


window.onload=function() {

	var prima=$('prima');
	if(prima){
		protoFlash=new ProtoFlash('prima', {
			interval:2.1,
			width: 271,
			height: 37,
			animSpeed: 1
		});
	}
	if($('gal')){
		posaGaleria('gal');
	}
	if($('clsGalStyle')){
		mostraGal();
	}
	if($('galIni')){
		protoFlash=new ProtoFlash('galIni', {
			interval:2.5,
			width: 442,
			height: 291,
			animSpeed: 1.5
		});
	}
	if($('map')){
		map();
	}
	
}

function enviarMail() {
	
	if (($('nombre').value=="") || ($('apellidos').value=="") || ($('mail').value=="") || ($('tel').value=="")) {
		alert('tiene que rellenar todos los campos obligatorios *');
		return;
	}
	var url="../xml/mail.php";
	var params="nombre="+encodeURI($('nombre').value)+"&apellidos="+encodeURI($('apellidos').value)+"&mailA="+encodeURI($('mail').value)+"&tel="+encodeURI($('tel').value)+"&dir="+encodeURI($('dir').value)+"&cp="+encodeURI($('cp').value)+"&ciudad="+encodeURI($('ciudad').value)+"&pais="+encodeURI($('pais').value)+"&noches="+encodeURI($('noches').value)+"&numhab="+encodeURI($('numhab').value)+"&dia="+encodeURI($('dia').value)+"&mes="+encodeURI($('mes').value)+"&ano="+encodeURI($('ano').value)+"&dias="+encodeURI($('dias').value)+"&mess="+encodeURI($('mess').value)+"&anos="+encodeURI($('anos').value)+"&com="+encodeURI($('com').value);
	var ajax=new Ajax.Request ( url, {
		method: 'post',
		postBody: params,
		onLoading: function() {
					//buida($('msg'));
					//var t=document.createTextNode(unescape(iditextos[1]));
					//$('msg').style.visibility='visible';
					//$('msg').appendChild(t);
				},
		onComplete:function(reply) {
					if (reply.responseText=="Err") {
						var txt="Ha ocurrido un error.";
					} else {
						var txt="Mensaje enviado satisfactoriamente";
					}
					
					alert(txt);
					
					if (reply.responseText=="Ok") {
						
						
						
					}
			}
		});	
}


function map(){
	if (GBrowserIsCompatible()) { 
			map = new GMap2(document.getElementById("map")); 
			map.setCenter(new GLatLng(39.537543, 2.71417), 16); 
			map.addControl(new GSmallMapControl()); 
			map.addControl(new GMapTypeControl()); 
			map.setMapType(G_NORMAL_MAP); 
			map.openInfoWindow(map.getCenter(), 
				"<div id='menmapa'><div id='iconomapa' style='float: left; margin-right: 23px;'><img src=../img/nueva/logo.jpg style='width:200px; margin-left:10px;'></div></div>"); 
			 
			/*
			GEvent.addListener(map,"click", function(overlay,latlng) {      
		      if (latlng) {    
		        //var myHtml = "The GLatLng value is: " + map.fromLatLngToDivPixel(latlng) + " at zoom level " + map.getZoom(); 
		        var myHtml = "The GLatLng value is: " + latlng + " at zoom level " + map.getZoom(); 
		        map.openInfoWindow(latlng, myHtml); 
		      } 
	    });*/
	    
	}
}


function menuon(x){
	if(x==1){
		$('item1').style.backgroundImage="url('../img/nueva/item1.jpg')";
	}
	if(x==2){
		$('item2').style.backgroundImage="url('../img/nueva/item2.jpg')";
	}
	if(x==3){
		$('item3').style.backgroundImage="url('../img/nueva/item3.jpg')";
	}
	if(x==4){
		$('item4').style.backgroundImage="url('../img/nueva/item4.jpg')";
	}
	if(x==5){
		$('item5').style.backgroundImage="url('../img/nueva/item5.jpg')";
	}
	
}
function menuoff(x){
	if(x==1){
		$('item1').style.backgroundImage="";
	}
	if(x==2){
		$('item2').style.backgroundImage="";
	}
	if(x==3){
		$('item3').style.backgroundImage="";
	}
	if(x==4){
		$('item4').style.backgroundImage="";
	}
	if(x==5){
		$('item5').style.backgroundImage="";
	}
	
}


function mostraGal(){
	new Effect.Opacity('blanco', { from: 1.0, to: 0.0, duration: 0.2, afterFinish: function(){
		$('blanco').style.display="none";
	} });
	
}

function abrirTrabajo(url){
	alert(url);
}

function posaGaleria(d) {
	var dd=$(d);
	
	if (dd) {
		var protoCarousel=new ProtoCarousel(dd, {
			   itemWidth: 150,
			   itemHeight: 150, 
			   buttonLeftWidth: 26,
			   buttonRightWidth: 26,
			   buttonLeft: '../img/btn_izq.png',
			   buttonRight: '../img/btn_dcha.png'
			  
			  });
	}
}



function link(url){
	
	window.location=url+".php";
}

function over(x){
	$('item'+x).style.backgroundImage="url('../img/fondoitem.jpg')";
	$('item'+x).style.backgroundRepeat="repeat-x";
	$('item'+x).style.color="#4A6C20";
	//$('fl'+x).src="http://www.rominstec.com/web/img/flecha.png"
}
function out(x){
	$('item'+x).style.backgroundImage="";
	$('item'+x).style.backgroundRepeat="";
	$('item'+x).style.color="white";
	//$('fl'+x).src="http://www.rominstec.com/web/img/flecha2.png"
}


