function loadCountries(state){
	if(state){
		document.getElementById('fs_country').style.visibility = "visible";
		document.getElementById('country').style.visibility = "visible";
		ajax.callurl("process.php?action=zones&c="+state, "zn");
	}
	else{
		document.getElementById('fs_country').style.visibility = "hidden";
		document.getElementById('country').style.visibility = "hidden";
	}
}
function loadCountries1(state){
	if(state){
		document.getElementById('fs_country1').style.visibility = "visible";
		document.getElementById('country1').style.visibility = "visible";
		ajax.callurl("process.php?action=zones&c="+state, "zn1");
	}
	else{
		document.getElementById('fs_country1').style.visibility = "hidden";
		document.getElementById('country1').style.visibility = "hidden";
	}
}
/*function loadStates(country){
	if(country){
		document.getElementById('fs_state').style.visibility = "visible";
		document.getElementById('state').style.visibility = "visible";
		ajax.callurl("process.php?action=zones&c="+country, "zn");
	}
	else{
		document.getElementById('fs_state').style.visibility = "hidden";
		document.getElementById('state').style.visibility = "hidden";
	}
}*/

function populateList(obj, ops){
	
	obj.options.length = 1;
	var o = ops.split('|');
	var ol = o.length;
	if(o[0]){
		for(var i = 1; i < ol; i++){
			obj.options[i] = new Option(o[i], o[i], false, false);
		}
	}
}
//----trim spaces function---->
function trimspace(str)
{
  var len= str.length;
  if (len != 0)
  {
    for(var i=0;i<len;i++)
    {
      if(str.indexOf(" ")==0)
        str=str.substring(1,len);
    }
    strtrim=str;
  }
  else
  {
    strtrim=str;
  }
  return strtrim;
}

function addtocart(code,i){
	var q = document.getElementById(i);
	//alert(q);
	
	
		if(q){			
			if(trimspace(q.selectedIndex) == '')
			{
				alert("Please Select the Quantity to Add to Cart");
				document.getElementById(i).focus();
				return;
			}else
				q = q.selectedIndex;
		}
		else
			q = 1;
		var hr = location.href;
		location.href = "cart_proccess.php?id="+code+"&qty="+q+"&q="+escape(hr.substr(hr.lastIndexOf("/") + 1));
	
}
function checkLogin(frm){
	if((frm.ulogin.value == "") || (frm.upass.value == "")){
		alert("Please enter Login ID and Password!");	
		frm.ulogin.focus();
		return false;
		<!--|| (frm.upass.value == "")-->
		<!--alert("Please enter User name and Password!");-->
	}	
}
function fnc_search(id1)
{
	var id =  document.getElementById(id1).selectedIndex;
	//alert(id);
	if(id == '' || id == 0)
	{
		alert("Please select the Artisan Country ");
		document.getElementById(id1).focus();
		return false;
	}
	else
	{		
		window.location.href = "find_artisans.php?aid="+id;
	}
}
function fnc_search1(i)
{
	var searchValue =  document.getElementById(i).value;
	if(trimspace(searchValue) == '')
	{
		alert("Please enter some text to Search");
		document.getElementById(i).focus();
		return false;
	}
	else
	{		
		window.location.href = "shop-listing.php?s="+searchValue;
	}
}





