/********************************
http://creativecocos.com/
Última modificación : 01/12/2010
Autor : Juan F. Capristán W.
*********************************/
var ancho_texto_pequeno=345;var alto_texto_pequeno=250;var ancho_form=425;var alto_form=240;var ancho_texto_grande_vertical=473;var alto_texto_grande_vertical=450;var ancho_texto_grande_horizontal=790;var alto_texto_grande_horizontal=360;var padding_izquierdo_texto=50;var padding_derecho_texto=40;var padding_arriba_texto=50;var padding_abajo_texto=40;var margen_cajas=20;var correccion_vertical=37;var correccion_horizontal=5;var ancho_ventana,alto_ventana;var ancho_contenedor,alto_contenedor;var ventana_vertical;var ancho_texto_actual,alto_texto_actual;var seccion_actual;$(document).ready(function(){calcula_seccion_actual();$(".txt").corner("tr bottom 18px");$(".capa_formulario").corner("18px");resize_ventana();$(window).resize(resize_ventana);cambia_imagen_fondo();var a=new Image();a.src="img/ok2.png";$("#boton_enviar_formulario").mouseover(function(){$(this).css("background-image","url(img/ok2.png)")});$("#boton_enviar_formulario").mouseout(function(){$(this).css("background-image","url(img/ok.png)")});$("#menu a").click(function(){cambiar_seccion($(this).attr("id"))});$(".logo").click(function(){if(seccion_actual!="inicio"){cambiar_seccion("inicio")}});$("#mas_informacion").click(function(){abrir_mas=($(this).find("img").attr("src")=="img/mas.png");if(abrir_mas){cambiar_seccion("mas_informacion");$(this).find("img").attr("src","img/menos.png")}else{cambiar_seccion("inicio");$(this).find("img").attr("src","img/mas.png")}});cambiar_seccion($("#"+seccion_actual).attr("id"));inserta_enlaces_de_contacto()});function calcula_seccion_actual(){seccion_actual=window.location.hash.substring(1);if(seccion_actual==""){seccion_actual="inicio"}}function calcula_orientacion_ventana(){ancho_ventana=$(window).width();alto_ventana=$(window).height();ventana_vertical=(alto_ventana>690)}function calcula_dimensiones_actuales(){if(ventana_vertical){if(seccion_actual=="inicio"){ancho_texto_actual=ancho_texto_pequeno;alto_texto_actual=alto_texto_pequeno}else{ancho_texto_actual=ancho_texto_grande_vertical;alto_texto_actual=alto_texto_grande_vertical}}else{if(seccion_actual=="inicio"){ancho_texto_actual=ancho_texto_pequeno;alto_texto_actual=alto_texto_pequeno}else{ancho_texto_actual=ancho_texto_grande_horizontal;alto_texto_actual=alto_texto_grande_horizontal}}}function resize_ventana(){var d,c;var b;var a=ancho_texto_actual;calcula_orientacion_ventana();calcula_dimensiones_actuales();if(seccion_actual!="inicio"){if(ventana_vertical){alto_contenedor=alto_texto_grande_vertical;ancho_contenedor=ancho_texto_grande_vertical+padding_izquierdo_texto+padding_derecho_texto}else{alto_contenedor=alto_texto_grande_horizontal;ancho_contenedor=ancho_texto_grande_horizontal}d=(alto_ventana/2)-(alto_contenedor/2);c=(ancho_ventana/2)-(ancho_contenedor/2);if(a!=ancho_texto_actual){$("#texto1").css("width",ancho_texto_actual+"px");$("#texto1").css("height",alto_texto_actual+"px")}}else{if(ventana_vertical){alto_contenedor=alto_texto_actual+alto_form+margen_cajas+padding_arriba_texto+padding_abajo_texto;ancho_contenedor=ancho_texto_actual+(ancho_form-ancho_texto_actual*3/5);b=0}else{alto_contenedor=alto_texto_actual+(alto_form-alto_texto_actual/2)+padding_arriba_texto;ancho_contenedor=ancho_texto_actual+ancho_form+margen_cajas+padding_izquierdo_texto+padding_derecho_texto;b=((alto_texto_actual+padding_arriba_texto+padding_abajo_texto)/2)}d=(alto_ventana/2)-(alto_contenedor/2)+correccion_vertical;c=(ancho_ventana/2)-(ancho_contenedor/2)+correccion_horizontal}$(".contenedor").css("top",d+"px");$(".contenedor").css("left",c+"px");$(".contenedor").css("width",ancho_contenedor+"px");$(".contenedor").css("height",alto_contenedor+"px");$(".capa_informacion").css("width",ancho_texto_actual+"px");$(".capa_formulario").css("margin-top",b+"px");$(".imagen_fondo").css("width",ancho_ventana);$(".imagen_fondo").css("height",alto_ventana)}function cambiar_seccion(b){seccion_actual=b;calcula_dimensiones_actuales();var c=$(window).height();var a=($("#texto1").css("width")==ancho_texto_pequeno+"px");$("#menu a").removeClass("on");$("#"+b).addClass("on");if(b!="inicio"&&a){$(".capa_formulario").fadeOut("normal",function(){if(ventana_vertical){$("#texto1").css("width",ancho_texto_grande_vertical+"px");$("#texto1").css("height",alto_texto_grande_vertical+"px");$(".capa_informacion").css("width",ancho_contenedor+"px");$("#twitter").css("width",(ancho_texto_grande_vertical+padding_izquierdo_texto+padding_derecho_texto-20)+"px")}else{$("#texto1").css("width",ancho_texto_grande_horizontal+"px");$("#texto1").css("height",alto_texto_grande_horizontal+"px");$(".capa_informacion").css("width",ancho_contenedor+"px");$("#twitter").css("width",(ancho_texto_grande_horizontal+padding_izquierdo_texto+padding_derecho_texto-20)+"px")}})}else{if(b=="inicio"){resize_ventana();$(".capa_informacion").css("width",ancho_texto_actual+padding_izquierdo_texto+padding_derecho_texto+"px");$(".capa_informacion").css("height",alto_texto_actual+padding_arriba_texto+padding_abajo_texto+"px");$("#texto1").css("width",ancho_texto_actual+"px");$("#texto1").css("height",alto_texto_actual+"px");$(".capa_formulario").fadeIn("normal");$("#twitter").css("width",(ancho_texto_actual+padding_izquierdo_texto+padding_derecho_texto-20)+"px")}else{$(".capa_formulario").hide()}}$("#mas_informacion img").attr("src","img/mas.png");$(".texto").hide();$("#texto_"+b).fadeIn("slow");return false}function cambia_imagen_fondo(){var a=11;var b=$(".imagen_fondo").attr("src");var c=Math.floor(Math.random()*a+1);while(b=="img/fondo"+c+".jpg"){c=Math.floor(Math.random()*a+1)}$(".imagen_fondo").attr("src","img/fondo"+c+".jpg");setTimeout("cambia_imagen_fondo()",10000)}function inserta_enlaces_de_contacto(){var c="mailto:";var b="contacto-web";var a="creativecocos.com";var d;$(".contacto").each(function(){d="?subject=Contacto CreativeCocos.com";$(this).html('+información : </span><a href="'+c+b+"@"+a+d+'" class="enlace">'+b+"@"+a+"</a> | +34 918 284 199")})};
