

function Busqueda(){
  this.FiltrosBusqueda=new Filtros();
  this.FechaBusqueda=Date.now();
  this.Resultados=new Resultados();
}//Busqueda

function RegistroHistoria(){
    this.micrositio=null;
    this.texto=null;
    this.lat=null;
    this.lng=null;
    this.zoom=null;
    this.pai=null;
    this.est=null;
    this.del=null;
    this.col=null;
    this.cat=null;
    this.sub=null;
    this.grp=null;
}//RegistroHistoria

function Lugar(addrr, pin,lat,lng, addrrd){
  this.Address = addrr;
  this.AddressDetails = addrrd;
  this.Pin=pin;
  this.Lat=lat;
  this.Lng=lng;
}//Lugar

function Filtros(){
    this.TextoBuscado='';
    this.POI='';
    this.Micrositio='';
    
    this.Pais=new Pais();
    this.Pais.IDPais = 1;
    this.Pais.Nombre = 'M&eacute;xico';
    this.Estado=null;
    this.Delegacion=null;
    this.Colonia=null;
    
    this.CategoriasTodas=new CategoriasTodas();
    this.CategoriasTodas.Nombre='Todas las Categor&iacute;as';
    this.Categoria=null;
    this.SubCategoria=null;
    this.Grupo=null;
    
    this.Zona=new Zona();
    this.Resultados = new Array();
    this.TotalResultados=0;
    this.TotalResultadosMostrados=0;
}//Filtros

function Zona(){
    this.Lat1 = null;
    this.Lng1 = null;
    this.Lat2 = null;
    this.Lng2 = null;
}//Zona

function Negocio(){
    this.Id = 0;
    this.IdCentroCom='';
    this.ContenidoCentroCom=new Array;
    this.CargadoDetalle=false;
    
    this.Generales = new Generales();
    this.Extras = new Extras();
    this.Contacto = new Contacto();
    this.Categorizacion = new Categorizacion();
    this.Ubicacion = new Ubicacion();
    this.Archivos=new Archivos();
    this.Autoplaza=new Autoplaza();
    this.QueremosComer=new QueremosComer();
    this.Pin=null;
    this.Comentarios = new Array;
}//Negocio

function Comentario(id){
  this.Id=id;
  this.Usuario=null;
  this.Fecha=null;
  this.Texto='';
}//Comentario

function Generales(){
    this.Nombre='';
    this.RazonSocial='';
    this.Descripcion='';
}//Generales

function Extras(){
    this.Horarios='';
    this.FormasDePago='';
    this.PalabrasClave='';
    this.Productos='';
}//Extras


function Archivos(){
    this.Icono = '';
    this.IconoWidth = '';
    this.IconoHeight = '';
    this.Logotipo = '';
    this.FotoMini = '';
    this.Fotos = new Array;
    this.Videos = new Array;
    this.Documentos = new Array;
}//Archivos

function Categorizacion(){
    this.Categoria = new Categoria();
    this.SubCategoria = new SubCategoria();
    this.Grupo = new Grupo();
}//Categorizacion

function Ubicacion(){
    this.Direccion='';
    this.CP='';
    this.Indicaciones='';
    this.Zona='';
    this.Pais = new Pais();
    this.Estado = new Estado();
    this.Delegacion = new Delegacion();
    this.Colonia = new Colonia();
    this.Lat='';
    this.Lng='';
}//Ubicacion

function Contacto(){
  this.PersonaContacto='';
  this.Telefono1='';
  this.Telefono2='';
  this.Telefono3='';
  this.Fax='';
  this.EMail='';
  this.WWW='';
  this.WWW2='';
  this.www_Cartelera='';
}//Contacto

function Autoplaza(){
    this.Id='';
    this.Disponibles='';
}//Usuario

function QueremosComer(){
    this.Id='';
    this.Url='';
    this.ReservaURL='';
}//QueremosComer

function Usuario(){
    this.ID=0;
}//Usuario


