// JavaScript Document
var aCajasBanner=[];
function CajaBanner(idcaja){
	this.caja_id=idcaja;
}
CajaBanner.prototype.inicio=function(){
	//try{
		this.div=$j("#cajabanner_"+this.caja_id);
		this.div.html="inicio caja"+this.caja_id;
		ma_url='/_base/libs/damebanner.asp';
		this.ajaxRequest = new ajaxObject(ma_url);
//}catch (e){}
}
CajaBanner.prototype.cargaBanner=function(){
	this.ajaxRequest.callback = function (responseText) {
		oRespu = $j.parseJSON(responseText);
		$j("#cajabanner_"+oRespu.caja).html(decodeURIComponent(oRespu.contenido));
		}
	var now = new Date();
	this.ajaxRequest.update('caja='+this.caja_id+'&ts=' + now.getTime());
}

function eefinCargaBanner(oResp, txt){
	alert(oResp.caja);
}

$j(InicioBanners);

function InicioBanners(){
	for (x=0; x<aCajasBanner.length;x++){
		aCajasBanner[x].inicio();
	}
	siguienteBanner();
}

function siguienteBanner(){
	for (x=0; x<aCajasBanner.length;x++){
		aCajasBanner[x].cargaBanner();
	}
		try {
        clearTimeout(to);
    } catch (e) {}

    to = setTimeout("siguienteBanner()", 15000);
}




// otra funcion ajax //
/*
   method : POST/GET
   url    : Call url
   func   : custom function which is used to process returned data,
            take only one parameter
*/
function CDownloadUrl(method, url, func) {
   var httpObj;
   var browser = navigator.appName;
   if(browser.indexOf("Microsoft") > -1)
      httpObj = new ActiveXObject("Microsoft.XMLHTTP");
   else
      httpObj = new XMLHttpRequest();
 
   httpObj.open(method, url, true);
   httpObj.onreadystatechange = function() {
      if(httpObj.readyState == 4){
         if (httpObj.status == 200) {
            var contenttype = httpObj.getResponseHeader('Content-Type');
            if (contenttype.indexOf('xml')>-1) {
               func(httpObj.responseXML);
            } else {
               func(httpObj.responseText);
            }
         } else {
            func('Error: '+httpObj.status);
         }
      }
   };
   httpObj.send(null);
}
// fin otra funcion ajax //




function enviaForm(cFormulario){ // envia el formulario
	$j("#"+cFormulario).submit();
	}
	
function MenuieFix(topLevel) //funcion para aņadir a los menus lo que le falta para ie5 y ie6
{
var ua = navigator.userAgent;
var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
var isMSIE5_5 = isMSIE && (ua.indexOf('MSIE 5.5') != -1);
var isMSIE6 = isMSIE && (ua.indexOf('MSIE 6.0') != -1);

	if (isMSIE5_5 || isMSIE6) 
	{
	document.getElementById(topLevel).innerHTML = document.getElementById(topLevel).innerHTML.replace (/<ul/gi,"<table><tr><td><ul").replace (/<\/ul>/gi,"</ul></td></tr></table></a>");
	for (i=0;i<document.getElementsByTagName("li").length; i++) 
		{
		if (document.getElementsByTagName("li").item(i).className == "sub" || document.getElementsByTagName("li").item(i).className == "sub menuSup")
			{
			document.getElementsByTagName("li").item(i).innerHTML = document.getElementsByTagName("li").item(i).innerHTML.replace(/<\/a>/i,"");
			}
		}
	}
}


