/*
 * © IT Media, 2008
 * www.itmedia.lv
 * info@itmedia.lv
 */

  $(document).ready(function(){  	if($.fn.fancybox){  	  $("div#gallery a").fancybox({  	  	hideOnContentClick:true,
  	  	zoomSpeedIn:0,
  	  	zoomSpeedOut:0,
  	  	overlayShow:true
  	  });
  	  $("#news").find("a.image").fancybox({
  	  	hideOnContentClick:true,
  	  	zoomSpeedIn:0,
  	  	zoomSpeedOut:0,
  	  	overlayShow:true
  	  });
  	  $("#download").find("a.thumb").fancybox({
  	  	hideOnContentClick:true,
  	  	zoomSpeedIn:0,
  	  	zoomSpeedOut:0,
  	  	overlayShow:true
  	  });
    }
  	$("#poll .submit input").bind("click",function(){
      return dovote();  	});
  	$("#print").bind("click",function(){      window.open($(this).attr("href"),'','height=600,width=800,scrollbars=yes,resizable=no,toolbar=no,location=no,status=no,menubar=no');      return false;  	});
  	if($.fn.pngFix){
  	  $(document).pngFix();
  	}
  	$("#children-menu").bind("mouseenter",function(){
      if(window.ttt){
        clearTimeout(ttt);
      }	      $("#children-submenu").css("display","").bind("mouseenter",function(){      	if(window.ttt){          clearTimeout(ttt);      	}      }).bind("mouseleave",function(){      	$(this).css("display","none");      });  	}).bind("mouseleave",function(){      ttt = window.setTimeout(function(){      	$("#children-submenu").css("display","none");      },500);  	});	
	$("#mid-menu a").bind("mouseover",function(){
	  if(!($(this).hasClass("active"))){
	    $(this).bind("mouseout",function(){
		  $(this).removeClass("active");
		});
	  }
	  $(this).addClass("active");	  
	});
  	if(strpos(document.location.href,"?print")){      $("a").bind("click",function(){      	return false;      }).css("cursor","text").removeAttr("href");
      $("form").bind("submit",function(){      	return false;      });
      window.print();  	}
  	$("#formdata").bind("submit",function(){      var str = "";
      var ok = true;      $("#formdata").find("*[name^='req']").each(function(){
        if($(this).val()=="" || $(this).val()=="0"){          str+=lx["form_"+$(this).attr("id")]+"\n";
          ok = false;        }
      });
      if(ok==false){      	alert(str);
      	return false;      }
      return true;  	});
  	$("a[rel='new'], a[rel='nofollow']").bind("click",function(){      window.open($(this).attr("href"));
      return false;  	});  });