/*
	Creation of the Core of JS
*/

var core = {

	/*
		Function to add a class to the last child of the navegation bar. Used for further access with CSS
	*/
		hoverNavegationBar : function()
	{
		$("#main-navegation > li").has("ul").hover(
				function()
				{
					$(this)
						.stop(true)
						.children("ul")
							.css("z-index","99999")
							.fadeIn();
				},
				function()
				{
					$(this)
						.stop(true)
						.children("ul")
							.fadeOut();
				}
		);
	},
	fixNewsletterInfo: function(){
		var newsletterFormDiv = $('#newsletterFormDiv');
		if(newsletterFormDiv.length){
			var texto = 'Ingrese su email';
			var input = newsletterFormDiv.children('div').children('input');
			input.attr('value',texto);
			input.focusin(function(){
				if($(this).attr('value') == texto){	$(this).attr('value','');	}
			});
			input.focusout(function(){
				if($(this).attr('value') == '' || $(this).attr('value') == 'Insert your Mail'){	$(this).attr('value',texto);	}
			});
		}
	},
	start:function()
	{

		this.hoverNavegationBar();
		this.fixNewsletterInfo();
	}
};


$(document).ready(function()
{
	core.start();
	
});
