function popWin(file,width,height,scrollbars,menubar) {	window.open(file,'','toolbar=no,left=20,top=20,status=no,width='+width+',height='+height+',scrollbars='+scrollbars+',directories=no,location=no,resizable=no,menubar='+menubar+'');
}

function popSide(file,width,height,scrollbars,menubar) {	window.open(file,'','toolbar=yes,left=20,top=20,status=yes,width='+width+',height='+height+',scrollbars='+scrollbars+',directories=yes,location=yes,resizable=yes,menubar='+menubar+'');
}

function popHealthWiseDialog(file) {
	popWin('/common/nav/popupindex.jhtml?articleId=' + file,'500','300','yes','no');
}

function openTOCpopup(){
	var popurl="/openTableOfContentAction.do"
	winpops=window.open(popurl,"","width=400,height=560,")
}

// Hack to allow us to use rollover images instead of image submit buttons that
// are incapable of being rollovers.
function submitFormEmail() {
	document.Submit.submit();
}

function submitFormSearch() {
	document.search.submit();
}

// Validates the eNewsletter email box input
function ValidateEmail() {
	document.Submit.method="POST";
	check1=0; check2=0; ok=0; 
	if (document.Submit.email.value.length < 7) {
		ok=1;   
	}
	var Em2=document.Submit.email.value;
	for(i=0; i<Em2.length; i++) { 
		if (Em2.charAt(i)=="@") {
			check1++;
		}
		if (Em2.charAt(i)==".") {
			check2++;
		}
		if (Em2.charAt(i)==" ") {
			ok=1;
		}
	}
	if (check1>1 || check1<1 || check2<1) {
		ok=1;
	}
	if (document.Submit.email.value.length < 1) {
		ok=1;  
	}
	if (ok==1) {
		alert("Please enter a valid email address.");
		document.Submit.email.focus();
		return (false);
	}
	return (true);
}

//Manly used for the crossword game. Generates today's date in the yyMMDD format
function parseDate(){

	var date = new Date();
	var month = date.getMonth()+1;
	var year = date.getYear().toString().substring(1,4);
	if (year.length > 2){ year = year.substring(1,3);}
	if (month < 10){ month = "0" + month; }

	var parsedDate = year + month + date.getDate();

	return parsedDate;
}


// Prompts user before jumping to link
function promptForLink(link, message){
	var dilema = confirm(message);
	if (dilema){
		if ((navigator.appName).indexOf("Microsoft")!=-1){ location.href(link); }
		else { location.href = link; }
	}	
}


//Pics a link for the "Medical test that could save your life" article.
function forcePick() {
	if (!document.forms.med_test.Gender.value || document.forms.med_test.Gender.value == "") {
		alert("Please choose a gender");
		return false;
	}else if (!document.forms.med_test.Age.value || document.forms.med_test.Age.value == "") {
		alert("Please choose an age range");
		return false;
	}else{
		var link;
		if (document.forms.med_test.Gender.value=="Men"){
			switch(document.forms.med_test.Age.value){
				case "20": link = '/content/openContent.do?contentId=12813'; break;
				case "40": link = '/content/openContent.do?contentId=12870'; break;
				case "50": link = '/content/openContent.do?contentId=12871'; break;
				default:; break;
			}
		}else{
			switch(document.forms.med_test.Age.value){
				case "20": link = '/content/openContent.do?contentId=12872'; break;
				case "40": link = '/content/openContent.do?contentId=12873'; break;
				case "50": link = '/content/openContent.do?contentId=12874'; break;
				default:; break;
			}
		}
		if ((navigator.appName).indexOf("Microsoft")!=-1){ location.href(link); }
		else { location.href = link; };
	}
}





