function ie(){
	if($.browser.msie){
		if($.browser.version <= 6){
			if(document.getElementById('colRight') != null){
				$("#colRight").width($("#top").width()-$("#colLeft").width());
				$("#colRight").css("margin-left", "-3")
			}
			if(document.getElementById('footRight') != null){
				if(document.getElementById('colLeft') != null)
					$("#footRight").width($("#top").width()-$("#colLeft").width());
				if(document.getElementById('colRightUp') != null)
					$("#footRight").width($("#foot").width() - $("#footLeft").width());
				$("#footRight").css("margin-left", "-3")
			}			
		}
	}
}

$(function(){
	ie();
	bgPos();			
	$(window).resize( function() {
		bgPos();
		ie();		
	} ); 
});

//---------- позиционирование бекграунда
function bgPos(){
	if(document.getElementById('colLeft') != null){
		$("#top").css("background", "none");
		$("#top").css("background", "transparent url('/bitrix/templates/Main/images/bg_line.gif') repeat-y " + $("#colLeft").width() + "px 0");
	}
	if(document.getElementById('colLeftDown') != null){
		
		$("#top").css("background", "none");
		$("#top").css("background", "transparent url('/bitrix/templates/Main/images/bg_line_main.gif') repeat-y " + (-400+$("#colLeftDown").width()) + "px 0");
	}

	if(document.getElementById('colLeftUp') != null){
		if($("#colRightUp").height() > $("#colCenterUp").height()){
			$("#colCenterUp").height($("#colRightUp").height());
			$("#colLeftUp").height($("#colRightUp").height());
		}else{
			$("#colRightUp").height($("#colCenterUp").height());
			$("#colLeftUp").height($("#colCenterUp").height());
		}
		//$("#colCenterUp").css("overflow","hidden");
		
	}
}

//----------- открытие окна для принт версии
function wopenPrint(src)
{
	var top = ($('body').height() - 700)/2;
	var left = ($('body').width() - 795)/2;
	w=window.open(src, "WPrint", "toolbars:no,scrollbars=1,width=795,height=700,top="+top+",left="+left);
	w.focus();
	return false;
}

//----------- купить товар
function buy(ob, id){
	obInput = document.getElementById("count"+id);
	url = ob.href + "&count=" + obInput.value;
	//alert(url)
	document.location.href = url;
	return false;
}
//----------- купить товар
function buyMain(ob, id){
	obInput = document.getElementById("count"+id);
	url = ob.href + "&count=" + obInput.value;
	//alert(url)
	document.location.href = url;
	return false;
}


//----------- Email по умолчанию
function onfocusEmail(ob){
	if(ob.value == 'user@wine.ua'){
		ob.value = '';
		ob.className = '';
	}
}

//----------- Email по умолчанию
function onblurEmail(ob){
	if(ob.value == ''){
		ob.value = 'user@wine.ua';
		ob.className = 'defEmail';
	}
}

//---------- загрузка производителей
function LoadVendors(id, ob){
	$("a", "ul.ListRegions > li").each(function(i) {
		$(this).removeClass("act");
	});
	$(ob).addClass("act");
	
	$.get("/bitrix/templates/Main/include_files/vendors/list_vendors.php", { reg: id }, function(data){
		$("#Vendors").html(data);
		$("#items > span").html(' "'+$(ob).html()+'"');
	});
	
}