﻿
/*************************************************
*  Change this to "https:" for secure signups
*************************************************/
var memProtocol = "http:";
var memUrl = "http://amdev1/memwebdev/membership/signup2.aspx?CCD=EGM";

function Redirect(url, protocol)
{
    if (! url.match(/^http(s)?:/i))
    {
        var loc = window.location;
        
        url = url.replace(/^\//, "");   
        
        url = loc.protocol + "//" + loc.host + "/" + url;   
    }
    
    if (protocol.match(/^https(:)?/i))
    {
        url = url.replace(/^http:/i, "https:");
    }

    window.location.replace(url);
    return false;
}
    
function ReplaceHttpsProtocol()
{
    if (location.protocol.match(/^https:/i))
       for(i=0; i < parent.document.links.length; i++)
          parent.document.links[i].href = parent.document.links[i].href.replace(/^https:/, "http:"); 
}

function SetIFrameSrc(id)
{
    if (id == null)
        id = "iframe";
        
    var frame = document.getElementById(id);
    
    if (frame != null)
    {
	//var d=new Date();
	//memUrl += "&t=" + d.getTime()
        if (memProtocol.match(/^https(:)?/i))
        {
            url = memUrl.replace(/^http:/i, "https:");
        }
        else
        {
            url = memUrl.replace(/^https:/i, "http:");
        }
        
        frame.src = url;
    }
}

function HideLoadingIcon(id)
{
     var div = document.getElementById(id);
     if (div != null)
        div.style.visibility = 'hidden';
}


//function check()
//{
// var x = document.getElementById('iframe');

//  if (x.contentWindow) {
//     x = x.contentWindow.document; //.forms["prefs_form"];
//  }
//  else {
//     x = x.contentDocument; //.forms["prefs_form"];
//  }


////x.body null [object]
////if (x.body != null)
// alert(x.body);
//}
