/* http://dean.edwards.name/weblog/2005/09/busted/ */

/* DO NOT DELETE THIS BLOCK!!! */
/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32) {
	var loc = document.location.toString();
	var index = loc.indexOf(":");
	var protocol = loc.substring(0,index);

	if (protocol == "http") {
		document.write("<script defer src=../js/ie_sslInit.js><\/script>");
	}
	else {
		document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
		var script = document.getElementById("__ie_onload");
		script.onreadystatechange = function() {
			if (this.readyState == "complete") {
				init(); // call the onload handler
			}
		}
	}
};
/*@end @*/

/* for Mozilla/Opera9 */
if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", init, false);
}

/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
	var _timer = setInterval(function() {
		if (/loaded|complete/.test(document.readyState)) {
			init(); // call the onload handler
		}
	}, 10);
}

/* for other browsers */
window.onload = init;

function init() {
	// quit if this function has already been called
	if (arguments.callee.done) return;

	// flag this function so we don't do the same thing twice
	arguments.callee.done = true;

	// kill the timer
	if (_timer) clearInterval(_timer);
	// do stuff
	prep();
	rotateBanner();
};
function rotateBanner() {
	var headerBanner = document.getElementById("headerBanner");
	if (headerBanner != null) {
		var sectionClass = headerBanner.className;
		var spanArea = document.getElementById("bannerText");
		var imgArray = new Array();
		if((sectionClass.match("hc"))||(sectionClass.match("al"))) {		
			imgArray[0] = "../images/hdr_hc_head1.jpg";
			imgArray[1] = "../images/hdr_hc_head3.jpg";
			imgArray[2] = "../images/hdr_hc_head4.jpg";
			imgArray[3] = "../images/hdr_hc_head5.jpg";
			imgArray[4] = "../images/hdr_hc_head6.jpg";
			imgArray[5] = "../images/hdr_hc_head7.jpg";
			imgArray[6] = "../images/hdr_hc_head8.jpg";
			imgArray[7] = "../images/hdr_hc_head9.jpg";
			imgArray[8] = "../images/hdr_hc_head10.jpg";
			imgArray[9] = "../images/hdr_hc_head11.jpg";
    	} else if (sectionClass.match("ol")) {
			imgArray[0] = "../images/hdr_bottle.jpg";
		} 
		else {
			imgArray[0] = "../images/hdr_gen_head1.jpg";
			imgArray[1] = "../images/hdr_gen_head2.jpg";
			imgArray[2] = "../images/hdr_gen_head3.jpg";
			imgArray[3] = "../images/hdr_gen_head4.jpg";
			imgArray[4] = "../images/hdr_gen_head5.jpg";
			imgArray[5] = "../images/hdr_gen_head1.jpg";
			imgArray[6] = "../images/hdr_gen_head2.jpg";
			imgArray[7] = "../images/hdr_gen_head3.jpg";
			imgArray[8] = "../images/hdr_gen_head4.jpg";
			imgArray[9] = "../images/hdr_gen_head5.jpg";
		}
		
		var i = Math.floor((Math.random() * 10) % imgArray.length);
		spanArea.style.backgroundImage = "url("+imgArray[i]+")";
	}
}

function prep() {
	if (location.href.indexOf("/tools/glossary.aspx") > -1) {
		if (window.glossaryToggle) {
			glossaryToggle();
		}
	}	
	
	if(document.getElementById("pfizerCode")) {
		document.getElementById("pfizerCode").innerHTML="LPU01292L1";
	}
	
	
}	
	

/************* FAQs realted javascript ********************************/

function ExpandorCollapse(parentNode)
{
   if (parentNode.getElementsByTagName('div')[0].style.display == 'none')
    {
         parentNode.getElementsByTagName('div')[0].style.display = 'block';
    } 
    else
    {
         parentNode.getElementsByTagName('div')[0].style.display = 'none';
    }
}

/************* End of FAQs realted javascript ********************************/

function HideNextLink()
{
    document.getElementById('divNextLink').className="nextLinkHide";
}
/********************** Moved from universal to common.js *****************************************/
function pageInit() {
}
function addToPageInit() {
	var initialContents = pageInit;
	var functionList = new String;
	functionList[0] = initialContents;
	for (var i=1;i<=arguments.length;i++) {
		functionList[i] += arguments[i];
	}
	pageInit = functionList;
}

/*******************************Script used for search control****************************/

function OpenPartnerUrl(urlId, name, link) {
   PartnerLinkClicked(name,link); 
   url = null; 
   switch(urlId) {
      case '1' : {
         url = "http://www.pfizer.com/files/products/uspi_lipitor.pdf"; 
         break; 
         }
          case '2' : {
         url = "http://www.pfizer.com/files/products/ppi_lipitor.pdf"; 
         break; 
         }
       }
         if(url) {
      window.open(url); 
      }
}

function GoToPartnerUrl(urlId, name, link) {
   PartnerLinkClicked(name,link); 
   url = null; 
   switch(urlId) {
      case '1' : {
         url = "http://www.pfizer.com/files/products/ppi_lipitor.pdf"; 
         break; 
         }
      case '2' : {
         url = "http://www.pfizer.com"; 
         break; 
         }
          case '3' : {
         url = "http://pfizer.com/pfizer/privacy/mn_privacy_truste.jsp"; 
         break; 
         }
          case '7' : {
         url = "http://pfizer.com/pfizer/privacy/mn_privacy_truste.jsp"; 
         break;
         } 
           case '8' : {
         url = "http://www.pfizer.com/general/terms.jsp"; 
         break; 
         }
      }
  if(url) {
      window.location = url; 
      }
 }
 
var SessionValue ="";   
        
function GetSessionValue(key) 
{
   try {
      xmlHttp = new XMLHttpRequest(); 
      }
   catch (e) {
      try {
         xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); 
         }
      catch (e) {
         try {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
            }
         catch (e) {
            alert("Your browser does not support AJAX!"); 
            return false; 
            }
         }
      }
   url = "../GetSessionValue.aspx?key=" + key + "&dummy=" + new Date().getTime(); 
   xmlHttp.open("GET", url, false); 
   xmlHttp.send(null); 
      if(xmlHttp.status == 200)
      {
         SessionValue = xmlHttp.responseText; 
      }
     return SessionValue;
}
