function preload() {

    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=preload.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function inner(id) {

	if (document.getElementById(id).className == 'menu-left-hidden') {

		document.getElementById(id).className = 'menu-left-display';
		document.getElementById(id + '-header').className = 'head-red';
	}	
		else {

		document.getElementById(id).className = 'menu-left-hidden';
		document.getElementById(id + '-header').className = 'head-red-closed';
	}
}

function photo_show(source) {
/*
	var small_temp = document.getElementById('photo-' + id).src;
	var small = document.getElementById('photo-temp-small').value;
	var big = document.getElementById('photo-temp-big').value;
*/
	document.getElementById('photo-main').src = source;
/*
	document.getElementById('photo-' + id).src = small;
	document.getElementById('link-' + id).href = 'javascript:photo_show(\'' + big + '\', \'' + id +'\')';
	document.getElementById('photo-temp-big').value = source;
	document.getElementById('photo-temp-small').value = small_temp;
*/
}

function filter() {

	var form = document.getElementById('filter-form');
	if (form.className == 'filter') {

		document.getElementById('filter-form').className = 'filter-hidden';
	}
		else {

		document.getElementById('filter-form').className = 'filter';
	}
}

function basket() {

	var total = document.getElementById('total').value;
	var summa = 0;
	for (var y = 0; y <= (total - 1); y++) {

		var price = document.getElementById('price_single['+y+']').value;
		var num = document.getElementById('num['+y+']').value;
		summa = summa + (price * num);
	}
	document.getElementById('price_total').innerHTML = summa;
}

function sizes() {

	var total = document.getElementById('total_sizes').value;
	var price = document.getElementById('price').value;
	var summa = 0;
	for (var y = 0; y <= (total - 1); y++) {

		if (document.getElementById('size_['+y+']').checked == true) {

			summa = summa + parseInt(price);
		}

	}
	document.getElementById('price_total').innerHTML = summa;
}

function check_sizes() {

  var summa = document.getElementById('price_total').innerHTML;
	if (summa == '0') {

		alert('Вы должны выбрать размер!');
		return false;
	}	
		else {

		return true;
	}

}

function addBookmark(url, title) {

	if (!url) url = location.href;
	if (!title) title = document.title;

	//Gecko
	if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
	//IE4+
	else if (typeof window.external == "object") window.external.AddFavorite(url, title);
	//Opera7+
	else if (window.opera && document.createElement) {

		var a = document.createElement('A');
		if (!a) return false; //IF Opera 6
		a.setAttribute('rel','sidebar');
		a.setAttribute('href',url);
		a.setAttribute('title',title);
		a.click();
	}
	else return false;

	return true;
}
