$().ready(function(){
				   
   $("#myForm").validate({
		   rules : {
				   usrname : {required : true, minlength: 2},
				   pass : "required"
		   },
		   messages : {
				   usrname : {
						   required : "Введите ваше имя",
						   minlength : "Введите не менее, чем 2 символа."
				   },
				   pass : "Введите пароль"
		   }
   });

	

   $("#form_add").validate({
		   rules: {
		firstname: "required",
		lastname: "required",
		username: {
			required: true,
			minlength: 2
		},
		password: {
			required: true,
			minlength: 5
		},
		confirm_password: {
			required: true,
			minlength: 5,
			equalTo: "#password"
		},
		email: {
			email: true
		},
		topic: {
			required: "#newsletter:checked",
			minlength: 2
		},
		agree: "required"
	},
	messages: {
		firstname: "Please enter your firstname",
		lastname: "Please enter your lastname",
		username: {
			required: "Please enter a username",
			minlength: "Your username must consist of at least 2 characters"
		},
		password: {
			required: "Please provide a password",
			minlength: "Your password must be at least 5 characters long"
		},
		confirm_password: {
			required: "Please provide a password",
			minlength: "Your password must be at least 5 characters long",
			equalTo: "Please enter the same password as above"
		},
		email: "Электронный адрес некорректен",
		agree: "Please accept our policy"
	}
   });
   
  var flag = true;	
	$("h2.h2_all_foto").click(function(){	
		if (flag){ $("#full_foto").fadeIn("slow"); flag = false; }
		else{ $("#full_foto").fadeOut("slow"); flag = true; }
		return false;	
	});
	
	var flag_1 = true;	
	$("h2.h2_all_foto_1").click(function(){	
		if (flag_1){ $("#full_foto_1").fadeIn("slow"); flag_1 = false; }
		else{ $("#full_foto_1").fadeOut("slow"); flag_1 = true; }
		return false;	
	});
	
	var flag_2 = true;	
	$("h2.h2_all_foto_2").click(function(){	
		if (flag_2){ $("#full_foto_2").fadeIn("slow"); flag_2 = false; }
		else{ $("#full_foto_2").fadeOut("slow"); flag_2 = true; }
		return false;	
	});
	
	var flag_3 = true;	
	$("h2.h2_all_foto_3").click(function(){	
		if (flag_3){ $("#full_foto_3").fadeIn("slow"); flag_3 = false; }
		else{ $("#full_foto_3").fadeOut("slow"); flag_3 = true; }
		return false;	
	});
	
	var flag_4 = true;	
	$("h2.h2_all_foto_4").click(function(){	
		if (flag_4){ $("#full_foto_4").fadeIn("slow"); flag_4 = false; }
		else{ $("#full_foto_4").fadeOut("slow"); flag_4 = true; }
		return false;	
	});
	
	var flag_5 = true;	
	$("h2.h2_all_foto_5").click(function(){	
		if (flag_5){ $("#full_foto_5").fadeIn("slow"); flag_5 = false; }
		else{ $("#full_foto_5").fadeOut("slow"); flag_5 = true; }
		return false;	
	});
	
	
	$("a#single_1").fancybox({
	'zoomOpacity'			: true,
	'overlayShow'			: false,
	'zoomSpeedIn'			: 500,
	'zoomSpeedOut'			: 500
	});
	
	$("#full_foto a").fancybox({
	'zoomOpacity'			: true,
	'overlayShow'			: false,
	'zoomSpeedIn'			: 500,
	'zoomSpeedOut'			: 500
	});
	
	$("div.div_img_del a").fancybox({
	'zoomOpacity'			: true,
	'overlayShow'			: false,
	'zoomSpeedIn'			: 500,
	'zoomSpeedOut'			: 500
	});
	
	$("a.group1").fancybox({
	'zoomOpacity'			: true,
	'overlayShow'			: false,
	'zoomSpeedIn'			: 500,
	'zoomSpeedOut'			: 500
	});
	
	function Delete(num_object) 
	{ 
		if(confirm("Удалить запись?")) {parent.location='adm_del.php?id='+num_object} 
		else {return false;} 
	} 

	$("a.open img").hover(
	  function () {$(this).addClass("select");},
	  function () {$(this).removeClass("select");}
	);
	
	$("#li_hover").hover(
      function () {
		$("#menu_hude").fadeIn("slow");
      },
	  function () { }
    );
	
	$("#menu_hude").hover(
      function () {},
	  function () {
        $(this).fadeOut("slow");
      }
    );
	
	
	
	
	
});
