/* seeMenuTabs js
========================================================= */


var iCurrent = 0;

var Nav = new Array( );

Nav[0] = ['http://www.dominosbiz.com/stmenu_images/menu/tabs/pizzas_off.gif', 'http://espanol.dominos.com/img/dominos/ES_2201.gif'];
Nav[1] = ['http://espanol.dominos.com/img/dominos/ES_2200.gif', 'http://www.dominosbiz.com/stmenu_images/menu/tabs/feasts_on.gif'];
Nav[2] = ['http://espanol.dominos.com/img/dominos/ES_2199.gif', 'http://espanol.dominos.com/img/dominos/ES_2598.gif'];
Nav[3] = ['http://espanol.dominos.com/img/dominos/ES_2198.gif', 'http://espanol.dominos.com/img/dominos/ES_2591.gif'];


var Images = new Array( );

for (var i = 0; i < Nav.length; i ++)
{
	Images[i] = new Array(2);

	Images[i][0]     = new Image( );
	Images[i][0].src = Nav[i][0];

	Images[i][1]     = new Image( );
	Images[i][1].src = Nav[i][1];
}

function show_nav(objImage, iTab, iState)
{
	objImage.src = Images[iTab][iState].src;

	if (iTab == iCurrent)
		objImage.src = Images[iTab][1].src;
}

function seeMenuShowTab(sTab)
{
	iCurrent = parseInt(sTab);

	for (var i = 0; i < Nav.length; i ++)
	{
		if (i == iCurrent)
		{
			document.getElementById(("Tab" + i)).src = Images[i][1].src;
			document.getElementById(("tabContainer" + i)).style.zIndex = "22";
			document.getElementById(("TabContent" + i)).style.display = "block";
		}

		else
		{
			document.getElementById(("Tab" + i)).src = Images[i][0].src;
			document.getElementById(("tabContainer" + i)).style.zIndex = "4";
			document.getElementById(("TabContent" + i)).style.display = "none";
		}
	}
}

/* End seeMenuTabs js
========================================================= */



/* Find It js
======================================================= */
function findIt(sLanguage){
   //var msg="Please enter your city, state and zip code.";
   var param="";

   if (sLanguage=="ES"){
     // msg = "Por favor escriba su calle, ciudad, estado y c&oacute;digo postal";
      param="&language=ES";
   } 

   var street = document.finddominos.street.value;
   var cityStateZip = document.finddominos.cityStateZip.value;
   var replStreet = "";
   var replCityStateZip = "";
   if(cityStateZip==("" || "Cdad., estado o c\363d. postal")){
      document.getElementById('formErrorMessageEN').style.display="block";}
   else{
      // replacing whitespaces
      replStreet = replaceWhitespace(street);
      replCityStateZip= replaceWhitespace(cityStateZip);
      submit=false;
       if (sLanguage=="ES"){
          location.href = "http://espanol.dominos.com/enes/ddominosbiz/apps/storelocator-ES.jsp?street="+replStreet+"&cityStateZip="+replCityStateZip;
       }
       else {
         location.href = "http://espanol.dominos.com/enes/ddominosbiz/apps/storelocator-EN.jsp?street="+replStreet+"&cityStateZip="+replCityStateZip;

       }
   }
}

/* End: Find It js
======================================================= */


/* replaceWhitespace js
======================================================= */
function replaceWhitespace (orgString){
   // whitespace characters
   var whitespace = " \t";
   var poundSign = "#";
   var index;
   var replacedString = "";
   // Is orgString empty?
   if ((orgString==null)) {return replacedString;}
   else{
      // Search through string's characters one by one
      // until we find a non-whitespace character.
      // When we do, return false; if we don't, return true.
      for (index = 0; index < orgString.length; index++)
      {
         // Check that current character isn't whitespace.
         var c = orgString.charAt(index);
         if (whitespace.indexOf(c) == -1) {
            if(poundSign.indexOf(c) == -1) {
               replacedString = replacedString + c ; 
            } else {
               replacedString = replacedString + "%23";
            }
         } else {
            replacedString = replacedString + "%20";
         }
      }
   }
   // All characters are whitespace.
   return replacedString;
}

/* End: replaceWhitespace js
======================================================= */



/* medWhiteArrowOn js  :changes the state of the Medium sited white Arrows on links
======================================================= */
function medWhiteArrowOn(option) {
	document.getElementById(option).style.background = "url(/stmenu_images/buttons/btn_arrow_white_blue.gif) 100% -10px";

}
function medWhiteArrowOff(option) {
		document.getElementById(option).style.background = "url(/stmenu_images/buttons/btn_arrow_white_blue.gif) 100% 0px";
}

/* End: medWhiteArrowOn js
======================================================= */


/* smlWhiteArrowOn js  :changes the state of the small sited white Arrows on links
======================================================= */
function smlWhiteArrowOn(option) {
	document.getElementById(option).style.background = "url(/stmenu_images/buttons/btn_arrow_white_blue_sml.gif) 100% -7px";

}
function smlWhiteArrowOff(option) {
		document.getElementById(option).style.background = "url(/stmenu_images/buttons/btn_arrow_white_blue_sml.gif) 100% 0px";
}

/* End: smlWhiteArrowOn js
======================================================= */

/* smlWhiteRedArrowOn js  :changes the state of the small sited white Arrows on links
======================================================= */
function smlWhiteRedArrowOn(option) {
	document.getElementById(option).style.background = "url(/stmenu_images/buttons/btn_arrow_white_red_sml.gif) 100% -7px";

}
function smlWhiteRedArrowOff(option) {
		document.getElementById(option).style.background = "url(/stmenu_images/buttons/btn_arrow_white_red_sml.gif) 100% 0px";
}

/* End: smlWhiteRedArrowOn js
======================================================= */