// JavaScript Document
var chkClrVal = new Array();
var currCont;
var intSites =  new Array(
	new Array("Admotion Argentina", "http:\/\/www.admotion.com.ar\/"),
	new Array("Admotion Brasil", "http:\/\/www.admotion.com.br\/"),
	new Array("Admotion México", "http:\/\/www.admotion.com.mx\/")
);
function genIntSel() {
	var u='<form name="intSelect">';
	u+='<select name="select" onchange="gt(this.form)" SIZE="1">';
	u+='<option value="">Sitios internacionales...<\/option>';
	u+='<option value=""><\/option>';
	for (i=0;i<intSites.length;i++) {
		u+='<option value="'+intSites[i][1]+'">'+intSites[i][0]+'<\/option>';
	}
	u+='<\/select>'
	u+='<\/form>';
	return u;
}
function genSwfObj(file, ancho, alto, fv, wmode) {
	var u='<OBJECT ID="id'+file+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=7,0,0,0" WIDTH="'+ancho+'" HEIGHT="'+alto+'"><PARAM NAME=movie VALUE="'+file+'" \/><PARAM NAME=quality VALUE=high \/><PARAM NAME=menu VALUE=false \/><PARAM NAME=bgcolor VALUE=#FEFEFE \/>';
	if (typeof(wmode)!="undefined") u+= '<PARAM NAME="wmode" VALUE="'+wmode+'" \/>';
	if (typeof(fv)!="undefined") u+= '<PARAM NAME=FlashVars VALUE="'+fv+'" \/>';
	u+= '<EMBED NAME="id'+file+'" swLiveConnect="true" bgcolor="#FEFEFE" src="'+file+'" menu=false quality=high WIDTH="'+ancho+'" HEIGHT="'+alto+'" TYPE="application\/x-shockwave-flash" PLUGINSPAGE="http:\/\/www.macromedia.com\/go\/getflashplayer"';
	if (typeof(fv)!="undefined") u+= ' FlashVars="'+fv+'"';
	if (typeof(wmode)!="undefined") u+= ' wmode="'+wmode+'"';
	u+= '><\/EMBED><\/OBJECT>';
	return u;
}
function insSwf(file, ancho, alto, fv) {
	document.write(genSwfObj(file, ancho, alto, fv));
}
function insSwfDiv(divid, file, ancho, alto, fv) {
	document.getElementById(divid).innerHTML = genSwfObj(file, ancho, alto, fv);
}
function pm(u,d,intl) {
	var t=u+'@'+d+'.'+intl;
	document.write('<A hr','ef="mai','lto:',t,'">',t,'</a>');
}
function clrValue(i, obj){
	if (!chkClrVal[i]) {
		chkClrVal[i]=true;
		obj.value="";
		obj.style.color="#555555";
	}
}
function CheckForm () {
	if (document.frmSiteSearch.search.value==""){
		alert("Por favor, debe ingresar al menos un termino de búsqueda.");
		document.frmSiteSearch.search.focus();
		return false;
	}
	return true
}
function printSearch() {
	var t='<table align="center" border="0" cellspacing="0" cellpadding="5">';
	t+='<tr bgcolor="#e6f3ea"><form method="get" name="frmSiteSearch" action="\/buscar.asp" onSubmit="return CheckForm();"><input name="mode" type="hidden" value="anywords" \/>';
	t+='<td class="prodc" align="right">Buscar en el sitio:<\/td>';
	t+='<td><input onfocus="clrValue(3, this)" class="formText" name="search"  type="text" value="" maxlength=20 \/><\/td>';
	t+='<\/form><\/tr>';
	t+='<tr><td colspan="2"><img src="\/i\/trans.gif" width="1" height="1" border="0" \/><\/td><\/tr>';
	t+='<tr><td colspan="2" class="prodc" align="center" bgcolor="#e6f3ea">';
	//t+=genIntSel();
	t+='<\/td><\/tr><\/table>';
	document.write(t);
}
function printLogin() {
	var t='<table width="0" border="0" cellspacing="5" cellpadding="0">';
	t+='<tr><form action="\/reportes\/login2.adm" method="post" name="loginRep" target="_self" id="loginRep">';
	t+='<td><img src="i\/log01.gif" alt="Acceso clientes" width="50" height="16" border="0" \/><\/td>';
	t+='<td><img src="i\/log02.gif" alt="Acceso clientes" width="2" height="24" border="0" \/><\/td>';
	t+='<td valign="bottom"><input onfocus="clrValue(1, this)" class="formText" name="id"  type="text" value="usuario" size="20" maxlength=20><\/td>';
	t+='<td valign="bottom"><input onfocus="clrValue(2, this)" class="formText" name="senha"  type="password" value="password" size="20" maxlength=20><\/td>';
	t+='<td><img src="i\/log02.gif" alt="Acceso clientes" width="2" height="24" border="0" \/><\/td>';
	t+='<td><input type="image" value="Login" src="i\/login.gif" alt="Login"><\/td>';
	t+='<\/form><\/tr>';
	t+='<\/table>';
	document.write(t);
}
function printm(u,d,t) {
	document.write('<a href="mai','lto:',u,'@',d,'">',t,'<\/a>');
}
function switchCon(x) {
	if (currCont!=null) document.getElementById("me"+currCont).style.backgroundColor = "";
	document.getElementById("contenido").innerHTML=document.getElementById("con"+x).innerHTML;
	document.getElementById("me"+x).style.backgroundColor = "#CCCCCC";
	currCont=x;
}
// Get query
function ADM_getArgs() {
	var args=new Object(), query=location.search.substring(1), pairs=query.split("&");
	for (var i=0;i<pairs.length;i++) {
		var pos=pairs[i].indexOf("=");
		if (pos==-1) continue;
		var argname=pairs[i].substring(0,pos),value=pairs[i].substring(pos+1);
		args[argname]=unescape(value)
	}
	return args
};
var args=ADM_getArgs();
// AJAX
function ajaxCarga(url, divid) {
	var ajax_request = false;
	if (window.XMLHttpRequest) ajax_request = new XMLHttpRequest();
	else if (window.ActiveXObject) {
		try {
			ajax_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) {
			try {
				ajax_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {}
		}
	}
	else return false;
	ajax_request.onreadystatechange = function() {
		ajaxToDiv(ajax_request, divid);
	}
	noCache = (url.indexOf("?")!=-1)? "&"+new Date().getMinutes() : "?"+new Date().getMinutes();
	ajax_request.open('GET', url+noCache, true);
	ajax_request.send(null);
}
function ajaxToDiv(ajax_request, divid) {
	if (ajax_request.readyState == 4 && (ajax_request.status==200 || window.location.href.indexOf("http")==-1)) {
		document.getElementById(divid).innerHTML = ajax_request.responseText;
		if (document.getElementById("swfDemo")) insSwfDiv("swfDemo", "swf\/demos\/demo-"+formatoCurrent+".swf", 250, 310,"ltxt=Cargando demostración");
	}
}
function gt(form) {
	var index=form.select.selectedIndex;
	if (form.select.options[index].value > "1") {
		location=form.select.options[index].value;
	}
}

