/*=============================================================================================
--       SITE/SYSTEM : Brand Platform v2
--       DESCRIPTION : Global JavaScript File
--  REVISION HISTORY : Date      Version   Name             Description
--                     09/27/05  1.0.0.0   Joe Gallagher    Initial version
--                     05/20/07  1.0.0.1   Tom Kelleher     Moved "var curURL" to top
=============================================================================================*/

var curURL = window.location.href;


/*===================================
-- Begin image rollover functions
====================================*/
//Preload specified images on the page
function MM_preloadImages() { //v3.0
  var d=document; 
	if(d.images)
	{ 
		if(!d.MM_p) d.MM_p = new Array();
	    	var i;
		var j=d.MM_p.length;
		var a=MM_preloadImages.arguments; 
		for(i=0; i<a.length; i++)
		{
		    if (a[i].indexOf("#")!=0)
			{ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}
		}
	}
}
//Restore the specified image to its original state
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
//Find image objects with specified IDs
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//Swap oringal image with specifed image
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; 
  document.MM_sr = new Array(); 
  for(i=0; i<(a.length-2); i+=3 )
   if ((x=MM_findObj(a[i]))!=null){
	document.MM_sr[j++]=x; 
	if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
	}
}
/*===================================
-- End image rollover functions
====================================*/

/*===================================
-- Begin text sizing functions
====================================*/
//Resets all the text-size images and sets the correct font
function styleSizer(whichStyle){
	//reset all the images
	MM_swapImage('smallTextButton','','/images/text_small.gif',1);
	MM_swapImage('mediumTextButton','','/images/text_medium.gif',1);
	MM_swapImage('largeTextButton','','/images/text_large.gif',1);
	//then set the correct font
	if(whichStyle=="smallFont"){
		setActiveStyleSheet('regularFont'); 
		MM_swapImage('smallTextButton','','/images/text_small_selected.gif',1);
	}else if(whichStyle=="mediumFont"){
		setActiveStyleSheet('largerFont');
		MM_swapImage('mediumTextButton','','/images/text_medium_selected.gif',1);
	}else if(whichStyle=="largeFont"){
		setActiveStyleSheet('largestFont');
		MM_swapImage('largeTextButton','','/images/text_large_selected.gif',1);
	}
}
//writeImages writes out what image should be live on page load
function writeImages(){
	 var cookie = readCookie("style");
 	 var title = cookie ? cookie : getPreferredStyleSheet();
	//regularFont, largerFont, largestFont
	if(title==null || title=='regularFont'){
		return('<a href="#" onClick="javascript:styleSizer(\'smallFont\');"><img src="/images/text_small_selected.gif" alt="Small text" name="smallTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'mediumFont\');"><img src="/images/text_medium.gif" alt="Medium text" name="mediumTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'largeFont\');"><img src="/images/text_large.gif" alt="Large text" name="largeTextButton" /></a>');
	}else if(title=='largerFont'){
		return('<a href="#" onClick="javascript:styleSizer(\'smallFont\');"><img src="/images/text_small.gif" alt="Small text" name="smallTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'mediumFont\');"><img src="/images/text_medium_selected.gif" alt="Medium text" name="mediumTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'largeFont\');"><img src="/images/text_large.gif" alt="Large text" name="largeTextButton" /></a>');
	}else if(title=='largestFont'){
		return('<a href="#" onClick="javascript:styleSizer(\'smallFont\');"><img src="/images/text_small.gif" alt="Small text" name="smallTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'mediumFont\');"><img src="/images/text_medium.gif" alt="Medium text" name="mediumTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'largeFont\');"><img src="/images/text_large_selected.gif" alt="Large text" name="largeTextButton" /></a>');
	}else{
		return('<a href="#" onClick="javascript:styleSizer(\'smallFont\');"><img src="/images/text_small_selected.gif" alt="Small text" name="smallTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'mediumFont\');"><img src="/images/text_medium.gif" alt="Medium text" name="mediumTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'largeFont\');"><img src="/images/text_large.gif" alt="Large text" name="largeTextButton" /></a>');
	}
}
// 1. Loop through every link element in the document.
// 2. Disable all preferred and alternate style sheets that we don’t want active.
// 3. Enable all preferred and alternate style sheets that we do want active.
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}
//Return the current style sheet
function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}
//Find out which style sheet is the preferred style sheet.
function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}
//Create a cookie to store the preferred style sheet.
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}
//Read the cookie to return the prefered style sheet.
function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}


