en_seccion = false;

function calcular_web(){
	var total = 0;
	var urgente = false;
	var autoactualizable = false;
	var basedatos = false;
	var formularios = false;
	
	
	var secciones = document.getElementById('secciones').value;

	if(document.getElementById('urgente').checked == true)
		urgente = true;
	if(document.getElementById('autoactualizable').checked == true)
		autoactualizable = true;
	if(document.getElementById('basedatos').checked == true)
		basedatos = true;
	if(document.getElementById('formularios').checked == true)
		formularios = true;

		
	var aux1 = 550 + (secciones *15);

		
	if(autoactualizable)
		aux1 = aux1 * 1.4;
		
	if(basedatos)
		aux1 = aux1 * 1.3;
		
	if(formularios)
		aux1 = aux1 + 50;

	if(urgente)
		aux1 = aux1 * 1.55;	
		
	document.getElementById('total_web').value = Math.round(aux1*100)/100;
	
	pedido = "<b>Su web estar&iacute;a compuesta por:</b><br>";
	pedido = pedido + secciones + " secciones.<br/>";	
	if(urgente)
		pedido = pedido + "Suplemento Urgencia (Web 24horas).<br>";
	if(autoactualizable)
		pedido = pedido + "Web actualizable por el cliente.<br>";
	if(basedatos)
		pedido = pedido + "Uso de bases de datos (SQL).<br>";
	if(formularios)
		pedido = pedido + "Formularios de contacto Web.<br>";
		
	$('#tarifa_web_texto').hide();
	document.getElementById('tarifa_web_texto').innerHTML = pedido;
	$('#tarifa_web_texto').fadeIn();
}

function calcular_3d(){
	var total = 0;
	var maqueta = false;
	var vray = false;
	
	var infos_int = document.getElementById('infografias').value;
	var infos_ext = document.getElementById('exteriores').value;
	if(document.getElementById('maqueta').checked == true)
		maqueta = true;
	var metros = document.getElementById('metros').value;
	if(document.getElementById('vray').checked == true)
		vray = true;
		
	var aux1 = infos_int * 35;
	var aux2 = infos_ext * 25;
	var aux3 = 0;

	if(vray)
		aux3 = (aux1 + aux2) * 1.5
	else
		aux3 = (aux1 + aux2)
	
	if(maqueta)
		if(aux3 < 100)
			aux3 += 50;
		else if(aux3 <= 200)
			aux3 += 40;
		else if(aux3 <= 300)
			aux3 += 30;
		else
			aux3 += 25;
	
	if(metros <= 0)
		total = 0
	else if(metros < 50)
		total = aux3;
	else if(metros < 80)
		total = aux3*1.1;
	else if(metros < 100)
		total = aux3*1.2;
	else if(metros < 120)
		total = aux3*1.3;
	else if(metros < 140)
		total = aux3*1.4;
	else if(metros < 160)
		total = aux3*1.5;
	else if(metros < 200)
		total = aux3*1.6;
	else if(metros < 250)
		total = aux3*1.7;
	else
		total = aux3*1.85;

	total = total*2;
	
	
	document.getElementById('total_3d').value = Math.round(total*100)/100;
	
	pedido = "<b>Usted recibir&iacute;a:</b><br>";
	if(infos_int > 0){
		pedido = pedido + infos_int + " infografías interiores";
		if(vray)
			pedido = pedido + " hiper-real&iacute;sticas.<br />";
		else
			pedido = pedido + " normales.<br />";
	}
	
	if(infos_ext > 0){
		pedido = pedido + infos_int + " infografías exteriores";
		if(vray)
			pedido = pedido + " hiper-real&iacute;sticas.<br />";
		else
			pedido = pedido + " normales.<br />";
	}
	
	if(maqueta)
		pedido = pedido + "Una maqueta (infograf&iacute;a).<br>";
	
	$('#tarifa_3d_texto').hide();
	document.getElementById('tarifa_3d_texto').innerHTML = pedido;
	$('#tarifa_3d_texto').fadeIn();
}

function poner_fondo(id){
	document.getElementById('Web').style.background = 'url(' + id + ')';
}

