dd=document;NS=(dd.layers)?1:0;IE=(dd.all)?1:0;DOM=(dd.getElementById)?1:0 
// to set the listbox display when the TAF popup DIV shows up
function setListBoxStyle(_toSet){
	if(_toSet == "y"){
		$('#Milk').attr("class", "hideListBox");
		$('#IceCream').attr("class", "hideListBox");
		$('#OrganicMilk').attr("class", "hideListBox");
		$('#Dietary').attr("class", "hideListBox");
	}
	if(_toSet == "n"){
		$('#Milk').removeAttr("class");
		$('#IceCream').removeAttr("class");
		$('#OrganicMilk').removeAttr("class");
		$('#Dietary').removeAttr("class");		
	}	
}

		function showLayer(L)
		{
                
			if(L == "BuyNow"){
						$("#ExitSite").hide();
						$("#Tellfriend").hide();
			}
			if(L == "ExitSite"){
						$("#BuyNow").hide();
						$("#Tellfriend").hide();
			}
			if(L == "Tellfriend"){
                    
				$("#ExitSite").hide();
				$("#BuyNow").hide();
	
				/*$('#error_status_text').css('display','none');
				document.getElementById('tafFormYourNameLabel').style.color='black';
				document.getElementById('tafFormYourEmailLabel').style.color='black';
				document.getElementById('tafFriendNamelLabel').style.color='black';
				document.getElementById('tafFriendEmailLabel').style.color='black';
				*/
			}


			setListBoxStyle('n');
			setListBoxStyle('y');
			$("#"+L).show();
                //document.getElementById("frameprod").src = "node/2";
		/*if(NS)dd.layers[L].display='show';
		else if (IE)obg=dd.all[L]; 
		else obg=dd.getElementById(L); 
		if(!NS)obg.style.display='block' */
                    /*$(".PopupBackgroundZ").hide();
                    $("#"+L).show();
                    setListBoxStyle('n');
                    setListBoxStyle('y');*/
		}
		
		function hideLayer(L){ 
		if(L == "BuyNow"){
			setListBoxStyle('n');
		}
		if(L == "ExitSite"){
			setListBoxStyle('n');
		}
		if(L == "Tellfriend"){
			setListBoxStyle('n');
		}
		if(NS)dd.layers[L].display='hide'; 
		else if (IE)obg=dd.all[L]; 
		else obg=dd.getElementById(L); 
		if(!NS)obg.style.display='none' 
		}

function productBuyNow(){
	window.open('http://www.drugstore.com/templates/brand/default.asp?brand=7681&aid=338621','BuyLactaidProducts');
	hideLayer('ExitSite');
	updateBuyNowVariable='no';
}

/*
* @author lfelipe - 08/31/11
* Function for redirect external link via disclaimer
*/
function productBuyNow1(url,divname){
	window.open(url,'BuyLactaidProducts');
	hideLayer(divname);
	updateBuyNowVariable='no';
}

