// JavaScript Document
function Check(ChkName,ChkValue)
{
	for(i=0;i<window.document.frm.checkbox1.length;i++)
		{
			if((window.document.frm.checkbox1[i].value=ChkName) && (ChkValue>0))
				window.document.frm.checkbox1[i].checked=true
		}
}
function chkvalue1(code)
{			
	if ( code == "" ) return;
	var str=""
	if ( document.frm.checkbox1 ) {
	
		if ( !document.frm.checkbox1.length ){				
			str = str + document.frm.checkbox1.value + "&"
		}else{
			for(i=0; i<document.frm.checkbox1.length; i++)
				str = str + document.frm.checkbox1[i].value +"&"
		}
		document.frm.checkInfo.value=str.substr(0,str.length-1)
	}
	var sd = document.frmcurrency.ctyp;
	document.frm.s__Symbol.value = getSymbol(sd[sd.selectedIndex].text);
	document.frm.s__Xchange.value = sd[sd.selectedIndex].value;
	document.frm.action="add_basket.asp?idx="+sd.selectedIndex;
	document.frm.method="post"
	document.frm.submit()	
}
function popItemInfo(ItemCode)
{
	var width=parseInt(parseInt(window.screen.width)/3)
	var height=parseInt(window.screen.height)/4
	var top=parseInt(window.screen.height)/3	
	var left=(parseInt(window.screen.width)-parseInt(parseInt(window.screen.width)/2))/2
	var Str='scrollbars=yes,width=' + width + ',height=' + height + ',top=' + top + ',left=' + left
	popupWin =   window.open('ItemInfo.asp?itemcode='+ItemCode,'Login',Str)	
}
function checknumbers()
{
	if(window.event.keyCode < 48  || window.event.keyCode > 57)		{
	
		window.event.keyCode = 0
		return false
	}
}
function getSymbol(str){
	var val = str.split("(");
	var tmp = val[1].split(")");
	return tmp[0];
}

function FormatNumber (num) {
        num = "" + num;
        if (num.indexOf (".") == 0) {
            num = "0" + num;
        };
        if (num.indexOf (".") == -1) {
            num = num + ".0";
        };
        num = num + "000";
        return (num.substring (0, num.indexOf (".") + 3));
    }

function wrtSval(d,val){
	val = val.replace(",","");
	var sd = document.frmcurrency.ctyp;
	d.value = getSymbol(sd[sd.selectedIndex].text)+ " " +FormatNumber(val*sd[sd.selectedIndex].value);
	//alert(document.frmcurrency.ctyp[document.frmcurrency.ctyp.selectedIndex].value);
}

function wrtSSval(d,val){
	val = val.replace(",","");
	var sd = document.frm;
	d.value = sd.s__Symbol.value+ " " +FormatNumber(val*sd.s__Xchange.value);
}
