$(function(){
	$(".a_ekran").click(function(){
		$('#sgs').addClass('fullscreen').removeClass('normalscreen');
		$('#fsclose').removeClass('dispnon');
		return false;
	});
	
	/*
	var hrot=2;
	function showHRot(){
		$('.hrot').addClass('dispnon');
		if(hrot==1){
			$('#hrot1').removeClass('dispnon');
			hrot=2;
		}else if(hrot==2){
			$('#hrot2').removeClass('dispnon');
			hrot=1;
		}
		var t = setTimeout(function(){showHRot();},10000);
	}
	
	setTimeout(function(){showHRot();},10000);
	*/
	$(".a_ekran2").click(function(){
		$('#sgs').removeClass('fullscreen').addClass('normalscreen');
		$('#fsclose').addClass('dispnon');
		return false;
	});
	
	$(".addsite, .senderr").click(function(){
			return false;
	});
	
	$(".podcat").live("mouseover", function(e){
		if(e.type=="mouseover"){
			$(".podcatT").addClass("dispnon");
			$("#"+this.rel).removeClass("dispnon").css({"top": (e.pageY-30)+"px", "left": (e.pageX-200)+"px"});
		}
	});
	
	$(".w850, .blok_onsite, .tm, .poisk").mouseover(function(){
		$(".podcatT").addClass("dispnon");
	});
	
	$(".img").live("mousemove mouseout click", function(e){
    var arrval=this.title.split(',');
		if(e.type=="mousemove"){
			var next='l';
			for(i=1; i<=arrval[0]; i++){
				$(".img#m"+i+arrval[1]).addClass("pos1_"+next).removeClass("pos0_"+next);
				if(next=='l') next='r';
				else if(next=='r') next='l';
			}
    }else if(e.type=="mouseout"){
			var next='l';
      for(i=1; i<=10; i++){
				$(".img#m"+i+arrval[1]).addClass("pos0_"+next).removeClass("pos1_"+next);
				if(next=='l') next='r';
				else if(next=='r') next='l';
			}
    }else if(e.type=="click"){
			$(".golosovat#r"+arrval[1]).find('div').removeClass("img curpo");
      $.ajax({
				type: "POST", cache: false, url: "index.php?ajax=rating",
				data:{aid: arrval[1], tr: arrval[0]}
			});
    }
  });
	
	$("#l_arr").mouseover(function () {$(this).find('div').toggleClass("left_arr_over");});		
	$("#l_arr").mouseout(function () {$(this).find('div').toggleClass("left_arr_over");});		
	$("#r_arr").mouseover(function () {$(this).find('div').toggleClass("right_arr_over");});		
	$("#r_arr").mouseout(function () {$(this).find('div').toggleClass("right_arr_over");});	
		
  $("#r_arr").click(function(){
		var str1=Number(this.rel);
    var str2=$("#listimg").css("left");
    str2=Number(str2.slice(0,-2));
    if(str1<str2){
      $("#listimg").css("left", "-=160");
    }else if(str1==str2){
      $("#listimg").css("left", "-800")
    }
    return false;
  }); 
	
	$("#l_arr").click(function(){
    var str2=$("#listimg").css("left");
    str2=Number(str2.slice(0,-2));
    if(this.rel>str2){
      $("#listimg").css("left", "+=160");
    }else if(str2==0){
      $("#listimg").css("left", '0');
    }
    return false;
  });
});

function getBrowserInfo() {
 var t,v = undefined;
 if (window.opera) t = 'Opera';
 else if (document.all) {
  t = 'IE';
  var nv = navigator.appVersion;
  var s = nv.indexOf('MSIE')+5;
  v = nv.substring(s,s+1);
 }
 else if (navigator.appName) t = 'Netscape';
 return {type:t,version:v};
}
 
function bookmark(a){
 var url = window.document.location;
 var title = window.document.title;
 var b = getBrowserInfo();
 if (b.type == 'IE' && 7 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
 else if (b.type == 'Opera') {
  a.href = url;
  a.rel = "sidebar";
  a.title = url+','+title;
  return true;
 }
 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
 return false;
}
