// JavaScript Document
function wsChangeColor(id, txtboxName)
{
	var thecolor = document.getElementById(txtboxName).value;
	theid = document.getElementById(id);
	theid.style.color= thecolor;
}


function wsChangeBgColor(id, txtboxName)
{
	var thecolor = document.getElementById(txtboxName).value;
	theid = document.getElementById(id);
	theid.style.backgroundColor= thecolor;
}

function wsChangeFontStyle(id, cmbname)
{
	var str = document.getElementById(cmbname).value;
	theid = document.getElementById(id);
	theid.style.fontFamily= str;
}

function wsChangeFontSize(id, cmbname)
{
	var val = document.getElementById(cmbname).value;
	var theid = document.getElementById(id);
	theid.style.fontSize= val;
}

function mySetFocus(txtboxName){
	document.getElementById(txtboxName).focus();
}

function mnChangeBorder(id, txtboxName) {
	var thesize = document.getElementById(txtboxName).value;
	theid = document.getElementById(id);
	theid.style.border= thesize;
}


function HideContent(d) {
	
	if(d.length < 1) { 
		return; 
	} document.getElementById(d).style.display = "none";
}

function ShowContent(d) {
	if(d.length < 1) { 
		return; 
	}
	document.getElementById(d).style.display = "block";
}

function ReverseContentDisplay(d) {
	if(d.length < 1) {
		return; 
	}
	if(document.getElementById(d).style.display == "none") {
		document.getElementById(d).style.display = "block"; 
	}
	else {
		document.getElementById(d).style.display = "none"; 
	}
}


function myConfirm(durl){
	var ans=confirm("Do you want continue ? ");
	if (ans == true) {
		window.location = durl;
	}
}	
	
	function showPrice(itemId,subId){
		var cmbName = "productSize"+itemId;
		var theDiv = "item_price"+itemId;
		var theItemId = itemId;
		show('store/size/?productId='+theItemId+'&&subId='+subId,theDiv);
	}
	
function validate_form(thisform)
{
with (thisform)
{
if (!isPositiveInteger(trim(quantity.value)))
  {
  	document.getElementById('error').style.display = ""; 
  	return false;
  }
}
}
	
function isPositiveInteger(val){
      if(val==null){return false;}
      if (val.length==0){return false;}
      for (var i = 0; i < val.length; i++) {
            var ch = val.charAt(i)
            if (ch < "0" || ch > "9") {
            return false
            }
      }
      return true;
}

function trim(s)
{
	var l=0; var r=s.length -1;
	while(l < s.length && s[l] == ' ')
	{	l++; }
	while(r > l && s[r] == ' ')
	{	r-=1;	}
	return s.substring(l, r+1);
}

function toggleview(element1) {

   element1 = document.getElementById(element1);

   if (element1.style.display == 'block' || element1.style.display == '')
      element1.style.display = 'none';
   else
      element1.style.display = 'block';

   return;
}


function changeImage(imageName){
var imgName = imageName;
document.getElementById("img1").src= "http://www.bigwoolly.com/images/products/2k/" + imgName;
}


function getPayMethod(cmbname){
	var payMethod = document.getElementById(cmbname).value;
		if(payMethod != 1) {
			account_type.style.display = 'block';
		} else {
			account_type.style.display = 'none';
			}
	
	
	}
	
function clearText(boxId)
{
      txtBox = document.getElementById(boxId);
      txtBox.value = "";
}
function handleClick(ev, url) {
	ev = ev || window.event;
	ev.cancelBubble = true;
	window.location.href = url;
}

function limitText(limitField, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	}
}

