//function to toggle homepage dropdowns
function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}

function get_random(varHowMany)
{
    var ranNum= Math.floor(Math.random()*varHowMany);
    ranNum += 1;
	//alert(ranNum);
	return ranNum;
}

//function to write main image

var imageLoc = "/images/";

//function originally get_random(5) - the +1 gets rid of the first image
function write_main() {
	var imageNum = get_random(4)+1;
	document.write('<map name="main1"><area href="/resources/career%20guides/index.php" alt="Free Career Guide" coords="4,202,144,225"></map>'+
		'<map name="main2"><area href="/resources/career%20guides/index.php" alt="Free Career Guide" coords="4,202,144,225"></map>'+
		'<map name="main3"><area href="/resources/career%20guides/index.php" alt="Free Career Guide" coords="4,202,144,225"></map>'+
		'<map name="main4"><area href="/resources/career%20guides/index.php" alt="Free Career Guide" coords="4,202,144,225"></map>'+
		'<map name="main5"><area href="/resources/career%20guides/index.php" alt="Free Career Guide" coords="4,202,144,225"></map>'+
		'<img src="' + imageLoc + 'header_main_image_' + imageNum + '.jpg" alt="" width="623" height="100" border="0" usemap="#main' + imageNum + '">'
	);
}

//function to write homepage dropdowns
function write_drop() {
	var varRand_tc = 1;
	var varRand_go = 1;
	var varRand_sh = 1;
	var varRand_lr = 1;
	
	var tcLinksArray = new Array()
	var goLinksArray = new Array()
	var shLinksArray = new Array()
	var lrLinksArray = new Array()
	tcLinksArray[0] = ""
	tcLinksArray[1] = "http://www.getnotus.com/individuals/index.php"
	tcLinksArray[2] = "http://www.getnotus.com/individuals/index.php"
	goLinksArray[0] = ""
	goLinksArray[1] = "http://www.getnotus.com/individuals/index.php"
	goLinksArray[2] = "http://www.getnotus.com/individuals/index.php"
	shLinksArray[0] = ""
	//shLinksArray[1] = weekly deals link
	shLinksArray[1] = "http://www.getnotus.com/individuals/index.php"
	shLinksArray[2] = "http://www.getnotus.com/individuals/index.php"
	lrLinksArray[0] = ""
	lrLinksArray[1] = "http://www.getnotus.com/individuals/index.php"
	lrLinksArray[2] = "http://www.getnotus.com/individuals/index.php"
	// onClick="toggleBox(\'tc_drop_div\',0);toggleBox(\'go_drop_div\',0);toggleBox(\'sh_drop_div\',0);toggleBox(\'lr_drop_div\',1);"
	document.write(
	'<map name="drop_tc_map"><area alt="" coords="0,157,46,171" href="' + tcLinksArray[varRand_tc] + '"></map>'+
	'<map name="drop_go_map"><area alt="" coords="0,157,46,171" href="' + goLinksArray[varRand_go] + '"></map>'+
	'<map name="drop_sh_map"><area alt="" coords="0,157,46,171" href="' + shLinksArray[varRand_sh] + '"></map>'+
	'<map name="drop_lr_map"><area alt="" coords="0,157,46,171" href="' + lrLinksArray[varRand_lr] + '"></map>'+
	'<div class="home_drop"><a href="' + tcLinksArray[varRand_tc] + '" onmouseover="javascript:document.tc_drop.src = \'' + imageLoc + '155x171_hb_tc_' + varRand_tc + '_on.jpg\';" onmouseout="javascript:document.tc_drop.src = \'' + imageLoc + '155x171_hb_tc_' + varRand_tc + '_off.jpg\';"><img src="' + imageLoc + '155x171_hb_tc_' + varRand_tc + '_off.jpg" name="tc_drop" id="tc_drop" alt="" width="155" height="250" border="0"></a></div>'+
	'<div class="home_drop"><a href="' + goLinksArray[varRand_go] + '" onmouseover="javascript:document.go_drop.src = \'' + imageLoc + '155x171_hb_go_' + varRand_go + '_on.jpg\';" onmouseout="javascript:document.go_drop.src = \'' + imageLoc + '155x171_hb_go_' + varRand_go + '_off.jpg\';"><img src="' + imageLoc + '155x171_hb_go_' + varRand_go + '_off.jpg" name="go_drop" id="go_drop" alt="" width="155" height="250" border="0"></a></div>'+
	'<div class="home_drop"><a href="' + shLinksArray[varRand_sh] + '" onmouseover="javascript:document.sh_drop.src = \'' + imageLoc + '155x171_hb_sh_' + varRand_sh + '_on.jpg\';" onmouseout="javascript:document.sh_drop.src = \'' + imageLoc + '155x171_hb_sh_' + varRand_sh + '_off.jpg\';"><img src="' + imageLoc + '155x171_hb_sh_' + varRand_sh + '_off.jpg" name="sh_drop" id="sh_drop" alt="" width="155" height="250" border="0"></a></div>'+
	'<div class="home_drop_last"><a href="' + lrLinksArray[varRand_lr] + '" onmouseover="javascript:document.lr_drop.src = \'' + imageLoc + '155x171_hb_lr_' + varRand_lr + '_on.jpg\';" onmouseout="javascript:document.lr_drop.src = \'' + imageLoc + '155x171_hb_lr_' + varRand_lr + '_off.jpg\';"><img src="' + imageLoc + '155x171_hb_lr_' + varRand_lr + '_off.jpg" name="lr_drop" id="lr_drop" alt="" width="155" height="250" border="0"></a></div>'+
	'<div id="tc_drop_div" class="home_drop_on"><a href="#" onclick="toggleBox(\'tc_drop_div\',0);"><img src="' + imageLoc + '155x171_hb_tc_' + varRand_tc + '_on.jpg" alt="" width="155" height="250" border="0" usemap="#drop_tc_map"></a></div>'+
	'<div id="go_drop_div" class="home_drop_on"><a href="#" onclick="toggleBox(\'go_drop_div\',0);"><img src="' + imageLoc + '155x171_hb_go_' + varRand_go + '_on.jpg" alt="" width="155" height="250" border="0" usemap="#drop_go_map"></a></div>'+
	'<div id="sh_drop_div" class="home_drop_on"><a href="#" onclick="toggleBox(\'sh_drop_div\',0);"><img src="' + imageLoc + '155x171_hb_sh_' + varRand_sh + '_on.jpg" alt="" width="155" height="250" border="0" usemap="#drop_sh_map"></a></div>'+
	'<div id="lr_drop_div" class="home_drop_on_last"><a href="#" onclick="toggleBox(\'lr_drop_div\',0);"><img src="' + imageLoc + '155x171_hb_lr_' + varRand_lr + '_on.jpg" alt="" width="155" height="250" border="0" usemap="#drop_lr_map"></a></div>'
	);
}

// Get the cookie!
function getCookie(name){
	var cname = name + "=";
	var dc = document.cookie;
		if (dc.length > 0) {
			begin = dc.indexOf(cname);
		if (begin != -1) {
			begin += cname.length;
			end = dc.indexOf(";", begin);
		if (end == -1) end = dc.length;
		return unescape(dc.substring(begin, end));
		}
	}
	return null;
}

// Set the cookie
function setCookie(name, value, expires, path, domain, secure) {
	document.cookie = name + "=" + escape(value) +
	((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
	((path == null) ? "" : "; path=" + path) +
	((domain == null) ? "" : "; domain=" + domain) +
	((secure == null) ? "" : "; secure");
}

