// <![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); } );
	}

	$(document).ready(
		function() {

			// no dotted outline for IE in As
			if ($.browser.msie) {
				$('a').focus(
					function() {
						$(this).blur()
					}
				);
			}
            
            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');   
            }
            
            $('.searchBox input').focus(
                function(){
                    if($(this).attr("value") == "B\u00FAsqueda" /*|| $(this).attr("value") == "Por Combustible" || $(this).attr("value") == "Por Precio"*/){
                        $(this).attr("value","");
                    }
                }
            );
            
            $('.searchBox input').blur(
                function(){
                    if($(this).attr("value") == ""){
                        switch($(this).attr("name")){
                            case "f_busqueda":
                                $(this).attr("value","B\u00FAsqueda");
                                break;
                            /*case "f_busqueda_combustible":
                                $(this).attr("value","Por Combustible");
                                break;
                            case "f_busqueda_precio":
                                $(this).attr("value","Por Precio");
                                break;*/
                        }
                    }
                }
            );
            
            $('.ficha_galeria_anterior').click(
                function(){
                    
                    var ancho_total = $('.ficha_galeria_desplazable').css('width');
                    ancho_total = ancho_total.substr(0,ancho_total.length-2);
                    var margin_actual = $('.ficha_galeria_desplazable').css('margin-left')
                    margin_actual = parseInt(margin_actual.substr(0,margin_actual.length-2));
                   
                    if(margin_actual+456 <= 0){
                        $('.ficha_galeria_desplazable').animate({'margin-left':margin_actual+456});
                    }
                    
                }
            );
            
            $('.ficha_galeria_siguiente').click(
                function(){
                    
                    var ancho_total = $('.ficha_galeria_desplazable').css('width');
                    ancho_total = ancho_total.substr(0,ancho_total.length-2);
                    var margin_actual = $('.ficha_galeria_desplazable').css('margin-left')
                    margin_actual = margin_actual.substr(0,margin_actual.length-2);
                 
                    if(margin_actual-456 > -ancho_total){
                        
                        $('.ficha_galeria_desplazable').animate({'margin-left':margin_actual-456});
                    }
                    
                }
            );
            
            $('.ficha_galeria_thumbnails img').click(function(){
                $(".ficha_galeria_main").attr("src",$(this).attr("alt"));
                
            });
            
            if($('#f_direccion').attr('value') == 'asc'){
                $('#btn_ordenamiento').css('background','url(../img/btn_orden_up.gif)');
            }else if($('#f_direccion').attr('value') == 'desc'){
                $('#btn_ordenamiento').css('background','url(../img/btn_orden_down.gif)');
            }
            
            /** Si la búsqueda está vacía, no buscar.. */
            $('.searchBox').find('#Ver').click(
                function(){
                    if($('.searchBox').find('input[name=f_busqueda]').attr('value') == 'Búsqueda'){
                        return false;
                    }
                }
            );
            
            $('.encuesta_input').click(
                function(){
                    $(this).parent().parent().submit();
                }
            );
          
            
		// END DEFAULT //
	//	Cufon.replace('h1', { fontFamily: 'Eurostile' });
//		Cufon.replace('.leftMenu ul li a', { fontFamily: 'Myriad Pro' });
		}
	);
    
    
    function irAPagina(pagina){
        $('#permitidos_form input[name="f_pag"]').attr('value',pagina);
        $('#permitidos_form').submit();
    }
    
// ]]>
