var showdata = "";

function showhide(id){
if (document.getElementById){
obj = document.getElementById(id);
if (obj.style.display == "none"){
obj.style.display = "";
} else {
obj.style.display = "none";
}
}
}


function MoveTo(){
   this.scrollTo(0,0);
}

function construct(nombre,email,text)
{ 

	if (nombre == "" || nombre.length <= 2) {
	  alert('Rellena el campo Nombre con por lo menos 3 letras');
	  /*this.mailform.enombre.focus();*/
	 return false
	}
	if (text == "" || text.length <= 4) {
	  alert('Rellena el campo Mensaje con por lo menos 5 letras');
	  /*contenido.mailform.emensaje.focus();*/
	 return false
	}
	if (email == "" || email.length <= 5) {
	  alert('Rellena el campo E-mail con por lo menos 6 letras');
	  /*contenido.mailform.email.focus();*/
	 return false
	}else{
	 	var chkmail = email;
	  	if (typeof(chkmail) != "undefined") {
			chkmail = chkmail.match(/(\w+)@(.+)\.(\w+)$/); 
			if (chkmail !=null) {
				if ((chkmail[3].length==2) || (chkmail[3].length==3)){ 
					/*sendtrue();*/	
					SendInfo('email.php?chkmail=10&ma='+email+'&me='+text+'&no='+nombre, 'contenido',0);
				}
			}else{
					alert('¡La dirección del correo no es valido!');
					/*contenido.mailform.email.focus();*/
					return false;
			}
		}
	}
	

}


function sendtrue()
{
	var cerror = 0;
	var mens = escape(document.comform.emensaje.value);
	if (mens == "" || mens.length <= 3) {
	  alert('Rellena el campo Mensaje con por lo menos 3 palabras');
	  cerror = cerror + 1;
	}
	var mail = document.comform.email.value;
	var chkmail = mail;
	  	if (typeof(chkmail) != "undefined") {
			chkmail = chkmail.match(/(\w+)@(.+)\.(\w+)$/); 
			if (chkmail !=null) {
				if ((chkmail[3].length==2) || (chkmail[3].length==3)){ 
					/*sendtrue();*/	
				}
			}else{
					alert('¡La dirección del correo no es valido!');
					cerror = cerror + 1;
			} 
		}
	var nomb = document.comform.enombre.value;
	if (nomb == "" || nomb.length <= 2) {
	  alert('Rellena el campo Nombre con por lo menos 3 letras');
	  cerror = cerror + 1;
	}
	var bid = document.comform.bid.value;
	var t = document.comform.detee.value;
	/*alert(cerror+'&me='+mens+'&ma='+mail+'&no='+nomb+'&bid='+bid+'&t='+t); */
	if (cerror == 0){
		/*alert('&me='+mens+'&ma='+mail+'&no='+nomb+'&bid='+bid+'&t='+t); */
		SendInfo('comment.php?chkmail=10&me='+mens+'&ma='+mail+'&no='+nomb+'&bid='+bid+'&t='+t, 'comment'+bid,1);
	}else{
		return false;
	}
}

function ampliar(ima,xa,ya)
{	
	if (BrowserDetect.browser != "Explorer"){
		document.getElementById('ampliar_pic').style.visibility = 'visible';
		document.getElementById('ampliar_pic').style.top = (document.documentElement.scrollTop-50) + 'px'; 
		document.getElementById('ampliar_pic').style.left = Math.ceil(((this.screen.width/2)-(xa/2))-15) + 'px';
		document.getElementById('ampliar_pic').style.width = (xa) +'px';
		document.getElementById('ampliar_pic').style.height = (ya+30) +'px';			  
		document.getElementById('ampliar_pic').innerHTML = "<p align=\"center\" style=\"margin: "+(ya/2)+"px 0px 10px 0px\"><img src='img/loader.gif'></p>"; /*Loading gif*/ 
		SendInfo('ampliar.php?img='+ima+'&xa='+xa+'&ya='+ya, 'ampliar_pic');
	}
	
}  

function showmap(){
   xa=580;
   ya=395;
   document.getElementById('ampliar_pic').style.visibility = 'visible';
   document.getElementById('ampliar_pic').style.top = (document.documentElement.scrollTop-50) + 'px'; 
   document.getElementById('ampliar_pic').style.left = Math.ceil(((this.screen.width/2)-(xa/2))-15) + 'px';
   document.getElementById('ampliar_pic').style.width = (xa) +'px';
   document.getElementById('ampliar_pic').style.height = (ya+30) +'px';	
   document.getElementById('ampliar_pic').innerHTML = "<div id=\"map_canvas\" style=\"width:580px; height:400px;position:relative;\"></div><p style=\"color:#000000;text-align:right\" onclick=\"closetall()\"><a href=\"javascript:closetall();\">cerrar</a></p>";
}

function closetall(){
	document.getElementById('ampliar_pic').style.visibility = 'hidden';
	document.getElementById('loading_screen').style.visibility = 'hidden';
}
 
function mouseX(evt) {
if (evt.pageX) return evt.pageX;
else if (evt.clientX)
   return evt.clientX + (document.documentElement.scrollLeft ?
   document.documentElement.scrollLeft :
   document.body.scrollLeft);
else return null;
}
function mouseY(evt) {
if (evt.pageY) return evt.pageY;
else if (evt.clientY)
   return evt.clientY + (document.documentElement.scrollTop ?
   document.documentElement.scrollTop :
   document.body.scrollTop);
else return null;
}
	

  var geocoder;
  var map;
  function initialize(x,y) { 
    var x;
	var y;
    geocoder = new google.maps.Geocoder();
    var latLng = new google.maps.LatLng(x, y);
    var myOptions = {
      zoom: 10,
      center: latLng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	var marker = new google.maps.Marker({
	    position: latLng,
	    title: 'Point A',
	    map: map,
	    draggable: false
    });
  } 
