function y2k(number) { return (number < 1000) ? number + 1900 : number; }
/**
 *	Valida si Es una fecha valida
 */
function isDate (day,month,year) {
	var today = new Date();
	year = ((!year) ? y2k(today.getYear()):year);
	month = ((!month) ? today.getMonth():month-1);
	if (!day) return false
	var test = new Date(year,month,day);
	if ( (y2k(test.getYear()) == year) && (month == test.getMonth()) && (day == test.getDate()) )
		return true;
	else
		return false
}
/**
 * Establecen la propiedad trim para los string para quitarles el espacio en blanco al principio
 * o al final o los dos
 */
String.prototype.trim = function(){
return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function(){
return this.replace(/^\s+/g,"");
}
String.prototype.rtrim = function(){
return this.replace(/\s+$/g,"");
}
function wopen(url,wname,w,h,resize,scroll,menu,tool,dir,loc,stat){
	extra = 'left='+(screen.width - w) / 2 +',top='+(screen.height - h) / 2 +',width='+w+',height='+h+',resizable='+resize+',scrollbars='+scroll+',menubar='+menu+',toolbar='+tool+',directories='+dir+',location='+loc+',status='+stat;
	window.open(url,wname,extra);
	return false;
}
/**
 * Funcion para checar todos los checkbox de un form
 */
function checkAll(chkbox, form){
	for (var i=0;i < form.elements.length;i++){
		var elemento = form.elements[i];
		if (elemento.type == "checkbox")
		{
			elemento.checked = chkbox.checked
		}
	}
}