function ValidateForm(form, _return) {
	if (!_return) _return = true;
	form = (!jsGetObject(form)) ? form : jsGetObject(form);
	
	for(i=0; i<form.elements.length; i++) {
		var __obj = form.elements[i];
		if (__obj.type) {
			if(__obj.type != "button" && __obj.type != "submit") {
				validation = __obj.getAttribute("req",2);
				if (!validation) validation = true;
				validationMsg = __obj.getAttribute("msg",2);
				var _elem_type = __obj.type.toLowerCase();
					
				if (__obj.id == "" && __obj.name) {
					alert("El Objeto de tipo \"" + _elem_type + "\" debe tener un Id y un Nombre para identificarlo.");
					return false;
				}
				
				var _validation = __obj.getAttribute("validation",2);
				if (_validation) {
					var _validation_s = _validation.split("|");
					var _validation_function = _validation_s[0];
					_validation_function = _validation_function.replace("this", "'" + __obj.name + "'");
					var _validation_msg = _validation_s[1];
					
					if (!eval(_validation_function)) {
						alert(_validation_msg);
						if(__obj.type != "hidden") __obj.focus();
						return false;
					}
				}
				
				if (validation && validationMsg) {
					var wv = false;
					var _obj_array = jsGetObject(__obj.id);
					if (_obj_array && _obj_array.length) {
						for(j=0; j<_obj_array.length; j++) {
							if (_elem_type == "radio" || _elem_type == "checkbox") {
								if (_obj_array[j].checked == true) {
									wv = true;
									break;	
								}
							}
						}
					}
					
					_obj_array = document.getElementsByName(__obj.name);
					if (_obj_array.length == 1) {
						switch (_elem_type) {
							case "select-one":
								wv = (__obj.value.toString() == "0") ? false : true;
								break;
							case "radio", "checkbox":
								wv = (__obj.checked == false) ? false : true;
								break;
							default:
								wv = (__obj.value == "") ? false : true;
								break;
						}
					}
					
					if (wv == false) {
						if (validationMsg == "") validationMsg = "Campo Obligatorio.";
						alert(validationMsg);
						if(__obj.type != "hidden") __obj.focus();
						return false;
					}
				}
			}
		}
	}
	
	form.submit();
	
	DisableFormElements(form);
	
	return false;
}


var __last_submit_button_caption;

function DisableFormElements(form) {
	form = (!jsGetObject(form)) ? form : jsGetObject(form);
	
	document.body.style.cursor = "wait";
	jsSetStyle("ProcesingData", "visibility", "visible");
	var __fieldsets = document.getElementsByTagName("fieldset");
	if (__fieldsets.length) {
		for(i=0; i < __fieldsets.length; i++) {
			__fieldsets[i].style.cursor = "wait";
		}
	}
	
	for(i=0; i<form.elements.length; i++) {
		var __obj = form.elements[i];
		if (__obj.type) {
			if (__obj.type == "submit") {
				__last_submit_button_caption = __obj.value;
				__obj.value = "Espere...";
			}
			__obj.disabled = true;
		}
	}
}

function EnableFormElements(form) {
	form = (!jsGetObject(form)) ? form : jsGetObject(form);
	
	document.body.style.cursor = "default";
	jsSetStyle("ProcesingData", "visibility", "hidden");
	var __fieldsets = document.getElementsByTagName("fieldset");
	if (__fieldsets.length) {
		for(i=0; i < __fieldsets.length; i++) {
			__fieldsets[i].style.cursor = "default";
		}
	}
	
	for(i=0; i<form.elements.length; i++) {
		var __obj = form.elements[i];
		if (__obj.type) {
			if (__last_submit_button_caption == "") __last_submit_button_caption = "Guardar";
			if (__obj.type == "submit") __obj.value = __last_submit_button_caption;
			__obj.disabled = false;
		}
	}
}

