

function SubmitForm() {
	var frm = document.measure;
	frm.submit();
}

function ResetElements(){
	var frm = document.measure;
	frm.kw.value = 'reset';
	frm.submit();
}

function Showall(){
	var frm = document.page_frm;
	frm.showall.value = '1';
	frm.submit();
}

function Showpage(pageno){
	var frm = document.page_frm;
	frm.page_no.value = pageno;
	frm.submit();
}

function pc(product){
	var frm = document.productlist_frm;
	frm.method='post';
	frm.code.value = product;
	frm.submit();
}
function pc1(product){
	var frm = document.frmSearch;
	if(product!="")
	{
    frm.code.value = product;
	frm.submit();
	return true;
    }
    else
    {
       alert("Please enter product Code or select category");
       frm.search.focus();
       return false;
    }
//

}

function GoBack(product)
{
   window.back();

}
function isValidNum(Val)
{
	if(Val.value == 0)
	{
		alert("Invalid quantity");
		Val.focus();
		return false;
	}

	var alp = "0123456789";
	for (var i=0;i<Val.value.length;i++)
	{
		temp=Val.value.substring(i,i+1);
		if (alp.indexOf(temp)==-1)
		{
			alert("Invalid quantity");
			Val.focus();
			return false;
		}
	} // closing the for loop
	return true;
} // closing the function isValidNum()

function FormSubmit() {
	if(isValidNum(document.cart_quantity.quantity))
	{
		document.cart_quantity.submit();
	}
}

function opentop(pcode)
{
//	parent.document.location = 'http://192.168.4.3/catalog/product_view.php?cspd='+pcode;
	parent.document.location = 'product_view.php?cspd='+pcode;
}

function TooltipTxt(displayText)
{
	return displayText; 
}

function checkItems()
{	
	var nsitem=0;
	f = document.cart_quantity;

	for(sel=0;sel<f.elements.length;sel++) {
		if(f.elements[sel].type == "checkbox" && f.elements[sel].checked == true) {
			nsitem = 1;
		} // if 
	}//for

	if(nsitem!=1)
	{
		alert('Please select the item');
	}else{
		f.submit();
	}
}

function chimg(sr,tg)
{
	var tg_img_path;
	var target	= document.getElementById(tg).src;
	var tg_th	= "th_nail_";
	tg_img_path = target.replace("th_nail_",'');
	document.getElementById(sr).src = tg_img_path;
}


function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

function showLayers() {
	args=showLayers.arguments;
	for (i=0;i<args.length;i++){
	lyr = getElemRefs(args[i]);
	if (lyr && lyr.css){
	lyr.css.display = "block";
	}
	}
}

function hideLayers() {
	args=hideLayers.arguments;
	for (i=0;i<args.length;i++){

	lyr = getElemRefs(args[i]);
	if (lyr && lyr.css) {
	lyr.css.display = "none";
	}
	}
}

function changeImage(x, zoom){
	showLayers('sdiv'+x);
	if(eval("document.wide"+x+"set==false")) {
	wide1 = new csWide('sdiv'+x, 'simg'+x, 'bdiv'+x, 'bimg'+x);
	wide1.initWide();
	eval("document.wide"+x+"set=true");
	}
}
