
/*$(document).ready(function(){
		$('li.headlink').hover(
			function() { $('div.menu-over-wrapper', this).css('display', 'block'); },
			function() { $('div.menu-over-wrapper', this).css('display', 'none'); });
	});*/

/*validar*/	














var rules = { nombre: 'Please review the name field.', email: 'Please review the email field.', mensaje: 'message',email2: 'Please review the confirm email field.',pass: 'Please review the password field.', pass2: 'Please review the desired password field.',emaillogin:'el email es incorrecto',namerecipe:'Name',categoriesrecipes:'Available courses',recipestext:'Recipe'};

var filters = {
    requerido: function(el) {return ($(el).val() != '' && $(el).val() != -1 && $(el).val() != 'Your Name' && $(el).val() != 'Your Message' && $(el).val() != 'Desired Password' && $(el).val() != 'Confirm Password' && $(el).val() != 'Your Email' && $(el).val() !='Recipe Name' && $(el).val() != 'Select...');},
    email: function(el) {return /^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/.test($(el).val());},
    telefono: function(el){return /^[0-9]*$/.test($(el).val());},
	emailr: function(el) {return ("$('#emal').val()".indexOf($(el).val()));},
	passr:function(el) {return ("$('#pass2').val()".indexOf($(el).val()));},
	emaillogin:function(el){return loginEmail();}}
	

