$URL_BaseIndex = $URL_Base  + 'index.php/';
$URL_BaseImage = $URL_Base  + 'web/images/';
$URL_BaseStyles = $URL_Base  + 'web/styles/';
$carrNoticias = false;
$tiempoNoticias = 60*1000;
$intervalNoticias = null;
$filesARRAY = new Array();
$imagesARRAY = new Array();
$delimiter = "|";
$delimiterImg = "|#|";
$textMonth = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
$textMonthShort = new Array("Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic");

function makeReadOnlyInputs(idForm) {
	var myForm = document.getElementById(idForm);
	
	for (var i = 0; i < myForm.length; i++) {
		var myElement = myForm.elements[i];
		$('#' + myElement.id).attr("readonly", "readonly");
	}
}

function addCSSElement(idElem, nameCSS, add) {
	if (add) {
		$('#' + idElem).addClass(nameCSS);
	} else {
		$('#' + idElem).removeClass(nameCSS);
	}
}

function disabledButton(idForm, opc) {
	if (opc) {
		$('#' + idForm + ' input:image').attr("disabled", "disabled");
		$('#' + idForm + ' input:submit').attr("disabled", "disabled");
		$('#' + idForm + ' button:button').attr("disabled", "disabled");
	} else {
		$('#' + idForm + ' input:image').removeAttr("disabled");
		$('#' + idForm + ' input:submit').removeAttr("disabled");
		$('#' + idForm + ' button:button').removeAttr("disabled");
	}
	
}

function validateMissingFields(idForm, inputs) {
	var rBoolean = false;
	var styleCSS = "its_input_blank";
	var myForm = document.getElementById(idForm);
	
	for (var i = 0; i < myForm.length; i++) {
		var myElement = myForm.elements[i];
		if (myElement.type == "text" || myElement.type == "password") {
			if (inputs != null && inputs.isArray()) {
				if ((myElement.id).inArray(inputs) && (myElement.value).allTrim() == "") {
					addCSSElement(myElement.id, styleCSS, true)
					rBoolean = true;
				} else {
					addCSSElement(myElement.id, styleCSS, false)
				}
			} else {
				if ((myElement.value).allTrim() == "") {
					addCSSElement(myElement.id, styleCSS, true)
					rBoolean = true;
				} else {
					addCSSElement(myElement.id, styleCSS, false)
				}
			}
		} 
	}
	
	return rBoolean;
}

function isEmailAddress(email) {
	var filter = /^[A-Za-z][A-Za-z0-9_\.-]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
	
	if (filter.test(email)){
		return true;
	}else{
		return false;
	}
}

function isMaxLength(obj) {
	var mlength = (obj.getAttribute) ? parseInt(obj.getAttribute("maxlength")) : "";
	
	if (obj.getAttribute && obj.value.length > mlength) {
		obj.value = obj.value.substring(0,mlength)
	}
}

function setDelimiter(valString) {
	valString = $.trim(valString);
	utlChar = valString.substr(valString.length - 1, 1);
	
	if (valString != "" && utlChar != "/") {
		valString = valString + "/";
	}
	
	return valString;
}

/*function changeCSSInputBlank(idForm, inputs) {
	var styleCSS = "cms_input_blank";
	var myForm = document.getElementById(idForm);
	
	for (var i = 0; i < myForm.length; i++) {
		var myElement = myForm.elements[i];
		if (myElement.type == "text" || myElement.type == "password") {
			if (inputs != null && inputs.isArray()) {
				if ((myElement.id).inArray(inputs) && (myElement.value).allTrim() == "") {
					addCSSElement(myElement.id, styleCSS, true)
				} else {
					addCSSElement(myElement.id, styleCSS, false)
				}
			} else {
				if ((myElement.value).allTrim() == "") {
					addCSSElement(myElement.id, styleCSS, true)
				} else {
					addCSSElement(myElement.id, styleCSS, false)
				}
			}
		} 
	}
}*/

/*function isInArray (value, arrr) {	
	var rBoleean = false;
	
	if (arrr.isArray()) {
		for (var i = 0; i < arrr.length; i++) {
				//alert(value + " - " + arrr[i]);
			if (value == arrr[i]) {
				//alert(value + " - " + arrr[i]);
				rBoleean = true;
				break;
			}
		}
	}
	
	return rBoleean;
}*/