/* ---------------------------------------------------
   Global variables:
   
   Values set to variables used by other functions
   afterwards. 
   --------------------------------------------------- */

/* sIFR functionality: 
   Used by sIFR to replace CSS classes with a specific SWF
   within the HTML code.
   
   Called by: Global
*/
/*if(typeof sIFR == "function") {
  // sIFR.replaceElement("#id name | .class name", named({sFlashSrc: "path/to/swf", sColor: "#color", sWmode: "transparent | opaque"}));  
	//sIFR.replaceElement(".ttl_leftmenu", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#ffffff", sWmode: "transparent"}));
	//sIFR.replaceElement(".ttl_firstcenterbox", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#1aa1cf", sWmode: "transparent"}));
	
	sIFR.replaceElement(".ttl_rightboxhome", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#ffffff", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".ttl_boxmainhomesecond", named({sFlashSrc: "/OldBay/swf/gillsanslight.swf", sColor: "#003366", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".ttl_boxmainhome", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#003366", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".subttl_rightboxhome", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#ffffff", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".ttl_newsbar", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#ffffff", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".ttl_signuparea", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#003366", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".ttl_tabs", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#ffffff", sCase: "upper",  sWmode: "transparent"}));
	sIFR.replaceElement(".subttl_tabs", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#f9e428", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".subttl_tabs_search", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#f9e428",sFlashVars:"textalign=right&offsetTop=1", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".subttl_section", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#01649f", sCase: "upper", sWmode: "transparent"}));
	
	// Miguel News
	sIFR.replaceElement(".ttl_boxnewsarticle", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#003366", sWmode: "transparent"}));
	sIFR.replaceElement(".subttl_sectionews", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#cc3300", sCase: "upper", sWmode: "transparent"}));
	
	sIFR.replaceElement(".txt_label", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#f9e428", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".ttl_rightbarproducts", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#003366", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".subttl_sectionsecond", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#003366", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".lnk_menuaccordion", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#f8e427", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".lnk_rightvideos", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#c82800", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".lnk_allrecipes", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#ffffff", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".lnk_email", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#ffffff", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".lnk_testimonial", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#c72800", sCase: "upper", sWmode: "transparent"}));
//	sIFR.replaceElement(".ttl_section", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#ffffff", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".ttl_thankspopup", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#003366",sFlashVars:"textalign=center&offsetTop=1", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".ttl_emailpopup", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#003366", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".ttl_rightbargrey", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#003366", sCase: "upper", sWmode: "transparent"}));
	sIFR.replaceElement(".ttl_boxrightnews", named({sFlashSrc: "/OldBay/swf/gillsans.swf", sColor: "#003366", sCase: "upper", sWmode: "transparent"}));

}*/

/*This script is for correct resolutions in 1024*768 End*/

// ||||||||||||||||||||||||||||||||||||||||||||||||||

function toggleRightMenu(id) {
	var i = 1;
	
	while(document.getElementById("rightmenu" + i) != undefined) {
		//if(i != id) {
			document.getElementById("rightmenu" + i).style.display = "none";
			document.getElementById("rightmenulink" + i).className = "";
		//}
		i++;
	}
	
	if(document.getElementById("rightmenu" + id).style.display == "none") {
		document.getElementById("rightmenu" + id).style.display = "block";
		document.getElementById("rightmenulink" + id).className = "rightmenuactive";
	}
	else {
		document.getElementById("rightmenu" + id).style.display = "none";
		document.getElementById("rightmenulink" + id).className = "";
	}
	
}

// ||||||||||||||||||||||||||||||||||||||||||||||||||

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

/*Nav Menu*/
var subnavlist = ["menu_empty","menu_personas","menu_empresas"];
var subnavitemlist = ["menu_item_home","menu_item_personas","menu_item_empresas"];
var subnavoff = -1;
var subnavdefault;

function toggleSubnav(id,state) {
	var i;
	
	if(state)
		for(i = 0; i < subnavlist.length; i++) {
			subnav = document.getElementById(subnavlist[i]);
			if(id != i)
				subnav.style.display = "none";
			else
				subnav.style.display = "block";
		}
	else {
		for(i = 0; i < subnavlist.length; i++) {
			subnav = document.getElementById(subnavlist[i]);
			if(id != 0)
				subnav.style.display = "none";
			else
				subnav.style.display = "block";
		}
		initSubnav(subnavdefault);
	}
}

