// JavaScript Document
function moreTxt () {
	document.getElementById("rMore").style.display = "block";
	document.getElementById("xMore").style.display = "none";
	}

function adjQty(str) {
	if( document.getElementById(str).value==0 ) {
	document.getElementById(str).value=1;
	}
}
function addItems() {
var i;
var j=1;
var params = '';
var partNumber;
var qty;
var qtyE
//var formFieldList =  document.getElementById(Items).getElementsByTagName('input,hidden');
var formFieldList =  document.getElementsByName('PartNumber');
for (var i = 0; i < formFieldList.length; i ++ )
   {   
    partNumber = formFieldList[i].value; 
	qtyE = document.getElementById(partNumber + ".qty");
	if (qtyE.tagName == 'SELECT') {
		qty = qtyE.options[qtyE.selectedIndex].value;
		qtyE.selectedIndex = 0;
	}
	else {
	 qty = qtyE.value;
	 qtyE.value = '';
	}
	
	if (qty > 0 && qty < 9999 ) {
		 params = params + 'Item.'+ j + '='+escape(partNumber)+ '&';
 		 params = params + 'qty.'+ j + '='+qty+ '&';	
//		 qtyE.value = "Qty";
		 j++;
	}		   
	 
   }
if(document.getElementById('option')){ 
	params=params + 'option=' +document.getElementById('option').value;
	}

showInfoSPost('/content/AddToOrder/' , 'ShoppingCart',params)

}

function hideItem() {
   document.getElementById("TodaySpecial").style.display = "none";
}

//  ---------------------------------------

function showItem(str) {
//	debugger;
      document.getElementById("TodaySpecial").style.display = "block";
      document.getElementById("TodaySpecialImg").src = "/img/1x1.gif";
      document.getElementById("TodaySpecial").style.width = "480px";

   if (str == 'ZoyaColorPicker') {
      showInfoS('/content/loadfile/?file=ZoyaColorPicker', 'TodaySpecialTxt');
      document.getElementById("TodaySpecial").style.background = "#EFEFEF";
      // background color on TodaySpecial.htm
      document.getElementById("TodaySpecial").style.color = "#000000";
      // text color on TodaySpecial.htm
      document.getElementById("TodaySpecialImg").src = "/images/title_zoya_cf.gif";
      return;
   }
   if (str == 'TodaySpecial') {
      showInfoS('/content/loadfile/?file=TodaySpecial', 'TodaySpecialTxt');
      document.getElementById("TodaySpecial").style.background = "#CC0000";
      document.getElementById("TodaySpecial").style.color = "#ffffff";

      return;
   }
   if (str == 'Promotion') {
      showInfoS('/content/loadfile/?file=Promotion', 'TodaySpecialTxt');
      document.getElementById("TodaySpecial").style.background = "#ffffe5";
      // background color on Promotion.htm
      document.getElementById("TodaySpecial").style.color = "#000000";
      return;
   }
   if (str == 'ExchangeInstructions') {
      showInfoS('/content/loadfile/?file=ExchangeInstructions', 'TodaySpecialTxt');
      document.getElementById("TodaySpecial").style.background = "#d5dfc6";
      // background color on TodaySpecial.htm
      document.getElementById("TodaySpecial").style.color = "#000000";
      // text color on TodaySpecial.htm
      return;
   }
}


//  ---------------------------------------

function fGoTo(obj) {

var varName = obj.name;
var url = eval(varName);
if (url === null || url === undefined || url === "") {
  return false;	
}
self.location.href = eval(varName);

}

//  ---------------------------------------
function hiliteMe(td,i) {
	var el = document.getElementById(td);
	if(i==2) {
		el.style.background = "#fff";
		} else {
		el.style.background = "#FFC";
	}
}

//  ---------------------------------------
function cImage(str) {
	var pic=document.getElementById("cPic");
	if(pic){ pic.src = str.src;
		} return false;
	}

function ChangeState() {
document.getElementById('ShipAddress5').value =document.getElementById('StateSelect').options[document.getElementById('StateSelect').selectedIndex].value;
}
function ChangeCountryState() {
var country;
var state;

country = document.getElementById("CountyZipSelect").options[document.getElementById("CountyZipSelect").selectedIndex].value;
country= country.toLowerCase();
document.getElementById("CountyZip").value = country;
if (country == "us") {
  hideDiv("StateText");
  showDiv("dStateSelect");
}
else {
  hideDiv("dStateSelect");
  showDiv("StateText");
  }
}
function SetStateCountry() {

var CountyZipSelectx = document.getElementById("CountyZipSelect");
var country=document.getElementById("CountyZip").value;
country= country.toLowerCase();
var state = document.getElementById("ShipAddress5").value;
var StateSelectx = document.getElementById("StateSelect"); 
if (country == "") country = "us";

for (var i=0; i < CountyZipSelectx.length ; i++) {
   if (CountyZipSelectx.options[i].value == country){
      CountyZipSelectx.options[i].selected = true; 
   }
  }

for (var i=0; i < StateSelectx.length ; i++) {
   if (StateSelectx.options[i].value == state){
      StateSelectx.options[i].selected = true; 
   }
  }
if (country == "us") {
  hideDiv("StateText");
  showDiv("dStateSelect");
}
else {
  hideDiv("dStateSelect");
  showDiv("StateText");
  }
document.getElementById("CountyZip").value = country;
}