//Runs on page load...
window.onload = function(e) {
    var cookie = readCookie("style");
    var title = cookie ? cookie : getPreferredStyleSheet();
    setActiveStyleSheet(title);
    //checkVisitedPages();
    SafariFix();
    MM_preloadImages('/images/LEDtabs_physiological.gif', '/images/treatmentchart_life.gif', '/images/treatmentchart_counseling.gif', '/images/treatmentchart_oral.gif', '/images/treatmentchart_other.gif');
    MM_preloadImages('/images/TYD_tab1.gif', '/images/TYD_tab2.gif', '/images/TYD_tab3.gif', '/images/TYD_tab4.gif');
    MM_preloadImages('/images/iyp_tab1.gif', '/images/iyp_tab2.gif', '/images/iyp_tab3.gif');
    MM_preloadImages('/images/tabsFastFacts_AboutCIALIS.gif', '/images/tabsFastFacts_AboutED.gif', '/images/tabbedChart_greenBack.gif');

    var el = document.getElementById("imgPrintBtn")
    if( el != null )
	{
		el.onclick = printPage;
	}

}

//Save the cookie in the onunload event
window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
/*===================================
-- End of original text sizing functions
====================================*/

function chooseFontSize(direction)
{
	// Get Current size.
	var cookie = readCookie("style");
	//alert('Cookie is: ' + cookie);

	// Go smaller
	//alert('Direction to size is: ' + direction);
	if( direction == 0 )
	{
		if(cookie==null || cookie=='regularFont')	{
			// Set to 'smallFont' which is regularFont.  
			// Basically do nothing because it is already as small as can be.
			createCookie("style", 'regularFont', 365);
			styleSizer('smallFont');
		
		}
		else if(cookie=='largerFont') {
			// Resize down to regularFont
			createCookie("style", 'regularFont', 365);			
			styleSizer('smallFont');
			
		}
		else if(cookie=='largestFont') {
			// Resize down to largerFont
			createCookie("style", 'largerFont', 365);
			styleSizer('largerFont');
		}
		else {
			// Set to 'smallFont'.  Should not get to this case.
			createCookie("style", 'regularFont', 365);
			styleSizer('smallFont');
		}
	}
	// Go bigger
	else
	{
		if(cookie==null || cookie=='regularFont')	{
			// Set to 'largerFont'
			createCookie("style", 'largerFont', 365);
			styleSizer('largerFont');
		}
		else if(cookie=='largerFont') {
			// Set to 'largestFont'
			createCookie("style", 'largestFont', 365);
			styleSizer('largestFont');

		}
		else if(cookie=='largestFont'){
			//Do nothing because it's at the largest font.
			//createCookie("style", 'largestFont', 365);
			//styleSizer('largestFont');
		}
	}

}



/*===================================
-- End text sizing functions
====================================*/







/*===================================
-- Begin Printer-Friendly Functions
====================================*/


//Get the URL of current page and append ?type=print to it. Open the new page.
function printPage() {
	var url = document.URL;
	if(url != '')
	{
		var finalURL = url + "?type=print";
		window.open(finalURL);
	}
}

//Get the URL of the current page. If the URL ends in type=print, attach print-friendly styles.
function pageType() {
  var str = document.URL
  point = str.lastIndexOf("?");
  var suffix = (str.substring(point+1,str.length));
  if (suffix == "type=print") {
	document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/pfriendly.css\">");
	document.write("<script type=\"text/javascript\">window.print();</script>");
  }
}
/*===================================
-- End Printer-Friendly Functions
====================================*/

// Toggels images
// parm: targetImageName : String - the name of the image to replace
// parm: newImgSource : String - the name and path of the image to replate the target image with
//
// return: void
function toggleImage(targetImageName, newImgSource) {
	
	if (targetImageName == null || newImgSource == null || targetImageName == "" || newImgSource == "") {
		alert("Error : toggleImage : targetImageName parm or newImgSource parm is null or empty.");
	}
	document.images[targetImageName].src = newImgSource;
}


