/*Begin menu drop down navigation script*/

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*end menu drop down navigation script*/

/* Begin Button Rollover Script */

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;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,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];}}
}

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;
}

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 Button Rollover Script */

/* Begin Exit Script */

function OutsideLink(URL)	
{
   var writeURL = URL;
   var thisSite="RESTASIS.com";
   if (URL.length > 60)
   {
	   writeURL = URL.substr(0, 60) + "...";
   }
   if (confirm("\nThank you for visiting " + thisSite + ".\n\nBy clicking 'OK' you will be taken to: \n\n" + writeURL +"   \n\nThis site is not maintained by or affiliated \nwith " + thisSite + " and Allergan, Inc.\n\nThis link has been provided for your \nconvenience but " + thisSite + " and \nAllergan, Inc. do not endorse and \nare not responsible for the content, \nlinks, privacy, or security of \ninformation on web sites outside \nof " + thisSite + "\n\n"))
   {
	   window.open(URL,"_blank");
   }
		
}

/* End Exit Script */

/* Begin Popup Window Script */

function openWindow (URL, winHeight, winWidth, parameters) {
	xPos = screen.width/2 - winWidth/2;
	yPos = screen.height/2 - winHeight/2;
	
	window.open(URL,'','height='+winHeight+',width='+winWidth+',left='+xPos+',top='+yPos+parameters);
}

/* End Popup Window Script */

/* Begin hide/show question Script */

function changeDiv(the_div,the_change)
{
  var the_style = getStyleObject(the_div);
  if (the_style != false)
  {
    the_style.display = the_change;
  }
}

function hideAll()
{
  changeDiv("type_doctor","none");
  changeDiv("plan_see_doc","none");
  changeDiv("rx_question","none");
  changeDiv("no_rx_question","none");
}

function hideSeenDoc()
{
  changeDiv("seen_doctor_yes","none");
  changeDiv("seen_doctor_no","none");
}

function getStyleObject(objectId) {
  if (document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
  } else {
    return false;
  }
}

/* End hide/show question Script */

    //the following two functions swap and revert images 
        function button_over (buttonName, overImage) { 
                document.getElementById(buttonName).src = overImage; 
        } 

        function button_up (buttonName, upImage) { 
                document.getElementById(buttonName).src = upImage; 
        } 
