window.onload = setWidthType;

function setWidthType() {
	var docWidth = document.documentElement.offsetWidth;
	var docHeight = document.documentElement.scrollHeight;
	var capsule = document.getElementById('capsule');
	if (docWidth < 1000) capsule.className = 'small';
	if (docWidth >= 1000) capsule.className = 'medium';
	if (docWidth > 1200) capsule.className = 'large';
}

function switchBlock(id) {
	var obj=document.getElementById(id);
	if (obj.style.display=='block') obj.style.display='none'; else obj.style.display='block';
	return false;
}

function updateprice(id) {
	var blabla = parseInt($('col'+id).innerHTML) * $('price'+id).innerHTML;
	$('sum'+id).innerHTML = blabla.toFixed(2);
	return true;
}

function plus(id)
{
	var bl = parseInt($('col'+id).innerHTML) + 1;
	$('col'+id).innerHTML = bl;
	document.getElementById(id).value = bl;
	updateprice(id);
	return true;
}

function minus(id)
{
	if (parseInt($('col'+id).innerHTML) != 1) {
		var bl = parseInt($('col'+id).innerHTML) - 1;
		$('col'+id).innerHTML = bl;
		document.getElementById(id).value = bl;
		updateprice(id);
	}
	return true;
}

function backshop(f)
{
	location.href=f;
}

function backbegin()
{
	location.href="http://bestdvdsale.com/shop/__calculate__/";
}

function finorder()
{
	location.href="http://bestdvdsale.com/shop/__finorder__/";
}

function backhistory()
{
	location.href="history.back()";
}