$(document).ready(function(){

	$("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"
	});

      $("#titletd").show().animate({opacity: 1},2000);


      if (window.innerWidth) {var wid=window.innerWidth; }
      else if(document.body && document.body.clientWidth) {var wid = document.body.clientWidth;}
      if (wid<1200) {
	$("img.trix").attr("height","61");
	$("img.pair").attr("height","190");
	$("img.allmodel").attr("height","150");
      }

      var antispam = Math.floor( Math.random( ) * 900 ) + 999;      
      $("span#antispam").html(antispam);
      $("form#guestf").append("<input type='hidden' name='antispamcheck' value='"+antispam+"'>");

});

function intro(){
      $("#introimg").bind('load',function(){ show().animate({opacity: 1},2000); });
      $("#introimg").show().animate({opacity: 1},3000);
      $("#introimg").show().animate({opacity: 0},2000);
      $("#introimg").show().animate({opacity: 0},3000);
      intro();
}

function menucenter(lang){
      if (lang=='en') {var ww3=880} else {var ww3=956}
      if (window.innerWidth) {var ww1=window.innerWidth; }
      else if(document.body && document.body.clientWidth) {var ww1 = document.body.clientWidth;}
      var ww2=(ww1-ww3)/2; 
      if (ww2<0) {ww2=0}
      document.getElementById("menu").style.left=ww2; 
}

function checkform(obj) {
  var ree1 = /\S+/gi;
  var ree2 = /\S+\@\S+\.\S+/i;
  var unameree = obj.uname.value.match(ree1);
  var uspamree = obj.antispam.value.match(ree1);
    if ( unameree == null )  { alert( "Çàïîëíèòå ïîëå ÈÌß" ); return false;   }
    if ( uspamree == null )  { alert( "Çàïîëíèòå ïîëå ÏÐÎÂÅÐÎ×ÍÛÉ ÊÎÄ" ); return false;   }
    return true;
}