function initSubnav(id) {
	if(subnavdefault > subnavoff) {
		toggleSubnav(id,true);
		MM_swapImage(subnavitemlist[id],'','images/' + subnavitemlist[id] + '_on.gif',1);
	}
	else
		toggleSubnav(0,true);
}

function  hidden_divs(ids)
 {
	if(ids == 1) 	
	 {
		document.getElementById("box_recipeslanding_cont_bottom_shrimp").style.display='block'; 
		document.getElementById("box_recipeslanding_cont_bottom_fish").style.display='none'; 
		document.getElementById("box_recipeslanding_cont_bottom_crab").style.display='none';
		document.getElementById("box_recipeslanding_cont_bottom_other").style.display = 'none';

		s.t({ channel: "Recipes",
		    pageName: "Recipes: Recipes Landing Page Shrimp Tab",
		    prop1: "Recipes Landing Page",
		    prop2: "Recipes Landing Page: Shrimp Tab"
		});
		
	 }
	 else if(ids ==2)
	 {
 		document.getElementById("box_recipeslanding_cont_bottom_shrimp").style.display='none';
	    document.getElementById("box_recipeslanding_cont_bottom_fish").style.display='block'; 
		document.getElementById("box_recipeslanding_cont_bottom_crab").style.display='none';
		document.getElementById("box_recipeslanding_cont_bottom_other").style.display = 'none';
		s.t({ channel: "Recipes",
		    pageName: "Recipes: Recipes Landing Page Fish Tab",
		    prop1: "Recipes Landing Page",
		    prop2: "Recipes Landing Page: Fish Tab"
		});
	 }
	 else if(ids ==3)
	 {
 		document.getElementById("box_recipeslanding_cont_bottom_shrimp").style.display='none';
	    document.getElementById("box_recipeslanding_cont_bottom_fish").style.display='none';
		document.getElementById("box_recipeslanding_cont_bottom_crab").style.display='block';
		document.getElementById("box_recipeslanding_cont_bottom_other").style.display = 'none';
		s.t({ channel: "Recipes",
		    pageName: "Recipes: Recipes Landing Page Crab Tab",
		    prop1: "Recipes Landing Page",
		    prop2: "Recipes Landing Page: Crab Tab"
		});
		
	 }	 
	 else if(ids ==4)
	 {
 		document.getElementById("box_recipeslanding_cont_bottom_shrimp").style.display='none';
	    document.getElementById("box_recipeslanding_cont_bottom_fish").style.display='none';
		document.getElementById("box_recipeslanding_cont_bottom_crab").style.display='none';
		document.getElementById("box_recipeslanding_cont_bottom_other").style.display = 'block';
		s.t({ channel: "Recipes",
		    pageName: "Recipes: Recipes Landing Page More Tab",
		    prop1: "Recipes Landing Page",
		    prop2: "Recipes Landing Page: More Tab"
		});
	 }	 	
}
function  hidden_divs_countries(ids)
 {
	if(ids == 1) 	
	 {
		document.getElementById("box_cont_shrimp_england").style.display='block'; 
		document.getElementById("box_cont_shrimp_ny").style.display='none'; 
		document.getElementById("box_cont_shrimp_sf").style.display='none'; 
		document.getElementById("box_cont_shrimp_florida").style.display='none';		
		document.getElementById("box_cont_shrimp_texas").style.display='none';

		s.t({ channel: "Old Bay Nation",
		    pageName: "Old Bay Nation: New England Shrimp Boil Recipe Page",
		    events : "event13",
		    prop2: "Old Bay Nation Shrimp Boil: New England",
		    prop5: "5C88E6F4-AFC3-4725-BDF1-6DF843F1B887",
		    prop7: "Shrimp",
		    prop16: "New England Shrimp Boil with OLD BAY",
		    products: ";" + "5C88E6F4-AFC3-4725-BDF1-6DF843F1B887",
		    eVar2: "5C88E6F4-AFC3-4725-BDF1-6DF843F1B887",
		    eVar17: "New England Shrimp Boil with OLD BAY"
		});
	 }
	 else if(ids ==2)
	 {
		document.getElementById("box_cont_shrimp_england").style.display='none'; 
		document.getElementById("box_cont_shrimp_ny").style.display='block'; 
		document.getElementById("box_cont_shrimp_sf").style.display='none'; 
		document.getElementById("box_cont_shrimp_florida").style.display='none';		
		document.getElementById("box_cont_shrimp_texas").style.display='none';

		s.t({ channel: "Old Bay Nation",
		   pageName: "Old Bay Nation: New York Shrimp Boil Recipe Page",
		    events: "event13",
		    prop2: "Old Bay Nation Shrimp Boil: New York",
		    prop5: "DF0A283C-1BE1-41FF-A249-8708146B3F2E",
		    prop7: "Shrimp",
		    prop16: "New York Style Shrimp Boil with OLD BAY",
		    products: ";" + "DF0A283C-1BE1-41FF-A249-8708146B3F2E",
		    eVar2: "DF0A283C-1BE1-41FF-A249-8708146B3F2E",
		    eVar17: "New York Style Shrimp Boil with OLD BAY"
		});
		
	 }
	 else if(ids ==3)
	 {
		document.getElementById("box_cont_shrimp_england").style.display='none'; 
		document.getElementById("box_cont_shrimp_ny").style.display='none'; 
		document.getElementById("box_cont_shrimp_sf").style.display='block'; 
		document.getElementById("box_cont_shrimp_florida").style.display='none';		
		document.getElementById("box_cont_shrimp_texas").style.display='none';

		s.t({ channel: "Old Bay Nation",
		    pageName: "Old Bay Nation: San Francisco Shrimp Boil Recipe Page",
		    events: "event13",
		    prop2: "Old Bay Nation Shrimp Boil: San Francisco",
		    prop5: "97B98B31-17D7-4CF1-BEDA-16B5D686D681",
		    prop7: "Shrimp",
		    prop16: "San Fran-Inspired Shrimp Boil with OLD BAY",
		    products: ";" + "97B98B31-17D7-4CF1-BEDA-16B5D686D681",
		    eVar2: "97B98B31-17D7-4CF1-BEDA-16B5D686D681",
		    eVar17: "San Fran-Inspired Shrimp Boil with OLD BAY"
		});
	 }	 
	 else if(ids ==4)
	 {
		document.getElementById("box_cont_shrimp_england").style.display='none'; 
		document.getElementById("box_cont_shrimp_ny").style.display='none'; 
		document.getElementById("box_cont_shrimp_sf").style.display='none'; 
		document.getElementById("box_cont_shrimp_florida").style.display='block';		
		document.getElementById("box_cont_shrimp_texas").style.display='none';

		s.t({ channel: "Old Bay Nation",
		    pageName: "Old Bay Nation: Florida Shrimp Boil Recipe Page",
		    events: "event13",
		    prop2: "Old Bay Nation Shrimp Boil: Florida",
		    prop5: "14BC9B6F-2CB7-402A-89EB-E4F39EC5B251",
		    prop7: "Shrimp",
		    prop16: "Florida Shrimp Boil with OLD BAY",
		    products: ";" + "14BC9B6F-2CB7-402A-89EB-E4F39EC5B251",
		    eVar2: "14BC9B6F-2CB7-402A-89EB-E4F39EC5B251",
		    eVar17: "Florida Shrimp Boil with OLD BAY"
		});
	 }
	 else if(ids ==5)
	 {
		document.getElementById("box_cont_shrimp_england").style.display='none'; 
		document.getElementById("box_cont_shrimp_ny").style.display='none'; 
		document.getElementById("box_cont_shrimp_sf").style.display='none'; 
		document.getElementById("box_cont_shrimp_florida").style.display='none';		
		document.getElementById("box_cont_shrimp_texas").style.display='block';
		
		s.t({ channel: "Old Bay Nation",
		    pageName: "Old Bay Nation: Texas Shrimp Boil Recipe Page",
		    events: "event13",
		    prop2: "Old Bay Nation Shrimp Boil: Texas",
		    prop5: "3EA3AF0D-CCDF-4AC5-987D-83C1DC754818",
		    prop7: "Shrimp",
		    prop16: "Galveston Bay Shrimp Boil with OLD BAY",
		    products: ";" + "3EA3AF0D-CCDF-4AC5-987D-83C1DC754818",
		    eVar2: "3EA3AF0D-CCDF-4AC5-987D-83C1DC754818",
		    eVar17: "Galveston Bay Shrimp Boil with OLD BAY"
		});
	 }
}
function LoadSWF(address,width,height,flashvars)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'">');
	document.write('<param name="movie" value="'+address+'" /><param name="FlashVars" value="section='+flashvars+'" /><param name="quality" value="high"><param name="menu" value="false" /><param name="wmode" value="transparent" /><embed src="'+address+'"  flashvars="section='+flashvars+'"  quality="high" wmode=transparent pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed><noembed> <div align="center">Su navegador no dipone de una versión apropiada de flash player. <br> Puede obtenerla gratuitamente <a href="http://www.adobe.com/es/products/flashplayer/">aqui </a> </div> </noembed></object>');
}

