﻿    function showDialog(url) {


        var iframe = $find(dialog).get_contentPane().get_element().getElementsByTagName("IFRAME")[0];

        iframe.contentWindow.location.href = 'http://' + iframe.contentWindow.location.host + url + iframe.contentWindow.location.search;
        //iframe.style.zIndex = 10;
        $get(dialog).style.zIndex = 10;
        $find(dialog).show();
        return false;
    }

    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

    try {
        var pageTracker = _gat._getTracker("UA-7929647-1");
        pageTracker._trackPageview();
    } catch (err) { }

    function LoadHeader() {
        $get('masthead').style.backgroundImage = resHeaderbackgroundImage;
        $get('masthead').innerHTML = resHeaderInnerHTML;
    }
    function LoadContact() {
        if($get('contact'))
            PageMethods.GetWebPart("~/Contact.ascx", "contact", OnGotWebPart, OnGotWebPartFail, 'Contact');
    }
    function LoadDonate() {
    	if ($get('donate'))
              PageMethods.GetWebPart("~/ucDonate.ascx", "donate", OnGotWebPart, OnGotWebPartFail, 'Donate');
    }

    function LoadLinks() {
    	if ($get('links'))
    	    PageMethods.GetWebPart("~/ucLinks.ascx", "links", OnGotWebPart, OnGotWebPartFail, 'links');
    }
    function LoadFooter() {
        PageMethods.GetWebPart("~/ucFooter.ascx", "footer", OnGotWebPart, OnGotWebPartFail, 'footer');
    }
    function OnGotWebPart(result, userContext, methodName) {
    	try {
    		var results = JSON.parse(result);
    		if (results.type == "div")
    			$get(results.id).innerHTML = results.html;
    		else if (results.type=="frame")
    			$get(results.id).src = "test.aspx";
    	}
    	catch (err) {
    	    //alert(err.message)
    	}
    }
    function OnGetWebPartTimeOut() {
    	//alert('timeout');
    }
    function OnGotWebPartFail(error, userContext, methodName) {
//    	alert(error._message);
    	$get('footer').innerHTML = error._message;

    }
    
    addEvent(window, "load", LoadFooter);
    addEvent(window, "load", LoadHeader);
    