// Activar los activeX de Flash.

function activarActiveX() {

	

	// **** Internet Explorer

	if (navigator.appName == "Microsoft Internet Explorer") {

		//Colección de elementos a reemplazar

		var arrElements = new Array(3);

		arrElements[0] = "object";

		arrElements[1] = "embed";

		arrElements[2] = "applet";

	

		

		//Loop over element types

		for (n = 0; n < arrElements.length; n++) {

		

			//set object for brevity

			replaceObj = window.document.getElementsByTagName(arrElements[n]);

			//loop over element objects returned

			for (i = 0; i < replaceObj.length; i++ ) {

			

				//set parent object for brevity

				parentObj = replaceObj[i].parentNode;

				

				//grab the html inside of the element before removing it from the DOM

				newHTML = parentObj.innerHTML;

				

				//remove element from the DOM

				parentObj.removeChild(replaceObj[i]);

				

				//stick the element right back in, but as a new object

				parentObj.innerHTML = newHTML;

			

				}

			}

		}

	// ***** Fin Internet Explorer

}

// Función de abrir ventana

function abrirVentana(url){

	

	if (url == 1) {

		url = "aviso_legal.html";

		

		}

	 window.open(url,'window1','width=740,height=300,status=no,scrollbars=yes');

	}

	

// Función para abrir fotos

function abrirFotos(url){

	//pagina = "media/" + url;

	pagina = "media/verfoto.php?id=" + url;

	 window.open(pagina,'window1','width=500,height=468,scrollbars=no,status=no,resize=yes');

	}





