function elements_position(){

     if (!jQuery('.tih2').hasClass('current')){
      jQuery(".bannermenu p").slideUp();
      jQuery(".current").parent().parent().addClass("acti");

    }else{
       jQuery(".current").parent().next().slideDown();
        jQuery(".current").parent().parent().addClass("acti");
 
    }
    jQuery(".current-menu-item").parent().parent().addClass("current-menu-item");
    jQuery(".sub-menu .sub-menu .current-menu-item").parent().parent().parent().parent().addClass("current-menu-item");

}
function botons(carousel) {
    jQuery('.btn_next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('.btn_prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};
function sprensa(carousel) {
    jQuery('#sprensa .dere').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#sprensa .izq').bind('click', function() {
        carousel.prev();
        return false;
    });
};
function slinks(carousel) {
   jQuery('#slinks .dere').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#slinks .izq').bind('click', function() {
        carousel.prev();
        return false;
    });
}
jQuery(document).ready(function(){
jQuery("#s").focus(function (){
             jQuery(this).attr('value', '');
 });
jQuery('#menu-item-459 a').click(function(){
     this.target = "_blank";
});

jQuery(".btn_news").click(function (){
            jQuery("#newsc").fadeIn();
            return false;
 });

jQuery(".cerrarl, .black").click(function (){
            jQuery("#newsc").fadeOut();
            return false;
 });

jQuery("#contactar").focus(function (){
            if (jQuery("#contactar").val() == "Escribe tu email..."){
                jQuery("#contactar").attr("value", "");
            }
        });

      /* $("#contactar").focusout(function (){
            if ($("#contactar").val() == ""){
                $("#contactar").attr("value", "Escribe tu email...");
            }
        });
      */
     jQuery("#enviar_contacto").click(function(){

          var mail = jQuery("#contactar").attr('value');
                  var filter=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
                  if (!filter.test(mail ) || mail == "")
                    {
                        jQuery("#contactar").css("border", "1px solid red");
                        jQuery("#news_message").fadeIn("normal");
                    }

                  else{
                      jQuery("#contactar").css("border", "");
                      jQuery("#form_contacto").submit();
                  }

         return false;
     });




    jQuery('.tih2').click(function() {
        return false;
    });
    jQuery('.bloquefl a').lightBox({fixedNavigation:true});
  elements_position();
    jQuery('.bannermenu .tih2').featureList({
        
            output		: '.output li'
           
          
    });
     jQuery('#vidosc').jcarousel({
       initCallback: botons,
       scroll : 3,
       wrap : "circular"
    });
     jQuery('#sprensa').jcarousel({
       initCallback: sprensa,
       scroll : 1,
       wrap : "last"
    });
     jQuery('#slinks #feedreading_blogroll_').jcarousel({
       initCallback: slinks,
       scroll : 1,
       wrap : "last"
    });
    jQuery(".sub-menu").parent("li").mouseenter(function(){

            jQuery(this).children(".sub-menu").show().prev("a").addClass("active")}).mouseleave(function(){

            jQuery(this).children(".sub-menu").hide().prev("a").removeClass("active");
        });

});