$.extend({
	stop: function(e){
        if (e.preventDefault) e.preventDefault();
        if (e.stopPropagation) e.stopPropagation();
    }
});
// Código
var a='';
$(document).ready(function(){
	/*
	Video
	
	video video
	
	*/
	
	$('#video-pro').click(function (e) {
				e.preventDefault();
				var src = this.hash.substr(1);
				$.modal('<iframe src="' + src + '" height="577" width="741" style="border:0">', {
				closeHTML:'<a href="#" style=" position:absolute;right:15px; top:15px;" ><img src="http://sensiohome.com/images/newsletter-close.gif" alt="" /></a>',
				containerCss:{
				borderColor:"#252525",
				height:577,
				padding:0,
				width:741
				},
				overlayClose:true,
				opacity:80
				});

	
	});
	$('#video-cook').click(function (e) {
				e.preventDefault();
				var src = this.hash.substr(1);
				$.modal('<iframe src="' + src + '" height="577" width="741" style="border:0">', {
				closeHTML:'<a href="#" style=" position:absolute;right:15px; top:15px;" ><img src="http://sensiohome.com/images/newsletter-close.gif" alt="" /></a>',
				containerCss:{
				borderColor:"#252525",
				height:577,
				padding:0,
				width:741
				},
				overlayClose:true,
				opacity:80
				});

	
	});
	
	
	/*Fromulario Footer*/
	
		$('#enviarnewfooter').click(function(e){
										 e.preventDefault();
											   
		$.post('http://sensiohome.com/ajax/new.php',{correo:$('#emailfooter').val()}, function(data) {
																								
  if(data=='ok'){$('.blockerroryes').fadeIn();
 				 $('.blockerrorno').hide();
  }
  if(data=='email'){
	  			$('.blockerroryes').hide();
 				 $('.blockerrorno').fadeIn();}
   if(data=='error'){	$('.blockerroryes').hide();
 						 $('.blockerrorno').fadeIn()}
});
			   
													   
													   });
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	$('#formsearch').submit(function(e){
		 e.preventDefault();
		 //alert('search')
		if($('#bes').attr('title')==$('#bes').val()){
			
		window.location=this.action+'/';
			
			}else{
		window.location=this.action+'/'+$('#bes').val().replace(/%20/g, '+');
			}
		
		});
	
	
	$('#recupero').click(function(e){
		 e.preventDefault();
		$('.loginuno').slideUp();
		$('#formulariodos').slideDown("slow");
		});
	$('#volverallogin').click(function(e){
		e.preventDefault();
		
		//$('#formulariodos').slideUp();
		$('.loginuno').slideDown("slow");
		$("#respuestaforgo").slideUp();
		})
	
	$('#try').click(function(e){
		 e.preventDefault();
		$('#registerformu').slideDown("slow");
		$('#register').slideUp();
		$('#respuestaforgo').slideUp();
		
		})
	
	
	
	$("form.validable").bind("submit", function(e){
			//var $mifor=this.id;									
												
		if (typeof filters == 'undefined') return;
	    $(this).find("input, textarea, select").each(function(x,el){
	        if ($(el).attr("className") != 'undefined') {
	        $.each(new String($(el).attr("className")).split(" "), function(x, klass){
	            if ($.isFunction(filters[klass]))
	                if (!filters[klass](el)) $(el).addClass("error");
	        });
	        }
	    });
		var nume=1;
		if ($(this).find(".error").size() > 0) {
			$.stop(e || window.event);
		
			$('.error').each(function(x,el){
				if(nume<4){
			a=a+' '+rules[$(el).attr("id")]+' <br/> ';	
				}
		
			
			
					});
				
			$('#liserror').html(a); 
			$('#register').slideDown("slow");
			$('#registerformu').slideUp();
					/*a='';
					$('.error').removeClass('error');
		*/
			return false;
		}
	    return true;
	});
	
	
	/*function loginEmail(){
		alert('uno')
	$.post("http://27478426.com.ar/test/ajax/chcklogin.php",{email:$('#emaillogin').val()},function(data){
			alert($(el).val()+'la data'+data);
			if(data){
				
			return true;																				
	}else{
		return false;
		
		}
});
	}
	*/
	
	
	/*
	
	$('#login').submit(function(e){
	//e.preventDefault();
	
	$.post("http://27478426.com.ar/test/ajax/chcklogin.php",{email:$('#emaillogin').val()},function(data) {
			alert('algo no?'+data);																						
  
});
	return false;	
	
	});
	*/
	
	var a_link = $('li.headlink a.item');
	
	$('li.headlink').hover(
		function() { 
			$('.menu-over-wrapper', this).css('display', 'block');
			$(this).find('.item').css('background-position', '0 -59px');
			//a_link.css('background-position', '0 -59px')
		},
		function() {
			$('.menu-over-wrapper', this).css('display', 'none');
			$(this).find('.item').css('background-position', '0 0');
			//a_link.css('background-position', '0 0')
		}
	);

		
		
$('#GORDONPRODUCTHOME').hover(
			function() { $('.submenu-arrow img', this).css('display', 'block'); },
			function() { $('.submenu-arrow img', this).css('display', 'none'); });
			
$('#PROPRODUCTHOME').hover(
			function() { $('.submenu-arrow img', this).css('display', 'block'); },
			function() { $('.submenu-arrow img', this).css('display', 'none'); });
			$('#BIONAIREHOME').hover(
			function() { $('.submenu-arrow img', this).css('display', 'block'); },
			function() { $('.submenu-arrow img', this).css('display', 'none'); });
			$('#GOURMETHOME').hover(
			function() { $('.submenu-arrow img', this).css('display', 'block'); },
			function() { $('.submenu-arrow img', this).css('display', 'none'); });
			$('#SWEETTREATSHOME').hover(
			function() { $('.submenu-arrow img', this).css('display', 'block'); },
			function() { $('.submenu-arrow img', this).css('display', 'none'); });
			
			$('#RECIPES').hover(
			function() { $('.submenu-arrow img', this).css('display', 'block'); },
			function() { $('.submenu-arrow img', this).css('display', 'none'); });
			$('#ARGOS').hover(
			function() { $('.submenu-arrow img', this).css('display', 'block'); },
			function() { $('.submenu-arrow img', this).css('display', 'none'); });

	
	
	
	
	
});


$(function(){
	
		
	
		$('#cousersend').click(function(e){
								$sendurl=$('#couserselect').val();		
										if($sendurl!='Show all...'){
											location.href=$sendurl;
											
											}
										
										});
		
		
		
		
		
		
		  $('#enviarnew').click(function(e){
										 e.preventDefault();
											   
		$.post('http://sensiohome.com/ajax/new.php',{correo:$('#newemail').val()}, function(data) {
																								
  if(data=='ok'){$('#newmessage').text('thanks').fadeIn();}
  if(data=='email'){$('#newmessage').text('email not valid ').fadeIn();}
   if(data=='error'){$('#newmessage').text('error try again later').fadeIn();}
});
			   
													   
													   });
						
						
                  
                  
			
	$('.Newsletter').click(function (e) {
		$('.newsletter-popup').modal({close:false,opacity:80,focus:'#newmessage', maxWidth:524,maxHeight:268,onShow: function (dialog) {
			$('#newemail', dialog.data).hint();
						}
			// if the user clicks "yes"
	
			});
		e.preventDefault();

		
		 
	});
         
          $("#directAccesori").change(function() {

				if($(this).val()!='Select...'){									 
                window.location = $(this).val();

				}
              });
          
  

		 
		   
		   
		   
		   
		   
		   });
