$(document).ready(function(){
	$(".del_news").click(function(){
		if(confirm("Вы действительно хотите удалить новость??")){
			return true;
		}
		else{
			return false;
		}
	});
	var W = 0;
	var H = 0;
	$(".pre_preview img").hover(function(){
		W = $(this).attr("width");
		H = $(this).attr("height");
		if($(this).attr("class")=='process'){
			$(this).removeClass("process").addClass("process1");
		}
		if($(this).attr("class")=='close'){
			$(this).removeClass("close").addClass("process");
			$(this).css({zIndex:"999"}).animate({
				marginLeft:"-"+((W/2))+"px",
				marginTop:"-"+(H/2)+"px",
				width:W*2,
				height:H*2
			},550,function(){
				$(this).removeClass("process").addClass("open");
			});
		}
	},function(){
		if($(this).attr("class")=='open' || $(this).attr("class")=='process'){
			$(this).css("z-index","998")
			.animate({
				width:W+"px",
				height:H+"px",
				marginLeft:"0px",
				marginTop:"0px"
			},550,function(){
				$(this).css("z-index","0").removeClass().addClass("close");
			}).removeClass().addClass("process1");
		}
	});
	
	$(".fullview").imageBox();
	/*var count_foto=$("a.fullview img").length;
	if($("a.fullview img").length){
		var y_win=getViewportHeight();
		var top=$(document).scrollTop()+y_win/2;
		$("body").prepend("<div class=\"fullshow\" style=\"z-index:999999999;\"></div>");
		$("div.fullshow").css("top",top).css("margin-top","-30px");
		$("div.fullshow").html("<div><div><div><div></div></div></div></div>");
		$("div.fullshow div").eq(0).addClass("tl");
		$("div.fullshow div").eq(1).addClass("tr");
		$("div.fullshow div").eq(2).addClass("bl");
		$("div.fullshow div").eq(3).addClass("br").html("<div class=\"w1\"><div></div></div><div class=\"w4\"><div class=\"w2\"></div></div><div class=\"w3\"><div></div></div>");*/
/*	var src='';
	var size='';
	var scr=$(document).scrollTop();
	var rel=''*/
	/*$("a.fullview img").click(function(){
		src=GetSrc($(this).attr("src"),"$2");
		$("div.fullshow div.w2").html("<img src=\""+src+"\" class=\"none\" />");
		var alt=$(this).attr("alt");
		rel=$(this).parent().attr("rel");
		$("div.fullshow div.w3 div").html(rel+" из "+count_foto);
		if(rel>1){
			$("div.fullshow div.w3 div").prepend("<a href=\"#\" class=\"prev\"><<<</a>");
		}
		if(rel<count_foto){
			$("div.fullshow div.w3 div").prepend("<a href=\"#\" class=\"next\">>>></a>");
		}
		alt=alt.split("jpg");
		alt=alt[0];
		$("div.fullshow div.w1 div").text(alt);
		size=$(this).attr("class").split("X");
		$("div.fullshow").fadeIn(500);
		openWin(size);
		return false;
	});*/
	/*$("div.fullshow div.w3 div a").live("click",function(){
		if($(this).attr("class")=='next'){
			var new_id=(rel*1)+1;	
		}
		else var new_id=rel-1;	
		var obj=$("a.fullview").filter(function (index) {
		    return $(this).attr("rel") == new_id;
  		}).children();
  		$(obj).trigger("click");
  		return false;
	});*/
	
	/*$("div.fullshow div.w2 img").live("click",function(){
		$("div.fullshow").fadeOut(500,function(){
			$("div.w2").html("").css("height","0px");
			var y_win=getViewportHeight();
			var top=$(document).scrollTop()+y_win/2;
			$("div.fullshow div.w1 div").text("").css("display","none");
			$("div.fullshow div.w3 div").text("").css("display","none");
			$("div.fullshow").css("top",top).css("margin-top","-30px").css("width","60px").css("margin-left","-30px").attr("id","");
		});
	});*/
	/*$("div.fullshow").everyTime(1000, function(i) {
		if(scr!=$(document).scrollTop()){
			if($("div.fullshow").attr("id")=='winOpen'){
				var t=$("div.fullshow").css("top");
				t=t.split("px");
				t=t[0]*1;
				var param=(t+($(document).scrollTop()-scr));
				scr=$(document).scrollTop();
				$("div.fullshow").animate({top:param+"px"},500);
			}
			else{
				scr=$(document).scrollTop();
			}
		}
	});/
	/*$(window).resize(function(){
		if($("div.fullshow").attr("id")=='winOpen'){
			openWin(size);
		}
	});
	}*/
});
/*function openWin(size){
	var x_size=size[0]*1;
	var y_size=size[1]*1;
	var y_win=getViewportHeight();
	var top=$(document).scrollTop()+y_win/2;
	//var hei=getDocumentHeight()-114;
	//var end_pic=top+((y_size+60)/2);
	if((y_size+20)>(y_win)){
		var old_y_size=y_size;
		y_size=y_win-100;
		x_size=(x_size*y_size)/old_y_size;
	}
	$("div.fullshow div.w1 div").css("display","none");
	$("div.fullshow div.w3 div").css("display","none");
	$("img.none").fadeOut(500,function(){
		$("img.none").attr("height",y_size).attr("width",x_size);
	});
	if($("div.fullshow").attr("id")=="winOpen"){
		$("div.fullshow").animate({marginLeft:-(x_size+60)/2,top:top,marginTop:-(y_size+60)/2,width:x_size*1+60},function(){
			$("div.fullshow div.w2").animate({height:y_size},function(){
				$("div.fullshow").animate({width:x_size*1+60},function(){
					$("img.none").fadeIn(500,function(){
						$("div.fullshow div.w1 div").fadeIn(200);
						$("div.fullshow div.w3 div").fadeIn(200);
					});
					$("div.fullshow").attr("id","winOpen");
				});
			});
		});
	}else{
		$("div.fullshow div.w2").animate({height:0},function(){
			$("div.fullshow").animate({width:60,left:"50%",marginLeft:"-30px",top:top,marginTop:"-30px"},function(){
				$("div.fullshow").fadeIn(500,function(){
					$("div.fullshow").animate({marginLeft:-(x_size+60)/2,top:top,marginTop:-(y_size+60)/2},function(){
						$("div.fullshow div.w2").animate({height:y_size},function(){
							$("div.fullshow").animate({width:x_size*1+60},function(){
								$("img.none").fadeIn(500,function(){
									$("div.fullshow div.w1 div").fadeIn(200);
									$("div.fullshow div.w3 div").fadeIn(200);
								});
								$("div.fullshow").attr("id","winOpen");
							});
						});
					});
				});
			});
		});
	}
}*/
/*function closeWin(){
	$("div.fullshow div.w2").animate({
		height:0
	},function(){
		$("div.fullshow").animate({
			width:60
		});
	},function(){
		$(this).attr("id","winClose");
	});
}*/
function GetSrc(AInputText, AReplaceText) { 
    var VRegExp = new RegExp(/(\w_)(.+\.jpg)$/);
    var VResult = AInputText.replace(VRegExp, AReplaceText); 
    return VResult; 
  }
var ua = navigator.userAgent.toLowerCase();
var isOpera = (ua.indexOf('opera')  > -1);
var isIE = (!isOpera && ua.indexOf('msie') > -1);
function getDocumentHeight() {
	return Math.max(document.compatMode != 'CSS1Compat' ? document.body.scrollHeight : document.documentElement.scrollHeight, getViewportHeight());
}
function getViewportHeight() {
	return ((document.compatMode || isIE) && !isOpera) ? (document.compatMode == 'CSS1Compat') ? document.documentElement.clientHeight : document.body.clientHeight : (document.parentWindow || document.defaultView).innerHeight;
}