$(document).ready(function() {
    var url = $('#menu-right > a');
    var loc = window.location.href.split('/');
    var page = loc[loc.length - 1].replace("#", "");
    url.each(function() {
        var aloc = ($(this).attr('href')).split('/');
        var linkpage = aloc[aloc.length - 1].replace("#", "");
        if (page == linkpage) {
            $(this).addClass('selected');
            $(this).css({ color: "#1d8ccd" })
        }
    });
    // Muestra y oculta los menús 
    $('#menu .lin1:has(div)').hover(
      function(e) {

          $(this).find('#divn2').css({ display: "block" });
          $(this).find('.n3right').css({ left: ($(this).outerWidth() - 21) + "px" });
          $(this).find('.n3left').css({ left: "-280px" });
          $(this).find('.menucontent').css({ height: ($(this).find('#divn2').outerHeight() - 45) + "px" });
          
          $(this).find('#an1').css("background", "#fefefe url(/portals/0/skins/Play/images/sep-hover.png) 100% 0 no-repeat ");
      },
      function(e) {
          $(this).find('#divn2').css({ display: "none" });
          $(this).css("background", "none");
          $(this).find('#an1').css("background", "url(/portals/0/skins/Play/images/sep.png) 100% 0 no-repeat ");
      }
   );

    $('.lin2:has(.n3right)').hover(
   	  function(event) {
   	      $(this).find('.n3right').css({ display: "block" });
		  $(this).find('#acat').css("background", "#fff url(/portals/0/skins/Play/images/h2.jpg) 5px 50% no-repeat");
		  $(this).find('#white').css({height:$(this).find('.n3right').outerHeight() -60 +"px"});

   	  },
      function(event) {
          $(this).find('.n3right').css({ display: "none" });
		  $(this).find('#acat').css("background", "url(/portals/0/skins/Play/images/h2.jpg) 5px 50% no-repeat");
      }
   );
    $('.lin2:has(.n3left)').hover(
   	  function(event) {
   	      $(this).find('.n3left').css({ display: "block" });
   	  },
      function(event) {
          $(this).find('.n3left').css({ display: "none" });
      }
   );
	   // Muestra y oculta los menús 
      $('#lilogin').hover(
      function(e) {
		  $('#lilogin').css("background", "url(/portals/0/skins/Play/images/lihov_login.png) no-repeat ");		
          $('#login').css({ display: "block" }); 
		  $('#lilogin .atop').removeClass('liLoginHover');
      },
      function(e) {
		  $('#lilogin').css("background", "url(/portals/0/skins/Play/images/li_login.jpg) no-repeat ");	
         $('#login').css({display: "none"});	
      }
      );
	   $('#litiendas').hover(
      function(e) {
		   $('#litiendas').css("background", "url(/portals/0/skins/Play/images/lihov_tiendas.png) no-repeat ");	
          $('#tiendas').css({ display: "block" });      
      },
      function(e) {
		  $('#litiendas').css("background", "url(/portals/0/skins/Play/images/li_tiendas.jpg) no-repeat ");	
         $('#tiendas').css({display: "none"});	
      }
      );
	      // Muestra y oculta los menús 
      $('#libuscar').hover(
      function(e) {
			  $('#libuscar').css("background", "url(/portals/0/skins/Play/images/lihov_buscar.png) no-repeat ");		
          $('#buscar').css({ display: "block" });      
      },
      function(e) {
		   
            if($('#dnn_ctr635_Buscador_fll').hasClass("focus")){
			}
			else{
			$('#buscar').css({display: "none"});
			 $('#libuscar').css("background", "url(/portals/0/skins/Play/images/li_buscar.jpg) no-repeat ");		
			}
      }
      );
	  $('#dnn_ctr635_Buscador_fll').blur(function(){              
		    $('#dnn_ctr635_Buscador_fll').removeClass("focus");     
	  		})           
		 .focus(function() {    
		        
			$("#dnn_ctr635_Buscador_fll").addClass("focus") 
	   }); 
	   $('#licarrito').hover(
      function(e) {
		  $('#licarrito').css("background", "url(/portals/0/skins/Play/images/lihov_carrito.png) no-repeat ");	
          $('#carrito').css({ display: "block" });      
      },
      function(e) {
         $('#licarrito').css("background", "url(/portals/0/skins/Play/images/li_carrito.jpg) no-repeat ");	
		 $('#carrito').css({display: "none"});	
      }
      );
	   
	   /************NIVEL 4 DEL MENU************/
	  $('.lin3:has(#divn4)').hover(
   	  function(event) {
		  
   	      $(this).find('#divn4').css({ display: "block" });
		  $(this).find('#childcat').css("background", "#eaeaea");

   	  },
      function(event) {
          $(this).find('#divn4').css({ display: "none" });
		  $(this).find('#childcat').css("background", "none");
      }
  	 );
   
}); 
/************Funcion Hover************/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/************ Accordion ************/

$(function() { 
	$('.tituloAltoRiesgo').click(function() {
		$('.tituloAltoRiesgo').removeClass('on');
	 	$('.contenidoOculto').slideUp('normal');
		if($(this).next().is(':hidden') == true) {

			$(this).addClass('on');

			$(this).next().slideDown('normal');
		 } 
		  
	 });

	$('.tituloAltoRiesgo').mouseover(function() {
		$(this).addClass('over');
		
	}).mouseout(function() {
		$(this).removeClass('over');										
	});
	
	$('.contenidoOculto').hide();

});

function limpiarNombre() {
        if ($(".inputWeddingNombre").attr("value") == "Nombre") {
            $(".inputWeddingNombre").attr({ 'value': '' });
        }
}
function limpiarApellido() {
        if ($(".inputWeddingApellido").attr("value") == "Apellido") {
            $(".inputWeddingApellido").attr({ 'value': '' });
        }
}
