


function show_product_reviews(id){
	obj = Layer(id);
	if(obj.style.visibility=='hidden'){
		obj.style.visibility='visible';
		obj.style.position='static';
	}
	else{
		obj.style.visibility='hidden';
		obj.style.position='absolute';
	}
}

function insertMore() {
if (moretxtvalue!='') {
    var leftPos = (screen.availWidth-900) / 2;
    var topPos = (screen.availHeight-600) / 2;
    var MoreInfo = new Object();
    MoreInfo = window.open('more_info.html', 'EnlargePicture','width=600,height=500,scrollbars=yes,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
    MoreInfo.document.write('<html><head><title>atlasphones.com - Product more info</title><link rel="stylesheet" href="http://p.hostingprod.com/@atlasphones.com/css/main.css" type="text/css"><link rel="stylesheet" href="http://p.hostingprod.com/@atlasphones.com/css/main1.css" type="text/css"><style>body, td, select, input{font: 11px Tahoma, Arial, Helvetica;color:#666666;}</style></head><body bgcolor="#ffffff" marginheight="0" marginwidth="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"><center><table border="0" cellpadding="0" cellspacing="0" width="100%" height="478"><tr valign="top"><td width="7" nowrap=""><img src="http://p.hostingprod.com/@atlasphones.com/i/p-t.gif" width="10" height="1"/></td><td width="100%"><img src="http://p.hostingprod.com/@atlasphones.com/i/logo.jpg" border="0" align="left" style="margin:0px 8px 8px 0px"/><p style="margin:20px 0px 0px 0px;">'+moretxtvalue+'</p></td><td width="7" nowrap=""><img src="http://p.hostingprod.com/@atlasphones.com/i/p-t.gif" width="1" height="1"/></td></tr></table><div style="border-bottom:1px solid #BBBBBB;"></div><div style="height:2px"><img src="http://p.hostingprod.com/@atlasphones.com//i/p-t.gif"/></div></center></body></html>');
    }
else {
    alert('Your browser settings not allow to run scripts or version of your browser is old.');
    }
}


function openShipping(num) {
    var leftPos = (screen.availWidth-900) / 2;
    var topPos = (screen.availHeight-600) / 2;
    var MoreInfo = new Object();
    MoreInfo = window.open('shipping-calc.html', 'EnlargePicture','width=600,height=500,scrollbars=yes,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}
function openDelivery(num) {
    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);
}


var Currtop='<div class=t6a2>CURRENTLY VIEWED ITEMS<br></div><div class=bg9h1><img src="http://p.hostingprod.com/@atlasphones.com/i/p-w.gif" width=15 height=1><br></div><table cellpadding=0 cellspacing=0 border=0 class=t23a1><tr>';

var Currbot='</tr></table>';

var Currdiv='';


var CurrItema='<td><center>';
var CurrItemab='<br></center><img src="http://p.hostingprod.com/@atlasphones.com/i/p-t.gif" width=75 height=1 alt="" border=0><br>'
var CurrItemb='<br></td>';

    function pasteRelated() {
	var items_count=6;
    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('-||-');
            document.write(CurrItema);
            document.write(tempvall[0]);
            document.write(CurrItemab);
            document.write(tempvall[1]);
            document.write(CurrItemb);
            if (i!=items_count) {
                document.write(Currdiv);
                }
            }
        }
        document.write(Currbot);
        }
    } 

function addtorel() {
	var items_count=6;
    related[CurrItemId]=CurrItem;
	rel_itms = new Array();
	inarr = false;
    for (i=1;i<=items_count;i++) {
    	cc='rel_'+i;
		if (!GetCookie(cc)) {
    	    SetCookie(cc, related[CurrItemId]);
        	break;
		} else {
			 if (GetCookie(cc)==related[CurrItemId]){
				 break;
			} else {
				for (i=0;i<items_count;i++) {
					ncc='rel_'+(i+1);
					if (GetCookie(ncc)==related[CurrItemId]) inarr=true;
					if (GetCookie(ncc))	rel_itms[i] = GetCookie(ncc);
				}
				if (!inarr){
					if (rel_itms.length == items_count) {
						rel_itms.splice(items_count-1,1);
					}
					rel_itms.unshift(related[CurrItemId]);
					for (i=1;i<=items_count;i++) {
						scc='rel_'+i;
						if (rel_itms[i-1]) SetCookie(scc, rel_itms[i-1]);
					}
				}
			}	
		}
	}
}	


var savingArray = false;

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

qvSaving = 0;

  if(savingArray){
	if(eval("qtyvalue"+num) < savingArray.length){
		qvSaving = savingArray[eval("qtyvalue"+num)]*eval("qtyvalue"+num)
	}
	else{
		qvSaving = savingArray[(savingArray.length - 1)]*eval("qtyvalue"+num)
	}
    totalprice = totalprice - qvSaving;
  }

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']")):(''))
    }
} 



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) {
    optval=optval+eval(optcheck.split('(+$')[1].split(')')[0]);
    }
    else {
        if (optcheck.indexOf('-$')!=-1) {
            optval=optval+eval('-'+optcheck.split('(-$')[1].split(')')[0]);
            }
            else {
            optval=optval+0;
            }
    }
}
return eval(optval);
}


function chprice(pr,num) {
if (Layer('pricetxt'+num)) {
		obj=Layer('pricetxt'+num);
		//obj2=eval("document.forms.multiorder.toppricetxt"+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.innerHTML='$'+pr;
		//obj2.value='$'+pr;
		}
}


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