function CategoriasTodas(){
    this.ID=0;
    this.Nombre='';
    this.Icono='';
    this.Categorias= new Array;

    this.Total=null;
    this.TotalEstado=null;
    this.TotalDelegacion=null;
    this.TotalColonia=null;
    
    this.TotalFiltroActual=null;
}//CategoriasTodas

function Categoria(){
    this.IDCategoria=0;
    this.Nombre='';
    this.Icono='';
    this.SubCategorias= new Array;

    this.Total=null;
    this.TotalEstado=null;
    this.TotalDelegacion=null;
    this.TotalColonia=null;
    
    this.TotalFiltroActual=null;
}//Categoria

function SubCategoria(){
    this.IDCategoria = 0;
    this.IDSubCategoria=0;
    this.Nombre='';
    this.Icono='';
    this.Grupos= new Array;

    this.Total=null;
    this.TotalEstado=null;
    this.TotalDelegacion=null;
    this.TotalColonia=null;
    
    this.TotalFiltroActual=null;
}//Subcategoria

function Grupo(){
    this.IDCategoria =0;
    this.IDSubCategoria =0;
    this.IDGrupo=0;
    this.Nombre='';
    this.Icono='';


    this.Total=null;
    this.TotalEstado=null;
    this.TotalDelegacion=null;
    this.TotalColonia=null;

    this.TotalFiltroActual=null;
}//Grupo

function Pais(){
    this.IDPais=0;
    this.Nombre='';
    this.Estados= new Array;
    
    this.Total=null;
    this.TotalCategoria=null;
    this.TotalSubCategoria=null;
    this.TotalGrupo=null;
    
    this.TotalFiltroActual=null;
}//Pais

function Estado(){
    this.IDPais = 0;
    this.IDEstado=0;
    this.Nombre='';
    this.Delegaciones= new Array;

    this.Total=null;
    this.TotalCategoria=null;
    this.TotalSubCategoria=null;
    this.TotalGrupo=null;
    
    this.TotalFiltroActual=null;
}//Estado

function Delegacion(){
    this.IDPais = 0;
    this.IDEstado = 0;
    this.IDDelegacion=0;
    this.Nombre='';
    this.Colonias= new Array;

    this.Total=null;
    this.TotalCategoria=null;
    this.TotalSubCategoria=null;
    this.TotalGrupo=null;
    
    this.TotalFiltroActual=null;
}//Delegacion

function Colonia(){
    this.IDPais = 0;
    this.IDEstado = 0;
    this.IDDelegacion=0;
    this.IDColonia = 0;
    this.Nombre='';

    this.Total=null;
    this.TotalCategoria=null;
    this.TotalSubCategoria=null;
    this.TotalGrupo=null;
    
    this.TotalFiltroActual=null;
}//Colonia


function AplicaTransparencia(objName,transparency){
      var browser=navigator.appName;
      if (browser=='Opera'){
              return;
      }
      
      var obj = e(objName);
      if (document.all){
              obj.style.filter = 'alpha(opacity='+transparency+')';
      }else{
              obj.style.opacity = transparency /100;
              obj.style.MozOpacity = transparency /100;
              obj.style.KHTMLOpacity = transparency /100;
      }
}//AplicaTransparencia