/*textarea char limiter*/
var wevent=window.event?true:false;
var count=0;
function limitChars(who,limit,evt){
	var kkey=wevent?evt.which:evt.keyCode;
	var v=who.value;
	if(v.length<limit){
		return kkey;
		}
	else{
		return kkey!=0;
	}
}

function limitChars2(who,limit){
	strText = document.getElementById(who).value;
	if(strText.length > limit)
		document.getElementById(who).value = strText.substring(0,limit);
}

/*submit form*/
function submitForm(){
		document.testform.submit();
}

function sendEmailForm(){
		document.emailform.submit();
}

/*displays a popup window*/
function popupWindowWS(fileName,h,w){
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable=0,menubar=0,status=0,location=no';
		title = 'OLDBAY' + Math.floor(Math.random()*1000000+1);
		var win = window.open(fileName,title,winprops);
		win.focus();
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus();}
}

/*displays a popup window*/
function popupWindow(fileName,h,w){
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=no,resizable=0,menubar=0,status=0,location=no';
		title = 'OLDBAY' + Math.floor(Math.random()*1000000+1);
		var win = window.open(fileName,title,winprops);
		win.focus();
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus();}
}

function safeSetBoxText(elementId, numberOfMsgs)
{
    box = document.getElementById(elementId);
    
    if (numberOfMsgs < 10)
        box.className = "box_msg_number_1digit";
    else if (numberOfMsgs < 100)
        box.className = "box_msg_number_2digit";
    else    
        box.className = "box_msg_number_3digit";
        
    if(document.all)
	{
       box.innerText = numberOfMsgs;
    }
    else
    {
       box.textContent = numberOfMsgs;
    }
}

