var open_div = '';

function openSubCats(div_id) {
	if (open_div != '') {
		if (open_div == div_id) {
			Effect.BlindUp(open_div);
			open_div = '';
		}
		else {
			Effect.BlindUp(open_div,{afterFinish: function() {
					Effect.BlindDown(div_id);			
					open_div = div_id;
				}
			});
		}
	}
	else {
		Effect.BlindDown(div_id);	
		open_div = div_id;
	}
}

var open_details = 0;

function openProductDetails(p_id) {
	if (open_details == 0) {
		//Effect.Appear('product_details_'+p_id, { duration: 1.0 });
		$('product_details_'+p_id).style.display = 'block';
		open_details = p_id;
	}
	else {
		closeProductDetails(open_details);
		//Effect.Appear('product_details_'+p_id, { duration: 1.0 });
		$('product_details_'+p_id).style.display = 'block';
		open_details = p_id;
	}
}

function closeProductDetails(p_id){
	//Effect.Fade('product_details_'+p_id, { duration: 1.0 });
	$('product_details_'+p_id).style.display = 'none';
}

function openPrintPage(p_id) {
	window.open('print.php?p='+p_id,'Print','width=500,height=700,toolbar=yes,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=yes,resizable=yes')
}

function changeBGImage(whichImage){
	if (document.body){
		document.getElementById('main_top_image').style.backgroundImage = "url('images/"+backImage[whichImage]+"')";
	}
}

function changeBGImageTime() {
	changeBGImage(get_random());
	setTimeout('changeBGImageTime()',5000);
}

function get_random() {
    var ranNum= Math.floor(Math.random()*7);
    return ranNum;
}

