function fixPNG(element)
{
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
	{
		var src;
		
		if (element.tagName=='IMG')
		{
			if (/\.png$/.test(element.src))
			{
				src = element.src;
				element.src = "/images/blank.gif";
			}
		}
		else
		{
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
			if (src)
			{
				src = src[1];
				element.runtimeStyle.backgroundImage="none";
			}
		}
		
		if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
	}
}

function prepare(){
	if(document.getElementById('greyFon')){
		document.getElementById('greyFon').style.height = document.getElementById('wrapper').offsetHeight + 'px';
		document.getElementById('greyFon').style.width = document.getElementById('wrapper').offsetWidth + 'px';
	}

document.getElementById('mapLinkContInn').onmouseover = function(){
		this.className = 'mapHover';
	}
	
	document.getElementById('mapLinkContInn').onmouseout = function(){
		this.className = '';
	}
}
window.onload = prepare;


function addTov(arg){
	var flag = 0;
	document.getElementById('errTop').style.display = '';
	document.getElementById('errBot').style.display = '';
	document.getElementById('noErrTop').style.display = 'none';
	document.getElementById('noErrBot').style.display = 'none';
	document.getElementById('forAdd').value = '';
	
	checkList = document.getElementsByTagName('input');
	for(i = 0; i < checkList.length; i++){
		if(checkList[i].className == 'ch'){
			if(checkList[i].checked == true){
				flag = 1;
				document.getElementById('forAdd').value += checkList[i].value + ',';
			}
		}
	}
	
	if(flag == 1){
	document.getElementById('errTop').style.display = 'none';
	document.getElementById('errBot').style.display = 'none';
	document.getElementById('noErrTop').style.display = '';
	document.getElementById('noErrBot').style.display = '';
	}
}

function addToBasket(){
	document.getElementById('formAdd').submit()
}

function checkOrder(){
	var error = 0;
	var mail = document.order_form.bc_3;
	var mail_flag = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(mail.value);

	if(mail.value==''){
		return true;
	}
	
	if(mail.value=='' || !mail_flag){
		error++;
	}
	
	if(error != 0){
		alert('Укажите корректный адрес электронной почты!');
		return false;
	}
}

function noOrder(){
	alert('Вы не выбрали ни одного товара!');
}
