// JavaScript Document

//left hand nav (HTML version)
//main menu
mainMenuAr = [ 'get-content',  'track-content' ];
function showMenuDiv(menuDivContent)
{
  if(document.getElementById)
  {
    for(i = 0; i < mainMenuAr.length; i++)
    {
      	if (mainMenuAr[i] == menuDivContent)
		{
			if (document.getElementById(menuDivContent).style.display == "block")
			{
				document.getElementById(menuDivContent).style.display = "";
			} 
			else 
			{
				document.getElementById(menuDivContent).style.display = "block";
			}
		} 
		else 
		{
			 document.getElementById(mainMenuAr[i]).style.display = "";
		}
    }
  } 
  else if(document.all)
  {
    for(i = 0; i < mainMenuAr.length; i++)
    {
      if (mainMenuAr[i] == menuDivContent)
	  {
			if (document.all[mainMenuAr[i]].style.display == "block")
			{
				document.all[mainMenuAr[i]].style.display = "";
			} 
			else 
			{
				document.all[mainMenuAr[i]].style.display = "block";
			}
	   } 
	   else 
	   {
			document.all[mainMenuAr[i]].style.display = "";
	   }
    }
  } 
  else if(document.layers) 
  {
      if (mainMenuAr[i] == menuDivContent)
	  {
			if (document.layers[menuDivContent].style.display == "block")
			{
				document.layers[menuDivContent].style.display = "";
			} 
			else 
			{
				document.layers[menuDivContent].style.display = "block";
			}
	   } 
	   else 
	   {
			document.layers[menuDivContent].style.display = "";
	   }
  }
}


//Product menu
function showDiv(divContent)
{
  // Strip spaces
  divContent = divContent.replace(" ", "");
  
  // Split to pull out the primary, and secondary elements
  var NavArray = divContent.split(",");

  if(document.getElementById)
  {
    document.getElementById(NavArray[0]).style.display = "block";
	document.getElementById(NavArray[0] + "_top").className = "selected";
  } else if(document.all){
    document.all[NavArray[0]].style.display = "block";
	document.all[NavArray[0] + "_top"].className = "selected";
  } else if(document.layers) {
    document.layers[NavArray[0]].style.display = "block";
	document.layers[NavArray[0] + "_top"].className = "selected";
  } 

  if (NavArray.length == 2)
  {
	  if(document.getElementById)
	  {
		document.getElementById(NavArray[0] + NavArray[1]).className = "select";
	  } else if(document.all){
		document.all[NavArray[0] + NavArray[1]].className = "select";
	  } else if(document.layers) {
		document.layers[NavArray[0] + NavArray[1]].className = "select";
	  } 
  }
}


	if((document.referrer.indexOf('startactive') != -1 )&&(document.location.href.indexOf('startactive') == -1))
	{
		if((getCookie("StartActiveSurvey") == null))
		{	
			var date = new Date();
			date.setTime(date.getTime()+(5*60*60*1000));	
			//window.open('/StartActiveForm.asp','startsurvey','width=550,height=620,toolbars=no');
			setCookie("StartActiveSurvey","1",date)
		}
	}


/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}


	