// HTML5 placeholder plugin version 0.3
// Enables cross-browser* html5 placeholder for inputs, by first testing
// for a native implementation before building one.
//
// USAGE: 
//$('input[placeholder]').placeholder();

(function($){
  
  $.fn.placeholder = function(options) {
    return this.each(function() {
      if ( !("placeholder"  in document.createElement(this.tagName.toLowerCase()))) {
        var $this = $(this);
        var placeholder = $this.attr('placeholder');
        $this.val(placeholder);
        $this
          .focus(function(){ if ($.trim($this.val())==placeholder){ $this.val(''); }; })
          .blur(function(){ if (!$.trim($this.val())){ $this.val(placeholder); }; });
      }
    });
  };
})(jQuery);


$(document).ready(function() {
	
	$('#verIndustrias, .industriasMenu').mouseover(function(){
		$('.industriasMenu').show();
	});
	$('#verIndustrias, .industriasMenu').mouseout(function(){
		$('.industriasMenu').hide();
		$('#verIndustrias').removeClass("over");
	});
	$('.industriasMenu').mouseover(function(){
		$('#verIndustrias').addClass("over");
	});
  
    $('input[placeholder]').placeholder();

	//HOME
	$('.vermasCompromiso').click(function(){
		$('#compromisoMore').slideToggle();
		$('.vermasCompromiso').toggle();
	});
	
	//BLOG
	$('#agregarComentario').click(function(){
		if($('#nombreComentForm').val() == ""){
			alert("Debe ingresar su nombre");		$('#nombreComentForm').focus();
		}else if($('#emailComentForm').val() == ""){
			alert("Debe ingresar su email");		$('#emailComentForm').focus();
		}else if($('#comentarioComentForm').val() == ""){
			alert("Debe ingresar un comentario");	$('#comentarioComentForm').focus();
		}else if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test($('#emailComentForm').val())){
			// ENVIA EL FORM
			$("#ComentForm").submit();			 
		}else{
			 alert("Debe ingresar un email valido");$('#emailComentForm').focus();
		}
		
	});
	
	// LightBox
	$(".iframe").fancybox({
		'width'				: '75%',
		'height'			: '75%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
});

