/* Written by Omar I. Young *//*updated by VML - 10/26/2009*/function isIE6(){    return ( document.all && (/msie 6./i).test(navigator.appVersion) && window.ActiveXObject ) ? true : false;}var sPath = window.location.pathname;var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);var ie6 = isIE6();var longsurvey = false;if(!ie6){	if(sPage!="code.asp")		{			$(document).ready(function showBox(){ 				var time = querySt("close");				if(querySt("close")){					setCookie('survey','true',time);								}				if(!getCookie("survey")){					tb_show("Important message", "http://www2.pmusa.com/en/quitassist/surveyFiles/code.asp?KeepThis=true&TB_iframe=true&height=400&width=700", false);					/*stage: http://qaibm2.pmusa.com/en/quitassist/index.asp?src=home&close=365 */					/*dev: http://pmusa.vmldev.com/en/quitassist/index.asp?src=home&close=365  */					/*live: http://www2.pmusa.com/en/quitassist/index.asp?src=home&close=365*/				}			});		}	}else{ 	if(sPage!="code.asp")		{			$(document).ready(function showBox(){ 				var time = querySt("close");				if(querySt("close")){					setCookie('survey','true',time);				}				if(!getCookie("survey")){					tb_show("Important message", "http://www2.pmusa.com/en/quitassist/surveyFiles/code.asp?KeepThis=true&TB_iframe=true&height=400&width=700", false);				}			});		}	}function querySt(ji) {	hu = window.location.search.substring(1);	gy = hu.split("&");	for (i=0;i<gy.length;i++) {		ft = gy[i].split("=");		if (ft[0] == ji) {			return ft[1];		}	}}function checkForm(){	//alert("longsurvey is: " + longsurvey);	var c1 = document.survey.compType[0];	var c2 = document.survey.compType[1];	if (!c1.checked&&!c2.checked){		obj = document.getElementById("compType");			obj.style.color = "red";	}	var g1 = document.survey.gender[0];	var g2 = document.survey.gender[1];	if (!g1.checked&&!g2.checked){		obj = document.getElementById("gender");			obj.style.color = "red";	}	var h1 = document.survey.hispanic[0];	var h2 = document.survey.hispanic[1];	if (!h1.checked&&!h2.checked){		obj = document.getElementById("hispanic");			obj.style.color = "red";	}	var message = "Please fill out the following fields:\n";		for(i=0; i<document.survey.elements.length; i++)	{		var element = document.survey.elements[i];		if (element.value=="NULL"){			element.style.color = "red";			message = message + "\n" + element.name + " = " + element.value + "\n"; 		}		else element.style.color = "black";	}	if (message == "Please fill out the following fields:\n"){				document.survey.submit();				window.parent.location.href = "http://www2.pmusa.com/en/quitassist/index.asp?src=home&close=365";/*stage: http://qaibm2.pmusa.com/en/quitassist/index.asp?src=home&close=365 *//*dev: http://pmusa.vmldev.com/en/quitassist/index.asp?src=home&close=365  *//*live: http://www2.philipmorrisusa.com/en/quitassist/index.asp?src=home&close=365*/		if(longsurvey == true){			checkDOB();		}					}		else {		alert("Please complete the fields highlighted in red.");		window.scrollTo(0,0);	}		}function checkDOB(){		var m = document.getElementById("month").value;	var d = document.getElementById("day").value;	var y = document.getElementById("year").value;	var today = new Date();	var month = today.getMonth() + 1;	var day = today.getDate();	var year = today.getFullYear();	if ( (year-y) > 18 ){		window.open('https://ssricheckbox.ssri.duke.edu/Survey.aspx?s=7194493de9a94dbf9fd5d49962c0727b');		return false;	}	else if ( (year-y) == 18 ){		if ( (month-m) >= 0 ){			if ( (day-d) >= 0 ){				window.open('https://ssricheckbox.ssri.duke.edu/Survey.aspx?s=7194493de9a94dbf9fd5d49962c0727b');				window.parent.location.href = "http://www2.pmusa.com/en/quitassist/index.asp?src=home&close=365";				return false;			}			else{				alert("We're sorry, but you're not eligible to take the next survey.\nThank you for your input.")				window.parent.location.href = "http://www2.pmusa.com/en/quitassist/index.asp?src=home&close=365";				return false;			}		}		else{			alert("We're sorry, but you're not eligible to take the next survey.\nThank you for your input.")			window.parent.location.href = "http://www2.pmusa.com/en/quitassist/index.asp?src=home&close=365";			return false;		}	}	else {		alert("We're sorry, but you're not eligible to take the next survey.\nThank you for your input.")		window.parent.location.href = "http://www2.pmusa.com/en/quitassist/index.asp?src=home&close=365";		return false;	}}function setCookie(c_name,value,expiredays){	var exdate=new Date();	exdate.setDate(exdate.getDate()+expiredays);	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate.toGMTString());+";path=/"}function getCookie(c_name){	if (document.cookie.length>0)	{		c_start=document.cookie.indexOf(c_name + "=");		if (c_start!=-1)		{ 			c_start=c_start + c_name.length+1 ;			c_end=document.cookie.indexOf(";",c_start);			if (c_end==-1) c_end=document.cookie.length			return unescape(document.cookie.substring(c_start,c_end));		} 	}	return "";}function deletecook(name){    var d = new Date();    document.cookie = name+"=1;expires=" + d.toGMTString() + ";" + ";";}