// JavaScript Document

/*---------------------------------------------------
* String Trim Functions
*---------------------------------------------------*/
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}

/*---------------------------------------------------
* Get Browser's Width and Height
*---------------------------------------------------*/
function getScreenSize() {
	var w = 0;
	var h = 0;
	if(typeof(window.innerWidth) == 'number'){
		w = window.innerWidth;
		h = window.innerHeight;
	}else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
		w = document.documentElement.clientWidth;
		h = document.documentElement.clientHeight;
	}else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
		w = document.body.clientWidth;
		h = document.body.clientHeight;
	}
	return w+'x'+h;
}

/*--------------------------------------------------*/
/*	retrieves current user's browser info 
/*--------------------------------------------------*/
function getBrowser(){
	var name = "";
	var version = jQuery.browser.version.charAt(0);
	if(jQuery.browser.safari) name = "safari";
	if(jQuery.browser.opera) name = "opera";
	if(jQuery.browser.msie){ name = "ie";
		if(navigator.userAgent.search("MSIE 8.0") != -1){
			version = 8;
		}else if(navigator.userAgent.search("MSIE 7.0") != -1){
			version = 7;
		}else{
			version = 6;
		}
	}
	if(jQuery.browser.mozilla) name = "firefox";
	
	if(navigator.appVersion.search("Chrome") != -1) name = "chrome";
	if(navigator.appVersion.search("Macintosh") != -1 && jQuery.browser.mozilla) name = "firefox-mac";
	
	var browser = {
		"name" : name,
		"version" : version
	};
	return browser;
}
