/* 2008.05.06	gbattin
				<function shareYourStoryDisclaimer>
*/

window.onload = initialize; 

function initialize (){
	searchButton();
	setSearchBox();
	abbottGlobal();
	logoClick();
	setupFooterNav();
	shareYourStoryDisclaimer();
	loginAdmin();
	excelAdminMenuAdjust();
}
function excelAdminMenuAdjust(){
	//Edit_ExcelDataEditor
	if(document.getElementById("Edit_ExcelDataEditor") != null){
		document.getElementById("Edit_ExcelDataEditor").style.top = '190px';
	}
}
function searchButton(){
	if (document.SerachForm.submitButton){
		document.SerachForm.submitButton.value = 'go';
	}
}
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 abbottGlobal(){
	if (document.getElementById('underSubNav')){
		var aGlobalLink = document.getElementById('underSubNav');
		var HTMLDisp = '';
		HTMLDisp = HTMLDisp + '<a class=\"abbottGlobalLink\" target=\"_blank\" href=\"http://www.abbott.com/\">Abbott Global</a>';
		HTMLDisp = HTMLDisp + '<br />';
		HTMLDisp = HTMLDisp + '<a class=\"abbottGlobalLink\" target=\"_blank\" href=\"http://www.abbottmolecular.com/\">Abbott Molecular</a>';
		aGlobalLink.innerHTML = HTMLDisp;
	}
}
function logoClick(){
	var logoClickThrough = document.getElementById('logo');
	var HTMLDisp = '';
	HTMLDisp = HTMLDisp + '<a href=\"http://www.pathvysion.com\"><img src=\"/images/trans.gif\" width=\"450\" height=\"150\" border=\"0\" alt=\"Home\" /></a>';
	logoClickThrough.innerHTML = HTMLDisp
}
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;
	
	linkPrivacy = 'PrivacyPolicy_1413.aspx';
	linkTerms = 'TermsofUse_1414.aspx';
	linkSiteMap = 'SiteMap_3.aspx';
	
	HTMLDisp = HTMLDisp + '<div id=\"footerNav\">'
	//HTMLDisp = HTMLDisp + '<a href=\"home_2' + isDotNet() + '\" class=\"\">Home</a> | ';
	//HTMLDisp = HTMLDisp + '<a href=\"Patients_6' + isDotNet() + '\" class=\"\">Patients</a> | ';
	//HTMLDisp = HTMLDisp + '<a href=\"Clinicians_890' + isDotNet() + '\" class=\"\">Clinicians</a> | ';
	//HTMLDisp = HTMLDisp + '<a href=\"LaboratoryProfessionals_7' + isDotNet() + '\" class=\"\">Laboratoy Professionals</a> | ';
	HTMLDisp = HTMLDisp + '<a href=\"SiteMap_3' + isDotNet() + '\" class=\"\">Site Map</a> | ';
	HTMLDisp = HTMLDisp + '<a href=\"' + linkPrivacy + '\" class=\"\">Privacy Policy</a> | ';
	HTMLDisp = HTMLDisp + '<a href=\"' + linkTerms + '\" class=\"\">Terms of Use</a>  ';
	HTMLDisp = HTMLDisp + '<div>'	
	footerNav.innerHTML = HTMLDisp;
}
function shareYourStoryDisclaimer() {
	var displayFooterDisclaimer = document.getElementById('CoDivision');
	var HTMLDisp = '';
	HTMLDisp = HTMLDisp + '<div id=\"CoDivision\">'
	HTMLDisp = HTMLDisp + '<p>This website and the information contained herin are intended for use by US residents only, are provided for informational purposes only and are not intended to replace a discussion with a healthcare provider.  All decisions regarding patient care must be made with a healthcare provider and consider the unique characteristics of each patient.</p>'
	HTMLDisp = HTMLDisp + '</div>';
	displayFooterDisclaimer.innerHTML = HTMLDisp;	
}
function isDotNet(){
	var checkDotNet;
	checkDotNet = document.SerachForm.isDotNet.value.indexOf('aspx');
	if(checkDotNet != -1){
		return '.aspx';
	}else{
		return '.asp';
	}
}

/* ~~~~~~~~~~~~~~~~~~~~[ login functions ] ~~~~~~~~~~~~~~~ */
function loginAdmin(){
	var rev = 20071220;
	if (document.getElementById('loginFoot')){
		var LoginBox = document.getElementById('loginFoot');
		var HTMLDisp = '';
		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 = 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 + '';
	   		LoginBox.innerHTML = HTMLDisp;
			
			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 externalLink(linkHref){
	var div = document.createElement('div');
	var container = document.createElement('div');
    var htmlStr = "";
	div.id = 'displaybox';
	container.id = 'form_container';
	if (document.body.firstChild){
      	document.body.insertBefore(div, document.body.firstChild);
		document.body.insertBefore(container, document.body.firstChild);
	} else {
      	document.body.appendChild(div);
		document.body.appendChild(container);
	}
	htmlStr += "<table width='100%' height='100%'>";
	htmlStr += "<tr><td align='center' valign='middle' width='100%' height='100%'>";
	htmlStr += "<div id='popBox'>";
	htmlStr += "Links which take you out of Abbott Laboratories worldwide web sites are not under the control of Abbott Laboratories, and Abbott Laboratories is not responsible for the contents of any such site or any further links from such site. Abbott Laboratories is providing these links to you only as a convenience, and the inclusion of any link does not imply endorsement of the linked site by Abbott Laboratories.<p />";
	htmlStr += "Do you understand and wish to continue?"
	htmlStr += "<div class='center'>";
	htmlStr += "<a onClick='linkGo(\"" + linkHref + "\");' href='javascript:void(0);'>";
	htmlStr += "<img border='0' alt='Yes' src='/images/gatewayPopYes.gif' height='26' width='65'>";
	htmlStr += "</a>";
	htmlStr += "<a onClick='cancelGate();' href='javascript:void(0);'>";
	htmlStr += "<img border='0' alt='No' src='/images/gatewayPopNo.gif' height='26' width='65'>";
	htmlStr += "</a>";
	htmlStr += "</div>";
	htmlStr += "</div>";
	htmlStr += "</td></tr>";
	htmlStr += "</table>";
	
	document.getElementById('form_container').innerHTML = htmlStr;
	scroll(0,0);
}
function linkGo(linkHref){
	setTimeout(function(){
	    window.location = linkHref;
	}, 0);	 
}
function cancelGate(){
	document.getElementById('displaybox').style.display = 'none';
	document.getElementById('form_container').style.display = 'none';
}


/* ~~~~~~~~~~~~~~~~~~~~[ END: login functions ] ~~~~~~~~~~~~~~~ */
document.write('<' + 'script');
document.write(' language="javascript"');
document.write(' type="text/javascript"');
document.write(' src="/javascriptO2/cookies.js">');
document.write('</' + 'script' + '>');



