/* First Time Visit Processing, 
*  
*  This is used to show the AZ logo animated
*  flash bar on the top of the Home page only on 
*  the first visit to the site during this session.
*/


// Read cookie
function rC(nam) {
	var tC = document.cookie.split('; '); 
	for (var i = tC.length - 1; i >= 0; i--) {
		var x = tC[i].split('=');
		if (nam = x[0]) return unescape(x[1]);
	} 
	return '~';
} 

// Write cookie
function wC(nam,val) {
	document.cookie = nam + '=' + escape(val);

} 

// Load cookie
function lC(nam,pg) {
	var val = getcookie(nam);
	if (val.indexOf(pg) != -1) return false;
	
	 val += pg + '~'; 
	 wC(nam,val);
	 return true;
}

function getcookie(cookiename) {
 var cookiestring=""+document.cookie;
 var index1=cookiestring.indexOf(cookiename);
 if (index1==-1 || cookiename=="") return ""; 
 var index2=cookiestring.indexOf(';',index1);
 if (index2==-1) index2=cookiestring.length; 
 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}

// Check first time
function firstTime() {
	return lC('txtFirstVisit','home');	
} 

// start the first time check
function start() {
   
   // Hide the large flash brand box graphic on the home page so 
   // that the user doesn't see it start twice if the page is forwarded
   var strHeader = "";
    
   // if the querystring doesn't contain the flash variable, check for first time visit
	if (firstTime()) {
		// Code you want to execute on first load of page during this session		
		strHeader = embedFlashTop(objSignOffMovie); 	      		
	} else {
		// if not first load, display the static logo bar image
		//var elemHeaderGraphic = document.getElementById("header_azsig_image");
		//elemHeaderGraphic.style.visibility = "visible";
		if(pageId != "home") {
			strHeader = '<img src="/esp/images/header_azsig_bar.jpg" id="header_azsig_image" width="971" height="49" border="0" alt="" >';		 
		}
	}
 
 
	var myElem = document.getElementById("header_azsig");	
	myElem.innerHTML = strHeader;
	
}
var pageId="";
onload = start;