// Leer XML desde AJAX

   var http_request = false;

   var xmlTexto     = "media/datos.xml";

   

   function makeRequest(url) {

      http_request = false;

	  

      // Detectar navegador

	  if (navigator.appName.indexOf("Explorer") != -1) {

	  

	   try {

            http_request = new ActiveXObject("Msxml2.XMLHTTP");

         	//alert("Objeto creado Explorer");

		 } catch (e) {

            try {

               http_request = new ActiveXObject("Microsoft.XMLHTTP");

            } catch (e) {}

         }

	  

	  

	  } else {

	  // Mozilla, Safari, ......

	  	

		http_request = new XMLHttpRequest();

         //alert("Objeto creado Mozilla");

		 

		 if (http_request.overrideMimeType) {

            http_request.overrideMimeType('text/xml');

         }



	  }

	  

      if (!http_request) {

         alert('No se puede crear XMLHTTP instancia use Internet Explorer, Firefoz, Mozilla, Safari.');

         return false;

      }

	  

      http_request.onreadystatechange = alertContents;

      http_request.open('GET', url , true);

      http_request.send(null);

   }



   function alertContents() {

   

   

      if (http_request.readyState == 4) {

         if (http_request.status == 200) {



            var xmldoc = http_request.responseXML;

            var root = xmldoc.getElementsByTagName('root').item(0);

            

			 // Nodo DATA para cargar el contenido de Atributos.

			if (navigator.appName == "Microsoft Internet Explorer") {

			 	textoDominio("dominio",root.childNodes[0].getAttribute("dominio"))

				textoNombre("nombre",root.childNodes[0].getAttribute("nombre"))

				document.title = root.childNodes[0].getAttribute("titulo");

				var dominio = root.childNodes[0].getAttribute("dominio");

				var titulo = root.childNodes[0].getAttribute("titulo");

				}else{

				textoDominio("dominio",root.childNodes[1].getAttribute("dominio"))

				textoNombre("nombre",root.childNodes[1].getAttribute("nombre"))

				document.title = root.childNodes[1].getAttribute("titulo");

				var dominio = root.childNodes[1].getAttribute("dominio");

				var titulo = root.childNodes[1].getAttribute("titulo");

				}

			  	

			  //

			

			

			// Nodo principal

            for (var iNode = 0; iNode < root.childNodes.length; iNode++) {

               

			 

			 

			  

			   var node = root.childNodes.item(iNode);

			   

			   // Nodo secundario 

               for (i = 0; i < node.childNodes.length; i++) {

			   

			   //alert("Nodo secundario:" + node.childNodes[i].nodeName);

			   

			   // Saber que nodo 

			   var tipo = node.childNodes[i].nodeName;

			   // Saber que nodo

			   

                  var sibl = node.childNodes.item(i);

                  var len = parseInt(sibl.childNodes.length / 2);

                  var arr = new Array(len);

                  var cnt = 0;

                  for (x = 0; x < sibl.childNodes.length; x++) {

                     var sibl2 = sibl.childNodes.item(x);

                     var sibl3;

                     if (sibl2.childNodes.length > 0) {

                        sibl3 = sibl2.childNodes.item(0);

                        arr[cnt] = sibl3.data;   

                        cnt++;

                     }

                  }

				// Rellenar contenidos

					verificarTipos(tipo,arr);

                  //addrow("mytable", arr);

				  

				 // Fin de rellenar contenidos

               

			   }

			   // Fin nodo secundario

            }

			// Fin nodo principal

			

			

         } else {

            alert('Hay un problema con la respuesta. / There was a problem with the request.');

         }

      }

   }

   

   // Genera la respuesta desde el servidor

   function do_xml() {

	   makeRequest(xmlTexto);

   }

   

   // Añade datos a una tabla

   function addrow(tablename, arr) {

   var tbl = document.getElementById(tablename);

   var lastRow = tbl.rows.length;

   var row = tbl.insertRow(lastRow);

      for (r = 0; r < arr.length; r++) {   

         var cell = row.insertCell(r);

         cell.innerHTML = arr[r];

		 textoDiv('titulo',arr[r]);

		 

      }

   }

   

   // Añade texto a un DIV

   function textoDiv1(id,texto){

   

   var objeto = document.getElementById(id);

   objeto.innerHTML = texto;

   

   }

   

   function textoDominio(id,datos){

	publidos = "| <a href='#' onclick='abrirVentana(1);' class='blanco'><b>Privacidad</b></a>";

	publi = " | <a href='publicidad.html' class='blanco'><b>Diseño web y hosting por Naima´s Publicidad</b></a> | &copy;2006 ";

   texto = '';

   var objeto = document.getElementById(id);

   texto = "<a href='http://"+ datos +"'>" + datos + "</a>";

   objeto.innerHTML = publidos + publi + texto;

   

   }

   

   function textoNombre(id,datos){

   texto = '';

   var objeto = document.getElementById(id);

   texto = "<h2>"+ datos + "</h2>";

   objeto.innerHTML = texto;

   

   }

   

   // Añade texto a un DIV

   function textoDiv(id,datos){

   var objeto = document.getElementById(id);

    texto = '';

	for (r = 0; r < datos.length; r++) {

		if (texto == "") {

				texto = datos[r];

			} else {

				texto = texto + '<br><br>' +datos[r];

			}

	  }

	texto = "<h3>"+ id + "</h3>" + "<blockquote>" + texto + "</blockquote>";
	
	if (id == 'contacto') {
		
		texto = texto + '<blockquote><a href="mailto:fabiola@fabiola-escort.com" style="font-size:12px;">fabiola@fabiola-escort.com</a></blockquote>.';
		}
		
   objeto.innerHTML = texto;

   }

   

    // Vericar el tipo de nodo

   // ***********************

   // ***********************

   // ***********************

   /*

   function verificarTipos(tipo,datos){

		

		switch (tipo) { 

		case 'presentacion': 

		    textoDiv('presentacion',datos);

		   break ;

		case 'fotos': 

		    textoDiv('fotos',datos); 

		   break; 

		case 'caracteristicas': 

		    textoDiv('caracteristicas',datos);

		   break ;

		case 'servicios': 

		   textoDiv('servicios',datos);

		   break ;

		case 'contacto': 

		   textoDiv('contacto',datos); 

		   break ;

		case 'tarifas': 

		    textoDiv('tarifas',datos);

		   break ;

		} 

		

	}

	*/

   // ***********************

   // ***********************

   // ***********************

// Fin funciones de AJAX



function addfavoritos(){

	window.external.AddFavorite("http://www.maria-escort.com ","MARIA ESCORT.COM");

	}
function paginarSimple(pagina,orden,estoy){
	document.location = estoy +"?pagina="+ pagina + orden ;
}