
function ShowImag(file, w, h){
      ww = w;
      hh = h;
      window.open('/photo.php?f='+file+'&w='+w+'&h='+h, 'Sample', ' width='+ww+', height='+hh+', scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no');
 }
 
 function fixPNG(element){
  //Если браузер IE версии 5.5-6
  if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)){
    var src;
	
    if (element.tagName=='IMG'){ //Если текущий элемент картинка (тэг IMG)
      if (/\.png$/.test(element.src)){ //Если файл картинки имеет расширение PNG
        src = element.src;
        element.src = "/images/p.gif"; //заменяем изображение прозрачным gif-ом
      }
    }else{ //иначе, если это не картинка а другой элемент
	  //если у элемента задана фоновая картинка, то присваеваем значение свойства background-шmage переменной src
      src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
      if (src){
        src = src[1]; //берем из значения свойства background-шmage только адрес картинки
        element.runtimeStyle.backgroundImage="none"; //убираем фоновое изображение
      }
    }
    //если, src не пуст, то нужно загрузить изображение с помощью фильтра AlphaImageLoader
    if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='image')";
  }
}


   $(document).ready(function(){
	  $(".btn-slide").click(function(){
		    $("#panel").slideToggle("slow");
		    return false;
	  }); 
	  
	  $("#btncancel").click(function(){
           document.getElementById("guest_mess").value=" Сообщение";
		   document.getElementById("guest_city").value=" Город";
		   document.getElementById("guest_name").value=" Имя";
      }); 
	  $("#tsearch").focus(function(){
        if (this.value==" Поиск...") this.value = "";
      });
      $("#tsearch").blur(function(){
        if (this.value=="") this.value = " Поиск...";
      });
   
      $("#guest_name").focus(function(){
        if (this.value==" Имя") this.value = "";
      });
      $("#guest_name").blur(function(){
        if (this.value=="") this.value = " Имя";
      });
      $("#guest_city").focus(function(){
        if (this.value==" Город") this.value = "";
      });
      $("#guest_city").blur(function(){
        if (this.value=="") this.value = " Город";
      });
      $("#guest_mess").focus(function(){
        if (this.value==" Сообщение") this.value = "";
      });
      $("#guest_mess").blur(function(){
        if (this.value=="") this.value = " Сообщение";
      });
	  
	  $('.topmenu ul li').hover(
        function() {
            //$(this).addClass("active");
            $(this).find('ul').stop(true, true);
            $(this).find('ul').slideDown();
        },
        function() {
            //$(this).removeClass("active");
            $(this).find('ul').slideUp('slow');
        }
      );
	  
	  $("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
	
	  $("ul.topnav li span").click(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	 });
	
   });