function isEmail(obj) {
	obj = (!jsGetObject(obj)) ? obj : jsGetObject(obj);
	if (obj) {
		if (obj.value != "") {
			var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
			if (filter.test(obj.value)) {
				return true;
			} else {
				return false;	
			}
		} else {
			return true;	
		}
	} else {
		return false;
	}
}

function jsValidPasswords(obj1,obj2) {
	try {
		var C1 = (!jsGetObject(obj1)) ? obj1 : jsGetObject(obj1);
		var C2 = (!jsGetObject(obj2)) ? obj2 : jsGetObject(obj2);
		
		if (C1 && C2) {
			if (C1.value != "" && C2.value != "") {
				if (C1.value == C2.value) {
					return true;
				}
			} else if (C1.value == "" && C2.value == "") {
				return true;	
			}
		}
		
		return false;
	} catch(err) {
		jsShowErrors("jsValidPasswords", err);
	}
}

function jsShowErrors(_func_name, _err) {
	var desc = (jsIsString(_err)) ? _err : _err.description;
	alert(_func_name + ": " + desc);
	return false;
}

function KeyAscii(e) {
	return (document.all) ? e.keyCode : e.which;
}

function openWin(eURL,eName,features) {
	window.open(eURL,eName,features);
}

function openCenterWin(eURL,eName,eFeatures,eWidth,eHeight) {
	var _features = "";
	_features = (eFeatures == "") ? "resizable=no,status=no,scrollbars=no" : eFeatures;
	_features += ",width="+eWidth+",height="+eHeight+",left="+((screen.width/2)-(eWidth/2))+",top="+((screen.height/2)-(eHeight/2));
	openWin(eURL,eName,_features);
}


function _CloseOnEsc(e) {
	if (KeyAscii(event) == 27) { window.close(); return; }
}

function InitESC() {
	document.body.onkeypress = _CloseOnEsc;
}


/*------------------------------------------------------------------------------------------------------------\
	Date Created: 12-30-05
	Modified Date: 12-30-05
	Function Name: ClearHTML(sHTML)
	Porpouse: Limpia el código HTML.
		sHTML: HTML Tags a limpiar.
/-------------------------------------------------------------------------------------------------------------*/
function ClearHTML(sHTML) {
	sHTML = CleanWord(sHTML);
	sHTML = sHTML.replace(/<[^>]*>/gi, "");
	sHTML = sHTML.replace( /\n/gi, "") ;
	sHTML = sHTML.replace(/&nbsp;/gi, "");
	var RegX = new RegExp(String.fromCharCode(10), 'g');
	sHTML = sHTML.replace(RegX, "");
	RegX = new RegExp(String.fromCharCode(13), 'g');
	sHTML = sHTML.replace(RegX, "");
	return sHTML;
}