function change(id, newClass) {
		identity=document.getElementById(id);
		identity.className=newClass;
		}
		
		function SubNavBack0()	
		{
		showLayer ('SubNav0')
		hideLayer ('SubNav1')
		hideLayer ('SubNav2')
		hideLayer ('SubNav3')
		hideLayer ('SubNav4')
		}
		
		function SubNavBack1()	
		{
		hideLayer ('SubNav0')
		showLayer ('SubNav1')
		hideLayer ('SubNav2')
		hideLayer ('SubNav3')
		hideLayer ('SubNav4')
		showLayer ('Section1SubNav1')
		hideLayer ('Section1SubNav2')
		hideLayer ('Section1SubNav3')
		hideLayer ('Section1SubNav4')
		}
		
		function SubNavBack2()	
		{
		hideLayer ('SubNav0')
		hideLayer ('SubNav1')
		showLayer ('SubNav2')
		hideLayer ('SubNav3')
		hideLayer ('SubNav4')
		showLayer ('Section1SubNav2')
		hideLayer ('Section1SubNav1')
		hideLayer ('Section1SubNav3')
		hideLayer ('Section1SubNav4')
		}
		
		function SubNavBack3()	
		{
		hideLayer ('SubNav0')
		hideLayer ('SubNav1')
		hideLayer ('SubNav2')
		showLayer ('SubNav3')
		hideLayer ('SubNav4')
		showLayer ('Section1SubNav3')
		hideLayer ('Section1SubNav2')
		hideLayer ('Section1SubNav1')
		hideLayer ('Section1SubNav4')
		}
		
		function SubNavBack4()	
		{
		hideLayer ('SubNav0')
		hideLayer ('SubNav1')
		hideLayer ('SubNav2')
		hideLayer ('SubNav3')
		showLayer ('SubNav4')
		showLayer ('Section1SubNav4')
		hideLayer ('Section1SubNav2')
		hideLayer ('Section1SubNav3')
		hideLayer ('Section1SubNav1')
		}
		
		/*THIS CONTROLS THE LINKS ON THE DAIRY DIGESTION TEST PAGES HEALTH_4A.INC*/
		function showTestDivs(_whichDiv){
			closeTestDivs();
			document.getElementById(_whichDiv).style.display = "block";
			document.getElementById('testHeaderImg').src = "../sites/default/files/dairydigsetion/"+_whichDiv+"_top.gif";
		}
		
		function closeTestDivs(){
			document.getElementById('day1').style.display = "none";
			document.getElementById('day2').style.display = "none";
			document.getElementById('results').style.display = "none";
		}
		
		function op_lgpr(url){	
			window.open(url,'prtopen','width=645,height=600,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no');
		}
		//THIS CONTROLS THE MAPS SHOWING UP WHEN SOMEONE SELECTS IT WITH THE DROPDOWN MENU
		function showDiv(divName) {
			jQuery('.productMap').hide();
			jQuery('#' + divName).show();
			return;
		}
		
		function validateEmail(email)
		{
			var splitted = email.match("^(.+)@(.+)$");
			if(splitted == null) return false;
			if(splitted[1] != null )
			{
			  var regexp_user=/^\"?[\w-_\.]*\"?$/;
			  if(splitted[1].match(regexp_user) == null) return false;
			}
			if(splitted[2] != null)
			{
			  var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
			  if(splitted[2].match(regexp_domain) == null) 
			  {
				var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
				if(splitted[2].match(regexp_ip) == null) return false;
			  }// if
			  return true;
			}
		return false;
		}
		
		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];}}
				}
				
		var currentDate = new Date();
		var currentYear = currentDate.getFullYear();
		


function showdivpopup(){
	$('#Tellfriend').css('display','block');
	$('#Tellfriend').css('top','1000px');
	$('#Tellfriend').css('z-index','1000px');
}
	//$("#search-theme-form input").attr("value","Search");
 /*$(document).ready(function() {
		var default_value = 'Search';
		if ($("#search-form input.form-text").length>0) {
			$('#search-theme-form input.form-text').val($("#search-form input.form-text").val());
			var default_value = $("#search-form input.form-text").val();
		}else{
			$('#search-theme-form input.form-text').val('mptext_js:eSearch');
			var default_value = 'Search';
		}							
		$("#search-theme-form input").attr("title","mptext_js:eSearch");
		$('#search-theme-form input').each(function() {				
				$('#search-theme-form input').focus(function() {
					if(this.value == default_value) {
						this.value = '';
					}
				});
				$('#search-theme-form input').blur(function() {
					if(this.value == '') {
						this.value = default_value;
					}
				});
			});
		$("#search-theme-form").submit(function(){																						
			if(!$.trim($("#search-theme-form #edit-search-theme-form-1").val())){
				return false;
			}
		});		 
 });*/
 $(document).ready(function() {
		var default_value = 'Buscar';
		if ($("#search-form input.form-text").length>0) {
			$('#google-appliance-search-form input.form-text').val($("#search-form input.form-text").val());
			var default_value = $("#search-form input.form-text").val();
		}else{
			$('#google-appliance-search-form input.form-text').val('Buscar');
			var default_value = 'Buscar';
		}							
		$("#google-appliance-search-form input").attr("title","Buscar");
		$('#google-appliance-search-form input').each(function() {				
				$('#google-appliance-search-form input').focus(function() {
					if(this.value == default_value) {
						this.value = '';
					}
				});
				$('#google-appliance-search-form input').blur(function() {
					if(this.value == '') {
						this.value = default_value;
					}
				});
			});
		$("#google-appliance-search-form").submit(function(){																						
			if(!$.trim($("#google-appliance-search-form #edit-search-term").val())){
				return false;
			}
		});		 
 });

function updateprod(prodval){
	//alert(prodval);	
	//updateproduct(prodval);
	//alert("here");

/*
	if(prodval=="reducedfat"){
		if(window.location.hash=="#Reduced_Fat_Milk"){
	    document.getElementById("frameprod").src = "node/39";
		//updateproduct(prodval);
		
	}
	}*/
}



