String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

// example of using trim, ltrim, and rtrim

/*
var myString = " hello my name is ";
alert("*"+myString.trim()+"*");
alert("*"+myString.ltrim()+"*");
alert("*"+myString.rtrim()+"*");
*/

/*
 * chages interface theme
 */
function changePlpInterfaceTheme(currentThemeCSSID, newThemeCSSPath){
	Ext.util.CSS.swapStyleSheet(currentThemeCSSID, newThemeCSSPath);
}

/*
 * Stores seleted theme in database
 */
function storeParticipantTheme(participantID,themeID,phpFunctionURL){
	Ext.Ajax.request({
		url: phpFunctionURL,
		params:{
			participantID: participantID,
			themeID: themeID
		},
		success: function(response){
			;
		},
		failure:function(){
			Ext.Msg.show({
			   title:'Error',
			   msg: 'Error storing selected theme to database !',
			   buttons: Ext.Msg.OK,
			   animEl: 'elId',
			   icon: Ext.MessageBox.WARNING
			});			
		}
	});
}

function successConfirmationMessage(message){
	Ext.Msg.show({
	   title:'Success',
	   msg: message,
	   buttons: Ext.Msg.OK,
	   animEl: 'elId',
	   icon: Ext.MessageBox.INFO
	});
}

function errorConfirmationMessage(message){
	Ext.Msg.show({
	   title:'Error',
	   msg: message,
	   buttons: Ext.Msg.OK,
	   animEl: 'elId',
	   icon: Ext.MessageBox.ERROR
	});
}

function warningConfirmationMessage(message){
	Ext.Msg.show({
	   title:'Warning',
	   msg: message,
	   buttons: Ext.Msg.OK,
	   animEl: 'elId',
	   icon: Ext.MessageBox.WARNING
	});
}