/*------------------------------------------------------------------------------------------------------------\
	Date Created: 12-30-05
	Modified Date: 12-30-05
	Function Name: CleanWord(html)
	Porpouse: Limpia el código HTML generado por Microsoft Word.
		html: HTML Tags a limpiar.
/-------------------------------------------------------------------------------------------------------------*/
function CleanWord(html) {
	html = html.replace(/<o:p>\s*<\/o:p>/g, "") ;
	html = html.replace(/<o:p>.*?<\/o:p>/g, "&nbsp;") ;
	
	// Remove mso-xxx styles.
	html = html.replace( /\s*mso-[^:]+:[^;"]+;?/gi, "" ) ;

	// Remove margin styles.
	html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, "" ) ;
	html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"" ) ;

	html = html.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, "" ) ;
	html = html.replace( /\s*TEXT-INDENT: 0cm\s*"/gi, "\"" ) ;

	html = html.replace( /\s*TEXT-ALIGN: [^\s;]+;?"/gi, "\"" ) ;

	html = html.replace( /\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi, "\"" ) ;

	html = html.replace( /\s*FONT-VARIANT: [^\s;]+;?"/gi, "\"" ) ;

	html = html.replace( /\s*tab-stops:[^;"]*;?/gi, "" ) ;
	html = html.replace( /\s*tab-stops:[^"]*/gi, "" ) ;

	// Remove FONT face attributes.
	html = html.replace( /\s*face="[^"]*"/gi, "" ) ;
	html = html.replace( /\s*face=[^ >]*/gi, "" ) ;

	html = html.replace( /\s*FONT-FAMILY:[^;"]*;?/gi, "" ) ;
	
	// Remove Class attributes
	html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;

	// Remove styles.
	html = html.replace( /<(\w[^>]*) style="([^\"]*)"([^>]*)/gi, "<$1$3" ) ;

	// Remove empty styles.
	html =  html.replace( /\s*style="\s*"/gi, '' ) ;
	
	html = html.replace( /<SPAN\s*[^>]*>\s*&nbsp;\s*<\/SPAN>/gi, '&nbsp;' ) ;
	
	html = html.replace( /<SPAN\s*[^>]*><\/SPAN>/gi, '' ) ;
	
	// Remove Lang attributes
	html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
	
	html = html.replace( /<SPAN\s*>(.*?)<\/SPAN>/gi, '$1' ) ;
	
	html = html.replace( /<FONT\s*>(.*?)<\/FONT>/gi, '$1' ) ;

	// Remove XML elements and declarations
	html = html.replace(/<\\?\?xml[^>]*>/gi, "") ;
	
	// Remove Tags with XML namespace declarations: <o:p></o:p>
	html = html.replace(/<\/?\w+:[^>]*>/gi, "") ;
	
	html = html.replace( /<H\d>\s*<\/H\d>/gi, '' ) ;

	html = html.replace( /<H1([^>]*)>/gi, '<div$1><strong><font size="6">' ) ;
	html = html.replace( /<H2([^>]*)>/gi, '<div$1><strong><font size="5">' ) ;
	html = html.replace( /<H3([^>]*)>/gi, '<div$1><strong><font size="4">' ) ;
	html = html.replace( /<H4([^>]*)>/gi, '<div$1><strong><font size="3">' ) ;
	html = html.replace( /<H5([^>]*)>/gi, '<div$1><strong><font size="2">' ) ;
	html = html.replace( /<H6([^>]*)>/gi, '<div$1><strong><font size="1">' ) ;

	html = html.replace( /<\/H\d>/gi, '</font></strong></div>' ) ;
	
	html = html.replace( /<(U|I|STRIKE)>&nbsp;<\/\1>/g, '&nbsp;' ) ;

	// Remove empty tags (three times, just to be sure).
	html = html.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;
	html = html.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;
	html = html.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;

	// Transform <P> to <DIV>
	var re = new RegExp("(<P)([^>]*>.*?)(<\/P>)","gi") ;	// Different because of a IE 5.0 error
	html = html.replace( re, "<div$2</div>" ) ;

	return html ;
}


function InputType(e, flag, _teclas) {
	var patron;
	var tecla = KeyAscii(e);
	var extrakey = -1;
	if (_teclas != "" && _teclas) {
		_teclas = _teclas.toString();
		extrakey = _teclas.indexOf(tecla.toString());
	}
	
	if (tecla == 8 || tecla == 13 || extrakey >= 0) return true; 
	//Tecla de retroceso (para poder borrar) y enter (para poder enviar)
	
	switch (flag) {
		case 0:
			patron = /[A-Za-z]/; //Solo acepta letras
			break;
		case 1:
			patron = /\D/; //No acepta números
			break;
		case 2:
			patron = /\w/; //Acepta números y letras
			break;
		default:
			patron = /\d/; //Solo acepta números
			break;
	}
	
	var key = String.fromCharCode(tecla);
	return patron.test(key);
}


function InputCheck(obj, flag) {
	obj = (!jsGetObject(obj)) ? obj : jsGetObject(obj);
	var patron;
	
	switch (flag) {
		case 0:
			patron = /[A-Za-z]/; //Solo acepta letras
			break;
		case 1:
			patron = /\D/; //No acepta números
			break;
		case 2:
			patron = /\w/g; //Acepta números y letras
			break;
		default:
			patron = /\d/; //Solo acepta números
			break;
	}
	
	return (obj.value != "") ? patron.test(obj.value) : true;
}


function ClearSelect(obj) {
	obj = (!jsGetObject(obj)) ? obj : jsGetObject(obj);
	obj.options.length = 0;	
}

function AddSelectOption(obj, txt, val, selected) {
	obj = (!jsGetObject(obj)) ? obj : jsGetObject(obj);
	
	selected = (selected == true) ? "defauldSelected" : "";
	var sub0 = new Option(txt, val, selected);
	obj.options[obj.options.length] = sub0;
}

function Log_Out() {
	ht = document.getElementsByTagName("body");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if (confirm('¿Desea Cerrar su Sesión?')) {
		return true;
	} else {
		ht[0].style.filter = "";
		return false;
	}
}

/*------------------------------------------------------------------------------------------------------------\
	Date Created: 12-31-05
	Modified Date: 12-31-05
	Function Name: jsSetAttribute(obj, _name, _value)
	Porpouse: Asigna un atributo a un objeto o elemento.
		obj: Id del Objeto.
		_name: Nombre del atributo.
		_value: Valor del atributo.
/-------------------------------------------------------------------------------------------------------------*/
function jsSetAttribute(obj, _name, _value) {
	obj = (!jsGetObject(obj)) ? obj : jsGetObject(obj);
	obj.setAttribute(_name, _value);
}


function FixPNG(myImage)  {
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : "";
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : "";
	   var imgTitle = (myImage.title) ? "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' ";
	   var imgStyle = "display:inline-block;" + myImage.style.cssText;
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>";
	   myImage.outerHTML = strNewHTML;
    }
}


function SetBgPNG(img_path) {
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	var _style;
	if (_jslib_isIE && version >= 5.5 && version < 7) {
		_style = "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='" + img_path + "')";
	} else {
		_style = "background-image:url('" + img_path + "')";
	}
	
	return _style;
}

function DisplayPicture(src, w, h, _id) {
	var imgtags;
	_id = (!_id) ? "" : 'id="' + _id + '"';
	if (_jslib_isIE) {
		imgtags = "<div " + _id + " style=\"width:" + w + "px; height:" + h + "px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src 
		+ "', sizingMethod='scale');\"></div>";
	} else {
		imgtags = '<img ' + _id + ' src="' + src + '" border="0" style="width:' + w + 'px; height:' + h + 'px;">';
	}
	
	return imgtags;
}

function findPosX(obj) {
	obj = (!jsGetObject(obj)) ? obj : jsGetObject(obj);
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	obj = (!jsGetObject(obj)) ? obj : jsGetObject(obj);
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}



var aFinMes = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); 

function finMes(nMes, nAno){ 
	return aFinMes[nMes - 1] + (((nMes == 2) && (nAno % 4) == 0)? 1: 0); 
} 

function padNmb(nStr, nLen, sChr){ 
	var sRes = String(nStr); 
	for (var i = 0; i < nLen - String(nStr).length; i++) 
		sRes = sChr + sRes; 
	return sRes; 
} 

function makeDateFormat(nDay, nMonth, nYear){ 
	var sRes; 
	sRes = padNmb(nDay, 2, "0") + "/" + padNmb(nMonth, 2, "0") + "/" + padNmb(nYear, 4, "0"); 
	return sRes; 
} 

function incDate(sFec0){ 
	var nDia = parseInt(sFec0.substr(0, 2), 10); 
	var nMes = parseInt(sFec0.substr(3, 2), 10); 
	var nAno = parseInt(sFec0.substr(6, 4), 10); 
	nDia += 1; 
	if (nDia > finMes(nMes, nAno)){ 
		nDia = 1; 
		nMes += 1; 
		if (nMes == 13){ 
			nMes = 1; 
			nAno += 1; 
		}
	} 
	return makeDateFormat(nDia, nMes, nAno); 
} 

function decDate(sFec0){ 
	var nDia = Number(sFec0.substr(0, 2)); 
	var nMes = Number(sFec0.substr(3, 2)); 
	var nAno = Number(sFec0.substr(6, 4)); 
	nDia -= 1; 
	if (nDia == 0){ 
		nMes -= 1; 
		if (nMes == 0){ 
			nMes = 12; 
			nAno -= 1; 
		} 
		nDia = finMes(nMes, nAno); 
	} 
	return makeDateFormat(nDia, nMes, nAno); 
} 

function addToDate(sFec0, sInc){ 
	var nInc = Math.abs(parseInt(sInc)); 
	var sRes = sFec0; 
	if (parseInt(sInc) >= 0) 
		for (var i = 0; i < nInc; i++) sRes = incDate(sRes); 
	else 
		for (var i = 0; i < nInc; i++) sRes = decDate(sRes); 
	
	var nDia = sRes.substr(0, 2); 
	var nMes = sRes.substr(3, 2); 
	var nAno = sRes.substr(6, 4);
	
	return nMes + "/" + nDia + "/" + nAno; 
}


function ShowButton(strId, strCaption, strOnClick, strW, strHints) {
	strW = (!strW) ? 100 + 'px' : strW;
	strW = ' style="width:' + strW + '";';
	var btags = '<input type="button" id="' + strId + '" name="' + strId + '" value="' + strCaption + '" onclick="' + strOnClick + '" class="BotonesMsgs" ' + 
	strHints + strW + '>';
	return btags;
}

function ShowTableMsg(strMsg, strButton) {
	var t = ''
	t += '<table border="0" cellspacing="2" cellpadding="2" class="TablaSimple">';
	t += '<tr>';
	t += '<td align="center">' + strMsg + '</td>';
	t += '</tr>';
	if (strButton != "") {
		t += '<tr>';
		t += '<td align="center">' + strButton + '</td>';
		t += '</tr>';
	}
	t += '</table>';
	
	return t;
}

function MM_jumpMenu(targ,selObj,restore) {
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function ReplaceChars(sHTML, CharCode, sString) {
	var RegX = new RegExp(String.fromCharCode(CharCode), 'g');
	sHTML = sHTML.replace(RegX, sString);
	
	return sHTML;
}


function ReplaceEnters(sHTML, sString) {
	var RegX = new RegExp(String.fromCharCode(10), 'g');
	sHTML = sHTML.replace(RegX, sString);
	var RegX = new RegExp(String.fromCharCode(13), 'g');
	sHTML = sHTML.replace(RegX, sString);
	
	return sHTML;
}


function DelRow(row, msg, start_row, fila1_class, fila2_class) {
	msg = (!msg) ? "" : msg;
	var tmp = (msg != "") ? confirm(msg) : true;
	
	var tmp_val = row.nodeName.toLowerCase();
	while(tmp_val != "tr") {
		row = jsGetParent(row);
		tmp_val = row.nodeName.toLowerCase();
	}
	
	if (tmp == true) {
		obj = jsGetParent(jsGetParent(row));
		if (obj && row) obj.deleteRow(row.rowIndex);
		if (obj) UpdateTable(obj, start_row, fila1_class, fila2_class);
	}
}

function DeleteData(obj, elemid, tabla, _msg, _shift, archivo, start_row, fila1_class, fila2_class) {
	if (obj) {
		_msg = (!_msg) ? true : confirm(_msg);
		_shift = (!_shift) ? 0 : _shift;
		
		if (_msg) {
			var del = new SetAjax();
			del.FilePath = __strMainDir + "/includes/procesos/" + archivo + ".php";
			del.setVar = [["tabla", tabla], ["elemid", elemid], ["shift", _shift]];
			del.onLoading = function() {
				document.body.style.cursor = "wait";
				jsSetStyle("ProcesingData", "visibility", "visible");
			}
			del.onCompletion = function() {
				document.body.style.cursor = "default";
				jsSetStyle("ProcesingData", "visibility", "hidden");
				DelRow(obj, "", start_row, fila1_class, fila2_class);
			}
			del.Execute();
		}
	}
	
	return false;
}


function UpdateTable(obj, start_row, fila1_class, fila2_class) {
	obj = (!jsGetObject(obj)) ? obj : jsGetObject(obj);
	
	var tmp = obj.nodeName.toLowerCase();
	while(tmp != "table") {
		obj = jsGetParent(obj);
		tmp = obj.nodeName.toLowerCase();
	}
	
	start_row = (!start_row) ? 1 : start_row;
	fila1_class = (!fila1_class) ? "Fila1" : fila1_class;
	fila2_class = (!fila2_class) ? "Fila2" : fila2_class;
	
	var flag = 1;
	for(i=start_row; i < obj.rows.length; i++) {
		if (flag == 1) {
			obj.rows[i].className = fila1_class;
			flag--;
		} else {
			obj.rows[i].className = fila2_class;
			flag++;
		}
	}
}

function FileExtension(__file) {
	__file = __file.toString();
	return __file.substr(__file.lastIndexOf('.')+1).toLowerCase();
}

function Msg(_msg){
	alert(_msg);
}

function CargarSelect(obj1, obj2, parent_field, tabla, _default_txt) {
	if (obj1) {
		if (!_default_txt) _default_txt = "Seleccione";
		var obj_values = jsGetObject("txtcargar_select_elements");
		obj2 = jsGetObject(obj2);
		obj_values.value = "";
		
		var cargar = new SetAjax();
		cargar.FilePath = __strMainDir + "/includes/procesos/cargar_select.php";
		cargar.setVar = [["tabla", tabla], ["parentid", obj1.value], ["parent_field", parent_field]];
		cargar.Element = obj_values;
		cargar.ElementAttribute = "value";
		cargar.onLoading = function() {
			document.body.style.cursor = "wait";
			obj1.disabled = true;
			obj2.disabled = true;
			ClearSelect(obj2);
			AddSelectOption(obj2, "Cargando...", "0");
		}
		cargar.onCompletion = function() {
			document.body.style.cursor = "default";
			obj1.disabled = false;
			ClearSelect(obj2);
			AddSelectOption(obj2, _default_txt, "0");
			
			var split1 = obj_values.value.split("[|]");
			for(i=0; i < split1.length; i++) {
				if (split1[i].length > 0) {
					var split2 = split1[i].split("[-]");
					AddSelectOption(obj2, split2[1], split2[0]);
				}
			}
			
			obj2.disabled = false;
		}
		cargar.Execute();
	}
}


document.write('<input type="hidden" name="txtcargar_select_elements" id="txtcargar_select_elements">');


function loadPage(page,lang) {
	var p = new SetAjax();
	p.FilePath = __strMainDir + "includes/procesos/cargar_page.php";
	p.setVar = [["page", page],["lang", lang]];
	p.Element = jsGetObject('container');
	p.ElementPlainText = false;
	p.RunScript = false;
	p.onLoading = function() {
		jsSetStyle("Loading2", "display", "block");
		document.body.style.cursor = "wait";
	}
	p.onCompletion = function() {
		jsSetStyle("Loading2", "display", "none");
		document.body.style.cursor = "default";
	}
	p.Execute();
	delete p;
}

function OnClick(page,tipo){
	tipo = (tipo == "" || tipo == null) ? 1 : tipo;
	if(page){
		if(tipo == 1)
			document.location.href = __strMainDir + '/' + page;
		else
			openWin(page,'FIESTAS Y EVENTOS 507 - Tu portal de fiestas y eventos...','');
	}
}
