var ie = false;
var ns6 = false;
var ns = false;
var opera = false;
if (eval(document.layers)) { ns=true; }
else {
    if (eval(document.all)) { ie=true; if (navigator.userAgent.indexOf('Opera')!=-1) opera=true;}
        else {
            if (eval(document.getElementById)) { ns6=true;}
            }
    }

function checkSearch(obj) {
  if (!obj.changed  || obj.value == '') {
    alert('Enter search keywords!');
    return false;
  }
  return true;
}

/////////////////
// Flying Order
////////////////
function init_fly() {
	x_cl_body = window.document.body.clientWidth;
	y_cl_body = window.document.body.clientHeight/2;
	scrollw=0;
	(x_cl_body > 900)?(scrollw=window.document.body.scrollLeft):(scrollw=scrollw-window.document.body.scrollLeft);
	new_x=x_cl_body;
	x=new_x-170-scrollw;
	y=window.document.body.scrollTop + y_cl_body - 55;
	fly_obj = Layer('flying_order');
	fly_obj.style.display = '';
	fly_obj.style.left = x;
	fly_obj.style.top = y;
}	
function Layer(layerName) {
return (ns)?(document.layers[layerName]):((ns6)?(document.getElementById(layerName)):(document.all(layerName)));
}

function makeavailable(num,state) {
    obj=eval("document.forms.multiorder.vwquantity"+num)
    obj.disabled=!state;
    ((state)?(obj.value=1):(obj.value=0))
    obj2=eval("document.forms.multiorder.vwitem"+num)
    obj2.disabled=!state;
    ((state)?(obj.value=1):(obj.value=0))
	
}
function chprice(pr,num) {
var obj2;
if (eval("document.forms.multiorder.pricetxt"+num)) {
		obj=eval("document.forms.multiorder.pricetxt"+num);
		if (eval(document.forms.multiorder2)) {obj2=eval("document.forms.multiorder2.toppricetxt"+num);} else {obj2=false;}
		obj3=eval("document.forms.multiorder.flypricetxt"+num);
		pr=Math.round(pr*100)/100;
		if (pr.toString().indexOf('.')!=-1) {
			pr=pr.toString().substring(0,pr.toString().indexOf('.')+3);
			if (pr.toString().split('.')[1].length==1) pr=pr+'0';
		}else{
			pr=pr+'.00';
		}
		obj.value='$'+pr;
		if (obj2) obj2.value='$'+pr;
		obj3.value='$'+pr;
	}
}
function updateall(num) {
var totalprice;
calcq(num);
((eval("optionvalue"+num).length>0)?(totalprice=eval("qtyvalue"+num)*(eval("ipr"+num)+calcoptions(num))):(totalprice=eval("qtyvalue"+num)*eval("ipr"+num)));
chprice(totalprice,num);
}
function calcq(num) {
obj=eval("ranges"+num);
for (var i in obj) {
    q=eval("qtyvalue"+num);
    ((obj[i]['q']<=q)?(eval("ipr"+num+"=obj[i]['pr']")):(''))
    }
} 
