// JavaScript Document

// switches the image when mouse is over
function imgToggle(image, sel)
{
	img = image.src;
	
	if(/_off./.test(img))
		img = img.replace(/_off./, "_on.");
	else if(/_sel./.test(img))
		img = img.replace(/_sel./, "_on.");
	else
		if(sel)
			img = img.replace(/_on./, "_sel.");
		else
			img = img.replace(/_on./, "_off.");
	
	image.src = img;
}

function resizeBgGradient()
{
	var $ctrh = parseInt(document.getElementById('div_container').offsetHeight);
	var $ctrt = parseInt(document.getElementById('div_container').offsetTop);
	var $ht=0;

	$ht = document.body.scrollHeight;

	if(($ctrh+$ctrt) > $ht)
		document.getElementById('img_bg_gradient').style.height = ($ctrh+$ctrt)+'px';
	else
		document.getElementById('img_bg_gradient').style.height = $ht+'px';
}

function placeOrder($iid, $iprice, $iname)
{
	location.href='mailto:stephane@toxicpaintball.ca?subject=[Commande] - '+$iname;
}

function setMaxHeight($element, $parent)
{
	$pht = document.getElementById($parent).scrollHeight;
	$ht = document.body.scrollHeight;
	
	if($pht > $ht)
	{
		$ht = document.body.scrollHeight;
		$ht = parseInt($ht*40/100);
		document.getElementById($element).style.height = $ht+'px';
	}
}