function muestraDiv(divname)
{
	if(document.getElementById(divname).style.display=='none')document.getElementById(divname).style.display='';
	else document.getElementById(divname).style.display='none';

}
	

var IE = document.all?true:false

var tempX = 0
var tempY = 0

function muestradivMapa(divNameMain, latitud, longitud, zoom, titulo, divMapa)
{
	if(document.getElementById(divNameMain).style.display=='none')
		{
		document.getElementById(divNameMain).style.display='';
		showGoogleMaps(latitud,longitud,zoom,titulo,divMapa);	
		}
	else document.getElementById(divNameMain).style.display='none';
	
	

}


function saltosLinea(texto, conbr) {

 var nl=document.all?String.fromCharCode(13):"\n";
 if (conbr) { 	
 	while(texto.indexOf(nl)>=0){
	  texto = texto.replace(nl, "<br/>");
	  if(document.all)  texto = texto.replace("\n", "");
	}
 } else {
	while(texto.indexOf("<br/>")>=0){
	  texto = texto.replace("<br/>",nl);
	}
 }
 return texto;
}





function vistaPrevia(formName,container, divOrigen,divDestino,divcontroles)
{



	var textContainer=document[formName][container].value;
	textContainer=saltosLinea(textContainer,true);
	
	document.getElementById(divDestino).innerHTML =textContainer;

	muestraDiv(divDestino);	
	muestraDiv(divcontroles);		
	muestraDiv(divOrigen);		
	
}


function showGoogleMaps(latitud, longitud, zoom,  text, divDestino){

	var newZoom=16
	 if(zoom!="")newZoom=zoom;


      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById(divDestino));
		
        map.setCenter(new GLatLng(latitud, longitud), newZoom);
		

//		insertar una linea simple:
		//map.openInfoWindow(map.getCenter(),document.createTextNode(text));

//		insertar codigo HTML
		if(text!="-1")map.openInfoWindow(map.getCenter(),text);		
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());	

/*		tipo de mapa		
			G_NORMAL_MAP
			G_SATELLITE_MAP
			G_HYBRID_MAP
			G_DEFAULT_MAP_TYPES*/
		map.setMapType(G_HYBRID_MAP);
		
		var point = new GLatLng(latitud, longitud);
		map.addOverlay(new GMarker(point));
		}
	

	
}



function InsertaFlash(id,nombre,ancho,alto,alineado,bgcolor,aleatorio,variables){
	
	
	var concatena=""
	if(variables=="")concatena="?r=";
	else concatena=variables+"&r=";
	//alert(nombre+''+concatena+''+r);
	
	
	var r;
	if(aleatorio==1) r=Math.round(Math.random() * 99999);
	else r=0;
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ancho+'" height="'+alto+'" id="'+id+'" align="'+alineado+'"') 
	document.write('<param name="allowScriptAccess" value="sameDomain"/>') 
	document.write('<param name="movie" value="'+nombre+''+concatena+''+r+'"/>')
	document.write('<param name="quality" value="high">')
	document.write('<param name="scale" value="exactfit">')
	
if(bgcolor==-1) {
	document.write('<param name="wmode" value="transparent" />')
	document.write('<param name="bgcolor" value="#000000" />')
	}
else{
	document.write('<param name="bgcolor" value="'+bgcolor+'">')
	}
	


	document.write('<embed src="'+nombre+''+concatena+''+r+'" quality="high" bgcolor="'+bgcolor+'" width="'+ancho+'" height="'+alto+'" name="'+id+'" align="'+alineado+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />') 	
	document.write('</object>') 

}


	

