<!--

var xmlHttp;
var completeDiv;
var inputField;
var nameTable;
var nameTableBody;

function createXMLHttpRequest() {
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
}

function initVars() {
	inputField = document.getElementById("kw");
	nameTable = document.getElementById("name_table");
	completeDiv = document.getElementById("popup");
	nameTableBody = document.getElementById("name_table_body");
}

function findNames(evt) {
	
    if(document.all)evt = event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
	if (charCode == 8) {
		clearNames();
	}
	initVars();
	if (inputField.value.length > 0) {
		createXMLHttpRequest();
		var url = "/includes/inc_hint.asp?q=" + escape(inputField.value);
		//alert(url);
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = callback;
		xmlHttp.send(null);
	}
	else {
		clearNames();
	}
}

function callback() {
	//alert(xmlHttp.readyState);
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			var name = xmlHttp.responseXML.getElementsByTagName("name")[0].firstChild.data;
			setNames(xmlHttp.responseXML.getElementsByTagName("name"));
		}
		else if (xmlHttp.status == 204 || xmlHttp.status == 500) {
			clearNames();
		}
		
	}
}

function setNames(the_names) {
	clearNames();
	var size = the_names.length;
	setOffsets();
	//alert(size);
	var row, cell, txtNode;
	for (var i = 0; i < size; i++) {
		var nextNode = the_names[i].firstChild.data;
		row = document.createElement("tr");
		cell = document.createElement("td");

		cell.onmouseout = function() {this.className='mouseOver';};
		cell.onmouseover = function() {this.className='mouseOut';};
		cell.setAttribute("bgcolor", "#FFFAFA");
		cell.setAttribute("border", "0");
		cell.setAttribute("class", "BodyText");
		cell.onclick = function() { populateName(this); } ;
		
		txtNode = document.createTextNode(nextNode);
		cell.appendChild(txtNode);
		row.appendChild(cell);
		nameTableBody.appendChild(row);
	}
}

function setOffsets() {
	
	var end = inputField.offsetWidth;
	
	var left = calculateOffsetLeft(inputField);
	
	var top = calculateOffsetTop(inputField) + inputField.offsetHeight;
	
	completeDiv.style.border = "black 1px solid";
	completeDiv.style.left = left + "px";
	completeDiv.style.top = top + "px";
	completeDiv.style.width = end + "px";
}

function calculateOffsetLeft(field) {
	return calculateOffset(field, "offsetLeft");
}

function calculateOffsetTop(field) {
	return calculateOffset(field, "offsetTop");
}

function calculateOffset(field, attr) {
	var offset = 0;
	while(field) {
		offset += field[attr];
		field = field.offsetParent;
	}
	return offset;
}

function populateName(cell) {
	inputField.value = cell.firstChild.nodeValue;
	clearNames();
}

function clearNames() {
	var ind = nameTableBody.childNodes.length;
	for (var i = ind - 1; i >= 0 ; i--) {
		nameTableBody.removeChild(nameTableBody.childNodes[i]);
	}
	completeDiv.style.border = "none";
}

//  This version of the refresh function will cause a new
//  entry in the visitor's history.  It is provided for
//  those browsers that only support JavaScript 1.0.
//  This is only for the redirect.


var sURL = unescape(window.location.href);
var edittable = null;
var previewListing = null;
var inPopUp;

function windowClose(windowname)
{
	if (windowname && windowname.open && !windowname.closed) windowname.close();
}


function tablePopUpLg(link)
{
	windowClose(previewListing);
	previewListing = window.open(link,'_previewListing','toolbar=no,width=725,height=500,resizable=no,scrollbars=yes');
	previewListing.focus();
	if (inPopUp) self.close();
}


function tablePopUpPrint(link)
{
	windowClose(previewListing);
	previewListing = window.open(link,'_previewListing','toolbar=no,width=770,height=700,resizable=no,scrollbars=yes');
	previewListing.focus();
	if (inPopUp) self.close();
}

function tablePopUp(link)
{
	windowClose(edittable);
	edittable = window.open(link,'_edittable','toolbar=yes,width=493,height=550,resizable=no,scrollbars=yes');
	edittable.focus();
	if (inPopUp) self.close();
}

function refreshEsp(querystring)
{
	if (querystring.lastIndexOf('?', querystring.length) == -1) {
		querystring = querystring + "?lang=2";
	}
	else {
		querystring = querystring + "&lang=2";
	}
    window.location.href = querystring;
    return false;
}

function refreshEng(querystring)
{
	if (querystring.lastIndexOf('?', querystring.length) == -1) {
		querystring = querystring + "?lang=1";
	}
	else {
		querystring =  querystring + "&lang=1";
	}
    window.location.href = querystring;
    return false;
}

function refreshEngUK(querystring)
{
	if (querystring.lastIndexOf('?', querystring.length) == -1) {
		querystring = querystring + "?lang=3";
	}
	else {
		querystring =  querystring + "&lang=3";
	}
    window.location.href = querystring;
    return false;
}

function SelectMap()
{
	if (document.frmmapLg.cboMapID.value == "") {
		alert("You need to choose a map to view.");
		document.frmmapLg.cboMapID.focus();
		return false;
	}
	else
	{
		document.frmmapLg.submit()
	}
}

