function show_product_reviews(id){
	obj = Layer(id);
	if(obj.style.display=='none'){
		obj.style.display='block';
	}
	else{
		obj.style.display='none';
	}
}

var Currtop = '<div class=t6a1><img width=1 height=3><br><div class=marg4><div class="sth4 fs18 co5 marg4 fInfo">Currently Viewed Items</div></div><img width=1 height=3><br><table><tr valign=top>';
var CurrItema = '<td><img width=135 height=1 vspace=3><br><center><img src=http://site.classicbeachstore.com/i/t6b1.gif width=126 height=7 alt="" border=0><br><table width=126 class=t3e1><tr><td height=86 align=center>';
var CurrItemab = '<br></td></tr></table><img src=http://site.classicbeachstore.com/i/t6b3.gif width=126 height=7><br></center><div style=width:125px;><div style="padding:6px 12px 6px 18px;">';
var CurrItemb = '<br></div></div></td>';
var Currbot = '</tr></table></div>';

    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('-||-');
            document.write(CurrItema);
            document.write(tempvall[0]);
            document.write(CurrItemab);
            document.write(tempvall[1]);
            document.write(CurrItemb);
            }
        }
        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) {
num=0;
var totalprice=0;
calcq(num);
qvSaving = 0;
((eval("optionvalue"+num).length>0)?(totalprice=eval("qtyvalue"+num)*(eval("ipr"+num)+calcoptions(num))):(totalprice=eval("qtyvalue"+num)*eval("ipr"+num)));
  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;
  }

/*
for (i=0;i<=calcitems;i++) {
  calcq(i);
 ((eval("optionvalue"+i).length>0)?(price=eval("qtyvalue"+i)*(eval("ipr"+i)+calcoptions(i))):(price=eval("qtyvalue"+i)*eval("ipr"+i)));
  qvSaving = 0;
  if(savingArray){
	if(eval("qtyvalue"+i) < savingArray.length){
		qvSaving = savingArray[eval("qtyvalue"+i)]*eval("qtyvalue"+i)
	}
	else{
		qvSaving = savingArray[(savingArray.length - 1)]*eval("qtyvalue"+i)
	}
    price = price - qvSaving;
  }



totalprice=totalprice+price;
}
*/
chprice(totalprice,0); 
}


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 (j=1;j<len;j++) {
optcheck=eval("optionvalue"+num+"["+j+"]");
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;
        }
 }
//alert("optionvalue"+num+"["+i+"]"+optcheck+"optval="+optval); 
}
return eval(optval);
}


function chprice(pr,num) {
if (Layer('pricetxt'+num)) {
		obj=Layer('pricetxt'+num);
		//obj2=Layer('pricetxt0');
		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.innerHTML='$'+pr;
		}
}

function openShipping(num) {
    var leftPos = 235;
    var topPos = 233;
    var MoreInfo1 = new Object();
    MoreInfo1 = window.open('shipping-calc.html', 'EnlargePicture1','width=663,height=370,scrollbars=yes,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}
function openDelivery(num) {
    var leftPos = 235;
    var topPos = 233;
    var MoreInfo2 = new Object();
    MoreInfo2 = window.open('delivery-est.html', 'EnlargePicture2','width=1000,height=500,scrollbars=yes,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
}

function insertMore() {
if (moretxtvalue!='') {
    var leftPos = 235;
    var topPos = 233;
    var MoreInfo = new Object();
    MoreInfo = window.open('more_info.html', 'EnlargePicture0','width=664,height=370,scrollbars=yes,resizable=no,statusbar=no,location=no,titlebar=0,top=' + topPos + ',left=' + leftPos);
    MoreInfo.document.write('<html><head><title>More Info</title><link href=http://site.classicbeachstore.com/css/main.css rel="stylesheet" type="text/css"></head><body bgcolor=#FFFFFF marginheight=20 marginwidth=0 topmargin=20 bottommargin=0 leftmargin=0 rightmargin=0 link="#10B2C1" vlink="#10B2C1" alink="#10B2C1"><center><table border="0" cellpadding="0" cellspacing="0" width="633" bgcolor="#FFFFFF" style="border:1px solid #0DB3C5"><tr><td><table border="0" cellpadding="0" cellspacing="0" width="633" background="http://site.classicbeachstore.com/i/email-top.gif" style="background-repeat:no-repeat;"><tr><td height="109" valign="top"><img width="1" height="84"><br><div class="al1 bd co1 fs15"><img src="http://site.classicbeachstore.com/i/ar3.gif" width="11" height="6" alt="" border="0" hspace="8">More info<img src="http://site.classicbeachstore.com/i/ar3.gif" width="11" height="6" alt="" border="0" hspace="8"></div></td></tr></table><table cellpadding="0" cellspacing="0" width="633"><tr><td><img width="1" height="15"><br><center><table cellpadding="0" cellspacing="0" width="600"><tr><td width="100%">'+moretxtvalue+'</td></tr></table><br></center></td></tr></table></td></tr></table></center></body></html>');
    }
else {
    alert('Your browser settings not allow to run scripts or version of your browser is old.');
    }
}


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