

function set_pos(){
	obj = document.getElementById('cont7');
	obj1 = document.getElementById('layers_div');
			// Find the element's offsetTop and offsetLeft relative to the BODY tag.
		objLeft   = obj1.offsetLeft;
		objTop    = obj1.offsetTop;
		objParent = obj1.offsetParent;
		while (objParent.tagName.toUpperCase() != "BODY")
		{
			objLeft  += objParent.offsetLeft;
			objTop   += objParent.offsetTop;
			objParent = objParent.offsetParent;
		}
		obj.style.top = objTop+4;
		//alert(obj.style.top)
		obj.style.left = objLeft;
}

function show_c_layer(num){
//alert(num + "   " + activeLayer);
		for(i=1;i<=10;i++){
		if(document.getElementById('hat' + i) && document.getElementById('cont' + i)){

		//alert(url2)
			if(i==num){
				document.getElementById('hat' + i).className = 't26a2';
				document.getElementById('cont' + i).style.display='block';
				activeLayer = num;
			}
			else{
				document.getElementById('hat' + i).className = 't26a1';
				document.getElementById('cont' + i).style.display='none';
			}
		}
		
}
}

var activeLayer = 1;

function over_c_layer(num){
		if(activeLayer != num){
			//document.getElementById('hat' + num).style.background = 'url(/i/t1e2.gif)';
		}
}

function out_c_layer(num){
			if(activeLayer != num){
				//document.getElementById('hat' + num).style.background = 'url(/i/t2e2.gif)';
			}
}


function first_layer_ini1(){
	for(i=1;i<=10;i++){
	if(document.getElementById('hat' + i) && document.getElementById('cont' + i)){
	activeLayer = i;
 		document.getElementById('hat' + i).className = 't26a2';
		document.getElementById('cont' + i).style.display='block'
		break;
		}
	}    
}

/*

    function pasteRelated() {
	var items_count=5;
    var asd=0;
    var Rell=false;
    for (var i=1;i<(items_count+1);i++) {
        ccc='rel_'+i;
        if (GetCookie(ccc)) {
            Rell=true;
            asd=asd+1;
            }
        }
//  alert(GetCookie('rel_5'));
    if (Rell) {
		document.write(Currtop);
    for (var i=1;i<(items_count+1);i++) {
        ccc='rel_'+i;
        if (GetCookie(ccc)) {
            tempvall=GetCookie(ccc).split('-||-');
            if (i==1) document.write(separ1);
            else document.write(separ2);
            document.write(CurrItema);
            document.write(tempvall[0]);
            document.write(CurrItemb);
	    document.write(tempvall[1]);
            document.write(CurrItemc);
            }
        }
        document.write(Currbot);
        }
    } 

*/



/*function makeavailable(num,state) {
    obj=eval("document.forms.multiorder.vwquantity"+num)
    obj.disabled=!state;
    ((state)?(obj.value=1):(obj.value=0))
}*/
function chprice(pr,num) {
obj=eval("document.forms.multiorder.pricetxt");


		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.innerHTML='$'+pr;
		obj.value='$'+pr;
}
function calcoptions(num) {
var optval=0;
len=eval("optionvalue"+num+".length");
for (i=1;i<len;i++) {
optcheck=eval("optionvalue"+num+"[i]");
if (optcheck.indexOf('(+')!=-1) {
	tmp=optcheck.split('(+')[1].split(')')[0];
	(tmp.indexOf('$')!=-1)?tmp=tmp.split('$')[1]:'';
    optval=optval+eval(tmp);
    }
    else {
        if (optcheck.indexOf('(-')!=-1) {
			tmp=optcheck.split('(-')[1].split(')')[0];
			(tmp.indexOf('$')!=-1)?tmp=tmp.split('$')[1]:'';
            optval=optval+eval('-'+tmp);
			
            }
            else {
            optval=optval+0;
            }
    }
}
return eval(optval);
}
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=0;i<obj.length;i++) {
    q=eval("qtyvalue"+num);
    ((obj[i]['q']<=q)?(eval("ipr"+num+"=obj[i]['pr']")):(''))
    }
}


function openDelivery() {
    var leftPos = (screen.availWidth-900) / 2;
    var topPos = (screen.availHeight-600) / 2;
    var MoreInfo = new Object();
    MoreInfo = window.open('delivery-est.html', 'EnlargePicture','width=1000,height=500,scrollbars=yes,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}


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))

for(i=0;i<document.forms.multiorder.elements.length; i++){
obj3 = document.forms.multiorder.elements[i];

	if(obj3.name.indexOf('vwattr'+num)!=-1){
		    obj3.disabled=!state;
    ((state)?(obj.value=1):(obj.value=0))
	}

}
	
	//alert(document.forms.multiorder.elements.length)
	
}


