$(document).bind('ready', function(){
	$("#banner_top").pngFix();
	$("#inicio").pngFix();
	$("#contacto").pngFix();
	$("#legales").pngFix();
	
	Shadowbox.init({
		handleOversize: "drag",
		modal: true,
		language: 'en',
		players:  ['img', 'html', 'iframe', 'qt', 'wmp', 'swf', 'flv']
	});

	$("#enviar").bind('click', function() {contacto()});
	//******************************************************
	//
	//ANIMACIONES PARA LOS BOTONES DEL MENÚ
	//
	//******************************************************

	$('#menu').children('li').each(function(){
		if($(this).html() != "")
		{
			$(this).hover(
				function()
				{
					$(this).toggleClass('menu_btn_over');
				},
	
				function()
				{
					$(this).toggleClass('menu_btn_over');
				}
			);
	
			if($(this).attr('class') != 'no_click')
			{
				$(this).mousedown(
					function()
					{
						$(this).toggleClass('menu_btn_click', 'menu_btn_over');
					}
				);
	
				$(this).mouseup(
					function()
					{
						$(this).toggleClass('menu_btn_click', 'menu_btn_over');
					}
				);
			}
	
			if($(this).attr('id') != "")
			{
				$(this).bind('click', function() {
					//document.location.href = "http://www.carnedecerdomexicana.com.mx/newsite/" + $(this).attr('id');
					document.location.href = "/" + $(this).attr('id');
				});
			}
		}
	});
	
	//**************************************************************
	//
	//FIX A LAS IMÁGENES PNG PARA IE5 E IE6
	//
	//**************************************************************

	//$('#banner_top, #menu, #legales').pngFix();
	
	//**************************************************************
	//
	//EFECTOS PARA LOS BANNER'S INFERIORES
	//
	//**************************************************************
	
	$("#footer").find('img').each(function(index){
		
		$(this).css({opacity: 0.75});

		$(this).hover(

			function()
			{
				$(this).animate({opacity: 1});
			},
			
			function()
			{
				$(this).animate({opacity: 0.75});
			}
		);
		//alert("Banner: " + index + $(this).width() + ", " + $(this).height());
	});
	
	$('#busqueda_text').bind('keypress', function(){
		$('busqueda_form')[0].submit();
	});

});

function contacto()
{

	name = $('#nombre').attr('value');
	email = $('#email').attr('value');
	comentarios = $('#comentarios').attr('value');
	
	$.ajax({
			url: "/contacto/submit",
			type: 'post',
			data: "nombre=" + name + "&email=" + email + "&comentarios=" + comentarios,
			success: function(data){
			alert(data);
		}
	});
}
