


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

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>Tell a Friend about this product</title><link href="http://site.home-gym.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="#3C5CA4" vlink="#3C5CA4" alink="#3C5CA4"><center><table border="0" cellpadding="0" cellspacing="0" width="635" bgcolor="#FFFFFF"><tr><td>   <table border="0" cellpadding="0" cellspacing="0" width="635" background="http://site.home-gym.com/i/email-top.jpg" style="background-repeat:no-repeat;"><tr><td height="94" valign="top"><img width="1" height="69"><br><div class="al1 bd co1 fs15"><img src="http://site.home-gym.com/i/ar3.gif" width="11" height="6" alt="" border="0" hspace="8">More info<img src="http://site.home-gym.com/i/ar3.gif" width="11" height="6" alt="" border="0" hspace="8"></div></td></tr></table><table width="635" style="border:1px solid #65801D"><tr><td height="230" valign="top" style="padding:10px">	<img width="1" height="15"><br>'+moretxtvalue+'</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 openShipping(num) {
    var leftPos = 235;
    var topPos = 233;
    var MoreInfo1 = new Object();
    MoreInfo1 = window.open('shipping-calc.html', 'EnlargePicture1','width=664,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);
}
var Currtop='<div class="t3a4 bd co1 fs14"><div class="t3a5 marg3">Recently Viewed Items</div></div><img width=1 height=6><br><table><tr valign=top>';

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

var Currdiv='';

var CurrItema='<td class=t5c1 width=122><center>';
var CurrItemab='<br><img width=122 height=1><br><div class="marg8">';
var CurrItemac='<br><img width=1 height=2><br><div class="co7">';
var CurrItemb='</div></div></center></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(CurrItemac);
            document.write(tempvall[2]);
            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))
	
}

