
$(document).ready(function(){	

	if (document.all && !window.opera) {
	if (typeof document.body.style.maxHeight == 'undefined') {
		var imgs = document.getElementsByTagName("img");
		for (i = 0; i < imgs.length; i++)
		{
			if (imgs[i].src.indexOf(".png") != -1)
			{
				imgs[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + imgs[i].src + "',sizingMethod='crop')";
				imgs[i].src="/img/0.gif";
			}
		}
	}
	}
    
    $("#menu_new td:last").addClass("last");

	$("div.block_one ul.left a").hover(function(){ 
		$(this).parents("li").addClass("hover"); 
	},function(){ 
		$(this).parents("li").removeClass("hover"); 
	});

	get_footer();
	
	
	$(".more a").focus(function(){
		$(this).blur();
	}); 
	
	$(".more a").click(function(){
		$(this).parent(".more").toggleClass("more_on").next(".hide").slideToggle("normal");
		if ($(this).parent(".more").hasClass("more_on")) {
			$(this).parent(".more").find("a.link").text("Свернуть");
		} else {
			$(this).parent(".more").find("a.link").text("Развернуть");
		}
		return false;           
	});  
	
	$(".list_tovar tr:odd").addClass("bg");
	
	if ($(".tray2 .on").prev(".sep").hasClass("left")) {
		$(".tray2 .on").prev(".sep").addClass("left_on");
	} else {
		$(".tray2 .on").prev(".sep").addClass("on1");
	}
	if ($(".tray2 .on").next(".sep").hasClass("right")) {
		$(".tray2 .on").next(".sep").addClass("right_on");
	} else {
		$(".tray2 .on").next(".sep").addClass("on2");
	}
	
	$("#user_pw0").focus( function() { 
		$(this).hide();
		$("#user_pw").show().focus();
	} );
	
	
	
	$("#kupon_yes").focus(function(){
		$(this).blur();
	}); 
	flag_kupon_yes=0;
	$("#kupon_yes").click(function(){
		if (flag_kupon_yes==0) {
			if ($("#coupon_info_code").text()==0) {
				$("#coupon_form").slideDown("fast");                
			} else {
				$("#coupon_info").slideDown("fast");    
			}
			flag_kupon_yes=1;
		} else {
			if ($("#coupon_info_code").text()==0) {
				$("#coupon_form").slideUp("fast");                
			} else {
				$("#coupon_info").slideUp("fast");    
			}
			flag_kupon_yes=0;
		}        
		return false;           
	});  
	
	
	$(".list_tovar strike").each(function(i){ 
		$(this).parents("tr").addClass("bg2");
	});
	
	
	if ($(".price_new2").length) {        
		$(".cpt_product_add2cart_button").addClass("cpt_product_add2cart_button2");
	}
	
});

$(window).resize(function(){	

	get_footer();
	
});

function get_footer() {
	var height=135;
	var screen_f = $("#footer").height();  
	if (screen_f>height) {
		$("#footer").css({"margin-top" : -screen_f + "px"});
		$("#padding_bot").css({"padding-bottom" : 175 + (screen_f-height) + "px"});		
	} 
}

function yandex_form() {
		return {type: 2, logo: 'rb', arrow: true, webopt: false, websearch: false, bg: '#EEEEEE', fg: '#000000', fontsize: 12, suggest: false, site_suggest: true, encoding: '', language: 'ru'}          
	} 
	
function yandex_result() {
		return {encoding: '', language: 'ru'}          
	} 
    
    
// окно, которое по центру
function OutInWin(pict, xw, yw, namew,scroll)
{
    var x_width, y_height;
    x_width  = xw;
    y_height = yw;
    if(!scroll)
     scroll='yes';
    w_top=0; w_left=0;

    w_top = (screen.height - y_height)/2-50;
    w_left= (screen.width - x_width)/2;

    window.open(pict, namew, "top="+w_top+",left="+w_left+",width="+x_width+",height="+y_height+",resizable=yes,scrollbars="+scroll+",status=no,dependent=no");
    return false;
 }



