$(document).ready(function(){
		$("div.topbut .img, div.leftbut .img, div.buten .img, div.butrus .img").mouseover(function(){
				var temp = $(this).attr("src");
				$(this).attr("src",$(this).attr("st"));
				$(this).attr("st",temp);
				if($(this).attr("portf")=="true"){					var temp = $("#prtfbut").attr("src");
					$("#prtfbut").attr("src",$($("#prtfbut")).attr("st"));
					$("#prtfbut").attr("st",temp);
				}
		}).mouseout(function(){				var temp = $(this).attr("src");
				$(this).attr("src",$(this).attr("st"));
				$(this).attr("st",temp);
				if($(this).attr("portf")=="true"){
					var temp = $("#prtfbut").attr("src");
					$("#prtfbut").attr("src",$($("#prtfbut")).attr("st"));
					$("#prtfbut").attr("st",temp);
				}		});

		$("div.buten img")
		.mouseover(function(){			$("div.buten").animate({marginTop: "-77px"},150);
			$("div.butrus").animate({marginTop: "-57px"},150);
			var temp = $(this).attr("src");
			$(this).attr("src",$(this).attr("st"));
			$(this).attr("st",temp);

			var temp = $("div.butrus").find("img").attr("src");
			$("div.butrus").find("img").attr("src",$("div.butrus").find("img").attr("st"));
			$("div.butrus").find("img").attr("st",temp);

		})
		.mouseout(function(){			$("div.buten").animate({marginTop: "-57px"},150);
			$("div.butrus").animate({marginTop: "-77px"},150);

			var temp = $(this).attr("src");
			$(this).attr("src",$(this).attr("st"));
			$(this).attr("st",temp);

			var temp = $("div.butrus").find("img").attr("src");
			$("div.butrus").find("img").attr("src",$("div.butrus").find("img").attr("st"));
			$("div.butrus").find("img").attr("st",temp);
		});

		$("div.forma input[@type='text'],div.forma textarea").focus(function(){
			$("input.send").css("color","#ED1C24");
		});

		$("#prochee").focus(function(){			$("input[@type='radio']").attr({"checked":"","disabled":"disabled"});
			}).blur(function(){				if($(this).val() == '')	{					$("input[@type='radio']").removeAttr("disabled");
				}
			}); 
/*
			if($("#newspage").size()>0){				gup();
			}
*/
});

function gup()
{
  var regex = new RegExp("\\d+.html");
  var res= regex.exec( window.location.href );
  if( res == null )
    return false;
  else
	  document.getElementById(res[0]).scrollIntoView(true);
	  //console.log(res[0]);
}

$("img").ready(function(){
    if($("#prtf").size()*1 < 1){			var temp = $("div.textzoner").clone().removeClass("textzoner").css({display:"none",width:"439px"});
			$("div.textzoner").after(temp);	    if(temp.height()*1 > 541){
	    	$("div.listing").after('<div class="listingnews next"><a href="javascript://" onclick="nexttext('+temp.height()+', this)">далее &gt;&gt;</a></div>')
	    	$("div.listing").after('<div class="listingnews prev"><a href="javascript://" onclick="prevtext('+temp.height()+', this)">&lt;&lt; назад</a></div>')
	    }
    }
	});

function nexttext(h,a){
	//var position = h*1-$("div.textzoner").height();	$("div.in").animate({marginTop: "-540px"},100);
	$("div.next").css("display","none");
	$("div.prev").css("display","block");
}
function prevtext(h,a){
	$("div.in").animate({marginTop: "0px"},100);
	$("div.prev").css("display", "none");
	$("div.next").css("display","block");
}

function check_form_stat(){	if(check_form_f())
		$("#gogo").submit();
	else{		if($.browser.msie){
			$("#rep").html("<span style='color: #f00;'>Просмотр статистики доступен после отправки запроса.</span>");
			$("#rep").html("<span style='color: #f00;'>Просмотр статистики доступен после отправки запроса.</span>");
			$("#rep").html("<span style='color: #f00;'>Просмотр статистики доступен после отправки запроса.</span>");
			$("#rep").html("<span style='color: #f00;'>Просмотр статистики доступен после отправки запроса.</span>");
		}else
			$("#rep").html("<span style='color: #f00;'>Просмотр статистики доступен после отправки запроса.</span>");
	}

}
function check_form(){
	if(check_form_f())
		$("#gogo").submit();
	else
		$("#rep").html("<span style='color: #f00;'>Для отправки запроса заполните, пожалуйста, все графы формы.</span>");

}

function check_form_f(){
	var res = true;
	$("div.forma input[@eto='1'], div.forma textarea[@eto='1']").css("border-color","white")
	.each(function(){		if( $(this).val() == ''){
			res = false;
			$(this).css("border","1px solid #FF0000");
		}
	});
	return res;

}




