
/** KumbiaForms - PHP Rapid Development Framework *****************************
*
* Copyright (C) 2005-2007 Andrés Felipe Gutiérrez (andresfelipe at vagoogle.net)
*
* This framework is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This framework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this framework; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*
* Este framework es software libre; puedes redistribuirlo y/o modificarlo
* bajo los terminos de la licencia pública general GNU tal y como fue publicada
* por la Fundación del Software Libre; desde la versión 2.1 o cualquier
* versión superior.
*
* Este framework es distribuido con la esperanza de ser util pero SIN NINGUN
* TIPO DE GARANTIA; sin dejar atrás su LADO MERCANTIL o PARA FAVORECER ALGUN
* FIN EN PARTICULAR. Lee la licencia publica general para más detalles.
*
* Debes recibir una copia de la Licencia Pública General GNU junto con este
* framework, si no es asi, escribe a Fundación del Software Libre Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*****************************************************************************/

var effectObj;

function highlightObj(){
	alert('Este campo es Obligatorio');
	new Effect.Highlight(effectObj, {startcolor:"#FF0000"})
	effectObj.select()
	effectObj.focus()
}

function iErrorObj(){
	new Effect.Highlight(effectObj, {startcolor:"#FF0000"})
}

function repairMyStatus(obj){	
	if(obj.selectedIndex!=0) obj.className = 'iNormal'; else obj.className = 'iError';
}

function entero(x){ return parseInt(x); }
function integer(x){ return parseInt(x); }

function enableBrowse(obj, action){
	var str = window.location.toString()
	window.location = $Kumbia.path+action+"/browse/"
}

//Object Manipulation Functions
function getObj(obj){
	if(document.getElementById("flid_"+obj))
	return document.getElementById("flid_"+obj)
	else return document.getElementById(obj)
}

function hideObj(obj){
	if(document.getElementById(obj)){
		document.getElementById(obj).style.visibility = "hidden"
		if(document.getElementById(obj).style.display=='block')
		document.getElementById(obj).style.display = "none"
	}
}

function showObj(obj){
	if(document.getElementById(obj)){
		document.getElementById(obj).style.visibility = "visible"
		if(document.getElementById(obj).style.display=='none')
		document.getElementById(obj).style.display = "block"
	}
}

function thisOption(obj){
	return obj.options[obj.selectedIndex]
}

function newObj(type, name){
	var a =  document.createElement(type)
	if(name)
	a.id = name
	return a
}

function appendObj(oParent, obj){
	document.getElementById(oParent).appendChild(obj)
}

//Handling Errors

if(document.all){
	onerror=handleErr

}
var txt=""
function handleErr(msg,url,l) {
	if(document.all){
		txt="KumbiaError: There was an error on this Application.\n\n"
		txt+="Error: " + msg + "\n"
		txt+="URL: " + url + "\n"
		txt+="Line: " + l + "\n\n"
		txt+="Please inform this error to your Software Provider.\n\n"
		alert(txt)
	}
	return true
}


