// <![CDATA[
	// opacity
    
    
    
	function opacity(element, value) {
		var value_noie = value / 100;
		$(element).css('filter', 'alpha(opacity=' + value + ')');
		$(element).css('-moz-opacity', value_noie);
		$(element).css('-khtml-opacity', value_noie);
		$(element).css('opacity',value_noie);
	}

	// center horizontally
	function centerHoriz(lo_que) {
		var x = parseFloat($(window).width()) / 2 - parseFloat($(lo_que).width()) / 2;
		var y = $(window).scrollTop() + $(window).height() / 2 - parseFloat($(lo_que).height()) / 2;
		x = x + 'px';
		y = y + 'px';
		$(lo_que).css({'left': x, 'top': y});    
	}

	// center vertically
	function centerVert(lo_que) {
		var y = $(window).scrollTop() + $(window).height() / 2 - parseFloat($(lo_que).height()) / 2;
		$(lo_que).css({'top': y});
	}

	// image load
	function loadImg(sID, sURL) {
		$(sID).unbind("load");
		$(sID).bind("load", function() { $(this).fadeIn(); } );
		$(sID).stop(true, true).fadeOut("normal", function () { $(sID).attr('src', sURL); } );
	}
    
    function MM_openBrWindow(theURL,winName,features) { //v2.0
        window.open(theURL,winName,features);
    } 

	$(document).ready(
    function(){
        
  
        
        // si es ie6
        if(is_IE6===true){
           $.each($("*"),function(){
                /* agrego la clase transparente si no la tiene, a todos los elementos del HTML*/
                if(!$(this).hasClass('trns'))
                    $(this).addClass('trns')    
            }); 
            DD_belatedPNG.fix('.trns');   
        }
          
            if(is_IE6!==true){
                
                $("#faqAcordion").accordion({
		      	   collapsible: true
    	       	});                   
                
	       	}
            $(".bannerFlash").click(function(){             
               //window.location.href=$(this).attr("link"); 
            });            
    		$(".cajaLista").css({
                'background-position' : 'left bottom', 
                'background-repeat' : 'repeat-x',
                'background-attachment' : 'scroll'});
            $(".contenido").css({
                'background-position' : '0 0', 
                'background-repeat' : 'repeat-x',
                'background-attachment' : 'scroll'});
            var altoIzq;
            var altoDer;
            altoIzq=$(".bloqueLeft").height();
            altoDer=$(".bloqueRight").height();
            if(altoIzq<altoDer){
                $(".bloqueLeft").height($(".bloqueRight").height());
            }else if(altoIzq>altoDer){
                $(".bloqueRight").height($(".bloqueLeft").height());
            }
            
			$('#mainNav li:has(ul)').hover(
				function(e)
				{
					$(this).find('ul').fadeIn();
					$(this).addClass("active");
				},
				function(e)
				{
					$(this).find('ul').fadeOut();
					$(this).removeClass("active");
				}
			);

			//When page loads...
			$(".tab_content").hide(); //Hide all content
			$("ul.tabs li:first").addClass("active").show(); //Activate first tab
			$(".tab_content:first").show(); //Show first tab content
			//When page loads...
			$("#secondaryMenu2 li:first").addClass("active").show(); //Activate first tab
			$(".customerServiceMenu .tab_content:first").show(); //Show first tab content
			//When page loads...
			$("#secondaryMenu3 li:first").addClass("active").show(); //Activate first tab
			$("#widget-video-destacados .tab_content:first").show(); //Show first tab content
			


			//On Click Event
			$("#widget-video-destacados ul.tabs li").click(function() {
				$("#widget-video-destacados ul.tabs li").removeClass("active"); //Remove any "active" class
				$(this).addClass("active"); //Add "active" class to selected tab
				$("#widget-video-destacados .tab_content").hide(); //Hide all tab content
				
				var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
					$(activeTab).fadeIn(300); //Fade in the active ID content
					return false;
			});
	
			//On Click Event
			$("#widgetTabsVideo ul.tabs li").click(function() {
				$("#widgetTabsVideo ul.tabs li").removeClass("active"); //Remove any "active" class
				$(this).addClass("active"); //Add "active" class to selected tab
				$("#widgetTabsVideo .tab_content").hide(); //Hide all tab content
				
				var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
					$(activeTab).fadeIn(300); //Fade in the active ID content
					return false;
			});
			//On Click Event
			$(".customerServiceMenu ul.tabs li").click(function() {
				$(".customerServiceMenu ul.tabs li").removeClass("active"); //Remove any "active" class
				$(this).addClass("active"); //Add "active" class to selected tab
				$(".customerServiceMenu .tab_content").hide(); //Hide all tab content
				
				var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
					$(activeTab).fadeIn(300); //Fade in the active ID content
					return false;
			});
	

			// no dotted outline for IE in As
			if ($.browser.msie) {
				$('a').focus(
					function() {
						$(this).blur();
					}
				);
			}

			
				// END DEFAULT //
        
         $("#prov_loc").colorbox({href:'seleccion_provincia.php','maxWidth':"500px"},
                        function(){
                            $("#cboProvincia").change(function(){actualizarLocalidad()});    
                             $("#btGuardar").click(function(){
                            // Envio los datos por Ajax y cierro el ligthbox    
                                  $.ajax({
                                        type : 'GET',
                                        url: "includes/funciones_ajax.php",
                                        data: 'op=2&prov='+$("#cboProvincia").val()+"&loc="+$("#cboLocalidad").val(),
                                        success: function(datos){
                                            $.fn.colorbox.close();
                                            setTimeout(function(){window.location = '/'},200);
                                        }
                                    });
                            });
                            // actualizo la localidad cuando cargo
                            actualizarLocalidad();
                });
                    
                  
       
        
        if(seleccionar_localidad){ // si tengo seteada la seleccion de la localidad, muestro el colorbox
            setTimeout(function(){$("#prov_loc").click()},1);
        }
        
		
	});
    
    function actualizarLocalidad(){
        $("#cboLocalidad").html("<option>Cargando...</option>");
        $("#cboLocalidad").attr('disabled','disabled');
        $("#btGuardar").attr('disabled','disabled');
        // consulto por Ajax el listado de localidades, definida una provincia
        $.ajax({
                type : 'GET',
                url: "includes/funciones_ajax.php",
                data: 'op=1&prov='+$("#cboProvincia").val(),
                success: function(datos){
                    // cambio el combo de localidads
                    $("#cboLocalidad").html(datos);
                    $("#cboLocalidad").attr('disabled','');
                    $("#btGuardar").attr('disabled','');
                }
            });  
    }
	
// ]]>
