<!--
var cookieName = 'AMO';

function initLayers(){
	if (location.href.indexOf('/about/') != -1){
		document.getElementById('aboutLayerTop').id='selectedLayerTop';
		document.getElementById('aboutLayerBot').id='selectedLayerBot';
	}else if (location.href.indexOf('/practitioners/') != -1){
		document.getElementById('pracLayerTop').id='selectedLayerTop';
		document.getElementById('pracLayerBot').id='selectedLayerBot';
	}else if (location.href.indexOf('/products/') != -1){
		document.getElementById('prodLayerTop').id='selectedLayerTop';
		document.getElementById('prodLayerBot').id='selectedLayerBot';
	}else if (location.href.indexOf('/careers/') != -1){
		document.getElementById('careerLayerTop').id='selectedLayerTop';
		document.getElementById('careerLayerBot').id='selectedLayerBot';
	}else if (location.href.indexOf('/media/') != -1){
		document.getElementById('mediaLayerTop').id='selectedLayerTop';
		document.getElementById('mediaLayerBot').id='selectedLayerBot';
	}
	
}

function advSearchSubmit(form){
    var aryCollections = new Array();
    for(i in collection_names){
        //alert(collection_names[i] + '=' + form[collection_names[i]].checked);
        if(form[collection_names[i]].checked){
            aryCollections[aryCollections.length] = collection_names[i];
        }
    }
    form["col"].value = aryCollections.join(',');
    //alert(form["col"].value);
}

function disclaimerYes(referer) {
    window.opener.location.replace(referer);
    window.close();
}

function goToSelected(selName) {
	var selected = selName.selectedIndex;
	var url = selName.options[selected].value;
	selName.selectedIndex = 0;
	if(url)
	location.href = url;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

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_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_findObj(n, d) { //v3.0
  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); 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];}
}


function popup1(url){
	var w;
	w=window.open(url,'emailWindow','width=450,height=420,status=yes,scrollbars=yes,resizable=yes');
	w.focus();
}
		
function popup2(url){
	var w;
	w=window.open(url,'printWindow','width=580,height=420,status=yes,scrollbars=yes,menubar=yes,resizable=yes');
	w.focus();
}

function popup(url,name,features){
	var w;
	w=window.open(url,name,features);
	w.focus();
}
/*
function warning(url){
	var cookies = document.cookie;
	var pos = cookies.indexOf(cookieName);
	if (pos == -1) {
  window.open("/site/legal_popup.asp?url=" + url ,"popup", "width=434,height=350,scrollbars=yes");
  } else {
  location.replace(url);
  }
}
*/
//print function
var Browser = 'MSIE';             
var Version = 5;         
var canPrint = false;
if(Browser == 'Netscape' && Version >= 4){canPrint=true}
if(Browser == 'MSIE' && Version >= 5){canPrint=true}
function printit(){  
    if(canPrint){window.print()}
    else
	{alert('To print this page you must click File and then click Print on the menu bar above.')
	}
}


/*
BrowserDetector()
Parses User-Agent string into useful info.

Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)

Author: Richard Blaylock
Author Email: blaylock@wired.com

Usage: var bd = new BrowserDetector(navigator.userAgent);
*/


// Utility function to trim spaces from both ends of a string
function Trim(inString) {
  var retVal = "";
  var start = 0;
  while ((start < inString.length) && (inString.charAt(start) == ' ')) {
    ++start;
  }
  var end = inString.length;
  while ((end > 0) && (inString.charAt(end - 1) == ' ')) {
    --end;
  }
  retVal = inString.substring(start, end);
  return retVal;
}