function popPrivacy(){
	popupWin = window.open("http://www.lillyhub.com/legal/consumer/privacy.html","ViewPop","status=0,height=590,width=600,scrollbars=1,resizable=yes,toolbar=0")
}
function popTerms(){
	popupWin = window.open("http://www.lillyhub.com/legal/consumer/termsofuse.html","ViewPop","status=0,height=590,width=600,scrollbars=1,resizable=yes,toolbar=0")
}
function popCopy(){
	popupWin = window.open("http://www.lillyhub.com/legal/consumer/copyright.html","ViewPop","status=0,height=590,width=600,scrollbars=1,resizable=yes,toolbar=0")
}

function popHCPPrivacy(){
	popupWin = window.open("http://www.lillyhub.com/legal/hcp/privacy.html","ViewPop","status=0,height=590,width=600,scrollbars=1,resizable=yes,toolbar=0")
}
function popHCPTerms(){
	popupWin = window.open("http://www.lillyhub.com/legal/hcp/termsofuse.html","ViewPop","status=0,height=590,width=600,scrollbars=1,resizable=yes,toolbar=0")
}
function popHCPCopy(){
	popupWin = window.open("http://www.lillyhub.com/legal/hcp/copyright.html","ViewPop","status=0,height=590,width=600,scrollbars=1,resizable=yes,toolbar=0")
}

function popPatInterstit( destURL )
{
	window.open( '/includepoppatinterstit.jsp?redirect=' + destURL, 'Interstit', 'width=318, height=240, status=yes, location=no, menu=no, scrollable=no, resize=no');
	//window.open( '/patient/interstitial.html?xURL=' + destURL, 'Interstit', 'width=318, height=240, status=yes, location=no, menu=no, scrollable=no, resize=no');
}

function popPInterstit( destURL )
{

	window.open( 'interstitials/pop_outlink.html?redirect=' + destURL, 'Interstit', 'width=425, height=425, status=yes, location=no, menu=no, scrollable=no, resize=no');
	//window.open( '/include/poppatinterstitial.jsp?xURL=' + destURL, 'Interstit', 'width=350, height=240, status=yes, location=no, menu=no, scrollable=no, resize=no');
}

function popPInterstit1( destURL )
{

	window.open( 'interstitials/pop_outlink1.html?redirect=' + destURL, 'Interstit', 'width=425, height=425, status=yes, location=no, menu=no, scrollable=no, resize=no');
}
function popPInterstit2( destURL )
{

	window.open( 'interstitials/pop_outlink2.html?redirect=' + destURL, 'Interstit', 'width=425, height=425, status=yes, location=no, menu=no, scrollable=no, resize=no');
}
function popPInterstit3( destURL )
{

	window.open( 'interstitials/pop_outlink3.html?redirect=' + destURL, 'Interstit', 'width=425, height=425, status=yes, location=no, menu=no, scrollable=no, resize=no');
}

/*===================================
-- Begin emailAFriend functionality
====================================*/
function sendToFriend() 
{ 
	var currentSite = window.location.href; 
        var url = ""; 
        if (currentSite.indexOf("-d.xh1.lilly.com") >= 0) {
          url = "https://emailafriend-d.xh1.lilly.com/index.jsp?url=" + currentSite;
        } else if (currentSite.indexOf("-d6.xh1.lilly.com") >= 0) {
          url = "https://emailafriend-d6.xh1.lilly.com/index.jsp?url=" + currentSite;
        } else if (currentSite.indexOf("-qa.xh1.lilly.com") >= 0) {
          url = "https://emailafriend-qa.xh1.lilly.com/index.jsp?url=" + currentSite;
        } else {
          url = "https://emailafriend.lilly.com/index.jsp?url=" + currentSite;
        }

	window.open(url, 'EmailAFriend', 'height=500, resizable=yes, scrollbars=yes, width=650'); 
}
/*===================================
-- End emailAFriend functionality
====================================*/



/*=======================================
-- Write Session Cookies
=========================================*/

function testSessionCookie () {
	document.cookie ="testSessionCookie=Enabled";
	if (readCookie("testSessionCookie")=="Enabled")
		return true;
	else
		return false;
}



function writeSessionCookie (cookieName, cookieValue) {
	if (testSessionCookie()) {
		document.cookie = escape(cookieName) + "=" + escape(cookieValue) + "; path=/";
		return true;
	}
	else return false;
}



/* Check tooltip code for compatibility with Firefox */

