/**
 * Returns an object with the specified ID.
 */

function getObj(id) {
	
	return document.getElementById(id);
	
}

/**
 * Returns whether an object with the specified ID exists.
 */

function objExists(id) {
	
	if (document.getElementById(id)) {
		return true;
	} else {
		return false;
	}

}

/**
 * Returns the file extension of the given file
 */

function getExtension(n) {
	
	n = n.substr(n.lastIndexOf('.') + 1);
	
	return n.toLowerCase();

}

/**
 * Returns the basename of a given file (removes the file extension)
 */

function getFilename(n) {

	return n.substr(0, n.lastIndexOf('.'));

}

function basename(s){var p=-1;for(var i=0;i<s.length;i++){if( s.charAt(i)=='\\'||s.charAt(i)=='/')p=i;}if(p<0)return s;return s.substr(p+1,s.length-p);}

/* Array prototype, matches value in array: returns bool */
Array.prototype.inArray = function(value){
	var i;
	for(i=0; i < this.length; i++){
		if(this[i] === value){
			return true;
		}
	}
	return false;
};

function getY( obj ) {

	var y = 0;

	while( obj != null ) {
		y += obj.offsetTop;
		obj = obj.offsetParent;
	}

	return y;

}

function getX( obj ) {

	var x = 0;

	while( obj != null ) {
		x += obj.offsetLeft;
		obj = obj.offsetParent;
	}

	return x;

}




function uploadCheckAdult(prefix) {

	var a = getObj(prefix + 'adult_true');
	var b = getObj(prefix + 'adult_false');

	if (a.checked == false && b.checked == false) {

		alert("Please specify whether your uploads are offensive or not.");
	
		return false;
	
	}

	return true;

}