/*close popup*/
function closePopup(){
	close();
	}


/*Preloader images*/
var arrayim1 = new Array();
function preLoad(im,im1){
var array1 = new Array(im,im1);
arrayim1[0] = new Image();
arrayim1[0].src = array1[0];
arrayim1[1] = new Image();
arrayim1[1].src = array1[1];
}

// activa la imagen onmouseover
function rollOn(id){
image = document.getElementById(id);
image.src = arrayim1[1].src;
}
function rollOff(id){
image = document.getElementById(id);
image.src = arrayim1[0].src;
}
 
//ADDED THIS DIRECTLY TO THE CODE 
//$(document).ready(function(){

		//$("#box_west").css("display","block").css("left","129px").css("top","-500px").css("position","relative").css("overflow","hidden");
		//$("#box_mid").css("display","block").css("left","380px").css("top","-779px").css("position","relative").css("overflow","hidden");
		//$("#box_north").css("display","block").css("left", "844px").css("top","-842px").css("position","relative").css("overflow","hidden");
		//$("#box_south").css("display","block").css("left","379px").css("top","-782px").css("position","relative").css("overflow","hidden");
		//$("#box_world").css("display","block").css("left","694px").css("top","-714px").css("position","relative").css("overflow","hidden");
//});
function openStory()
{
    var p = $("#ctn_middle_map");
    var offset = p.offset();
  
    if (navigator.userAgent.indexOf("Firefox") != -1)
    	$("#box_btn").css("display", "block").css("left", offset.left + 654 + "px").css("top", offset.top + 2 + "px");
    else
    	$("#box_btn").css("display", "block").css("left", offset.left + 653 + "px").css("top", offset.top + 2 + "px");
}

function hidenBottom()
{
    var p = $("#ctn_middle_map");
    var offset = p.offset();
   
    if (navigator.userAgent.indexOf("Firefox") != -1)
    	$("#box_btn").css("display", "none").css("left", offset.left + 654 + "px").css("top", offset.top + 2 + "px");
	else
		$("#box_btn").css("display", "none").css("left", offset.left + 653 + "px").css("top", offset.top + 2 + "px");
}


function adjustCss()
{
  //debugger;
  if (document.all)
  {
  
  document.getElementById('footerContainer').className = 'ctn_bottom_cont_ie';
  }
  else
  {
  document.getElementById('footerContainer').className = 'ctn_bottom_cont_other';
  }

}
