var coord = Array()
var destino = 'subSubmenu'

function sitemapVer(tipo, grupo){
	obj = document.getElementById('subSubmenu')
	obj.style.visibility = 'visible'
	obj.style.display = 'block'
	ref = document.getElementById('submenuDesplegable')
	superior = posicion(ref)['y']
	izquierda = posicion(ref)['x'] + (860 - 570)
	obj.style.top = superior + 'px'
	obj.style.left = izquierda + 'px'
	listarLinks(tipo, grupo)
}

function listarLinks(tipo, grupo){
	var url = "php/listarLinks.php?tipo=" + escape(tipo) + '&grupo=' + escape(grupo) + '&id=' + Math.random()
	document.getElementById(destino).innerHTML = '<p style="color:#F00">Cargando...</p>'
	xmlHttp = crearXmlHttp()
	xmlHttp.open("GET", url, true)
	xmlHttp.onreadystatechange = listarLinksHttp
	xmlHttp.send(null)
}

function listarLinksHttp(){
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
		if (xmlHttp.status == 200)
			document.getElementById(destino).innerHTML = xmlHttp.responseText
}

function sitemapCerrar(){
	obj = document.getElementById('subSubmenu')
	obj.style.visibility = 'hidden'
	obj.style.display = 'none'
}

function posicion(oElement){
	if (typeof(oElement.offsetParent) != 'undefined'){
		for (var posX=0, posY=0; oElement; oElement=oElement.offsetParent){
			posX += oElement.offsetLeft
			posY += oElement.offsetTop
		}
		coord['y'] = posY
		coord['x'] = posX
	}
	else{
		coord['y'] = oElement.y
		coord['x'] = oElement.x
	}
	return coord
}

function sitemap(){
	alert('Gracias por consultarnos y usar nuestros servicios.')
}

function tab(titulo){
	salida = '<table cellspacing="0"><tr>'
	salida += '<td class="tabs" style="width:153px; background:url(images/html/tabGESel.gif) 0 0 no-repeat" />' + titulo + '</td>'
	salida += '</tr></table>'
	document.getElementById('tabs').innerHTML = salida
}
