function formSend( form) {
	var query="";
	for( i=0; i<=form.elements.length; i++) {
// 		alert( form.elements[i].name + " : "+ typeof form.elements[i]);
		if( typeof form.elements[i] == "object" && form.elements[i].name.length) {
			query+="&"+form.elements[i].name+"="+form.elements[i].value;
		}
	}
	var url="admin.php?"+query;
	alert( url);
// 	window.open( url);
// 	xmlhttp=get_xmlhttp()
// 	enviar(xmlhttp,"GET", url,true, moduleShow);
}

function moduleShow( xmlhttp) {
	val=""
	for(i in xmlhttp) {
		try {
		val+="xmlhttp."+i+"="+xmlhttp[i]+"\n"
		} catch(e) {}
	}
	if(xmlhttp.status==404) {
		alert("Se supondría que esta página no existe")
	}
	if( xmlhttp.responseText!='') {
		document.getElementById("ajax_container").innerHTML=xmlhttp.responseText;
	}
}


function get_xmlhttp() {
try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}
return xmlhttp
}

function enviar(xmlhttp,metodo,url,async,callback,target_object) {
 xmlhttp.open(metodo, url,async);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
   callback(xmlhttp, target_object)
  }
 }
 xmlhttp.send(null)
}

function check_user() {
	xmlhttp=get_xmlhttp()
	var username=document.getElementById("user_EMAIL").value
	enviar(xmlhttp,"GET","ajax.php?module=auth&class=user&event=check&username="+encodeURIComponent(username),true,check_userBack);
}

function check_userBack(xmlhttp) {
	val=""
	for(i in xmlhttp) {
		try {
		val+="xmlhttp."+i+"="+xmlhttp[i]+"\n"
		} catch(e) {}
	}
	if(xmlhttp.status==404) {
		alert("Se supondría que esta página no existe")
	}
	if( xmlhttp.responseText!='') {
		document.getElementById("user_EMAIL").value="";
		document.getElementById("user_EMAIL").focus();
		var message="El e-mail '"+xmlhttp.responseText+"' ya se encuentra registrado.";
		document.getElementById("msgboard").innerHTML=message;
	} else {
		document.getElementById("msgboard").innerHTML='';
	}
}

function select_reload( this_id, val) {
	xmlhttp=get_xmlhttp();
	var este=document.getElementById(this_id);
	enviar(xmlhttp,"GET","ajax.php?cate_ID="+este.value+"&subc_ID="+val,true,get_select_reload);
}
function get_select_reload(xmlhttp) {
	val=""
	for(i in xmlhttp) {
		try {
		val+="xmlhttp."+i+"="+xmlhttp[i]+"\n"
		} catch(e) {}
	}
	if(xmlhttp.status==404) {
		alert("Se supondría que esta página no existe")
	}
	if( xmlhttp.responseText!='') {
		var sel=document.getElementById("subc_ID");
		sel.parentNode.innerHTML=xmlhttp.responseText;
	} 
}

function select_reload2( table, fid, fname, wf, wv, ftarget) {
	xmlhttp=get_xmlhttp();
// 	alert( ftarget);
	enviar(xmlhttp,"GET","ajax.php?table="+table+"&fid="+fid+"&fname="+fname+"&wf="+wf+"&wv="+wv+"&ftarget="+ftarget,true,get_select_reload2, ftarget);
}
function get_select_reload2(xmlhttp, target_object) { 
	val=""
	for(i in xmlhttp) {
		try {
		val+="xmlhttp."+i+"="+xmlhttp[i]+"\n"
		} catch(e) {}
	}
	if(xmlhttp.status==404) {
		alert("Se supondría que esta página no existe")
	}
	if( xmlhttp.responseText!='') {
// 		alert( xmlhttp.responseText);
// 		alert( target_object);
		document.getElementById(target_object).parentNode.innerHTML=xmlhttp.responseText;
// 		alert( sel.parentNode.innerHTML);
// 		sel
		
	}
}


function ajaxBannerShow( id, panel) {
	xmlhttp=get_xmlhttp();
// 	alert( panel);
	enviar(xmlhttp,"GET","inc/banner.inc.php?id="+id,true,r_ajaxBannerShow, panel);
}
function r_ajaxBannerShow(xmlhttp, panel) {
// 	var cont = panel;
	val=""
	for(i in xmlhttp) {
		try {
		val+="xmlhttp."+i+"="+xmlhttp[i]+"\n"
		} catch(e) {}
	}
	if(xmlhttp.status==404) {
		alert("Se supondría que esta página no existe")
	}
	if( xmlhttp.responseText!='') {
// 		alert( xmlhttp.responseText);
// 		alert( panel);
		document.getElementById( panel).innerHTML=xmlhttp.responseText;
	} 
}