/***********************************************************************

	External JavaScript Utility for common functionality to be
	included on all pages on the site.

***********************************************************************/


// left Nav Rollover 
function leftNavRoll(el, imgEl) {
//alert(document.getElementById(el).style.backgroundColor);
/*
	
	if (document.all) {
		if(document.all[el].style.backgroundColor != "#C2C2E0") {
			document.all[el].style.backgroundColor = "#C2C2E0";
			//document.images[imgEl].src = "images/leftnav_arrow_white.gif";
		}
		else {
			document.all[el].style.backgroundColor = "transparent";
			//document.images[imgEl].src = "images/leftnav_arrow_selected.gif";
		}
	}

	 else if (document.getElementById) {
		var elColor = document.getElementById(el).style.backgroundColor;
*/
		
		if((document.getElementById(el).style.backgroundColor != "#C2C2E0")) {
			document.getElementById(el).style.backgroundColor = "transparent";
			//document.images[imgEl].src = "images/leftnav_arrow_white.gif";
//			(document.getElementById(el).style.backgroundColor == null) || 
		}
		else {
			document.getElementById(el).style.backgroundColor = "#C2C2E0";
			//document.images[imgEl].src = "images/leftnav_arrow_selected.gif";
		}
//	}
}

function leavingSite() {
var msg = "Thank you for visiting PsychiatrySource.com.\n";
msg += "You are about to leave this site to visit other websites for which AstraZeneca is not responsible.";

	if (confirm(msg)) 
		return true;
	else
		return false;
}

function gsmMsg() {
var myMsg = "This information is provided by Clinical Pharmacology, a critically-acclaimed electronic drug information reference published by Gold Standard Multimedia. The data is based on medications available in the U.S. and interactions clinically recognized in the U.S.";

	if (confirm(myMsg)) 
		return true;
	else
		return false;
}




function newWin(url,w,h) {
		objNewWin = window.open("","win",'status=1,scrollbars=1,resizable=1,width=' + w + ',height=' + h);
        objNewWin.location = url;
        objNewWin.focus();
}

function displayWindow(url, width, height) {
	if (!window.Win || Win.closed)
	    var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=1,toolbar=yes' );
	else
		Win.location = url;
		Win.focus();
}


function addBookmark(addUrl) {
myUserAgent = navigator.userAgent.toLowerCase();
	if (myUserAgent.indexOf("msie") != -1) {
		window.external.AddFavorite(addUrl, 'PsychiatrySource.com');
	}
	else {
		alert ('If you are using Netscape or Mozilla, you can press CTRL+D on your keyboard to bookmark this site.')	
	}
}

function popupText(msg) {
	alert("This will launch the " + msg + " page.");
}

function whichSearch(frm) {
	var theForm = document.forms[0];
	var appDir = "/psychsource/";
	
	if (frm == "drug") {
		if(theForm.txtDrugSearch.value == "") {
			alert("Please enter a Drug Name.");
			theForm.txtDrugSearch.focus();
			return false;
		}

		//theForm.action = "/psychsource/test/DrugInteractionsPopup.aspx";
		//theForm.target = "win";
		//onSubmit = newWin("","550","400");		
		theForm.action = appDir + "DesktopDefault.html?tabid=47&tabindex=8";

		theForm.submit();
	}

	else if(frm == "psych") {
		if(theForm.txtPsychSearch.value == "") {
			alert("Please enter a Search Term.");
			theForm.txtPsychSearch.focus();
			return false;
		}
		theForm.action = appDir + "DesktopDefault.html?tabid=44&tabindex=6";
		theForm.submit();
		//return true;
	}
}

// links back to the window that opened the current window.
function linkToOpener(url) {
	window.opener.location = url;
	window.opener.focus();
}