/*----------------------------------- */
var cX = 0; 
var cY = 0;
function UpdateCursorPosition(e)
{ 
	cX = e.pageX; 
	cY = e.pageY;
}
function UpdateCursorPositionDocAll(e)
{ 
	cX = event.clientX; 
	cY = event.clientY;
}


if(document.all) 
{ 
	document.onmousemove = UpdateCursorPositionDocAll; 
}
else { 
	document.onmousemove = UpdateCursorPosition;
} 

window.onscroll = refreshCoordinates;

function mouseX(evt) {
	if (evt.pageX) return evt.pageX;
	else if (evt.clientX)
		return evt.clientX + (document.documentElement.scrollLeft ?
	document.documentElement.scrollLeft :
	document.body.scrollLeft);
	else return null;	
}

function mouseY(evt) {
	if (evt.pageY) return evt.pageY;
	else if (evt.clientY)
		return evt.clientY + (document.documentElement.scrollTop ?
	document.documentElement.scrollTop :
	document.body.scrollTop);
	else return null;
}


function refreshCoordinates()
{
	if(document.all) 
	{ 
		document.onmousemove = UpdateCursorPositionDocAll; 
	}
	else { 
		document.onmousemove = UpdateCursorPosition;
	} 
}

function AssignPosition(def) {

	refreshCoordinates;


	def.style.left = (cX - 540) + "px";
	def.style.top = (cY - 110) + "px";
	
	var browserName = navigator.appName;
	//alert(browserName);
	if( browserName != "Netscape" )
	{
		//alert('for IE only');
		def.style.left = (cX - 600) + "px";
		def.style.top = (cY + document.documentElement.scrollTop - 100 ) + "px"; //- 100
		//alert(document.documentElement.scrollTop);
	}
}



function SafariFix()
{
	var browserName = navigator.appVersion;
	//alert(browserName);
	if( browserName.indexOf('Mac') > 0 )
	{

		if(browserName.indexOf('Safari') > 0)
		{	
			document.getElementById('mainContent').style.top = 15 + 'px';
		}
		else
		{
			document.getElementById('mainContent').style.top = 13 + 'px';
		}
	}
}

//Pop Tracking Window 0) Domain 1) Path 2) window name 3) Tracking name

function launchTrackWindow() 
{

	var windowArgs = launchTrackWindow.arguments;

	var finalURL = '';
	if( windowArgs[0].length > 0 )
	{
		dcsMultiTrack('DCS.dcssip', windowArgs[0], 'DCS.dcsuri', windowArgs[1], 'WT.ti', windowArgs[3]);
		//alert('I got to the if statement');
		finalURL = 'http://' + windowArgs[0] + '/' + windowArgs[1];
		//alert('I got to the if statement with finalURL=' + finalURL);
		window.open( finalURL, windowArgs[2]);
		return false;
	}
	else
	{
		dcsMultiTrack('DCS.dcsuri', windowArgs[1], 'WT.ti', windowArgs[3]);
		//alert('I got to the else statement with .dcsuri=' + windowArgs[1] + 'and WT.ti=' + windowArgs[3]);
		//alert('test');
		return true;
	}
}

function dlPDF( objTar )
{
	var tarObj = document.getElementById(objTar);
	//alert( tarObj.selectedIndex );
	if(tarObj.selectedIndex != 0)
	{
		if(tarObj.value != '')
		{
			//alert( tarObj.value );
			window.open( tarObj.value, 'pdfDL');
		}
		else
			alert('No PDF to download yet.');
	}

}

function comingSoon( strMessage ) {
	alert('Coming Soon: ' + strMessage);
	return false;
}

function popInterstit( destURL )
{
	window.open( '/hcp/interstitial.html?xURL=' + destURL, 'Interstit', 'width=318, height=240, status=yes, location=no, menu=no, scrollable=no, resize=no');
}



// display/hide block-type elements
function displayHideBlock(id)
{
	var el = document.getElementById(id);
	if( el != null )
		{
			if( el.style.display == 'block' || el.style.display == null )
				el.style.display = 'none';
			else
				el.style.display = 'block';
		}
	
}



//////////// START TABBED CHART ///////////////////

var expandAll = false;

function HideTab(contentDivID) {
	document.getElementById(contentDivID).style.display = 'none';
	expandAll = true;
	fexpandCollapse(contentDivID);

}

