
$(document).ready(function() {
	setTimeout("animation()",300);
	var repeticiones=1;
	$("a[rel='pop-up']").click(function () {  
        var caracteristicas = "height=600,width=980,scrollTo,resizable=1,scrollbars=1,location=0";  
        nueva=window.open(this.href, 'Popup', caracteristicas);  
        return false;  
	});

	$("a[rel='contactar']").click(function () {  
        var caracteristicas = "height=400,width=700,scrollTo,resizable=1,scrollbars=1,location=0";  
        nueva=window.open(this.href, 'Popup', caracteristicas);  
        return false;  
	});
	
	$("img[rel='botoncerrar']").click(function () {  
        $("div[rel='ventana']").animate({left: '941px' }, {queue:false, duration:200, easing:''});
	});
	
	$("div[rel='menuprincipal']").click(function () {
		$("#menu"+this.id).animate({left: '0px' }, {queue:false, duration:200, easing:''});
		if (this.id == 'mapa'){
			var api='ABQIAAAATiiCM6VcsMWpFwgDn0WLtRRio8-e2ZvmV4l1jOMw5_bYle07zxSgZ_sCuavzK_cCm_KNHoVrXSgFQQ';
			$.getScript('http://maps.google.com/maps?file=api&v=2.x&key='+api+'&async=2&callback=cargarMapa'); 
		}
	});
	
	$("div[rel='menuprincipal']").mouseover(function(event){
	    event.preventDefault();
	    for (i=0;i<=repeticiones;i++){
	   		$(this).animate({opacity:".1"},100).animate({opacity:"1"},100);
	    }
	});

	$("#blog").mouseover(function(event){
	    event.preventDefault();
	    for (i=0;i<=repeticiones;i++){
	   		$(this).animate({opacity:".1"},100).animate({opacity:"1"},100);
	    }
	});
	
	$("#buzon").mouseover(function(event){
	    event.preventDefault();
	    for (i=0;i<=repeticiones;i++){
	   		$(this).animate({opacity:".1"},100).animate({opacity:"1"},100);
	    }
	   });

	$("img[rel='menusecundario']").click(function () {  
        $("#sub"+this.id).animate({left: '0px' }, {queue:false, duration:200, easing:''});
		if (this.id=="menutg"){
			$("#submenuprosolarcheck").animate({left: '0px' }, {queue:false, duration:200, easing:''});
		}
		if (this.id=="menusu"){
			$("#submenuprosolarcheck").animate({left: '0px' }, {queue:false, duration:200, easing:''});
		}
		if (this.id=="menuup"){
			$("#submenuprosolarcheck").animate({left: '0px' }, {queue:false, duration:200, easing:''});
		}
		if (this.id=="menusa"){
			$("#submenuprosolarcheck").animate({left: '0px' }, {queue:false, duration:200, easing:''});
		}
	});
	
	$("img[rel='subbotoncerrar']").click(function () {  
        $("div[rel='subventana']").animate({left: '941px' }, {queue:false, duration:200, easing:''});
	});
	   
});

// fin funcion

function animation(){
	sun_raft();
	cloud1();
	cloud2();
	cloud3();
	$("#solnaciente").animate({top: '-100px' }, {queue:false, duration:600, easing:'easeOutBounce'});
	$("#pared").animate({left: '125px' }, {queue:false, duration:1200, easing:'easeOutBounce'});
	$("#producto").animate({left: '395px' }, {queue:false, duration:2400, easing:'easeOutBounce'});
	$("#empresa").animate({left: '282px' }, {queue:false, duration:3600, easing:'easeOutBounce'});
	$("#mapa").animate({top: '210px' }, {queue:false, duration:2400, easing:'easeOutBounce'});
	$("#buzon").animate({top: '290px' }, {queue:false, duration:2400, easing:'easeOutBounce'});
	$("#galerias").animate({top: '212px' }, {queue:false, duration:2000, easing:'easeOutBounce'});
	$("#salud").animate({top: '230px' }, {queue:false, duration:2000, easing:'easeOutBounce'});
	$("#ecologia").animate({top: '280px' }, {queue:false, duration:2000, easing:'easeOutBounce'});
	$("#blog").animate({top: '290px' }, {queue:false, duration:2000, easing:'easeOutBounce'});	
	$("#garantia").animate({top: '345px' }, {queue:false, duration:2000, easing:'easeOutBounce'});
	$("#precio").animate({top: '350px' }, {queue:false, duration:2000, easing:'easeOutBounce'});
	$("#vacaciones").animate({top: '0px' }, {queue:false, duration:2000, easing:'easeOutBounce'});
}
	
