function pop(url,width,height){
	popup = window.open(url, 'popup', 'width=' + width + ', height=' + height + ', resizable=yes, scrollbars=yes, toolbar=yes, status=yes, location=yes, menubar=yes, status=yes, directories=yes');
	popup.focus();
	return;
}

function link(url, isPopup, width, height) {
	if (isPopup) {
		pop(url, width, height);
	} else {
		document.location.href = url;
	}
}

var defaultEmptyOK = false

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}
function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}
function isInteger (s)
{   var i;
    if (isEmpty(s)) 
       if (isInteger.arguments.length == 1) return defaultEmptyOK;
       else return (isInteger.arguments[1] == true);
    
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if( i != 0 ) {
            if (!isDigit(c)) return false;
        } else { 
            if (!isDigit(c) && (c != "-") || (c == "+")) return false;
        }
    }
    return true;
}

//Variable encargada de controlar el doble submit
var isSubmit=false;
function isValidSubmit(msg){
	if(!isSubmit){
		isSubmit=true;
		return true;
	} else {
		alert(msg);
		return false;
	}                       
}

function isOutdated(dateStr) {
  	var result = true;
  	try {
	 	var re = new RegExp('(\\d+)/(0)?(\\d+)/(\\d+)');
		var groups = re.exec(dateStr);
		var currentDate = new Date();
		if (groups != null && groups.length >= 3) {
			var activityDate = new Date();
			activityDate.setDate(groups[1]);
			activityDate.setMonth(groups[3]-1);			
			activityDate.setYear(groups[4]);
			result = activityDate.getTime() <= currentDate.getTime();
		}
	} catch (e) {
		result = true;
	}
	return result;
  }