function ShowTab(contentDivID,tabColor) {
	document.getElementById('imagemapDiv').className = tabColor;
	document.getElementById(contentDivID).style.display = "block";
	
	
}




function panelMouseOver(contentDivID) {
	
	//chart mouse over effect because psuedo hover in class does not work in IE6
		selectedPanelPath = document.getElementById(contentDivID);
		if(selectedPanelPath.style.display == "none") { // panel should check tab color, then change panel class depending on that color
				selectedPanelPath.parentNode.className = "beigePanel";
	
		}
		
}
	
	
function panelMouseOut(contentDivID) {
	//chart mouse over effect because psuedo hover in class does not work in IE6
		selectedPanelPath = document.getElementById(contentDivID);
		if(selectedPanelPath.style.display == "none") {

				selectedPanelPath.parentNode.className = "accordianPanel";
		}
		
}
		
function ReverseContentDisplay(contentDivID,tab) {
	
	selectedPanelPath = document.getElementById(contentDivID);

		
			if(selectedPanelPath.style.display == "none") { 
				selectedPanelPath.style.display = "block"; 
				selectedPanelPath.parentNode.className = tab;
			
				var imgs = selectedPanelPath.parentNode.getElementsByTagName('IMG');
		
				for (var i=0; i<imgs.length; i++) {
				imgs[i].src = "/images/arrowGreenOpen.gif";
				 }
			 } else {
				selectedPanelPath.parentNode.className = "accordianPanel";
				selectedPanelPath.parentNode.getElementsByTagName('A').className = "accordianPanel";
			
				var imgs = document.getElementById(contentDivID).parentNode.getElementsByTagName('IMG');
		
				for (var i=0; i<imgs.length; i++) {
					imgs[i].src = "/images/arrowBeigeClosed.gif";
				 }
				selectedPanelPath.style.display = "none";

			 }

}


////// Expand All Panels in Tab /////
function fexpandCollapse(divMasterContainerId) {
	var vList = new Array;
	vList = document.getElementById(divMasterContainerId).getElementsByTagName('DIV');	
	expandAll = !expandAll;
	var blockToggle = 'none';

  if(expandAll) {
  	blockToggle = 'block';
  } else {
 	blockToggle = 'none';
  }
  
  for (var i=0; i< vList.length; i++){
		if (vList[i].id.match('content') && vList[i].style.display != blockToggle) { // find div tags with "Content" in their name
	
			ReverseContentDisplay(vList[i].id,'beigeTab');
		}
	}
}

/////////////// END TABBED CHART /////////////////////


/////////////// START POPUP COMMANDS /////////////////

function popMedicineChart( )
{
	window.open( '/talk_to_doctor/medicine_chart.jsp', 'MedicineChart', 'width=620,height=350,status=yes,location=no,menu=no,scrollbars=1,resizable=yes,toolbar=0');
}

/////////////// END POPUP COMMANDS ///////////////////

/////////////// START FLASH REQUIREMENTS COMMANDS ///////////////////

// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// -----------------------------------------------------------------------------





// Flash Player Version Detection - Rev 1.5
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		for (var i in params)
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }

    document.write(str);
}



function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

















/////////////// END FLASH REQUIREMENTS COMMANDS ///////////////////




/* THE SCRIPT TO LAUNCH THE BENEFITS CHART - KYLEDEFRANCO */
	function cialis_benefits() {
		document.getElementById('div_popup_chart').style.display="block";
	}
	function cialis_benefits_close() {
		document.getElementById('div_popup_chart').style.display="none";
	}


/* load images... */

 	function load_images() {
		var imgArray=new Array();
		imgArray[0]="images/index_top_without_text_1.jpg";
		imgArray[1]="images/index_top_without_text_2.jpg";
		imgArray[2]="images/index_top_without_text_3.jpg";
		imgArray[3]="images/index_top_without_text_4.jpg";
		imgArray[4]="images/index_top_without_text_5.jpg";
		imgArray[5]="images/index_top_without_text_6.jpg";

		// generate random number between 0 and 6
		var rNum = Math.floor(Math.random()*6);

		document.images.imgTop.src=imgArray[rNum];	
	}



/* To show and hid Div  */

	function showdetail()
		{
		if (document.getElementById('detail').style.display=='none')
			{
			document.getElementById('detail').style.display='block';
			window.detail.focus();
			}
		else
			document.getElementById('detail').style.display='none';

		}
