$(window).ready(function (){

	if (jQuery.browser.msie) {
		version = parseInt(jQuery.browser.version);
		if(version<7){
			//alert("Estás usando la versión 6 de explorer")
		}
	}

	// CUFON
	<!--Cufon.replace('h1, h2', { fontFamily: 'Champagne & Limousines' });
	<!---->Cufon.replace('h3, h4, h5, ul#footer-nav');-->
	

	// SLIDE
	$("#slideshow").slideShow();	
	$("#slideshow a").fancybox({ overlayOpacity: 0.85, overlayColor: '#FFF', transitionIn: 'elastic', transitionOut: 'fade'	});
	$("#link-world-map").fancybox({ overlayOpacity: 0.85, overlayColor: '#FFF', transitionIn: 'elastic', transitionOut: 'fade', autoScale: false, width: 750, height: 400 });
	$("#link-partners").fancybox({ overlayOpacity: 0.85, overlayColor: '#FFF', transitionIn: 'elastic', transitionOut: 'fade' });
		$("#configurador").fancybox({
		'overlayOpacity'	:'0.85', 
		'overlayColor'		:'#FFF',
        'width'             : '75%',
        'height'            : '75%',
        'autoScale'         : false,
        'transitionIn'      : 'fade',
        'transitionOut'     : 'fade',
        'type'              : 'iframe'
    });
	
	$("#aplicaciones").fancybox({'overlayOpacity'	:'0.85', 
		'overlayColor'		:'#FFF',
        'width'             : '75%',
        'height'            : '75%',
        'autoScale'         : false,
        'transitionIn'      : 'fade',
        'transitionOut'     : 'fade',
        'type'              : 'iframe'
    });
	// EXTERNAL
	$(".external").attr("target", "_blank");
	
	// NOTICIAS
	$(".titulo-categoria").click(muestraNoticias);
	
	// DOTS FOOTER
	//dotsFooter()
	
	//ALTURA CAJAS
	equalBox();
	
	// VALIDAR CAMPOS DE FORMULARIO DE CONTACTO
	$("#contacto #form").validate();
	$("#cliente #form").validate();

	// ACORDEON
	$("#acordeon h4:not(:first)").hide()
	$("#acordeon div:not(:first)").hide()
	$("#acordeon ul a").click(controlAcordeon)
		
})

function controlAcordeon(){
	//var cual = $(this).attr("href");
	//$("#acordeon div").slideUp(400)
	//$("#acordeon "+cual).slideDown(400)
	var indice = $("#acordeon ul a").index($(this))
	$("#acordeon div, #acordeon h4").hide()
	$("#acordeon div:eq("+indice+")").show()
	$("#acordeon h4:eq("+indice+")").show()
	return false;
}



function muestraNoticias(){
	var id = $(this).attr("href");
	$("#lista-noticias, #lista-novedades").slideUp(400);
	$(id).slideDown(400);
	return false;
}



function dotsFooter(){
	var cantidad;
	var cadena;
	var recorte;
	$(".footer-news li a").each(function (){
			cadena = String($(this).text());
			cantidad  = cadena.length;
			if(cantidad>30){
				recorte = cadena.substr(0,28)+"...";
				$(this).text(recorte)
			}
	})
} 	


function equalBox() {
	var altoFinal = 0;
	var altoCaja = 0;
	$(".box").each( function () {
		altoCaja = Number($(this).height());
		if( altoCaja>altoFinal ){
			altoFinal = altoCaja;	
		}
	});
	$(".box").css({ height:altoFinal+"px"});
}


	
	 