function init() {var reqTemp;if (window.XMLHttpRequest) {reqTemp = new XMLHttpRequest();if (reqTemp.overrideMimeType) {reqTemp.overrideMimeType('text/xml');}} else if (window.ActiveXObject) {try {reqTemp = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {reqTemp = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}}}var url = "AppServlet";reqTemp.open("POST", url, true);reqTemp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");return reqTemp;}//init

    
  function nullOptions(aMenu){
      try {
              aMenu.options.length=0;
      } catch(err){}

      try {
              var tot=aMenu.options.length
              for (i=0;i<tot;i++){
                      aMenu.options[i]=null
              }
      } catch(err){}
  }//nullOptions

function EsExplorer(){    
    if (BrowserDetect.browser=='Explorer'){
      return true;    
    } else {
      return false;    
    }
    
}//EsExplorer

function NewWindow(mypage,myname,w,h,scroll,pos){if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes';win=window.open(mypage,myname,settings);}//NewWindow

function AbreLink(murl){
  NewWindow(murl,"link"+Math.random().toString().substring(2),700,600,"yes","center");
}//AbreLink

    
function RegresaValorXML(xmlNode){
    try {
       var strValor='';
      if (xmlNode.childNodes.length>0){
          strValor=xmlNode.childNodes[0].nodeValue;
      } 
      return strValor;
    } catch(err){
      return '';
    }
}//RegresaValorXML
    
function RegresaValorLista(xml, strCampo, indice){
        var strValor="";
        try {
                var r = xml.getElementsByTagName("ROW")[indice];
                strValor = r.getElementsByTagName(strCampo)[0].childNodes[0].nodeValue;
                if (strValor=="null"){
                        strValor="";
                }
        } catch(err){}

        return strValor;
}//RegresaValorLista



	function FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas)
	/**********************************************************************
		IN:
			NUM - the number to format
			decimalNum - the number of decimal places to format the number to
			bolLeadingZero - true / false - display a leading zero for
											numbers between -1 and 1
			bolParens - true / false - use parenthesis around negative numbers
			bolCommas - put commas as number separators.

		RETVAL:
			The formatted number!
	 **********************************************************************/
	{
	        if (isNaN(parseInt(num))) return "NaN";

		var tmpNum = num;
		var iSign = num < 0 ? -1 : 1;		// Get sign of number

		// Adjust number so only the specified number of numbers after
		// the decimal point are shown.
		tmpNum *= Math.pow(10,decimalNum);
		tmpNum = Math.round(Math.abs(tmpNum))
		tmpNum /= Math.pow(10,decimalNum);
		tmpNum *= iSign;					// Readjust for sign


		// Create a string object to do our formatting on
		var tmpNumStr = new String(tmpNum);

		// See if we need to strip out the leading zero or not.
		if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
			if (num > 0)
				tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length);
			else
				tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length);

		// See if we need to put in the commas
		if (bolCommas && (num >= 1000 || num <= -1000)) {
			var iStart = tmpNumStr.indexOf(".");
			if (iStart < 0)
				iStart = tmpNumStr.length;

			iStart -= 3;
			while (iStart >= 1) {
				tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length)
				iStart -= 3;
			}
		}

		// See if we need to use parenthesis
		if (bolParens && num < 0)
			tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")";

		return tmpNumStr;		// Return our formatted string!
	}//FormatNumber 

        function QuitaNull(texto){
		if (texto=='null'){
			return '';
		} else {
			return texto.trim();
		}
	}//QuitaNull

	function reverse(inp) {var outp = 0;for (n = 0; n <= inp.length; n++) {outp = inp.charAt (n) + outp;}return outp;} //reverse
        function atox(a){var temp = reverse(a);var dec = parseInt(temp.charAt(0));var temp1 = temp.substring(1,dec+1);temp1 = temp1 + '.' + temp.substring(dec+1,temp.length -1);return temp1;}//atox

        String.prototype.trim = function(){ return this.replace(/^\s+|\s+$/g,'') }; //trim
        
	Array.prototype.remove = function(from, to) {
	  var rest = this.slice((to || from) + 1 || this.length);
	  this.length = from < 0 ? this.length + from : from;
	  return this.push.apply(this, rest);
	}; //Array Remove



        function MarquitoFoto(strTexto){
		var strMarco="";
                if (strTexto!=""){
                  strMarco = "<table bgcolor=white width='120px' cellspacing='0' cellpadding='1' style='border:1px solid rgb(150,150,150)' onmouseout ='this.style.border=\"1px solid rgb(150,150,150)\";' onmouseover ='this.style.border=\"1px solid rgb(255,150,9)\";'><tr><td valign=middle align=center><div style='top:0px; left:0px;'>" + strTexto;
                  strMarco = strMarco + "</div></td></tr></table>";
                }
		return strMarco;
	}//MarquitoFoto
        
        

  var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

