


//for(var i = 1; i <= divs; i++){
//var div = document.getElementById("a"+i);



function setStars(howmany) {
	
	stars_string='';
	
	for (x=0;x<howmany;x++) {
		
	//alert(x);
	stars_string = stars_string + '<img src="acg/images/new/grey_star.png" border=1 alt="*">'
	
	}
	
	
	document.getElementById('stars_box').innerHTML=stars_string;
	
	
	
	}

function resizeCart(dowhat) {
	
	
	
	var bag_items = document.getElementById("shopping").getElementsByTagName("div").length-2; //2 for misc divs



//alert(bag_items);
	
	if ((dowhat==1) && (bag_items >5)) { 
	
	document.getElementById('shopping').style.overflow='visible';
//	$("shopping").slideDown();
	
	} else {
		
		document.getElementById('shopping').style.overflow='hidden';
		
	}
	
	
}










function hideLoadingBox(){
	
	
document.getElementById('loading_box').style.display='none';	
	
}



function updateQtyPer(price_each) {
	
	
	
		
		document.getElementById('qty_total').innerHTML="Total: " +formatCurrency(document.cart_quantity.cart_quantity.value*price_each);
	  //  twelve_good = document.cart_quantity.cart_quantity.value;
		
	
	}
	
	
	function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num + '.' + cents);
}


//remember to build preloader (using php to get dir's contents)


function rollOver(imageObject,imageFolder,imageName) {
	
	//alert(imageObject.src);
	newImage='images/' +  imageFolder + '/' + imageName + '.png';
	//alert(newImage);
	imageObject.src=newImage;
	//imageObject.src='';
}



function doField(what,ortext) {
if (what.value==ortext) {
what.value=''
}
else if (what.value=='') {
what.value=ortext;
}
}



// check multi checkboxes based on the name passed in.
function CheckMultiple(name) 
{
theFrm = document.frmSS;
for (var i=0; i < theFrm.length; i++) 
{
fldObj = theFrm.elements[i];
var fieldnamecheck=fldObj.name.indexOf(name);
if (fieldnamecheck != -1) {
if (fldObj.checked) {
return true;
}
}
}
return false;
}


function CheckSS()
{
theFrm = document.frmSS;

hasDot = theFrm.Email.value.indexOf(".");
hasAt = theFrm.Email.value.indexOf("@");

if (hasDot == -1 || hasAt == -1)
{
alert("Please enter a valid email address.");
theFrm.Email.focus();
theFrm.Email.select();
return false;
}


return true;
}





function popupImage(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
