
<!-- 

// Rapid Classified v2.1 - Pro
// 


function selectcat(ipage) {

	oform = document.cat;
	catID = oform.ccat.options[oform.ccat.selectedIndex].value;
	window.location = ipage+"?catid="+catID;

}

function selectsubcat(ipage) {

	oform = document.cat;
	catID = oform.ccat.options[oform.ccat.selectedIndex].value;
	subcatID = oform.cscat.options[oform.cscat.selectedIndex].value;
	window.location = ipage+"?catid="+catID+"&subcatID="+subcatID;

}

function select3rdcat(ipage) {

	oform = document.cat;
	catID = oform.ccat.options[oform.ccat.selectedIndex].value;
	subcatID = oform.cscat.options[oform.cscat.selectedIndex].value;
	cat3rdID = oform.csscat.options[oform.csscat.selectedIndex].value;
	window.location = ipage+"?catid="+catID+"&subcatID="+subcatID+"&3rdcatID="+cat3rdID;

}


function validateInput() {

	var errorm = "";
	var oform = document.register;
	var nick = oform.R1.value.replace(/[\s<>']/g, "");
	oform.R1.value = nick
	var city = oform.R2.value.replace(/[<>']/g, "");
	oform.R2.value = city
	var email = oform.R3.value.replace(/[\s<>']/g, "");
	var pass = oform.R4.value.replace(/[\s<>]/g, "");
	oform.R4.value = pass
	var cpass = oform.R5.value.replace(/[\s<>]/g, "");
	oform.R5.value = cpass
	var ePat = /^([\w-\.]+)@([\w-]+)\.([\w-\.]+)$/g;
	var matchEmail=email.match(ePat);
	var nLen = nick.length;
	var pLen = pass.length;


	if (nick == "" | email == "" | city == "" | pass == "" | cpass == "") {
		var errorm = errorm + ("    -- Uno de los datos requeridos está vacío!     \n");
		var trap = ("error");
	}


	if (email !== "") {
		if (matchEmail == null){
			var errorm = errorm + ("    -- Formato de email es inválido!     \n");
			var trap = ("error");
		}
	}

	if (nick !== "") {
		if (nLen < 4){
			var errorm = errorm + ("    -- El Usuario debe tener al menos cuatro caracteres!     \n");
			var trap = ("error");
		}
	}

	if (pass !== "") {
		if (pLen < 6){
			var errorm = errorm + ("    -- El Password debe tener al menos 6 caracteres!     \n");
			var trap = ("error");
		}
	}

	if (pass !== cpass) {
		var errorm = errorm + ("    -- Password incorrecto!     \n");
		var trap = ("error");

	}
	
	for (i=0; i < 6; i++) {
		if (document.getElementById("z"+i) != null && isNaN(document.getElementById("z"+i).value)){
			var nan = document.getElementById("z"+i).value
			var errorm = errorm + ("    -- Value ["+nan+"] es inválido. Debe ser un número!     \n");
			var trap = ("error");
		}
	}


	if (trap == "error") {
		alert ("Por favor, corrija los errores siguientes y reenvie el formulario:\n\n" + errorm);
	} else {
		oform.B1.disabled = true;
		oform.submit();
	}

}

function ulogon() {

	var iemail = document.userlogon.email.value;
	var ePat = /^([\w-\.]+)@([\w-]+)\.([\w-\.]+)$/g;
	var matchEmail = iemail.match(ePat);

	if (iemail == "" | matchEmail == null) {
		alert("    -- Formato de Email es inválido!     \n");
		return false;
	}
	return true;
}

function usrmgr(oForm, iAction, user) {

	switch (iAction) {

		case "moderator":
			if (window.confirm("Cambiar la situación de la cuenta para el usuario <"+user+">.")) {
				oForm.itask.value = iAction;
				oForm.submit();		
			}
		break;

		case "maillist":
			if (window.confirm("Cambiar una Email List participation status para el usuario <"+user+">.")) {
				oForm.itask.value = iAction;
				oForm.submit();		
			}
		break;

		case "add_credit":
			if (window.confirm("Cambiar para AGREGAR créditos al usuario <"+user+">.")) {
				oForm.itask.value = iAction;
				oForm.submit();		
			}
		break;

		case "remove_credit":
			if (window.confirm("BORRAR créditos para el usuario <"+user+">.")) {
				oForm.itask.value = iAction;
				oForm.submit();		
			}
		break;

		default:
			if (window.confirm("Confirme que desea "+iAction+" cuenta para el usuario <"+user+">.")) {
				oForm.itask.value = iAction;
				oForm.submit();		
			}
	}

}

function popup(url,wname,params) {
	PopWin = window.open(url,wname,params);
	PopWin.focus();
}

function evalSize(iw,ih) {

	if (document.getElementById("uimage")!==null) {
		var osz=document.getElementById("sz");
		var oimage=document.getElementById("uimage");
		var w = oimage.width;
		var h = oimage.height;
		osz.innerHTML="Dimension: "+w+"x"+h+" px";
		if (w > iw | h > ih) {
			alert("El tamaño de la imágen máximo permitido : "+iw+"x"+ih+"px.\n\nPor favor seleccione otra imágen o reduzca el tamaño.");
			document.img.isvalid.value="false";
		}else{
			document.img.isvalid.value="True";
			document.img.imgw.value = w;
			document.img.imgh.value = h;
		}

	}
}



function sendmail() {
	
	var errorm = "";
	var email = document.reply.R1.value;
	var ePat = /^([\w-\.]+)@([\w-]+)\.([\w-\.]+)$/g;
	var matchEmail=email.match(ePat);
	var message = document.reply.R2.value.replace(/[<>]/g, "");
	var mLen = message.length;
	var sname = document.reply.R3.value.replace(/[<>]/g, "");

	if (email == "" | message == "" | sname == "") {
		var errorm = errorm + ("    -- Uno de los datos requeridos esta incompleto!     \n");
		var trap = ("error");
	}


	if (mLen > 500){

		var errorm = ("    --El mensaje contiene " + mLen + " caracteres. Solo se permiten 500, por favor, modifique el texto!    \n");
		var trap = ("error");

	}

	if (email !== "") {
		if (matchEmail == null){
			var errorm = errorm + ("    -- Formato de Email es inválido!     \n");
			var trap = ("error");
		}
	}

	if (trap == "error") {
		alert ("Por favor, corrija los siguientes errores y reenvie el formulario:\n\n" + errorm);
	} else {
		 document.reply.submit();
	}

}

function searchAds() {

	var oform = document.search; 
	var sTarget = oform.SH3.options[oform.SH3.selectedIndex].text;
	oform.categoryName.value = sTarget;
	var searchStr = oform.SH1.value;
	var searchStr = searchStr.toLowerCase();

	// if (searchStr == "") {return alert("Please specify Keywords to search.");}
	oform.SH1.value = searchStr;
	oform.action = "search.asp"
	oform.submit();


}

function savePrefs(oform, action) {

	if (action == "pass") {
		oform.flag.value = "reset";
		var id = oform.P13.value;
		var pass = oform.P14.value;
		var conf = oform.P15.value;
		if (pass !== conf) { return alert("Password incorrecto!"); }
		if (id == "" | pass == "") {if (!window.confirm("ID de Administrador o Password en blanco. Desea continuar?")) return;}

	}else{
		oform.flag.value = "config";
	}

	oform.submit();
}

function bnDelete(oform)
{


	if (oform.options.length !==0){
		i=0;
		for (i=0; i < oform.options.length; i++) {
			if (oform.options[i].selected == true){
				if (window.confirm("Desea BORRAR el banner "+oform.options[oform.selectedIndex].value+"?")) {
					window.location="filter.asp?url=admin_rotator.asp&act=13&b="+oform.options[oform.selectedIndex].value;
				}
				return false;
			}else{
				notselected = true;
			}
   		}
		if (notselected) {alert("No seleccionó ningún banner.");}

	}else{
		alert("La lista de banners disponibles está vacía.");
	}

}

function savePaymentOptions(oform) {

	var ePat = /(\w+)@(\w+)\.(\w+)/;
	var email = oform.AP13.value
	var re = /\d+\.\d{2}/;
	for (var i=1; i<12; i++){
		var mch = re.exec(oform.elements["AP"+i].value);
		if (mch == null) {return alert("Uno o más de los datos de precio esta mal configurado. Asegúrese de usar formato de monedas. Para poner precio en ceros, use 0.00");} 
		oform.elements["AP"+i].value = mch;
	}

	var matchEmail=email.match(ePat);
	if (matchEmail == null){return alert("Su formato de Email PayPal Email Format es inválido!");}
	if (oform.AP27.value=='' | isNaN(oform.AP27.value)) {return alert("Una de las opciones de duración/vigencia no es un número o está vacío!");}
	if (oform.AP28.value=='' | isNaN(oform.AP28.value)) {return alert("Una de las opciones de duración/vigencia no es un número o está vacío!");}
	if (oform.AP29.value=='' | isNaN(oform.AP29.value)) {return alert("Una de las opciones de duración/vigencia no es un número o está vacío!");}
	if (oform.AP30.value=='' | isNaN(oform.AP30.value)) {return alert("Una de las opciones de duración/vigencia no es un número o está vacío!");}
	oform.submit();
	

}



function checkAll(oChkBox)
{
var bStatus = oChkBox.checked;
var docFrm = document.forms["paylog"];
    for (i=0; i < docFrm.elements.length; i++) {
    	if (docFrm.elements[i].type == "checkbox") {
			docFrm.elements[i].checked = bStatus;
       }
    }
}

function createTemplate(oform) {

var name = oform.NT1.value.replace(/["']/g, "");  
var descr = oform.NT2.value.replace(/["']/g, "");
var subject = oform.NT3.value.replace(/["']/g, "");
var body = oform.NT4.value;
oform.NT1.value = name;
oform.NT2.value = descr;
oform.NT3.value = subject;
if (name == "" | descr == "" | subject == "" | body == "") {return alert("Uno de los datos está vacío!");}
var type = oform.NT5.options[oform.NT5.selectedIndex].text;

if (window.confirm("Desea crear Nuevo '"+type+"' - '"+name+"'.")){oform.submit();}



}

//-->

