function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function reportItem(itemtype, scriptid, itemid) {

	var windowHeight = 330;
	
	if ( itemtype == 'link' ) {
		windowHeight = 290;
	}
	
	launchCentered('report.php?type=' + itemtype + '&id=' + scriptid + '&del=' + itemid, 500, windowHeight );
}

function launchCentered( url, width, height ) {
	launchCentered( url, width, height, '' );
}

function launchCentered( url, width, height, options) {
	var left = ( screen.width - width ) / 2;
	var top = ( screen.height - height ) / 2;
	
	var options = "top="+top+",left="+left+",width="+width+",height="+height+","+options;
	window.open( url, 'popup', options );
}

String.prototype.trim = function() {
	var x=this;
	x=x.replace( /^\s*/, "" );
	x=x.replace( /\s*$/, "" );
	return x;
}

function isValidEmail( fieldValue ) {
	if ( /^\w+([\.\+-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,7})+$/.test(fieldValue) )
		return true;
	
	return false;
}

function isValidURL(url) {

	if ( url == null )
		return false;

// space extr
	var reg='^ *';
//protocol	
	reg = reg+'(?:([Hh][Tt][Tt][Pp](?:[Ss]?))(?:\:\\/\\/))?';
//usrpwd	
	reg = reg+'(?:(\\w+\\:\\w+)(?:\\@))?';
//domain
	reg = reg+'([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|localhost|([Ww][Ww][Ww].|[a-zA-Z0-9].)[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,6})';
//port
	reg = reg+'(\\:\\d+)?';
//path
	reg = reg+'((?:\\/.*)*\\/)?';
//filename
	reg = reg+'(.*?\\.(\\w{2,4}))?';
//qrystr
	reg = reg+'(\\?(?:[^\\#\\?]+)*)?';
//bkmrk
	reg = reg+'(\\#.*)?';
// space extr
	reg = reg+' *$';

	return url.match(reg);
}

// returns true if checkStr contains only characters specified in checkOK
// probably can be replaced with a more efficient regular expression

function isValidString( checkStr, checkOK ) {

	if ( !checkOK )
		var checkOK = '';

	var allValid = true;

	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		
		if (j == checkOK.length) {
			allValid = false;
			break;
		}
	}
	
	return allValid;
}

var alphabeticChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var numericChars = "0123456789";

function isNumeric( val ) {
	return isValidString( val, numericChars );
}

function isNumeric( val, addChars ) {
	return isValidString( val, numericChars + addChars );
}

function isAlphabetic( val ) {
	return isValidString( val, alphabeticChars );
}

function isAlphabetic( val, addChars ) {
	return isValidString( val, alphabeticChars + addChars );
}

function isAlphaNumeric( val ) {
	return isValidString( val, alphabeticChars + numericChars );
}

function isAlphaNumeric( val, addChars ) {
	return isValidString( val, alphabeticChars + numericChars + addChars );
}