function sun_raft(){
	$("#sun").animate({opacity:".7"},1000).animate({opacity:"1"},1000);
	$("#raft").animate({top:"-=5px"},1000).animate({top:"+=5px"}, 1000);
	$("#raftripple").animate({opacity:".1"},1000).animate({opacity:"1"},1000);
	setTimeout("sun_raft()",2000);
}
function cloud1(){
	$("#cloud1").animate({left:"+=1200px"},60000).animate({left:"-150px"}, 0)
	setTimeout("cloud1()",60000);
}
function cloud2(){
	$("#cloud2").animate({left:"+=1200px"},55000).animate({left:"-250px"}, 0)
	setTimeout("cloud2()",55000);
}
function cloud3(){
	$("#cloud3").animate({left:"+=1200px"},50000).animate({left:"-100px"}, 0)
	setTimeout("cloud3()",50000);
}

<!-- fin elementos animaci�n -->

// google maps


//<![CDATA[

function cargarMapa() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(40.350315, -3.899118), 16);
    map.addControl(new GSmallMapControl()); 
	map.addControl(new GMapTypeControl());
	var latlng1 = new GLatLng(40.350315, -3.899118);
	var icono = new GIcon();
	icono.image = "docs/img/oilicon.png";
	icono.iconSize=new GSize(38,36);
	icono.iconAnchor = new GPoint(-65, 35);
	marker1 = new GMarker(latlng1,icono);
	var tabs = [
  		new GInfoWindowTab("Direcci&oacuten", "<div style='color: #727071; font-size: 10px;'><img src='docs/img/logo40x40.png' height='40px' alt='Protect Tint Max'><br/>Avenida Quitapesares, 20<br/>Nave 42-D<br/>28670 Villaviciosa de Od&oacute;n - Madrid<br/>Telf: 91 691 98 24 / 669 473 119<br/>Coordenadas GPS: Lat: N 40.350315 - Lon: W 3.899118</div>")
	];
	map.openInfoWindowTabsHtml(new GLatLng(40.350315, -3.899118),tabs);
	map.addOverlay(marker1);
	var mt1 = new MarkerTracker(marker1, map);
  }
}

//]]>

/* galerias */

function mostrarfoto(fotografia, imagen){
	document.images["imgactiva"].src=fotografia;
	document.getElementById('marcofoto').style.display='inline';
	document.getElementById('botoncierre').style.display='none';
}

function ocultarmarcofoto(){
	document.getElementById('marcofoto').style.display='none';
	document.images["imgactiva"].src="../img/blanco.gif";
	document.getElementById('botoncierre').style.display='inline';
}

/* fin galerias */ 

/* precio.php */

function changecomponent(id, valor){
	document.getElementById(id).disabled=valor;
}

function deleteoption(combo){
	if (combo.options[0].value=='seleccione'){
		combo.remove(0);
	}
}

function ponerprecio(precio){
	document.getElementById('inputprecio').value=precio;
	if (precio==''){
		document.getElementById('diviva').style['display']='none';
	} else {
		document.getElementById('diviva').style['display']='inline';
	}
	
}

function selectitem(id){
	document.getElementById(id).selected='selected';
}

function showcombo(combo){
	if(combo.id=='combotipo'){
		if (combo.value=='turismo'){
			changecomponent('subturismo',false);
			changecomponent('subfurgon',true);
			deleteoption(combo);
			selectitem('seleccione3');
			ponerprecio('');
		}
		if (combo.value=='todoterreno'){
			changecomponent('subturismo',true);
			changecomponent('subfurgon',true);
			deleteoption(combo);
			selectitem('seleccione2');
			selectitem('seleccione3');
			ponerprecio('Desde 170 euros');
		}
		if (combo.value=='monovolumen'){
			changecomponent('subturismo',true);
			changecomponent('subfurgon',true);
			deleteoption(combo);			
			selectitem('seleccione2');
			selectitem('seleccione3');
			ponerprecio('Desde 170 euros');
		}
		if (combo.value=='furgon'){
			changecomponent('subturismo',true);
			changecomponent('subfurgon',false);
			deleteoption(combo);
			selectitem('seleccione2');
			ponerprecio('');
		}
	}//if combotipo
	if (combo.id=='subturismo'){
		if (combo.value=='seleccione'){
			ponerprecio('');
		}
		if (combo.value=='dospuertas'){
			ponerprecio('Desde 120 euros');
		}
		if (combo.value=='trespuertas'){
			ponerprecio('Desde 100 euros');
		}
		if (combo.value=='cuatropuertas'){
			ponerprecio('Desde 150 euros');
		}
		if (combo.value=='cincopuertas'){
			ponerprecio('Desde 150 euros');
		}
	}// if subturismo
	if (combo.id=='subfurgon'){
		if (combo.value=='seleccione'){
			ponerprecio('');
		}
		if (combo.value=='acristalado'){
			ponerprecio('Desde 180 euros');
		}
		if (combo.value=='mixto'){
			ponerprecio('Desde 140 euros');
		}
	}// if subfurgon
}
