
$(document).ready(function(){

	//hide message_body after the first one
	$(".message_list .message_body").hide();

	//toggle message_body
	$(".message_head").click(function(){
		$(this).next(".message_body").slideToggle(100)
		return false;
	});
	//collapse all messages
	$(".collpase_all_message").click(function(){
		//$(this).hide()
		//$(".show_all_message").show()
		$(".message_body").slideUp(100)
		return false;
	});
	//show all messages
	$(".show_all_message").click(function(){
		//$(this).hide()
		//$(".collpase_all_message").show()
		$(".message_body").slideDown()
		return false;
	});
});


// при событии resize пересчитать размеры двух центральных блоков
  window.onresize=SizeBox;

// функция пересчета
  function SizeBox()
  {
  var x=$(window).width();    // получаем ширину и высоту доступной области окна
  var y=$(window).height();

    //alert (x+" "+y);    //для проверки

   // document.getElementById("menuh").style.left=(x/2-292)+"px";
  //  document.getElementById("titimg").style.left=(x/2-500)+"px";
  // document.getElementById("container-scroll").style.width=(x-310)+"px";


  }

     function SeeBigInGal(idgalimg)
  {
    var nimg=new Image(); // расчет размера нового окна под размер картинки
    nimg.src="gal/1024x768/"+idgalimg;
    var w=nimg.width;
    var h=nimg.height;
    if (w==0) {w=450};
    if (h==0) {h=450};
  var x=$(window).width();    // получаем ширину и высоту доступной области окна
  var y=$(window).height();
      // alert (w+" "+h+" " +x+" " +y);
     document.getElementById("bigim").style.left=(x/2-w/2)+"px";
     document.getElementById("bigim").style.top=(y/2-h/2)+"px";
  	 document.getElementById("seeimg").src="";
     document.getElementById("seeimg").src="gal/1024x768/"+idgalimg;
     document.getElementById("seeimg").onload=function(){$("#bigim").fadeIn("slow");}
  }

    function SeeBigIn(idgalimg)
  {    var nimg=new Image(); // расчет размера нового окна под размер картинки
    nimg.src="webadmin/uploads/otziv/sm/"+idgalimg;
    var w=nimg.width;
    var h=nimg.height;
    if (w==0) {w=450};
    if (h==0) {h=450};

  var x=$(window).width();    // получаем ширину и высоту доступной области окна
  var y=$(window).height();

     document.getElementById("bigim").style.left=(x/2-w/2)+"px";
     document.getElementById("bigim").style.top=(y/2-h/2)+"px";
  	 document.getElementById("seeimg").src="";
     document.getElementById("seeimg").src="webadmin/uploads/otziv/sm/"+idgalimg;
     document.getElementById("seeimg").onload=function(){$("#bigim").fadeIn("slow");}
  }

  function SeeBigOut()
  {
    $("#bigim").fadeOut("slow", function() {document.getElementById("seeimg").src="";});

  }

      function hidesee(blockh) {
      $("#"+blockh).toggle("fast");
    }

      function IntoBasket(idm) {
  //document.getElementById('basket').innerHTML='';
	var url='json.php';
	var kol=document.getElementById('kol'+idm).value;
	$('#basket').load(url, {id: idm,k: kol});
	document.getElementById('kol'+idm).style.background="#a7f89d";
  }
  function IntoBasketReq(idm,im) {
  //document.getElementById('basket').innerHTML='';
	var url='jsonreq.php';
	var kol=document.getElementById('kol'+idm).value;
	$('#basket').load(url, {id: idm,k: kol,i: im},function(){location.replace('basket.php');});
	document.getElementById('kol'+idm).style.background="#a7f89d";
	//location.replace('basket.php');
  }
