// JavaScript Document


function nuevoAjax(){
	var xmlhttp=false;
	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 submitContacto(container, status, params, good, bad){
	
//	if(pass == ''){alert('Debe especificar una contrasena'); return false;}
//	if(isNaN(employeid) || employeid == ''){alert('El numero de empleado debe ser numerico'); return false;}
	params= params.replace(/\&amp;/g, '&');
	ajax=nuevoAjax();
	ajax.open("POST", "/index2.php?option=com_contacto", true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1) {
			if(oldstatus == '')oldstatus = document.getElementById(status).innerHTML;
			document.getElementById(status).innerHTML ='<img src="/javascript/fm-loader.gif">';
         }
		if (ajax.readyState==4) {
		
			if(ajax.status==200){
				
				result = ajax.responseText;
				if(result == "OK"){
					document.getElementById(container).innerHTML = good;
					document.getElementById(status).innerHTML ='';
				}
				else document.getElementById(status).innerHTML = oldstatus+'<span class="error">'+bad+'</span>';
			}
			else{
				document.getElementById(status).innerHTML = oldstatus+'<span class="error">'+bad+'</span>';	
			}
		}
	}		
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send(params);
}

var imgpreload = new Image();
imgpreload.src = '/javascript/fm-loader.gif';
