
/*--- WEB VIEW POP ---*/

	//goto using puid (POPUP)
	function _gotopop(puid)
	{
		var myWin = window.open("/members/index.aspx?puid=" + puid, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=650,height=750');
	}

	//goto using url (POPUP)
	function _gotourlpop(url)
	{
		var myWin = window.open(url, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=650,height=750');
    }
//goto using url (POPUP)
function _pop(url) {
    var myWin = window.open(url, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=650,height=750');
}
function _popup(url) {
    var myWin = window.open(url, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=650,height=750');
}

/*--- EMAIL VIEW POP ---*/



function assigntoBottomEmailValue(emailValue, e)
{
txtEmailToAssign = FindElement(e);
txtEmailToAssign.value = emailValue;
}

function assigntoTopEmailValue(emailValue, e)
  {
	var elm = null;
    for (i = 0; i < document.forms[0].elements.length; i++)
    {   
    if (document.forms[0].elements[i].name.indexOf(e) != -1)
        {
			if(document.forms[0].elements[i].name.indexOf('funneltop1') == -1) 
			{           
            elm = document.forms[0].elements[i];
			break;
			}
		
        }
    }
	elm.value = emailValue;
	
  }


//returns an element based on name
function FindElement(e)
{
    
    var elm = null;
    for (i = 0; i < document.forms[0].elements.length; i++)
    {      
    if (document.forms[0].elements[i].name.indexOf(e) != -1)
        {            
            elm = document.forms[0].elements[i];
			break;
        }
    }
	return elm;
}



function goRegister(url)
{
	if (url == "") {
		url = "/publicsite/funnel/register.aspx";
	}
	
	widthofwin = window.screen.width;
	heightofwin = window.screen.height;

	if (widthofwin > 800)
	{
		widthofwingo = 900
		heightofwingo = 850
	}
	if (widthofwin < 800)
	{
		widthofwingo = 630
		heightofwingo = 450
	}

    try {
		// If the opener of this page was a popunder, close the popunder
		if(self.opener.winID == "popunder") {
			self.opener.window.close();
		}

		if(self.opener.closed==false)
		{
			self.opener.doPopUnder = false;
			self.opener.location.href = url;
			window.close();
		}
		else
		{
			var win3 = window.open(url,'signupwin','toolbar=1,location=1,scrollbars=1,directories=1,status=1,menubar=1,resizable=1,width='+widthofwingo+',height='+heightofwingo);
		}
    }
    catch(e) {
		var win3 = window.open(url,'signupwin','toolbar=1,location=1,scrollbars=1,directories=1,status=1,menubar=1,resizable=1,width='+widthofwingo+',height='+heightofwingo);
	}
	finally {
		self.close();
	}
	
}

function checkClose()
{
	setTimeout("checkClose_Part2()",100);
}

function checkClose_Part2()
{
try
{
if(window.opener.winID == "main" || window.opener.name == "main") self.close();
}
catch(e){}
}

function noPop()
{
	doPopUnder = false;
}



function switchID(a, b) {
    //alert(id);
    var off;
    var on;

    off = document.getElementById(b);
    off.style.display = 'none';
    on = document.getElementById(a);
    on.style.display = 'inline';
}

function switchTabImg(img) {
    if (img == "1") {
    document.getElementById("tabHot").setAttribute('src', '/images/publicsite/whatshot-off.gif');
    document.getElementById("tabPlan").setAttribute('src', '/images/publicsite/jilliansplan-on.gif');
        
    }
    else {
    document.getElementById("tabHot").setAttribute('src', '/images/publicsite/whatshot-on.gif');
    document.getElementById("tabPlan").setAttribute('src', '/images/publicsite/jilliansplan-off.gif');
    
    }
}

function startTimer() {

    //setInterval('flipMUnit()', 30000);
    //setTimeout('flipMUnit()', 10000);


}

function flipMUnit() {

    if (document.getElementById('MarketingUnit').style.display == 'inline') {
        document.getElementById('MarketingUnit').style.display = 'none';
        document.getElementById('EditorialUnit').style.display = 'inline';
       
    }

    else {
        document.getElementById('MarketingUnit').style.display = 'inline';
        document.getElementById('EditorialUnit').style.display = 'none';
        switchTabImg('1');
    }
}


//returns an element based on name
function FindElementByName(e) {

    var elm = null;
    for (i = 0; i < document.forms[0].elements.length; i++) {
        if (document.forms[0].elements[i].name.indexOf(e) != -1) {
            elm = document.forms[0].elements[i];
            break;
        }
    }
    return elm;
}

// Show HIde div element
var state = 'none';
function showhide(layer_ref) {

    var layer_ref = layer_ref;

    if (state == 'block') {
        state = 'none';
    }
    else {
        state = 'block';
    }
    if (document.all) { //IS IE 4 or 5 (or 6 beta) 
        eval("document.all." + layer_ref + ".style.display = state");
    }
    if (document.layers) { //IS NETSCAPE 4 or below 
        document.layers[layer_ref].display = state;
    }
    if (document.getElementById && !document.all) {
        hza = document.getElementById(layer_ref);
        hza.style.display = state;
    }
} 

	//goto using url (POPUP) - name slightly misspelled, easier to just add function
	//and gotoPopOffer function does not appear to exist, anyway.  ND, 10/20/09
	function _gotpPopOffer(url)
	{
		var myWin = window.open(url, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=650,height=750');
    }