function BrowserDetector(ua) {

// Defaults
  this.browser = "Unknown";
  this.platform = "Unknown";
  this.version = "";
  this.majorver = "";
  this.minorver = "";

  uaLen = ua.length;

// ##### Split into stuff before parens and stuff in parens
  var preparens = "";
  var parenthesized = "";

  i = ua.indexOf("(");
  if (i >= 0) {
    preparens = Trim(ua.substring(0,i));
        parenthesized = ua.substring(i+1, uaLen);
        j = parenthesized.indexOf(")");
        if (j >= 0) {
          parenthesized = parenthesized.substring(0, j);
        }
  }
  else {
    preparens = ua;
  }

// ##### First assume browser and version are in preparens
// ##### override later if we find them in the parenthesized stuff
  var browVer = preparens;

  var tokens = parenthesized.split(";");
  var token = "";
// # Now go through parenthesized tokens
  for (var i=0; i < tokens.length; i++) {
    token = Trim(tokens[i]);
        //## compatible - might want to reset from Netscape
        if (token == "compatible") {
          //## One might want to reset browVer to a null string
          //## here, but instead, we'll assume that if we don't
          //## find out otherwise, then it really is Mozilla
          //## (or whatever showed up before the parens).
        //## browser - try for Opera or IE
    }
        else if (token.indexOf("MSIE") >= 0) {
      browVer = token;
    }
    else if (token.indexOf("Opera") >= 0) {
      browVer = token;
    }
        //'## platform - try for X11, SunOS, Win, Mac, PPC
    else if ((token.indexOf("X11") >= 0) || (token.indexOf("SunOS") >= 0) ||
(token.indexOf("Linux") >= 0)) {
      this.platform = "Unix";
        }
    else if (token.indexOf("Win") >= 0) {
      this.platform = token;
        }
    else if ((token.indexOf("Mac") >= 0) || (token.indexOf("PPC") >= 0)) {
      this.platform = token;
        }
  }

  var msieIndex = browVer.indexOf("MSIE");
  if (msieIndex >= 0) {
    browVer = browVer.substring(msieIndex, browVer.length);
  }

  var leftover = "";
  if (browVer.substring(0, "Mozilla".length) == "Mozilla") {
    this.browser = "Netscape";
        leftover = browVer.substring("Mozilla".length+1, browVer.length);
  }
  else if (browVer.substring(0, "Lynx".length) == "Lynx") {
    this.browser = "Lynx";
        leftover = browVer.substring("Lynx".length+1, browVer.length);
  }
  else if (browVer.substring(0, "MSIE".length) == "MSIE") {
    this.browser = "IE";
    leftover = browVer.substring("MSIE".length+1, browVer.length);
  }
  else if (browVer.substring(0, "Microsoft Internet Explorer".length) ==
"Microsoft Internet Explorer") {
    this.browser = "IE"
        leftover = browVer.substring("Microsoft Internet Explorer".length+1,
browVer.length);
  }
  else if (browVer.substring(0, "Opera".length) == "Opera") {
    this.browser = "Opera"
    leftover = browVer.substring("Opera".length+1, browVer.length);
  }

  leftover = Trim(leftover);

  // # Try to get version info out of leftover stuff
  i = leftover.indexOf(" ");
  if (i >= 0) {
    this.version = leftover.substring(0, i);
  }
  else
  {
    this.version = leftover;
  }
  j = this.version.indexOf(".");
  if (j >= 0) {
    this.majorver = this.version.substring(0,j);
    this.minorver = this.version.substring(j+1, this.version.length);
  }
  else {
    this.majorver = this.version;
  }
}
// function BrowserCap
var bd = new BrowserDetector(navigator.userAgent);
var cssFile = '<link rel="stylesheet" href="http://www.amo-inc.com/style/include/global.css" type="text/css" />';
if (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4)) && (bd.platform.indexOf('Win') != -1)) {
cssFile = '<link rel="stylesheet" href="/style/include/global_nav.css" type="text/css" />';
}

function warning(url){
	var showLegalPopup = true;
	if(location.hostname.toLowerCase().indexOf('10.37.1') != -1){showLegalPopup = false;}
	if(showLegalPopup){
		var cookies = document.cookie;
		var pos = cookies.indexOf(cookieName);
		if (pos == -1) {
			window.open("/site/legal_popup.asp?url=" + url, "popup", "width=434,height=350,scrollbars=yes");
		} else {
			location.href = 'http://' + getSiteUrl(url) + '/site/home.asp';
		}
	} else {
		location.href = 'http://' + getSiteUrl(url) + '/site/home.asp';
    }
}

