$(document).ready(function(){	$(function(){		$('.img').hover(function(){			$(this).children('img').stop().animate({width:"160px",height:"120px",marginLeft:"-12px",marginTop:"-10px"}, 200);			},			function(){			$(this).children('img').stop().animate({width:"133px",height:"100px",marginLeft:"0px",marginTop:"0px"}, 200);			});	});	$('#submitForm').hover(		function(){			$(this.parentNode).css({'margin-top' : '1px'});		},		function(){			$(this.parentNode).css({'margin-top' : '0px'});		}	 );	 $('#respaun').hover(		function(){			$(this.parentNode).css({'margin-top' : '1px'});		},		function(){			$(this.parentNode).css({'margin-top' : '0px'});		}	 );	 $('#filterView').hover(		function(){			$(this).css({'margin-top' : '1px'});		},		function(){			$(this).css({'margin-top' : '0px'});		}	 );	 $('#addToCart').hover(		function(){			$(this).css({'margin-top' : '11px'});		},		function(){			$(this).css({'margin-top' : '10px'});		}	 );	 $('#news-banner').hover(		function(){			/*$(this.parentNode).css({'padding-top' : '0px'});*/			$(this.parentNode).animate({'paddingTop' : '0px'},200);		},		function(){			/*$(this.parentNode).css({'padding-top' : '10px'});*/			$(this.parentNode).animate({'paddingTop' : '10px'},400);		}	 );	 $('#hot-banner').hover(		function(){			/*$(this.parentNode).css({'padding-top' : '0px'});*/			$(this.parentNode).animate({'paddingTop' : '0px'},200);		},		function(){			/*$(this.parentNode).css({'padding-top' : '10px'});*/			$(this.parentNode).animate({'paddingTop' : '10px'},400);		}	 );	 $('#discount-banner').hover(		function(){			/*$(this.parentNode).css({'padding-top' : '0px'});*/			$(this.parentNode).animate({'paddingTop' : '0px'},200);		},		function(){			/*$(this.parentNode).css({'padding-top' : '10px'});*/			$(this.parentNode).animate({'paddingTop' : '10px'},400);		}	 );	 $('#send').hover(		function(){			$(this.parentNode).css({'margin-top' : '1px'});		},		function(){			$(this.parentNode).css({'margin-top' : '0px'});		}	 );	 $('#login').hover(		function(){			$(this).css({'margin-top' : '9px'});		},		function(){			$(this).css({'margin-top' : '8px'});		}	 );	var onblock=false;	var isauth=false;    $("#menu li.m-catalog").hover(		function(){			$(this).addClass("active");		},		function(){			$(this).removeClass("active");		}	);	// авторизация	$("#auth").hover(		function(){			onblock=true;			$(this).css({'display' : 'block'});		},		function(){			onblock=false;			$(this).css({'display' : 'none'});		}	);	$("#auth-logout").hover(		function(){			onblock=true;			$(this).css({'display' : 'block'});			},		function(){			onblock=false;			$(this).css({'display' : 'none'});			}	);	$(".history td a").hover(		function(){			$(this).parent("td").parent("tr").css({'background-color' : '#e2e8f4'});			$(this).parent("td").parent("tr").children('td').children('a').css({'color' : '#4e6fa2'});			},		function(){			$(this).parent("td").parent("tr").css({'background-color' : '#f9f8f0'});			$(this).parent("td").parent("tr").children('td').children('a').css({'color' : '#000'});		}	);		$(".cart tr:first td").css({'border' : '0'});	$('a.nyroModal').nyroModal({		bgColor: '#f4f2e2',		padding: 0,		endRemove: function() {		if(document.getElementById("clearCartCookie") != null) {			if(document.getElementById("clearCartCookie").innerHTML == '1')			//setCookie( "userCart", "", '-1', '/' );			$.cookie("userCart", "", { expires: -1, path:'/'});		}		$('.layout ').removeClass("layoutWbg");		var getCart = $.cookie("userCart");		var count = 0;		var total = 0;		if(getCart!=null && getCart.indexOf(';')) {			var userCart = getCart.split(';');            //alert('s:'+getCart+'    l:'+userCart.length);            count = userCart.length;			for(var i=0; i<count; i++) {				var item = userCart[i].split(':');				total += +item[4];			}		}		//var variant_id = document.getElementById("variant_id").value;		//document.getElementById("cartLink").innerHTML = total+' товаров';		$("#cartLink").html( (isNaN(total) ? 0 : total)+' товаров' );		},		endFillContent: function(elts, settings, callback) {			$('.layout ').addClass("layoutWbg");			if ( $(settings.from).attr('opt') ) {				selItem = $(settings.from).attr('opt');			}			return true;		}	});	// выделить все	$('#a-recount').click(function(){			$(".cart-delete").click();		}	);	// корзина	$('#cartLink').ready(function(){		if(document.getElementById("clearCartCookie") != null) {			if(document.getElementById("clearCartCookie").innerHTML == '1')				//setCookie( "userCart", "", '-1', '/' );				$.cookie("userCart", "", { expires: -1, path:'/'});		}		var getCart = $.cookie("userCart");		var count = 0;		var total = 0;		if(getCart!=null && getCart.indexOf(';')) {			var userCart = getCart.split(';');			//alert('s:'+getCart+'    l:'+userCart.length);			count = userCart.length;			for(var i=0; i<count; i++) {				var item = userCart[i].split(':');				total += +item[4];			}		}		//var variant_id = document.getElementById("variant_id").value;		document.getElementById("cartLink").innerHTML = (isNaN(total) ? 0 : total)+' товаров';		}	);	// авторизация	$('#loginLink').ready(function(){		var authCookie = $.cookie("auth");		if(authCookie!=null && authCookie.indexOf('.')>0) {			var auth = authCookie.split('.', 3);			var str = base64_decode(auth[2]);			// проверяем является ли раскодированная строка сериализованным массивом			if(str.indexOf('a')==0) {				// десериализуем массив				var arr = unserialize(str);				// текст в блок				$("#auth-block").html( decodeURI(arr[2]) );				// проверяем является ли оптовиком				if(auth[1]==1) {					// оптовик. выводим его данные					$("#catalog-link").parent().show();					$("#catalog-link").html("Каталог");					$("#menu li").css("padding-left","70px");					//document.getElementById("loginLink").innerHTML = decodeURI(arr[4])+' '+decodeURI(arr[3]);					//$("#loginLink").html( decodeURI(arr[4])+' '+decodeURI(arr[3]) );					// добавка к блоку с текстом					$("#auth-block").html( $("#auth-block").html()+',<br />'+decodeURI(arr[3])+',<br />'+decodeURI(arr[4]) );				} else {					// розничный. соответственно					//document.getElementById("loginLink").innerHTML = decodeURI(arr[2]);					//$("#loginLink").html( decodeURI(arr[2]) );				}				document.getElementById("loginLink").href="/office";				isauth = true;			} else {				// если куки битые, то удаляем их				$.cookie("auth", "", { expires: -1, path:'/'});				//$("#catalog-link").parent().parent().css('padding-left: 100px;');			}		} else {			//$("#catalog-link").parent().parent().css('padding-left', 100);		}	});	// показываем блок с авторизацией	$("#header li.account a").hover(function(){		if(isauth) {			$("#auth-logout").css({'display' : 'block'});		} else {			$("#auth").css({'display' : 'block'});	}	}, function(){		if (onblock==false){			$("#auth").css('display', 'none');			$("#auth-logout").css({'display' : 'none'});			}		}	);	$("#reg-opt").change(function(){		if(this.checked) {			$("#company-set").css({'display' : 'block'});		} else {			$("#company-set").css({'display' : 'none'});		}	});	// форма поиска	$("#search").submit(		function(){			//alert('noob!');		}	);});function echeck(str) {	var at="@"	var dot="."	var lat=str.indexOf(at)	var lstr=str.length	var ldot=str.indexOf(dot)	if (str.indexOf(at)==-1){		return false	}	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){		return false	}	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){		return false	}	if (str.indexOf(at,(lat+1))!=-1){		return false	}	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){		return false	}	if (str.indexOf(dot,(lat+2))==-1){		return false	}	if (str.indexOf(" ")!=-1){		return false	}	return true}
