var contentFormat = new Array();
	contentFormat['jpg'] = 'picture';
	contentFormat['jpeg'] = 'picture';
	contentFormat['png'] = 'picture';
	contentFormat['gif'] = 'picture';
	contentFormat['avi'] = 'video';
	contentFormat['mp4'] = 'video';
	contentFormat['wmv'] = 'video';
	contentFormat['flv'] = 'video';

var endHourFormat = new Array();
	endHourFormat['00'] = '01';
	endHourFormat['01'] = '02';
	endHourFormat['02'] = '03';
	endHourFormat['03'] = '04';
	endHourFormat['04'] = '05';
	endHourFormat['05'] = '06';
	endHourFormat['06'] = '07';
	endHourFormat['07'] = '08';
	endHourFormat['08'] = '09';
	endHourFormat['09'] = '10';
	endHourFormat['10'] = '11';
	endHourFormat['11'] = '12';
	endHourFormat['12'] = '13';
	endHourFormat['13'] = '14';
	endHourFormat['14'] = '15';
	endHourFormat['15'] = '16';
	endHourFormat['16'] = '17';
	endHourFormat['17'] = '18';
	endHourFormat['18'] = '19';
	endHourFormat['19'] = '20';
	endHourFormat['20'] = '21';
	endHourFormat['21'] = '22';
	endHourFormat['22'] = '23';
	endHourFormat['23'] = '00';
	
var APP_COLORS = new Array();
	APP_COLORS['admin'] = 'FE5933';
	APP_COLORS['agenda'] = 'FF9000';
	APP_COLORS['games'] = '37BDD6';
	APP_COLORS['messaging'] = 'A883C1';
	APP_COLORS['wishlist'] = 'ED0FA6';
	APP_COLORS['album'] = '00FF06';

function function_exists( function_name ){
	if (typeof function_name == 'string'){
		return (typeof window[function_name] == 'function');
	}else{
		return (function_name instanceof Function);
	}
}

function call_user_func(cb, parameters) {
	var func;

	if (typeof cb == 'string'){
		if (typeof this[cb] == 'function'){
			func = this[cb];
		}else{
			func = (new Function(null, 'return ' + cb))();
		}
	}else if (cb instanceof Array){
		func = eval(cb[0]+"['"+cb[1]+"']");
	}

	if (typeof func != 'function'){
		throw new Exception(func + ' is not a valid function');
	}

	return func.apply(null, Array.prototype.slice.call(parameters));
}

function array_keys( input, search_value, argStrict ) {   
	var tmp_arr = {}, strict = !!argStrict, include = true, cnt = 0;
	var key = '';

	for (key in input) {
		include = true;
		if (search_value != undefined) {
			if( strict && input[key] !== search_value ){
				include = false;
			} else if( input[key] != search_value ){
				include = false;
			}
		}

		if (include) {
			tmp_arr[cnt] = key;
			cnt++;
		}
	}

	return tmp_arr;
}

function array_key_exists (key, search){
    if( !search || (search.constructor !== Array && search.constructor != Object) ){
        return false;
    }

    return key in search;
}


function intval( mixed_var, base ) {
	var tmp;

	var type = typeof( mixed_var );

	if(type == 'boolean'){
	if (mixed_var == true) {
	return 1;
	} else {
	return 0;
	}
	} else if(type == 'string'){
	tmp = parseInt(mixed_var * 1);
	if(isNaN(tmp) || !isFinite(tmp)){
	return 0;
	} else{
	return tmp.toString(base || 10);
	}
	} else if(type == 'number' && isFinite(mixed_var) ){
	return Math.floor(mixed_var);
	} else{
	return 0;
	}
}

function getPosition(element){
	var left = getLeft(element);
	var top = (getTop(element) + element.offsetHeight);

	return Array(left, top);
}

function getLeft(element){
	var offsetLeft = 0;

	while(element != null){
		offsetLeft += element.offsetLeft;
		element = element.offsetParent;
	}

	return offsetLeft;
}

function getTop(element){
	var offsetTop = 0;

	while(element != null){
		offsetTop += element.offsetTop;
		element = element.offsetParent;
	}

	return offsetTop;
}
