$(document).ready(function() {
						   

	/////////////////////////////////////////////
	var option = {
	resizeLgImages: true,
	displayNav: true
	//handleUnsupported : 'remove',
	//keysClose: ['c', 27]
	};

	//Shadowbox.init(option);
	Shadowbox.init();
	/////////////////////////////////////////////
	
	
	$(".footer ul li:last-child").css("border","none");
	
	$(".main .down .available .details ul li:last-child").css("height","82px");
	
	
	// click para el "li" de la vista available...
	$(".main .down .available .details ul li a.show").click(function(){
																	 
		$(".main .down .available .details ul li").removeClass("li_gen");
		$(this).parents("li").addClass("li_gen");
		return false;
	
	});
	
	
	/*	Form User friendly	*/
	
	$("form").find(".required").not(".email").each(function(){
		$(this).keyup(function(){
			if(IsBlank($(this).val())) // si el valor del input está vacío…
			{		
				if($(this).siblings("span.error").length == 0 ){ 
					//$(this).siblings("span.error").remove();
					$(this).css("border","1px solid #f00");
					$(this).after('<span class="error">This is a required field.</span>');
					$(this).siblings("span.error").css("display","block");
				}
			}
			else    // si no está vacío el campo . . . 
			{
				$(this).css("border","1px solid #E6E6E6");
				$(this).siblings("span.error").remove();
			}
		});
		
	});


	$("form").find(".email").filter(".required").each(function(){
		$(this).keyup(function(){
			if(!isValidEmail($(this).val())){ // este input es pasado por la función ‘valid_email()’ … si no es correcto…				
				
				if($(this).siblings("span.error").length == 0 ){ 
					$(this).siblings("span.error").remove();
					$(this).css("border","1px solid #f00");
					$(this).after('<span class="error">Email is invalid.</span>');
					$(this).siblings("span.error").css("display","block");
				}
				
			}else{
				$(this).css("border","1px solid #E6E6E6");
				$(this).siblings("span.error").remove();
				
			}
		});
	});

	/*	Form User Friendly End	*/
	

});

function validate(formId)
{
	//var form = document.form;
	var ok = true;
	
	$("form#"+formId).find(".required").not(".email").each(function(){
		if(IsBlank($(this).val())) // si el valor del input está vacío…
		{		
			ok = false;
			if($(this).siblings("span.error").length == 0 ){ 
				$(this).siblings("span.error").remove();
				$(this).css("border","1px solid #f00");
				$(this).after('<span class="error">This is a required field.</span>');
				$(this).siblings("span.error").css("display","block");
			}
		}
		else    // si no está vacío el campo . . . 
		{
			$(this).css("border","1px solid #E6E6E6");
			$(this).siblings("span.error").remove();
		}
	});


	$("form#"+formId).find(".email").filter(".required").each(function(){ 
		if(!isValidEmail($(this).val())){ // este input es pasado por la función ‘valid_email()’ … si no es correcto…
			ok = false; // el ok sera ‘false’
			if($(this).siblings("span.error").length == 0 ){ 
				$(this).siblings("span.error").remove();
				$(this).css("border","1px solid #f00");
				$(this).after('<span class="error">Email is invalid.</span>');
				$(this).siblings("span.error").css("display","block");
			}
			
		}else{
		
			$(this).css("border","1px solid #E6E6E6");
			$(this).siblings("span.error").remove();
			
		}			
	});
	
	$("form#"+formId).find(".number").filter(".required").each(function(){ 
		if(!validnum($(this).val())){ // este input es pasado por la función ‘valid_email()’ … si no es correcto…
			ok = false; // el ok sera ‘false’
			if($(this).siblings("span.error").length == 0 ){ 
				$(this).siblings("span.error").remove();
				$(this).css("border","1px solid #f00");
				$(this).after('<span class="error">Required field.</span>');
				$(this).siblings("span.error").css("display","block");
			}
			
		}else{
		
			$(this).css("border","1px solid #E6E6E6");
			$(this).siblings("span.error").remove();
			
		}			
	});
	
	return ok;
}


function validnum(s)
{
     // Check for number
	 num = new RegExp(/^(?:\+|-)?\d+$/);
     if (!num.test(s)) {
          return false;
     }
	return true;
}

function IsBlank (strString)
{
	if (strString.length == 0)
		return true;

	for (i = 0; i < strString.length; i++)
	{
		strChar = strString.charAt(i);
		if (strChar != " ")
			return false;
	}
	return true;
}

function isValidEmail(email){

	if (email.length < 5)
		return false;

	subEmail=email.split('@'); //subEmail is a string array (contains strings splitted by '@')
	if (subEmail.length != 2)
		return false;

	dotStr=subEmail[1].split('.'); //dotStr is a string array (contains strings splitted by '.')

	if(dotStr.length<2)
		return false;

	for(i=1;i<dotStr.length;i++){
		if((dotStr[i].length!=2)&&(dotStr[i].length!=3))
			return false;
	}
return true;
}// End isValidEmail