
var lEvents=false;
// Sistema de Localización Geografica (C) Versus Soft 1997-99. JavaScript Code.

function StartEvents()
{
lEvents=true
window.defaultStatus='Sistema de Localización Geografíca. Proyecto SIC-Cádiz';
}
function vsOpenWindow(cURL,cWinName,cFeatures)
{
window.open(cURL,cWinName,cFeatures)
}
// DataItem
function DataItem(cNombre,cDomicilio,cCP,cTlf,cFax,cURL,cURLImg,cTipo1,cSubtipo1,cSubtipo2)
{
this.cNombre=cNombre
this.cDomicilio=cDomicilio
this.cCP=cCP
this.cTlf=cTlf
this.cFax=cFax
this.cURL=cURL
this.cURLImg=cURLImg
this.cTipo1=cTipo1
this.cSubtipo1=cSubtipo1
this.cSubtipo2=cSubtipo2
}
function getProperties(obj) 
  {
  var properties = "";   
  properties = '<TABLE BORDER="2" WIDTH="90%" COLS="2">';  
  properties += '<TR ALIGN="left" BGCOLOR="lightgrey"><TH>Property</TH><TH>Value</TH></TR>';  
      
  for (var propName in obj) 
      {   
      properties +="<TR><TD>"+propName+"</TD><TD>"+obj[propName]+"&nbsp;</TD></TR>";  
      }   
  properties +="</TABLE>";  
return properties;   
} 

function ObjNavegador ()
{  
    var agt=navigator.userAgent.toLowerCase()    
    this.major = parseInt(navigator.appVersion)
    this.minor = parseFloat(navigator.appVersion)
    this.nav  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1)))
    this.ns2 = (this.nav && (this.major == 2))
    this.ns3 = (this.nav && (this.major == 3))
    this.ns4 = (this.nav && (this.major >= 4))
    this.navonly      = (this.nav && (agt.indexOf(";nav") != -1))
    this.ie   = (agt.indexOf("msie") != -1)
    this.ie3  = (this.ie && (this.major == 2))
    this.ie4  = (this.ie && (this.major >= 4))
     
    if (this.ns2 || this.ie3) this.js = 1.0
    else if (this.ns3 || this.opera) this.js = 1.1
    else if (this.ns4 || this.ie4) this.js = 1.2
    else if ((this.nav && (this.minor > 4.05)) || (this.ie && (this.major > 4))) 
         this.js = 1.2
    else this.js = 0.0 // HACK: always check for JS version with > or >=
}
function RMoveLayer(cName,nRelativeX,nRelativeY)
{
var nValueX,nValueY
if (Navegador.ns4)
   {
   if (nRelativeX)
      {
      nValueX=eval('document.layers["'+cName+'"].left')+nRelativeX
      eval ('document.layers["'+cName+'"].left='+nValueX)
      }
   if (nRelativeY)
      {
      nValueY=eval('document.layers["'+cName+'"].top')+nRelativeY
      eval ('document.layers["'+cName+'"].top='+nValueY)
      }
   }
else if (Navegador.ie4)
   {
   if (nRelativeX)
      {
      nValueX=parseInt(eval (cName+'.style.left'))+nRelativeX
      nValueX=nValueX+'px'
      eval(cName+'.style.left="'+nValueX+'"')
      }
   if (nRelativeY)
      {
      nValueY=parseInt(eval (cName+'.style.top'))+nRelativeY
      nValueY=nValueY+'px'
      eval(cName+'.style.top="'+nValueY+'"')
      }   
   }
}
function AMoveLayer(cName,nAbsX,nAbsY)
{
if (Navegador.ns4)
   {
   eval ('document.layers["'+cName+'"].left='+nAbsX)
   eval ('document.layers["'+cName+'"].top='+nAbsY)
   }
else if (Navegador.ie4)
   {
   eval (cName+'.style.left="'+nAbsX+'px"')
   eval (cName+'.style.top="'+nAbsY+'px"')
   }
}
//
function LayerHeight(cName)
{
var nReturn
if (Navegador.ns4)
   {
   nReturn=eval ('document.layers["'+cName+'"].height')
   }
else if (Navegador.ie4)
   {
   nReturn=parseInt(eval(cName+'.style.height'))
   }
return nReturn
}


function LayerWidth(cName)
{
var nReturn
if (Navegador.ns4)
   {
   nReturn=eval ('document.layers["'+cName+'"].width')
   }
else if (Navegador.ie4)
   {
   nReturn=parseInt(eval(cName+'.style.width'))
   }
return nReturn
}

