var state = 'none';

/*=========================================================== 
	New JS function "dispLocInfo()" added 09/16/09 by skiernan
	PURPOSE: To allow only a single dropdown element to be 
					  displayed at a time on the new "Where To Buy"
					  page (part of OpenText Platform Migration)
===========================================================*/
function dispLocInfo(layer_ref) {
	if(document.getElementById) { 
		var targObj = document.getElementById(layer_ref);
		var targObj_LI = document.getElementById(layer_ref+'_arrow');
		var li_array = document.getElementById('int_dropdown_jar').getElementsByTagName('li');
		var div_array = document.getElementById('int_dropdown_jar').getElementsByTagName('div');
		
		if(targObj.style.display == "block") {
			targObj.style.display = "none";
			targObj_LI.style.backgroundPosition = "0px 0px";
		} 
		else {
			for(var i=0; i<li_array.length; i++) {
				li_array[i].style.backgroundPosition = "0px 0px";
			}
			for(var i=0; i<div_array.length; i++) {
				if(div_array[i].className == "int_contentWrapper") {
					div_array[i].style.display = "none";
				}
			}
			targObj.style.display = "block";
			targObj_LI.style.backgroundPosition = "0px -32px";
		}
	}
	else { alert('Your browser does not support this technology. Please upgrade your browser.'); }
} //end dispLocInfo function


function showhide(layer_ref)
{
  if( document.getElementById(layer_ref).style.display == "block" ) {
    document.getElementById(layer_ref).style.display = "none";
    document.getElementById(layer_ref+'_arrow').style.backgroundPosition = "0px 0px";
  } else {
    document.getElementById(layer_ref).style.display = "block";
    document.getElementById(layer_ref+'_arrow').style.backgroundPosition = "0px -32px";
  }
}

function switchLinkDisplay(carry) 
{
  document.getElementById('detail1_link').className = "";
  document.getElementById('detail2_link').className = "";
  document.getElementById('detail3_link').className = "";
  document.getElementById('detail4_link').className = "";
  document.getElementById('detail5_link').className = "";
  document.getElementById('detail6_link').className = "";
  document.getElementById('detail7_link').className = "";
  document.getElementById('detail8_link').className = "";
  document.getElementById('detail9_link').className = "";
  document.getElementById('detail10_link').className = "";
  
  document.getElementById(carry).className = "active";
}

function openNewWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function popUp(page, name, w, h, scroll) { 
  name = "foo";
  page = page.split(" ").join("%20");
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  //var resizable = false;
  winprop  = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=yes,toolbar=yes,menubar=yes';
  win = window.open(page, name, winprop);
  win.focus();
}

/* Used for image swapping */
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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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 showProductImage(carry)
{
  document.getElementById('productImage_xlarge').style.display = "none";
  document.getElementById('productImage_large').style.display = "none";
  document.getElementById('productImage_medium').style.display = "none";
  document.getElementById('productImage_small').style.display = "none";
  document.getElementById('productImage_xsmall').style.display = "none";
  document.getElementById(carry).style.display = "block";
}

function setProductImageButton(buttonId)
{
  //reset all buttons to up position
  document.getElementById('xlarge_down').style.display = "none";
  document.getElementById('xlarge_up').style.display = "inline";
  document.getElementById('large_down').style.display = "none";
  document.getElementById('large_up').style.display = "inline";
  document.getElementById('medium_down').style.display = "none";
  document.getElementById('medium_up').style.display = "inline";
  document.getElementById('small_down').style.display = "none";
  document.getElementById('small_up').style.display = "inline";
  document.getElementById('xsmall_down').style.display = "none";
  document.getElementById('xsmall_up').style.display = "inline";

  //set specified button (id) to down position
  document.getElementById(buttonId + "_up").style.display = "none";
  document.getElementById(buttonId + "_down").style.display = "inline";
}

var omni_prop_def = ["","site","region","country","language","","petType","loggedInStatus","userType","","",   "searchKeywords","","","","","","leadType","wtbCountryCd","wtbPostalCode","wtbCity","wtbRadius","wtbSearchType"];

function reportOmniVars(){ // report omniture variables
  var msg = "Hill's Omniture Reporting\n";

  if(typeof window.s_zxw != "undefined" && typeof window.s_zxw.pageName != "undefined"){
    msg += "\nOmniture code present\n  using H code (s_zxw. notation)\n";
    msg += "\ns_account: " + s_account + " (report suite)";
    msg += "\ns_zxw.pageName: " + s_zxw.pageName;
    msg += "\ns_zxw.products: " + s_zxw.products;
    msg += "\ns_zxw.events: " + s_zxw.events;
    msg += "\ns_zxw.campaign: " + s_zxw.campaign;
    msg += "\ns_zxw.channel: " + s_zxw.channel;

    for(var i = 1; i < 11; i++) {
      if(typeof window.s_zxw["prop" + i] != "undefined" && window.s_zxw["prop" + i] != ""){
        msg += "\ns_zxw.prop" + i + ": " + window.s_zxw["prop" + i];
        if(omni_prop_def[i] != "")
          msg += " . . . . (" + omni_prop_def[i] + ")";
      }
    }

    for(var i = 1; i < 14; i++) {
      if(typeof window.s_zxw["eVar" + i] != "undefined" && window.s_zxw["eVar" + i] != ""){
        msg += "\ns_zxw.eVar" + i + ": " + window.s_zxw["eVar" + i];
        if(omni_prop_def[i + 10] != "")
          msg += " . . . . (" + omni_prop_def[i + 10] + ")";
      }
    }
  } else {
    msg += "\nOmniture code not present!";
  }

  alert(msg);
}

//Gadi #7870 3/11/2010 automating right column separator lines
	$(document).ready
	(
		function()  
		{
			$("div#column3 div.rightside_notlast:last").css("visibility", "hidden");
		}
	)	