function quitar_fondo(id){
	if(!en_seccion)
		document.getElementById('Web').style.background = '#FFFFFF';
}

function fadeOut_todo(id){
	$('#Cuadro1').fadeOut();
	$('#Cuadro2').fadeOut();
	$('#Cuadro3').fadeOut();
	$('#Cuadro4').fadeOut();
	$('#'+id+'').fadeIn();
	$('#Volver').fadeIn();
	
	en_seccion = true;
}

function seccion_3d(id){
	$('#iconos3d').fadeIn();
	$('#pizarra3d').fadeIn();
}

function ocultar_web(){
	$('#iconosweb').fadeOut();
	$('#pizarraweb').fadeOut();
	$('#promociones').fadeOut();
}

function ocultar_disenyo(){
	$('#iconosimagen').fadeOut();
	$('#pizarraimagen').fadeOut();
	$('#restauracion').fadeOut();
}

function ocultar_contacto(){
	$('#sobremi').fadeOut();
	$('#tarifas').fadeOut();
}

function mostrar_todo(){
	$('#Web').fadeOut();
	$('#Web').fadeIn();
	$('#Cuadro1').fadeIn();
	$('#Cuadro2').fadeIn();
	$('#Cuadro3').fadeIn();
	$('#Cuadro4').fadeIn();
	$('#Volver').fadeOut();
	
	en_seccion = false;
	
	//Seccion 3D
	$('#iconos3d').fadeOut();
	$('#pizarra3d').fadeOut();
	
	//Seccion Web
	ocultar_web();

	//Diseño Gráfico
	ocultar_disenyo();

	//About
	ocultar_contacto();
}

function borrar_iconos(id){
	$('#i_claustro').fadeOut();
	$('#i_piscina').fadeOut();
	$('#i_marq').fadeOut();
	$('#i_vivienda').fadeOut();
	$('#i_despacho').fadeOut();
	$('#i_galeria').fadeOut();
	$('#i_banyo').fadeOut();
	$('#i_cype').fadeOut();
	$('#i_banyo2').fadeOut();
	$('#i_loft').fadeOut();
}

function s3d_categoria(id){
	borrar_iconos();
	
	if(id == 'ext'){
		$('#i_piscina').fadeIn();
		$('#i_marq').fadeIn();
		$('#i_claustro').fadeIn();
	}else if(id == 'int'){
		$('#i_vivienda').fadeIn();
		$('#i_despacho').fadeIn();
		$('#i_galeria').fadeIn();
		$('#i_banyo').fadeIn();
		$('#i_cype').fadeIn();
		$('#i_banyo2').fadeIn();
		$('#i_loft').fadeIn();
	}else if(id == 'otr'){
		$('#i_galeria').fadeIn();
		$('#i_cype').fadeIn();
		$('#i_banyo2').fadeIn();
	}else if(id == 'viv'){
		$('#i_vivienda').fadeIn();
		$('#i_despacho').fadeIn();
		$('#i_banyo2').fadeIn();
		$('#i_loft').fadeIn();
	}else if(id == 'tod'){
		$('#i_claustro').fadeIn();
		$('#i_piscina').fadeIn();
		$('#i_marq').fadeIn();
		$('#i_vivienda').fadeIn();
		$('#i_despacho').fadeIn();
		$('#i_galeria').fadeIn();
		$('#i_banyo').fadeIn();
		$('#i_cype').fadeIn();
		$('#i_banyo2').fadeIn();
		$('#i_loft').fadeIn();
	}
}

function ver_3d(img){
	$('#pizarra3d').fadeOut();
	document.getElementById('pizarra3d').style.background = 'url(' + img +')';
	$('#pizarra3d').fadeIn();
}

function ver_web(img){
	$('#pizarraweb').fadeOut();
	document.getElementById('pizarraweb').style.background = 'url(' + img +')';
	$('#pizarraweb').fadeIn();
}

function ver_imagen(img){
	$('#pizarraimagen').fadeOut();
	document.getElementById('pizarraimagen').style.background = 'url(' + img +')';
	$('#pizarraimagen').fadeIn();
}