function warnAgain(form) {
	var url = location.search.substring(location.search.indexOf("=")+1);
	if (document.forms[form].dontShow.checked) {
		var today = new Date();
  		var expiry = new Date(today.getTime() + 1 * 24 * 60 * 60 * 1000); // plus 1 days
  		var expired = new Date(today.getTime() - 1 * 24 * 60 * 60 * 1000); // less 1 days
  		document.cookie=name + "=" + escape(cookieName) + "; expires=" + expiry.toGMTString();
		window.opener.location.href = 'http://' + getSiteUrl(url) + '/site/home.asp';
		window.close();
	} else {
		window.opener.location.href = 'http://' + getSiteUrl(url) + '/site/home.asp';
		window.close(); 
	}
}

function globalJumpPage(){
	if(location.hostname.toLowerCase().indexOf('allergan') != -1){
    	location.href = 'http://' + getSiteUrl('www.allergan.com') + '/site/default.asp';
	}
	else if(location.hostname.toLowerCase().indexOf('amo-inc') != -1){
		location.href = 'http://' + getSiteUrl('www.amo-inc.com') + '/site/default.asp';
	}
	else if(parseInt(location.port) < 9000){
    	location.href = 'http://' + getSiteUrl('www.allergan.com') + '/site/default.asp';
	}
	else if(parseInt(location.port) >= 10000){
		location.href = 'http://' + getSiteUrl('www.amo-inc.com') + '/site/default.asp';
	}
}

function getSiteUrl(url){
    var port = '';
	if(location.hostname.toLowerCase().indexOf('10.37.1') == -1 && location.hostname.toLowerCase().indexOf('irapps62') == -1){
	    return url;
	} else {
        switch(url){
	        case "www.allergan.com":
		        port = 8080;
		        break;
	        case "www.allergan.com.br":
		        port = 8680;
		        break;
	        case "www.allergan.de":
		        port = 8580;
		        break;
	        case "www.allergan.co.jp":
		        port = 8880;
		        break;
	        case "www.allergan.fr":
		        port = 8280;
		        break;
	        case "www.allergan.ca":
		        port = 8380;
		        break;
	        case "www.allergan.au":
		        port = 8780;
		        break;
	        case "www.allergan.co.uk":
		        port = 8480;
		        break;
	        case "www.amo-inc.com":
		        port = 10020;
		        break;
	        case "www.amo-inc.de":
		        port = 10030;
		        break;
	        case "www.amo-inc.co.jp":
		        port = 10010;
		        break;
		}
		// this if statement adds a one to the port number if they are on stage.
		if ((location.port.indexOf(81,2) != -1) || ((location.port > 9000) && (location.port.indexOf(1,4) != -1))){
			port = port + 1;
		}
        return location.hostname + ':' + port;
    }
}

// Dynamic height positioning
	function JB_getDivHeight() {
	/*
		var rightColH = getElemRefs('rightContent').offsetHeight;
		var rightCol = getElemRefs('rightContent').style;
		var leftColH = getElemRefs('leftContent').offsetHeight;
		var leftCol = getElemRefs('leftContent').style;
		var contentH = getElemRefs('content').offsetHeight;
		var mainImage = getElemRefs('mainImage').style;
		if (rightColH < leftColH){
			rightCol.height = leftColH+'px';
			mainImage.height = leftColH+'px';
		}else{
			leftCol.height = rightColH+'px';
			mainImage.height = rightColH+'px';
		}
	*/
	}
	
	function setLeft(onLayer){
		var botLayer=getElemRefs(onLayer+'Bot');
		var botLayerWidth=botLayer.offsetWidth;
		var topLayerWidth=getElemRefs(onLayer+'Top').offsetWidth;		
		var newLeft=(botLayerWidth/2)-(topLayerWidth/2)+2;
		botLayer.style.left=-newLeft;
	}
	
	function getElemRefs(id) {
		var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
		if (el) el.css = (el.style)? el.style: el;
		return el;
	}
// -->