function SelectMapEsp()
{
	if (document.frmmapLg.cboMapID.value == "") {
		alert("Necesita seleccionar una mapa para verlo.");
		document.frmmapLg.cboMapID.focus();
		return false;
	}
	else
	{
		document.frmmapLg.submit()
	}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
// *****************************Fly Menu Functions compatibal with Net 4, 6 and IE 5.5 *******************


//  ********************** Text Menu Mouse over **************************************
var ns4 = (document.layers ? true:false);
var ns6 = (document.getElementById ? true:false);
var ie4 = (document.all ? true:false);
var g_Color_On ="#99CC99";//99FF99 66CC66
var g_Color_Off ="#FFFFFF";
var mac;
var agt=navigator.userAgent.toLowerCase();
var is_mac    = (agt.indexOf("mac")!=-1);

if (agt.indexOf("mac")!=-1) {
	mac=true;
}
else {
	mac=false;
}


function mouseChange(m_id, m_status) {
	if (ns4) {m_id.bgColor = ((m_status == 1) ? g_Color_On : g_Color_Off);}
	if (ns6) {m_id.bgColor = ((m_status == 1) ? g_Color_On : g_Color_Off);}
	if (ie4) {m_id.style.backgroundColor = ((m_status == 1) ? g_Color_On : g_Color_Off);}
}


var TimerID;
ns= 0;




if (navigator.appName == "Netscape") {
// *********************For Netscape 6 *********************************************
	if (parseInt(navigator.appVersion)  == 5) {
		layerRef="document.getElementById";
		styleSwitch =".style";
		ns = 1;
	}
// *********************For Netscape 4 *********************************************
	else {
		layerRef="document.layers";
		styleSwitch="";
	}
}
// *********************For IE *****************************************************
else {
	layerRef="document.all";
	styleSwitch=".style";
}

function fadeLayer(layerName) {
     clearTimeout(TimerID)
     //TimerID = self.setTimeout('hideLayer("buttonLayerID' + layerName + '")', 750)
     self.setTimeout('hideLayer("buttonLayerID' + layerName + '")', 750)	
}


function showLayer (layerName) {
//    self.clearTimeout(TimerID)
// *********************For Netscape 4 *********************************************
	if (ns4) {
			x = 'document.' + layerName;
			eval(x +'.visibility = "show"');
	}
// *********************For IE *****************************************************
	else if (layerRef == "document.all") {
		if (eval(layerRef + '["' + layerName + '"]')) {
			eval(layerRef + '["' + layerName + '"]' + styleSwitch + '.visibility ="visible"');
		
		}
	}
// *********************For Netscape 6 *********************************************
	else if (layerRef == "document.getElementById") {
		x = 'document.getElementById("' + layerName + '")';
		eval(x + styleSwitch +'.visibility="visible"');
	}
	//if (mac) {
	//	hideLayer('iframeDiv');
	//}
}

function showLayerAds (layerName) {
    self.clearTimeout(TimerID)
// *********************For Netscape 4 *********************************************
	if (ns4) {
			x = 'document.' + layerName;
			eval(x +'.visibility = "show"');
	}
// *********************For IE *****************************************************
	else if (layerRef == "document.all") {
		if (eval(layerRef + '["' + layerName + '"]')) {
			eval(layerRef + '["' + layerName + '"]' + styleSwitch + '.visibility ="visible"');
		}
	}
// *********************For Netscape 6 *********************************************
	else if (layerRef == "document.getElementById") {
		x = 'document.getElementById("' + layerName + '")';
		eval(x + styleSwitch +'.visibility="visible"');
	}
}


function hideLayer (layerName) {
//	clearTimeout(TimerID)
// *********************For Netscape 4 *********************************************
	if (ns4) {
			x = 'document.' + layerName;
			eval(x +'.visibility = "hide"');
	}
// *********************For IE *****************************************************
	else if (layerRef == "document.all") {
		if (eval(layerRef + '["' + layerName + '"]')) {
			eval(layerRef + '["' + layerName + '"]' + styleSwitch + '.visibility ="hidden"');
		}
	}
// *********************For Netscape 6 *********************************************
	else if (layerRef == "document.getElementById") {
		x = 'document.getElementById("' + layerName + '")';
		eval(x + styleSwitch +'.visibility="hidden"');
	}
}



function hideMacLayer (layerName) {
	if (mac) {
		clearTimeout(TimerID);
		// *********************For Netscape 4 *********************************************
		if (ns4) {
				x = 'document.' + layerName;
				eval(x +'.visibility = "hide"');
		}
		// *********************For IE *****************************************************
		else if (layerRef == "document.all") {
			if (eval(layerRef + '["' + layerName + '"]')) {
				eval(layerRef + '["' + layerName + '"]' + styleSwitch + '.visibility ="hidden"');
			}
		}
		// *********************For Netscape 6 *********************************************
		else if (layerRef == "document.getElementById") {
			x = 'document.getElementById("' + layerName + '")';
			eval(x + styleSwitch +'.visibility="hidden"');
		}
	}
}

function submitForm() {
	if (document.frmKeywords.kw.value == "") {
		alert("You need to enter a text value to search.");
		document.frmKeywords.kw.focus();
		return false;
	}
	else {
	return true;
	}
}
function submitFormEsp() {
	if (document.frmKeywords.kw.value == "") {
		alert("No se te olvide proporcionar la palabra clave en el espacio.");
		document.frmKeywords.kw.focus();
		return false;
	}
	else {
	return true;
	}
}




//-->