function LayerVisible(cName)
{
var lShow,cShow;
if (Navegador.ns4)
   {
   cShow=eval ('document.layers["'+cName+'"].visibility')
   }
else if (Navegador.ie4)
   {
   cShow=eval (cName+'.style.visibility')
   }
cShow=cShow.toLowerCase()
if (cShow == 'hidden')
   {
   lShow=false
   }
else 
   {
   lShow=true
   }
return lShow
}
//
function EscondeFicha(cNone)
{
if (lEvents)
   {
   ShowLayer('LHint',0)
   }
}
//
function SacaFicha(nItem,nTop,nLeft,nHeight,nWidth,cVAlign,cHAlign)
{
if (lEvents)
   {
   var cLayer='LHint'
   var lShow

   lShow=LayerVisible(cLayer)

   if (lShow)
      {
      ShowLayer(cLayer,0)
      }

   AMoveLayer(cLayer,nTop,nLeft)
   CreaFicha(cLayer,aDataItem[nItem],'LEFT',nHeight,nWidth,cVAlign,cHAlign)
   ShowLayer(cLayer,1)
   }
}
//
function CreaFicha(cLayer,oDataItem,cJustify,nHeight,nWidth,cVAlign,cHAlign)
{
var cFicha
cFicha='<table width=100% height=100% cellpadding=0 cellspacing=0 border=0>'
+'<tr>'
+'<td align="'+cHAlign+'" valign="'+cVAlign+'"> '
+'<table border=0 cellpadding=0 cellspacing=0 width="'+nWidth+'"><tr><td align="'+cHAlign+'">'
+'<table border=0 cellpadding=0 cellspacing=0>'
+'<tr>'
+'<td>'
+'<table border=1 cellpadding=0 cellspacing=0>'
+'<tr>'
+'<td bgcolor="#FFFFDF">'
+'<table border=0>'
+'<tr>'
+'<td bgcolor="#444488"  align='+cJustify+' >'
+'<table align='+cJustify+' cellpadding=2 border=0>'
+'<tr>'
+'<td valign="MIDDLE"><img src="'+oDataItem.cURLImg+'"> '
+'</td>'
+'<td valign="MIDDLE"> <font color="yellow" face="Arial,Helvetica" size=-2><b>'
+oDataItem.cNombre+'</b></font> </td>'
+'</tr>'
+'</table>'
+'</td>'
+'</tr>'
+'<tr> '
+'<td bgcolor="white"> <font face="Arial,Helvetica" size=-2><i>'
+oDataItem.cDomicilio+'</i> </font> </td>'
+'</tr>'
if (!oDataItem.cSubtipo2 && oDataItem.cSubtipo1)
   {
    cFicha=cFicha+'<tr> '
    +'<td bgcolor="silver"> <font face="Arial,Helvetica" size=-2>'
    +oDataItem.cSubtipo1+'</font> </td>'
    +'</tr>'
    } 
if (oDataItem.cSubtipo2)
    {
    cFicha=cFicha+'<tr> '
    +'<td bgcolor="silver"> <font face="Arial,Helvetica" size=-2>'
    +oDataItem.cSubtipo2+'</font></td>'
    +'</tr>'
    } 
cFicha=cFicha+'</table>'
+'</td>'
+'</tr>'
+'</table>'
+'</td>'
+'<td width=10 background="/planodecadiz/img/trans_black_vertical10.gif"><FONT SIZE=-5>&nbsp;</FONT></td>'
+'</tr>'
+'<tr>'
+'<td background="/planodecadiz/img/trans_black_horizontal10.gif" colspan=2 height=10><FONT SIZE=-5>&nbsp;</FONT></td>'
+'</tr>'
+'</table>'
+'</td></tr></table>'
+'</td>'
+'</tr>'
+'</table>'

ModifyLayer(cLayer,cFicha)

}
//
function ModifyLayer(cName,cNewContent)
{
if (Navegador.ns4)
   {
   eval ('document.layers["'+cName+'"].document.open()')
   eval ('document.layers["'+cName+'"].document.write('+"'"+cNewContent+"'"+')')
   eval ('document.layers["'+cName+'"].document.close()')
   }
else if (Navegador.ie4)
   {
   eval (cName+'.innerHTML='+"'"+cNewContent+"'")
   }
}
//
function ShowLayer(cName,lShow)
{
var cNewValue

if (lShow==1)
   {
   cNewValue="visible"
   }
else if (lShow==2)
   {
   cNewValue="inherit"
   }
else if (lShow==0)
   {
   cNewValue="hidden"
   }
if (Navegador.ns4)
   {
   eval ('document.layers["'+cName+'"].visibility="'+cNewValue+'"')
   }
else if (Navegador.ie4)
   {
   eval (cName+'.style.visibility="'+cNewValue+'"')
   } 
}

var Navegador=new ObjNavegador()

// Final JS Defs 
