var n;$(document).ready(function(){	n = 1;	$("body").everyTime(5000, function() {		showNextObject();	});	//colorbox	$("a[rel='gal']").colorbox({opacity:0.5, scalePhotos:true, maxWidth:"90%", maxHeight:"90%", current:"{current} / {total}", slideshow:true, slideshowAuto:false, slideshowStart:"начать слайдшоу", slideshowStop:"остановить слайдшоу"});	$("a.gal").colorbox({opacity:0.5, scalePhotos:true, maxWidth:"90%", maxHeight:"90%", current:"{current} / {total}"});	//Форма поиска		if($('#search-txt').val() == 'Поиск по сайту'){$('search-txt').css({color:'#979797'});}	else{$('search-txt').css({color:'#000'});}	$('#search-txt').focus(function(){		if ($('#search-txt').val() == 'Поиск по сайту'){			$('#search-txt').val('');		}		$('#search-txt').css({color:'#000'});	});	$('#search-txt').blur(function(){		if ($('#search-txt').val() == ''){			$('#search-txt').val('Поиск по сайту');			$('#search-txt').css({color:'#979797'});		}	});		$("#subscribe #d-sel").click(		function(){			if($("#subscribe UL").css('display') == 'none'){				$("#subscribe UL").slideDown(150);				$("#subscribe #d-sel-ico").html('&minus;')			}else{				$("#subscribe UL").slideUp(150);				$("#subscribe #d-sel-ico").html('+')							}		}	);	if($("#unsuber").attr('checked')){		$("#subscribe .selectbox").css('display','none');		$("#subscribe .sub").css('display','none');		$("#subscribe .unsub").css('display','block');	}	$("#subscribe .unsubscribe").change(		function(){			if($("#subscribe .selectbox").css('display') == 'none'){				$("#subscribe .selectbox").slideDown(150);				$("#subscribe .sub").css('display','block');				$("#subscribe .unsub").css('display','none');			}else{				$("#subscribe .selectbox").slideUp(150);				$("#subscribe .sub").css('display','none');				$("#subscribe .unsub").css('display','block');							}		}	);	$("#subscribe UL li input").change(		function(){				var n = $("#subscribe ul li input:checked").length;				if (n>0){$("#subscribe .allcity").removeAttr('checked');}		}	);		$('#subs-link').click(		function(){			if($("#subscribe").css('display') == 'none'){				$("#subscribe").slideDown(150);			}else{				$("#subscribe").slideUp(150);			}		}	);			if($('#pochto').val() == 'Адрес электронной почты'){$('#pochto').css({color:'#979797'});}	else{$('#pochto').css({color:'#000'});}	$('#pochto').focus(function(){		if ($('#pochto').val() == 'Адрес электронной почты'){			$('#pochto').val('');			$('#pochto').css({color:'#000'});		}	});	$('#pochto').blur(function(){		if ($('#pochto').val() == ''){			$('#pochto').val('Адрес электронной почты');			$('#pochto').css({color:'#979797'});		}	});	//ROTATOR	$('#c-left .l1 .n-r-p').hover(		function(){			$(this).css('cursor','pointer');			$('#news-rotator').css('display', 'block');			$('#news-rotator2').css('display', 'none');			$('#news-rotator3').css('display', 'none');			n=1;		}	);	$('#c-left .l2 .n-r-p').hover(		function(){			$(this).css('cursor','pointer');			$('#news-rotator').css('display', 'none');			$('#news-rotator2').css('display', 'block');			$('#news-rotator3').css('display', 'none');			n=2;		}	);	$('#c-left .l3 .n-r-p').hover(		function(){			$(this).css('cursor','pointer');			$('#news-rotator').css('display', 'none');			$('#news-rotator2').css('display', 'none');			$('#news-rotator3').css('display', 'block');			n=3;		}	);	$('#news-rotator, #news-rotator2, #news-rotator3').hover(		function(){			$("body").stopTime();		},		function(){			$("body").everyTime(5000, function() {			showNextObject();		});		}	);	$('.banner a').hover(		function(){			this.css('cursor','pointer');		},		function(){		}	);});var ShowReaktiveFlag = false;function ShowReaktiveStart(){ ShowReaktiveFlag = true; setTimeout("ShowReaktive()",50); }function ShowReaktive(){	if ((ShowReaktiveFlag) && ($("#reaktive_block").css('display')=='none')){		$("#reaktive_block").css({display: "block"});		$("#reaktive_block IMG").css({width: 0, height: 0, left: "207px", top: "131px"});		$("#reaktive_block IMG").animate({width: 274, height: 131, left:0, top:0}, 150);	}}function HideReaktiveStart(){ ShowReaktiveFlag = false; setTimeout("HideReaktive()",50); }function HideReaktive(){	if ((!ShowReaktiveFlag) && ($("#reaktive_block").css('display')!='none')){		if ($.browser.msie) $("#reaktive_block").css('display','none');		else $("#reaktive_block").fadeOut(300);	}}function hideForm(){$(".up_auth_form").hide(); $("#dark").hide();}function showForm(obj){ 	$("#dark").show(); 	$("#"+obj).show(); 	actForm = "#"+obj;} function showNextObject(){	if (n>3) {n=1;}	if (n==1){		if($('#news-rotator').length){			$('#news-rotator').css('display', 'block');			$('#news-rotator2').css('display', 'none');			$('#news-rotator3').css('display', 'none');		}	}	if (n==2){		if($('#news-rotator2').length){			$('#news-rotator').css('display', 'none');			$('#news-rotator2').css('display', 'block');			$('#news-rotator3').css('display', 'none');		}	}	if (n==3){		if($('#news-rotator3').length){			$('#news-rotator').css('display', 'none');			$('#news-rotator2').css('display', 'none');			$('#news-rotator3').css('display', 'block');		}	}	n = n+1;};function	emailCheck (emailStr) {	var checkTLD=1;	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;	var emailPat=/^(.+)@(.+)$/;	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";	var validChars="\[^\\s" + specialChars + "\]";	var quotedUser="(\"[^\"]*\")";	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;	var atom=validChars + '+';	var word="(" + atom + "|" + quotedUser + ")";	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");	var matchArray=emailStr.match(emailPat);	if (matchArray==null) return false;	var user=matchArray[1];	var domain=matchArray[2];	for (i=0; i<user.length; i++)	if (user.charCodeAt(i)>127) 	return false;	for (i=0; i<domain.length; i++)	if (domain.charCodeAt(i)>127)	return false;	if (user.match(userPat)==null) 	return false;	var IPArray=domain.match(ipDomainPat);	if (IPArray!=null) {	for (var i=1;i<=4;i++) if (IPArray[i]>255) return false;		return true;	}	var atomPat=new RegExp("^" + atom + "$");	var domArr=domain.split(".");	var len=domArr.length;	for (i=0;i<len;i++) if (domArr[i].search(atomPat)==-1)	return false;	if (checkTLD && domArr[domArr.length-1].length!=2 &&	domArr[domArr.length-1].search(knownDomsPat)==-1)			return false;	if (len<2)		return false;	return true;}function	trim(s){	return 	s.replace(/^(\s*)/,"$`").replace(/(\s*)$/,"$'");}function SendTheFeed(obj){	if (trim(obj.uname.value)==""){ alert('Представьтесь, пожалуйста'); return false; }	if (!emailCheck(obj.umail.value)){ alert('Укажите, пожалуйста, корректный адрес электронной почты'); return false; }	if (trim(obj.utext.value)==""){ alert('Введите текст сообщения'); return false; }	var timeobj = document.getElementById("wait");	var sendobj = document.getElementById("mail-send");	var sentobj = document.getElementById("mail-sent");	var date=new Date();	sendobj.style.display = "none";	sentobj.style.display = "none";	timeobj.style.display = "";	requrl = "/inc/sendmail.php?uname="+encodeURI(obj.uname.value)+"&umail="+encodeURI(obj.umail.value)+"&email="+encodeURI(obj.email.value)+"&utext="+encodeURI(obj.utext.value)+"&uniq=" +date.getTime();	var XHttpRequest = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");	if (XHttpRequest){		XHttpRequest.onreadystatechange = function(){ 			if (XHttpRequest.readyState == 4) 				if (XHttpRequest.status == 200){					newval = parseInt(XHttpRequest.responseText,10);					sendobj.style.display = "none";					timeobj.style.display = "none";					sentobj.style.display = "";					setTimeout("ReadyToSendFeedBack()",3000);					return XHttpRequest.responseText;				}				else{					alert("Ошибка. Попробуйте позднее");					sendobj.style.display = "";					sentobj.style.display = "none";					timeobj.style.display = "none";					return false;				}		};		XHttpRequest.open("GET", requrl, true);		XHttpRequest.send("null");	}}function ReadyToSendFeedBack(){	hideForm();	var timeobj = document.getElementById("wait");	var sendobj = document.getElementById("mail-send");	var sentobj = document.getElementById("mail-sent");	sendobj.style.display = "";	sentobj.style.display = "none";	timeobj.style.display = "none";}function SendSubscribe(obj){	if (!emailCheck(obj.ep.value)){ alert('Укажите, пожалуйста, корректный адрес электронной почты'); return false; }	var date=new Date();	if (obj.unsubscribe.checked) requrl = "/inc/subscribe.php?umail="+encodeURI(obj.ep.value)+"&type=u&uniq=" +date.getTime();	else {		if (obj.city.checked) requrl = "/inc/subscribe.php?umail="+encodeURI(obj.ep.value)+"&type=s&d=all&uniq=" +date.getTime();		else {			tc = '';			if (obj.moto.checked) tc += 'moto_';			if (obj.dzer.checked) tc += 'dzer_';			if (obj.kir.checked) tc += 'kir_';			if (obj.ordj.checked) tc += 'ordj_';			if (obj.sver.checked) tc += 'sver_';			if (obj.len.checked) tc += 'len_';			if (obj.ind.checked) tc += 'ind_';			requrl = "/inc/subscribe.php?umail="+encodeURI(obj.ep.value)+"&type=s&d="+tc+"&uniq=" +date.getTime();		}	}	//alert(requrl);	var XHttpRequest = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");	if (XHttpRequest){		XHttpRequest.onreadystatechange = function(){ 			if (XHttpRequest.readyState == 4) 				if (XHttpRequest.status == 200){					newval = XHttpRequest.responseText;										//setTimeout("ReadyToSendFeedBack()",3000);					if (newval=='s') alert('Вы успешно подписались на рассылку');					else if (newval=='u') alert('Вы успешно отписались от рассылки');					else alert('Ошибка. Попробуйте позднее.');					$("#subscribe").slideUp(150);					return true;//XHttpRequest.responseText;				}				else{					alert("Ошибка. Попробуйте позднее..");					//sendobj.style.display = "";					//sentobj.style.display = "none";					//timeobj.style.display = "none";					return false;				}		};		XHttpRequest.open("GET", requrl, true);		XHttpRequest.send("null");	}}
