//Documento Evento
var desligar=true;
var restablecer=false;
$(document).ready(function()
{
    eventos();
});
function eventos()
{
	$(".documentoEvento").click(function()
	{
		sumarContador();
	});
}
function sumarContador()
{
	if(!restablecer)
	{
		$.ajax({
		  url: 'http://www.gruporh.com/rhmadrid/nrnfd/sumar.php',
		  success: function(data)
					{
						//window.open ("http://www.gruporh.com/rhmadrid/nrnfd/NUEVOSRETOS.pdf"); 
						restablecer=true;
					}
		});
	}
}


// Invitacion Evento


var desligar=true;
var restablecer=false;
$(document).ready(function()
{
    eventos();
});
function invitacion()
{
	window.open(
					"../rhmadrid/mailings/invitacion.pdf",
					"ventana1",
					"width=800,height=600"
				);
}
function eventos()
{
    $(".invitacionEvento").mouseover(function()
    {
		desligar=true;
        $('.invitacion').animate(
		{
			top:"0px",
			height:"303px"
		},1000);
		$('.imagenweb').animate(
		{
			bottom:"0px",
			height:"303px"
		},1000);
		$('.invitacionEvento').animate(
		{
			top:"0px",
			height:"303px"
		},1000);
		$('.solapa').animate(
		{
			height:"0px"
		},1000);
    });
	
    $(".invitacionEvento").mouseout(function()
    {
		if(desligar)
		{
			pararEventos();
			volverArriba();
		}
    });
	
    $(".invitacionEvento").click(function()
    {
		if(!restablecer)
		{
			$(".invitacion").stop(true,true);
			$(".imagenweb").stop(true,true);
			$(".invitacionEvento").stop(true,true);
			$(".solapa").stop(true,true);
			desbindear();
			$(".invitacionEvento").hide();
			restablecer=true;
		}
    });
 }
 
 function desbindear()
 {
	if(desligar)
	{
		$(".invitacion").unbind();
		$(".imagenweb").unbind();
		$(".invitacionEvento").unbind();
		$(".solapa").unbind();
	}
 }
 
 function pararEventos()
 {
	$(".invitacion").stop(true);
	$(".invitacion").stop(true);
	$(".invitacionEvento").stop(true);
	$(".solapa").stop(true);
 }
 
 function volverArriba()
 {
	$('.invitacion').animate(
	{
		top:'-195px',
		height:'245px'
	},1);
	$('.imagenweb').animate(
	{
		bottom:'50px',
		height:'195px'
	},1);
	$('.invitacionEvento').animate(
	{
		top:'-195px',
		height:'245px'
	},1);
	$('.solapa').animate(
	{
		height:'50px'
	},1);
 }
 
 
