// JavaScript Document
<!--

var WindowObjectReference; // global variable 
var spathurl; // global variable 
function openRequestedPopup() 
{ 
spathurl = location.href;
WindowObjectReference = window.open("email.cfm?path=" + spathurl, "DescriptiveWindowName", "height=500,width=640,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,minimize=no,maximize=no"); 
} 

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function isLeavingHIVTest(DestinationURL, Language) {
	/* Regular expression to allow the following Websites:
		cdc.gov
		cdcnpin.org
	*/
	var allowedWebsites = /cdc\.gov|cdcnpin\.org/;
	var VisitSite
	
	// 	Test the DestinationURL to check if the alert message should be shown.
	if (allowedWebsites.test(DestinationURL) == false) {
		// Determine which language to display the alert
		switch(Language) {
			case "Eng":
				//return confirm("Notice\n\n You are temporarily leaving the HIVTest Website to open an external Web site. HIVTest are not responsible for the availability or content of external sites, nor do we endorse, warrant, or guarantee the services or information described or offered on external sites. Further, the site you are about to visit may contain information that may not be appropriate for all audiences. The views and information offered on extermal Web sites do not necessarily state or reflect those of the U.S. Department of Health and Human Services, CDC or NPIN. ");
				VisitSite = confirm("Notice\n\n You are temporarily leaving the HIVTest Web site to open an external Web site. HIVTest is not responsible for the availability or content of external sites, nor do we endorse, warrant, or guarantee the services or information described or offered on external sites. Further, the site you are about to visit may contain information that may not be appropriate for all audiences. The views and information offered on extermal Web sites do not necessarily state or reflect those of the U.S. Department of Health and Human Services, HIVTest. ");
				//alert(VisitSite);
				if (VisitSite == true)
				{
					window.open(DestinationURL);
				}
				return false;
				break;
			case "Span":
				//return confirm("Aviso\n\n Usted est&aacute; temporalmente saliendo del sitio en la Web de NPIN de los CDC para vincular un sitio en la Web externo. Los CDC y NPIN no se encargan de la disponibilidad o el contenido de los sitios externos, ni nosotros apoyamos, merecemos, o garantizamos los servicios o la informaci&oacute;n descrita u ofrecida en los sitios externos. Aún m&aacute;s, el sitio que usted est&aacute; por visitar puede contener informaci&oacute;n que quiz&aacute; no sea apropiada para todas las audencias. Las criteros y la informaci&oacute;n proporcionada en los sitios en la Web externos no necesariamente declaran o reflejan los del Departamento de la Salud y Servicio Sociales de los Estados Unidos, los CDC o NPIN.");
				confirm("Aviso\n\n Usted está temporalmente saliendo del sitio en la Web de HIVTest para vincular un sitio en la Web externo. HIVTest no se encargan de la disponibilidad o el contenido de los sitios externos, ni nosotros apoyamos, merecemos, o garantizamos los servicios o la información descrita u ofrecida en los sitios externos. Aún más, el sitio que usted está por visitar puede contener información que quizá no sea apropiada para todas las audencias. Las criteros y la información proporcionada en los sitios en la Web externos no necesariamente declaran o reflejan los del Departamento de la Salud y Servicio Sociales de los Estados Unidos, HIVTest.");
				if (VisitSite == true)
				{
					window.open(DestinationURL);
				}
				return false;				
				break;
			// The default alert display language is English						
			default:
				//return confirm("Notice\n\n You are temporarily leaving the CDC NPIN Web site to open an external Web site. CDC and NPIN are not responsible for the availability or content of external sites, nor do we endorse, warrant, or guarantee the services or information described or offered on external sites. Further, the site you are about to visit may contain information that may not be appropriate for all audiences. The views and information offered on extermal Web sites do not necessarily state or reflect those of the U.S. Department of Health and Human Services, CDC or NPIN.");	
				VisitSite = confirm("Notice\n\n You are temporarily leaving the CDC NPIN Web site to open an external Web site. CDC and NPIN are not responsible for the availability or content of external sites, nor do we endorse, warrant, or guarantee the services or information described or offered on external sites. Further, the site you are about to visit may contain information that may not be appropriate for all audiences. The views and information offered on extermal Web sites do not necessarily state or reflect those of the U.S. Department of Health and Human Services, CDC or NPIN. ");
				//alert(VisitSite);
				if (VisitSite == true)
				{
					window.open(DestinationURL);
				}
				return false;
				break;
		}
	}
	else return true;
}

function isLeaving(DestinationURL, Language) {
	/* Regular expression to allow the following Websites:
		cdc.gov
		cdcnpin.org
	*/
	//var allowedWeb sites = /cdc\.gov|cdcnpin\.org/;
	var allowedWebsites = /cdcnpin\.org/;
	var VisitSite
	
	// 	Test the DestinationURL to check if the alert message should be shown.
	if (allowedWebsites.test(DestinationURL) == false) {
		// Determine which language to display the alert
		switch(Language) {
			case "Eng":
				
				VisitSite = confirm("Notice\n\nYou are temporarily leaving the HIVTest Web site to open an external Web site. HIVTest is not responsible for the availability or content of external sites, nor do we endorse, warrant, or guarantee the services or information described or offered on external sites. Further, the site you are about to visit may contain information that may not be appropriate for all audiences. The views and information offered on external Web sites do not necessarily state or reflect those of the U.S. Department of Health and Human Services, HIVTest. ");
				//alert(VisitSite);
				if (VisitSite == true)
				{
					window.open(DestinationURL);
				}
				return false;
				break;
			case "Span":
				
				VisitSite = confirm("Aviso\n\n Usted está temporalmente saliendo del sitio en la Web de HIVTest para vincular un sitio en la Web externo. HIVTest no se encargan de la disponibilidad o el contenido de los sitios externos, ni nosotros apoyamos, merecemos, o garantizamos los servicios o la información descrita u ofrecida en los sitios externos. Aún más, el sitio que usted está por visitar puede contener información que quizá no sea apropiada para todas las audencias. Las criteros y la información proporcionada en los sitios en la Web externos no necesariamente declaran o reflejan los del Departamento de la Salud y Servicio Sociales de los Estados Unidos, HIVTest.");
				//alert(VisitSite);
				if (VisitSite == true)
				{
					window.open(DestinationURL);
				}
				return false;
				break;
			// The default alert display language is English						
			default:
				
				VisitSite = confirm("Notice\n\n You are temporarily leaving the CDC NPIN Web site to open an external Web site. CDC and NPIN are not responsible for the availability or content of external sites, nor do we endorse, warrant, or guarantee the services or information described or offered on external sites. Further, the site you are about to visit may contain information that may not be appropriate for all audiences. The views and information offered on external Web sites do not necessarily state or reflect those of the U.S. Department of Health and Human Services, CDC or NPIN. ");
				//alert(VisitSite);
				if (VisitSite == true)
				{
					window.open(DestinationURL);
				}
				return false;
				break;
		}
	}
	else return true;
}

