var internationalURLChk = "amdinternational";
var URLUs = "http://amd.orbisdesign.net/home_2.aspx";
var URLInt = "http://amdinternational.orbisdesign.net/home_2.aspx";
var sectionChoice = "US";

var GB_ROOT_DIR = "/javascriptO2/greybox/";

window.onload = initialize; 

function initialize () {
	hideLive();
	displayFontSize();
	logoClick();
	searchButton();
	italSubTitle();
	setupSupportNav();
	setupFooterNav();
	documentID();
	abbottGlobal();
	setSearchBox();
	loginAdmin();
	hideRegen();
	setGoogleSearch();
	document.getElementById("logo2").onclick = function(){
		window.location.href = "http://www.abbott.com";
	}
}
function hideLive(){
	/* for live only */
	var sSite = window.location;
	sSite = sSite + ' ';
	sSite = sSite.toLowerCase();
	
	if(sSite.indexOf("abbottmolecular.com") != -1){
		if(sSite.indexOf("products_3627") != -1){
			//document.getElementById('ID_40500').innerHTML = "<a href=\"ViroSeqSoftwarev27_40500.aspx\">ViroSeq Software v2.7</a>";
		}
		if(sSite.indexOf("products_4992") != -1){
			//document.getElementById('ID_12339').innerHTML = "<a href=\"ViroSeqSoftwarev27_12339.aspx\">ViroSeq Software v2.7</a>";
		}
		
		var anchors = document.getElementsByTagName("a");
	
		for(var i=0; i < anchors.length; i++)
		{
			var a = anchors[i];
			var href = a.href;
			if ((href.indexOf("44256") != -1))
			{
				anchors[i].style.display = 'none';
			}
		}		
	}
}
function setGoogleSearch(){
	var sSite;
	var tempHold = '';
	tempHold = document.forms['SerachForm'].isDotNet.value;
	sSite = window.location;
	document.forms['SerachForm'].isDotNet.value = sSite;
	sSite = document.forms['SerachForm'].isDotNet.value;
	document.forms['SerachForm'].isDotNet.value = tempHold;
	sSite = sSite.toLowerCase();
	
	if(sSite.indexOf('international2.abbott') != -1 || sSite.indexOf('international.abbott') != -1 ){
		document.SerachForm.client.value = 'amdinternational';
		document.SerachForm.proxystylesheet.value = 'amdinternational';
		document.SerachForm.site.value = 'international';
		document.SerachForm.url.value = 'http://international.abbottmolecular.com';
	}else if(sSite.indexOf('abbottmolecular.com') != -1){
		document.SerachForm.client.value = 'amd';	//This chooses the front end
		document.SerachForm.proxystylesheet.value = 'amd';	
		document.SerachForm.site.value = 'amdLive';
		document.SerachForm.url.value = 'http://www.abbottmolecular.com';
		document.SerachForm.siteUrl.value = 'www.abbottmolecular.com';	//
	}
}
function checkFileExists(fileString){
	submitSupport(fileString);
}
function hideRegen(){
	if(isDotNet().indexOf('aspx') == 1){
		if(document.getElementById('regenLinks') != null){
			document.getElementById('regenLinks').style.display = 'none';
		}
	}
}
function searchExternalEnterSetHidden(e){
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	
	if (keycode == 13) {
		if(document.getElementById("BonsaiEx_SearchText3") != null){
			document.getElementById("BonsaiEx_SearchText3").value = document.getElementById("SearchInput").value;
		}
		document.getElementById("BonsaiEx_SearchText").value = document.getElementById("SearchInput").value;
		return true;
	}else{
		return true;
	}
}
function clearDefault(){
	if(document.SerachForm.SearchText.value == 'Enter Search'){
		document.SerachForm.SearchText.value = '';
	}
}
function setSearchBox(){
	if(document.SerachForm.SearchText.value == ''){
		document.SerachForm.SearchText.value = 'Enter Search';
	}
}
function logoClick(){
	var HTMLDisp = '';
	var transImage = '';
	var whatBaseUrl = baseURL();

	if(whatBaseUrl.indexOf("search.abbottmolecular") != -1){
		transImage = 'http://www.abbottmolecular.com';
	}
	
	if (document.getElementById('logo')){
		var logoClickThrough = document.getElementById('logo');
	}

	HTMLDisp = HTMLDisp + '<a href=\"http://www.abbott.com/\"><img src=\"' + transImage + '/images/trans.gif\" width=\"175\" height=\"116\" border=\"0\" alt=\"Visit Abbott.com\" /></a>';
	logoClickThrough.innerHTML = HTMLDisp;
}
function searchButton(){
	if (document.getElementById('logo2')){
		var LoginBox = document.getElementById('logo2');
	}
	if (document.SerachForm.submitButton){
		document.SerachForm.submitButton.value = 'go';
	}
}
function gotoLink(FormName,DropName){
		var URL_Base = eval( "document." + FormName + "." + DropName );
		var URL = URL_Base.options[URL_Base.selectedIndex].value;
        window.location.href = URL;
}
function setupSupportNav(){
	var supportNav = document.getElementById('relocnav_2');
	var HTMLDisp = '';
	var isGoogleSearch;
	var urlAbsolute = '';
	
	sSite = window.location;
	sSite = sSite + ' ';
	sSite = sSite.replace(/^\s+|\s+$/g, '');
	sSite = sSite.substring(sSite.indexOf("/")+2);
	sSite = sSite.substring(0,sSite.indexOf("/"));	
	sSite = sSite.toLowerCase();
	
	if(siteState() == 'INT'){
		urlAbsolute = URLInt;
	}else{
		urlAbsolute = URLUs;
	}

	HTMLDisp = HTMLDisp + ' | '
	
	if(siteState() == 'INT'){
		HTMLDisp = HTMLDisp + '<a href=\"' + setupSupportNavSearch() + '/PrintMultipleProducts_8960' + isDotNet() + '\" class=\"\">Print Products</a> | ';
	}else{
		HTMLDisp = HTMLDisp + '<a href=\"' + setupSupportNavSearch() + '/ecommerce/cart.aspx\" class=\"\">Cart</a> | ';
		HTMLDisp = HTMLDisp + '<a href=\"' + setupSupportNavSearch() + '/PrintMultipleProducts_5934' + isDotNet() + '\" class=\"\">Print Products</a> | ';
	}
	
	if(siteState() == 'INT'){
		HTMLDisp = HTMLDisp + '<a href=\"' + setupSupportNavSearch() + '/1_9176' + isDotNet() + '\" class=\"\">Chromosome Search</a> | ';
	}else{
		HTMLDisp = HTMLDisp + '<a href=\"' + setupSupportNavSearch() + '/1_5968' + isDotNet() + '\" class=\"\">Chromosome Search</a> | ';
	}
	//US / Global Links
	if(siteState() == 'INT'){
		HTMLDisp = HTMLDisp + '<a href=\"#\" onMouseDown=\"loadPop(\'US\');\" class=\"\">U.S.</a> | ';
		HTMLDisp = HTMLDisp + '<div id=\"yahIcon\">&raquo;</div>';
		HTMLDisp = HTMLDisp + '<a href=\"#\" class=\"supNavYAH\">Global</a>';
	}else{
		HTMLDisp = HTMLDisp + '<div id=\"yahIcon\">&raquo;</div>';
		HTMLDisp = HTMLDisp + '<a href=\"#\" class=\"supNavYAH\">U.S.</a> | ';
		HTMLDisp = HTMLDisp + '<a href=\"#\" onMouseDown=\"loadPop(\'GLOBAL\');\" class=\"supNav\">Global</a>';
	}	
	
	supportNav.innerHTML = HTMLDisp;
}
function setupSupportNavSearch(){
	var siteUrlIs;
	var checkOnSearchMini;
	checkOnSearchMini = document.SerachForm.isDotNet.value.indexOf('earch.asp');
	if(checkOnSearchMini != -1){
		siteUrlIs = document.forms['searchform'].siteUrl.value;
		siteUrlIs = document.forms[1].url.value;	//['gs'] not working in IE
		return siteUrlIs;
	}else{
		return "";
	}
}
function setupFooterNav(){
	var footerNav = document.getElementById('FooterImage_1');
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	var HTMLDisp = '';
	var linkPrivacy,linkTerms,linkSiteMap;
	
	if(siteState() == 'INT'){
		linkPrivacy = 'PrivacyPolicy_2880' + isDotNet();
		linkTerms = 'TermsofUse_2881' + isDotNet();
		linkSiteMap = 'SiteMap_3' + isDotNet();
		linkPrintProds = 'PrintMultipleProducts_8960' + isDotNet();
	}else{
		linkPrivacy = 'PrivacyPolicy_3933' + isDotNet();
		linkTerms = 'TermsofUse_3934' + isDotNet();
		linkSiteMap = 'SiteMap_3' + isDotNet();
		linkPrintProds = 'PrintMultipleProducts_5934' + isDotNet();
	}
	
	HTMLDisp = HTMLDisp + '<div id=\"footerNav\">'
	HTMLDisp = HTMLDisp + '<a href=\"' + setupSupportNavSearch() + "/" + linkSiteMap + '\" class=\"aaa\">Site Map</a> | ';
	HTMLDisp = HTMLDisp + '<a href=\"' + setupSupportNavSearch() + "/" + linkPrintProds + '\" class=\"\">Print Products</a> | ';
	if(siteState() == 'INT'){
		HTMLDisp = HTMLDisp + '<a href=\"' + getSiteUrlUs() + '\" class=\"\">United States</a> | ';
		HTMLDisp = HTMLDisp + '<div id=\"yahIcon\">&raquo;</div>';
		HTMLDisp = HTMLDisp + '<a href=\"' + getSiteUrlInt() + '\" class=\"supNavYAH\">Global</a> | ';
	}else{
		HTMLDisp = HTMLDisp + '<div id=\"yahIcon\">&raquo;</div>';
		HTMLDisp = HTMLDisp + '<a href=\"' + getSiteUrlUs() + '\" class=\"supNavYAH\">United States</a> | ';	
		HTMLDisp = HTMLDisp + '<a href=\"' + getSiteUrlInt() + '\" class=\"supNav\">Global</a> | ';
	}

	HTMLDisp = HTMLDisp + '<a href=\"' + setupSupportNavSearch() + "/" + linkPrivacy + '\" class=\"\">Privacy Policy</a> | ';
	HTMLDisp = HTMLDisp + '<a href=\"' + setupSupportNavSearch() + "/" + linkTerms + '\" class=\"\">Terms of Use</a>  ';
	HTMLDisp = HTMLDisp + '<div>'
	
	HTMLDisp = HTMLDisp + '<div id=\"footerDisclaimer\">'
	HTMLDisp = HTMLDisp + 'This Internet site that you have requested is intended for the residents of a particular country or countries and may contain information on pharmaceuticals, medical devices and other products or uses of those products that are not approved in other countries or regions. If you are a resident of a country other than those to which this site is directed, contact your local Abbott affiliate to obtain the appropriate product information for your country of residence.'
	HTMLDisp = HTMLDisp + '<div>'
	
	footerNav.innerHTML = HTMLDisp;
}
function siteState(){
	var sSite;
	var tempHold = '';
	
	tempHold = document.forms['SerachForm'].isDotNet.value;
	sSite = window.location;
	document.forms['SerachForm'].isDotNet.value = sSite;
	sSite = document.forms['SerachForm'].isDotNet.value;
	document.forms['SerachForm'].isDotNet.value = tempHold;
	sSite = sSite.substring(sSite.indexOf("/")+2);
	sSite = sSite.substring(0,sSite.indexOf("/"));	
	sSite = sSite.toLowerCase();

	if(sSite.indexOf('international') != -1 || sSite.indexOf('stage.global') != -1 || sSite.indexOf('am.global.stage') != -1){
		return 'INT';
	}else if(sSite.indexOf('search.') != -1){
		if(document.forms[1].url.value == 'http://international.abbottmolecular.com'){
			return 'INT';
		}else{
			return 'US';
		}
	}else{
		return 'US';
	}
}
function getSiteUrlUs(){
	var finalUrl = '';
	var sSite;
	var tempHold = '';
	
	tempHold = document.forms['SerachForm'].isDotNet.value;
	sSite = window.location;
	document.forms['SerachForm'].isDotNet.value = sSite;
	sSite = document.forms['SerachForm'].isDotNet.value;
	document.forms['SerachForm'].isDotNet.value = tempHold;
	sSite = sSite.substring(sSite.indexOf("/")+2);
	sSite = sSite.substring(0,sSite.indexOf("/"));	
	sSite = sSite.toLowerCase();

	if(sSite.indexOf('orbisdesign') != -1){
		finalUrl = 'http://amd.orbisdesign.net/home_2' + isDotNet();
	}else if(sSite.indexOf('stage.abbottmolecular') != -1){
		finalUrl = 'http://stage.abbottmolecular.com/home_2' + isDotNet();
	}else if(sSite.indexOf('stage.global.abbottmolecular') != -1){
		finalUrl = 'http://stage.abbottmolecular.com/home_2' + isDotNet();		
	}else{
		finalUrl = 'http://www.abbottmolecular.com/home_2' + isDotNet();
	}
	return finalUrl;
}
function getSiteUrlInt(){
	var finalUrl;
	var sSite;
	var tempHold = '';
	
	tempHold = document.forms['SerachForm'].isDotNet.value;
	sSite = window.location;
	document.forms['SerachForm'].isDotNet.value = sSite;
	sSite = document.forms['SerachForm'].isDotNet.value;
	document.forms['SerachForm'].isDotNet.value = tempHold;
	sSite = sSite.substring(sSite.indexOf("/")+2);
	sSite = sSite.substring(0,sSite.indexOf("/"));	
	sSite = sSite.toLowerCase();
	
	if(sSite.indexOf('amd.orbisdesign') != -1){
		finalUrl = 'http://amdinternational.orbisdesign.net/home_2' + isDotNet();
	}else if(sSite.indexOf('amdinternational.orbisdesign') != -1){	
		finalUrl = 'http://amdinternational.orbisdesign.net/home_2' + isDotNet();
	}else if(sSite.indexOf('am.stage.orbisdesign.net') != -1){		
		finalUrl = 'http://am.global.stage.orbisdesign.net/home_2' + isDotNet();
	}else if(sSite.indexOf('am.global.stage.orbisdesign.net') != -1){		
		finalUrl = 'http://am.global.stage.orbisdesign.net/home_2' + isDotNet();
	}else if(sSite.indexOf('stage.abbottmolecular') != -1){
		finalUrl = 'http://stage.global.abbottmolecular.com/home_2' + isDotNet();		
	}else if(sSite.indexOf('stage.global.abbottmolecular') != -1){
		finalUrl = 'http://stage.global.abbottmolecular.com/home_2' + isDotNet();		
	}else{
		finalUrl = 'http://international.abbottmolecular.com/home_2' + isDotNet();
	}
	return finalUrl;	
}
function italSubTitle(){
	if(document.getElementById('subTitle')){
		var subTitle = document.getElementById('subTitle');
		var subTitleChnged;
	
		if(window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
			subTitleChnged = subTitle.innerText;		// IE;
	  	}else{
	    	if(window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
				subTitleChnged = subTitle.textContent; 			// Firefox
			}
		}
		subTitleChnged = replaceSubstring(subTitleChnged,"Invitro","<em>Invitro</em>");
		subTitleChnged = replaceSubstring(subTitleChnged,"In vitro","<em>In vitro</em>");
		subTitle.innerHTML = subTitleChnged;
	}
}
function replaceSubstring(inputString, fromString, toString) {
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { 
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else {
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";

      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } 
      
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } 
   return temp; 
}
/*~~~~~~~~~~~~~~~~~~~[ajax: file exists]~~~~~~~~~~~~~~~~~~~~~~ */
function submitSupport(fileCheck){
	xmlhttpPostNewProd('/include/checkFileExists.asp?fileName=' + fileCheck)
}
function xmlhttpPostNewProd(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            returnHttpReqResults(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send('asdf');	//must send something or get "length required" in FF
}
function returnHttpReqResults(results){
	var HTMLDisp = '';
	if (document.getElementById('httpReqResults')){
		var httpReqResultsHtml = document.getElementById('httpReqResults');
		HTMLDisp = HTMLDisp + results;
		httpReqResultsHtml.innerHTML = HTMLDisp; 
	}
}
/*~~~~~~~~~~~~~~~~~~~[]~~~~~~~~~~~~~~~~~~~~~~ */
function documentID(){
	var docID = document.getElementById('DocID');
	var docIDset;
	if(window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		docIDset = docID.innerText;		// IE;
  	}else{
    	if(window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
			docIDset = docID.textContent; 			// Firefox
		}
	}
	
	if(siteState() == 'INT'){
		docIDset = parseInt(docIDset) + 635500;
	}else{
		docIDset = parseInt(docIDset) + 631000;
	}
	
	docIDset = '30-' + docIDset;
	docID.innerHTML = docIDset;
}
function abbottGlobal(){
	var sSite = window.location;
	sSite = sSite + ' ';

	if(document.getElementById('underSubNav')){
		var corporateLink = document.getElementById('underSubNav');
		var HTMLDisp = '';
		HTMLDisp = HTMLDisp + '<div id=\"corporateLink\">';
		HTMLDisp = HTMLDisp + '<ul>';
		HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"http://www.abbott.com/\" class=\"corpLink\">Abbott Global</a></li>';
		if(siteState() == 'US'){
			if(sSite.indexOf('amd.orbisdesign.net') != -1){ 
				HTMLDisp = HTMLDisp + '<li><a href=\"/includeGlobal/OnToInternational.asp?GoTo=http://amdinternational.orbisdesign.net/home_2.aspx\" class=\"corpLink\">Abbott Molecular Global</a></li>';
			}else if(sSite.indexOf('am.stage.orbisdesign.net') != -1){
				HTMLDisp = HTMLDisp + '<li><a href=\"/includeGlobal/OnToInternational.asp?GoTo=http://am.global.stage.orbisdesign.net/home_2.aspx\" class=\"corpLink\">Abbott Molecular Global</a></li>';
			}else{
				HTMLDisp = HTMLDisp + '<li><a href=\"/includeGlobal/OnToInternational.asp?GoTo=http://international.abbottmolecular.com/home_2.aspx\" class=\"corpLink\">Abbott Molecular Global</a></li>';
			}	
			//HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"http://www.aneuvysion.com/\" class=\"corpLink\">AneuVysion.com</a></li>';
			HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"http://www.pathvysion.com/\" class=\"corpLink\">PathVysion.com</a></li>';
			//HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"http://www.urovysion.com/\" class=\"corpLink\">UroVysion.com</a></li>';
			HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"/include/ExternalLink_Plex.asp?GoTo=http://PLEX-ID.com&GoToName=PLEX ID\" class=\"corpLink\">PLEX-ID.com</a></li>';
			//HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"/include/ExternalLink_Athogen.asp?GoTo=http://www.athogen.com\" class=\"corpLink\">Athogen.com</a></li>';
			HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"/include/ExternalLink_Cynogen.asp?GoTo=http://www.cynogen.com/pages/home/1.php\" class=\"corpLink\">Cynogen.com</a></li>';
			//HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"/include/ExternalLink.asp?GoTo=http://www.codemap.com/abbottmolecular\" class=\"corpLink\">Medicare Part B Fee<br /> Schedules</a></li>';
		}else{
			HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"/includeGlobal/ExternalLink_Plex.asp?GoTo=http://PLEX-ID.com&GoToName=PLEX ID\" class=\"corpLink\">PLEX-ID.com</a></li>';
			//HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"/include/ExternalLink.asp?GoTo=http://www.codemap.com/abbottmolecular\" class=\"corpLink\">Medicare Part B Fee<br />Schedules</a></li>';
			//HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"/includeGlobal/ExternalLink_Athogen.asp?GoTo=http://www.athogen.com\" class=\"corpLink\">Athogen.com</a></li>';
			HTMLDisp = HTMLDisp + '<li><a target=\"_blank\" href=\"/includeGlobal/ExternalLink_Cynogen.asp?GoTo=http://www.cynogen.com/pages/home/1.php\" class=\"corpLink\">Cynogen.com</a></li>';			
		}
		HTMLDisp = HTMLDisp + '</ul>';
		HTMLDisp = HTMLDisp + '<div id=\"bannerPromo\"></div>';
		HTMLDisp = HTMLDisp + '<div>';
		corporateLink.innerHTML = HTMLDisp;
	}	
}
function prodDescChart(node){
	if(document.getElementById("txtLocusPre"+node).value == ''){
		alert("please enter a Locus Prepend");
		document.getElementById("txtLocusPre"+node).focus();
		return false;
	}
	
	if(document.getElementById("txtLocus"+node).value == ''){
		alert("please enter a Locus");
		document.getElementById("txtLocus"+node).focus();
		return false;
	}

	if(document.getElementById("txtChromosome"+node).value == ''){
		alert("please enter a Chromosome");
		document.getElementById("txtChromosome"+node).focus();
		return false;
	}

	if(document.getElementById("txtRegion"+node).value == ''){
		alert("please enter a Region");
		document.getElementById("txtRegion"+node).focus();
		return false;
	}
	
	if(document.getElementById("selFluorophore"+node).value == '-1'){
		alert("please select a Fluorophore");
		document.getElementById("selFluorophore"+node).focus();
		return false;
	}

	return true;
}
function confirmDelete(){
	if(confirm('Delete Entry?')){
		return true;
	}else{
		return false;
	}
	return false;
}
function autoComplete (field, select, property, forcematch) {
	var found = false;
	for (var i = 0; i < select.options.length; i++) {
	if (select.options[i][property].indexOf(field.value) == 0) {
		found=true; break;
		}
	}
	if (found) { select.selectedIndex = i; }
	else { select.selectedIndex = -1; }
	if (field.createTextRange) {
		var cursorKeys ="8;46;37;38;39;40;33;34;35;36;45;";
		if (cursorKeys.indexOf(event.keyCode+";") == -1) {
			var r1 = field.createTextRange();
			var oldValue = r1.text;
			var newValue = found ? select.options[i][property] : oldValue;
			if (newValue != field.value) {
				field.value = newValue;
				var rNew = field.createTextRange();
				rNew.moveStart('character', oldValue.length) ;
				rNew.select();
				}
			}
		}
	}
	
function InitializeLocusSearch(){
	document.getElementById("txtLocus").value = '';
}	
function SetLocusSearchBoxOnSelect(){
	document.getElementById("txtLocus").value = document.ProdDescChartFormAdd.options.value;
}
function baseURL(){
	var sSite;
	sSite = window.location;
	sSite = sSite + ' ';
	sSite = sSite.replace(/^\s+|\s+$/g, '');
	sSite = sSite.toLowerCase();
	return sSite;
}
/* ~~~~~~~~~~~~~~~~~~~~[ login functions ] ~~~~~~~~~~~~~~~ */
function loginAdmin(){
	var rev = 20071220;
	if (document.getElementById('loginFoot')){
		var LoginBox = document.getElementById('loginFoot');
		var HTMLDisp = '';
		var strHtm = '';
		var sPath = window.location.pathname;
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
		var sSite = window.location;
		
		if(sPage.indexOf('.aspx') > 0){
			sPage = sPage.substring(0,(sPage.length - 1));
		}
		
		sSite = sSite + ' ';
		
		if(sSite.indexOf('orbisdesign.net') != -1 && sSite.indexOf('ecommerce') == -1 && sSite.indexOf('stage') == -1){ 
			sSite = sSite.substring(sSite.indexOf("/")+2);
			sSite = sSite.substring(0,sSite.indexOf("/"));
			sSite = sSite.substring(0,sSite.indexOf("."));
	
			var sUser = sSite + 'User';
			var sPass = sSite + 'Pass';		

			if(getCookie(sSite + 'AdminLoggedIn') == 'True'){
				HTMLDisp = HTMLDisp + '<a href="#" id=\"loginLink\" onClick="LogOut(\'' + sSite + '\');return false;" style=\"\text-decoration:none;font-size:8px;">Log Out</a>';
			}else{
				HTMLDisp = HTMLDisp + '<a href="#" id=\"loginLink\" onClick="DispLogin();return false;" style=\"\text-decoration:none;font-size:8px;">Log In</a>';
			}	
			HTMLDisp = HTMLDisp + '<div id=\"Login\">';
			HTMLDisp = HTMLDisp + '<form id=\"adminLoginForm\" method=\"post\" action=\"/Admin/Default.asp?OnTo=' + sPage + '" name=\"Security\" style=\"display:inline;\" >';
			HTMLDisp = HTMLDisp + '<input class=\"txtInput\" type=\"text\" name=\"txtUserID\">';
			HTMLDisp = HTMLDisp + '<input class=\"txtInput\" type=\"password\" name=\"txtPassword\">';
			HTMLDisp = HTMLDisp + '<input type=\"button\" value=\"log in\" name=\"Login2\" onClick=\"submitLogin();">';
			HTMLDisp = HTMLDisp + '<br /><span style=\"white-space:nowrap;\"><input type=\"checkbox\" name=\"savePass\" value =\"true\">Remember me</span><br />';
			HTMLDisp = HTMLDisp + '<input type=\"hidden\" name=\"FormSubmitted\" value =\"true\">';
			HTMLDisp = HTMLDisp + '<input type=\"hidden\" name=\"ByPassAdmin\" value =\"true\">';
			HTMLDisp = HTMLDisp + '<input type=\"hidden\" name=\"siteUrlSec\" value =\"\">';
			HTMLDisp = HTMLDisp + '<a href="#" id=\"closeLink\" onClick="hideLogin();return false;">Cancel</a>';
			HTMLDisp = HTMLDisp + '</form>';
			HTMLDisp = HTMLDisp + '</div>';
			HTMLDisp = HTMLDisp + '';
			
			
			sId = sPage.substring(sPage.indexOf("_")+1,sPage.indexOf(".as"));

			strHtm = strHtm + "<div id=\"xmlDiv\"><a target=\"_blank\" href=\"/o2New/www/Include/SetVariables.asp?Page=" + sId + "&WebSite=amd.orbisdesign.net\">XML</a></div>";
			
	   		LoginBox.innerHTML = HTMLDisp + strHtm;

			if(getCookie(sUser) != null){
				document.forms['Security'].txtUserID.value = getCookie(sUser);
				document.forms['Security'].txtPassword.value = getCookie(sPass);
			}
		}	
	}
}
function submitLogin(){
	var sSite = window.location;
	document.forms['Security'].siteUrlSec.value = sSite;
	sSite = document.forms['Security'].siteUrlSec.value;
	sSite = sSite.substring(sSite.indexOf("/")+2);
	sSite = sSite.substring(0,sSite.indexOf("/"));
	sSite = sSite.substring(0,sSite.indexOf("."));
	var sUser = sSite + 'User';
	var sPass = sSite + 'Pass';
	
	if(document.Security.savePass.checked == true){
		SetGetCookie(sUser,document.forms['Security'].txtUserID.value);
		SetGetCookie(sPass,document.forms['Security'].txtPassword.value);
		document.forms['Security'].submit();
	}else{
		document.forms['Security'].submit();
	}
}
function DispLogin(){
	var Login = document.getElementById('Login');
	Login.style.display = 'block';
	document.Security.txtUserID.focus();
}
function hideLogin(){
	var Login = document.getElementById('Login')
	Login.style.display = 'none';
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~ [  ] ~~~~~~~~~~~~~~~~ */
function checkEnter(e){

	var characterCode
	
	if(e && e.which){
		e = e
		characterCode = e.which
	}else{
		e = event
		characterCode = e.keyCode
	}
	
	if(characterCode == 13){
		document.getElementById("googleSearchParam").value = document.getElementById("SearchInput").value;
		document.forms[0].submit()
		return false 
	}else{
		return true 
	}
}
function isDotNet(){
	var checkDotNet;
	checkDotNet = document.SerachForm.isDotNet.value.indexOf('aspx');
	if(checkDotNet != -1){
		return '.aspx';
	}else{
		return '.asp';
	}
}
function printFriendly(){
	var headID = document.getElementsByTagName("head")[0];
	var cssNode = document.createElement('link');
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = '/cssGlobal/printFriendly.css';
	cssNode.media = 'screen';
	headID.appendChild(cssNode);
	document.getElementById("TestOutput").innerHTML = "<a href=\"#\" onClick=\"window.print();\">Print</a> | <a href=\"#\" onClick=\"printFriendlyCancel();\">Cancel</a>";
}
function printFriendlyCancel(){
	var headID = document.getElementsByTagName("head")[0];         
	var cssNode = document.createElement('link');
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = '/cssGlobal/printFriendlyCancel.css';
	cssNode.media = 'screen';
	headID.appendChild(cssNode);
	document.getElementById("TestOutput").innerHTML = "";
}
/* ~~~~~~~~~~ [font size] ~~~~~~~~~~~~ */
function displayFontSize(){
	if (document.getElementById('setFontSizeArea')){
		var fontSizeCookie = "fontSizeCookie";
		drawFontControls();
		loadFontSizeStyleSheet(getCookie(fontSizeCookie));
	}
}
function drawFontControls(){
		var fontSizeArea = document.getElementById('setFontSizeArea');
		var HTMLDisp = '';
		var fontSizeCookie = "fontSizeCookie";
		var currentSize = '';
		var img1 = '';
		var img2 = '';
		var img3 = '';
		var fontSizeClass1 = '';
		var fontSizeClass2 = '';
		var fontSizeClass3 = '';		
		
		if(getCookie(fontSizeCookie) == null){
			SetGetCookie(fontSizeCookie,'1');
		}		
		currentSize = getCookie(fontSizeCookie);
		
		if(currentSize == '1'){
			img1 = 'textSize1_YAH.gif';
			img2 = 'textSize2.gif';
			img3 = 'textSize3.gif';
			fontSizeClass1 = 'textSize1_YAH';
			fontSizeClass2 = 'textSize2';
			fontSizeClass3 = 'textSize3';			
		}else if(currentSize == '2'){
			img1 = 'textSize1.gif';
			img2 = 'textSize2_YAH.gif';
			img3 = 'textSize3.gif';
			fontSizeClass1 = 'textSize1';
			fontSizeClass2 = 'textSize2_YAH';
			fontSizeClass3 = 'textSize3';
		}else if(currentSize == '3'){
			img1 = 'textSize1.gif';
			img2 = 'textSize2.gif';
			img3 = 'textSize3_YAH.gif';
			fontSizeClass1 = 'textSize1';
			fontSizeClass2 = 'textSize2';
			fontSizeClass3 = 'textSize3_YAH';	
		}
		
		HTMLDisp = HTMLDisp + '<a href=\"#\" onClick=\"setFontSize(\'1\')\"><img class=\"' + fontSizeClass1 + '\" src=\"/imagesGlobal/trans.gif\" width=\"15\" height=\"12\" alt=\"Text Size 1\" />';
		HTMLDisp = HTMLDisp + '<a href=\"#\" onClick=\"setFontSize(\'2\')\"><img class=\"' + fontSizeClass2 + '\" src=\"/imagesGlobal/trans.gif\" width=\"15\" height=\"12\" alt=\"Text Size 2\" />';
		HTMLDisp = HTMLDisp + '<a href=\"#\" onClick=\"setFontSize(\'3\')\"><img class=\"' + fontSizeClass3 + '\" src=\"/imagesGlobal/trans.gif\" width=\"15\" height=\"12\" alt=\"Text Size 3\" />';  
		
		fontSizeArea.innerHTML = HTMLDisp;	
}
function setFontSize(size){
	var fontSizeCookie = "fontSizeCookie";
	SetGetCookie(fontSizeCookie,size);
	drawFontControls();
	loadFontSizeStyleSheet(getCookie(fontSizeCookie));
}
function loadFontSizeStyleSheet(version){
	var headID = document.getElementsByTagName("head")[0];         
	var cssNode = document.createElement('link');
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = '/cssGlobal/setFontSize_' + version + '.css';
	cssNode.media = 'screen';
	headID.appendChild(cssNode);
}
function indicationsMessage(){
	document.getElementById('indicationsMessage').innerHTML = "<div id=\"closeInidicationsLink\"><a href=\"#\" onClick=\"closeIndication();\" style=\"color:#f00;\">X CLOSE</a></div>" + document.getElementById('IndicationsForUse').innerHTML;
	document.getElementById('indicationsMessage').style.display = 'block';
	document.getElementById('indicationsMessage').style.whiteSpace = 'normal';
}
function closeIndication(){
	document.getElementById('indicationsMessage').style.display = 'none';
	document.getElementById('indicationsMessage').innerHTML = "";
}
/*~~~~~~~~~~~~~~~~~~~[gateWay]~~~~~~~~~~~~~~~~~~~~~~ */
function loadPop(section){
	var divParent = document.getElementById('main');		
	var newdiv = document.createElement('div');
	var newdivDark = document.createElement('div');
	var divIdName = 'newDiv';
	var divIdName2 = 'newDivBack';
	sectionChoice = section;
	newdiv.setAttribute('id',divIdName);
	newdivDark.setAttribute('id',divIdName2);
	divParent.appendChild(newdiv);
	divParent.appendChild(newdivDark);
	if(document.getElementById('dropDown')){
		document.getElementById('dropDown').style.display = 'none';
	}

	xmlhttpPost('/O2NetAm/Applications/TransformDoc/default.aspx?XmlDoc=/xml/content/gateWay.xml&XsltDoc=/xslt/gateWayPop.xslt&XmlVars=section|' + section,'newDiv');
}
function closePop(){
	removeElement('newDiv');
	removeElement('newDivBack');
	if(document.getElementById('dropDown')){
		document.getElementById('dropDown').style.display = 'block';
	}	
}
function removeElement(divToRemove){
	var d = document.getElementById('main');
	var olddiv = document.getElementById(divToRemove);
	d.removeChild(olddiv);
}
function closePopAndGo(){
	var section = window.sectionChoice;
	SetGetCookie('abbottMolecularGatewayPref',section);
	var cookieChoice = getCookie('abbottMolecularGatewayPref');
	switch(cookieChoice){
	case "US":
		setKookie('abbottMolecularGatewayPref','US');
		window.location.href = getSiteUrlUs();
		break;    
	default:
		setKookie('abbottMolecularGatewayPref','GLOBAL');
		window.location.href = getSiteUrlInt();
	}	
}

/*~~~~~~~~~~~~~~~~~~~[]~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~ [ text editor ] ~~~~~~~~~~~~~~~~ */
if(baseURL().indexOf('orbisdesign') != -1){
	document.write('<' + 'script');
	document.write(' language="javascript"');
	document.write(' type="text/javascript"');
	document.write(' src="/JavaScriptGlobal/textEditor.js">');
	document.write('</' + 'script' + '>');

	document.write('<' + 'script');
	document.write(' language="javascript"');
	document.write(' type="text/javascript"');
	document.write(' src="/o2Layout/Xsl_Common/ewe/source/ewe.js">');
	document.write('</' + 'script' + '>');
	
	document.write('<' + 'script');
	document.write(' language="javascript"');
	document.write(' type="text/javascript"');
	document.write(' src="/javascriptGlobal/printCatalog.js">');
	document.write('</' + 'script' + '>');	
}

document.write('<' + 'script');
document.write(' language="javascript"');
document.write(' type="text/javascript"');
document.write(' src="/javascriptO2/cookies.js">');
document.write('</' + 'script' + '>');

function loadAjaxMultiple(){
	if(typeof(xmlhttpPost)=='undefined'){
		document.write('<' + 'script');
		document.write(' language="javascript"');
		document.write(' type="text/javascript"');
		document.write(' src="/javascriptO2/ajaxMultiple.js">');
		document.write('</' + 'script' + '>');
	}	
}	
loadAjaxMultiple();

