/*
GLOBAL
*/
/*
GLOBAL > Constants
*/
var Constants = new function() {}
Constants.MAX_PHOTOS_PER_LISTING = 8;
Constants.BASE_URL = 'http://www.studentgiant.com';
/*
GLOBAL > Messages
*/
var Messages = new function(){}
Messages.MISSING_PARAMS = 'Please fill in all fields that aren\'t marked \"Optional\". ';
Messages.MISSING_PARAMS_PHOTO  = 'Please select a photo and enter a description.';
Messages.MAX_PHOTOS_PER_LISTING = 'You may only have a total of ' + Constants.MAX_PHOTOS_PER_LISTING + ' photos per ';
Messages.CREDIT_VALUES = 'Standard listings will be [standard_credits] credits per day. Featured listings will be [featured_credits] credits per day.';
Messages.alert = function(messageType,where){
	alert(messageType + where);
}
Messages.prompt = function(action,what,cb){
	var answer = confirm('Are you sure you want to ' + action + ' ' + what + '?');
	if(cb && answer) cb();
}
/*
GLOBAL > Assets
*/
var GlobalAssets = new Object();
GlobalAssets.SMALL_PROGRESS = '/images/smallProgress.gif';
/*
GLOBAL > Elements
*/
var GlobalElements = function(){};
GlobalElements.prototype.newImage = function(imgName,imgSrc,imgAlt) {
	var content = '';
	if(imgName && imgSrc) {
		if(!imgAlt) imgAlt='';
		var img = new Image();
		img.src = imgSrc;
		img.id = img.name = imgName;
		img.alt = img.title = imgAlt;
		content = img;
	} else {
		alert(GlobalMessages.MISSING_PARAMS + 'newImage');
	}
	return content;
}
/*
GLOBAL > Utils
*/
var Utils = new function(){}
Utils.getFunctionName = function(func) {
if (typeof func == "function" || typeof func == "object" )
	var name = (""+func).match(/function\s*([\w\$]*)\s*\(/); 
	if(name !== null)
		return name[1];
}
Utils.roundNumber = function(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}