function DoNone()
{
    
}

Function.prototype.bind = function(object) 
{	
	var __method = this;
	return function() 
	{
		return __method.apply(object, arguments);
	}
}

String.prototype.trim = function()
{
    var sRetVal;
    
    sRetVal = this.replace(/^[\s]+/g,'');
    sRetVal = this.replace(/[\s]+$/g,'');

    return sRetVal; 
}

String.prototype.endsWith = function(s){
	var reg = new RegExp(s + "$");
	return reg.test(this);
}

String.prototype.startsWith = function(s){
	var reg = new RegExp("^" + s);
	return reg.test(this);
}

String.prototype.format = function() {
  var s = this;
  for (var i = 0; i < arguments.length; i++) {       
    var reg = new RegExp("\\{" + i + "\\}", "gm");             
    s = s.replace(reg, arguments[i]);
  }

  return s;
}
String.prototype.checkEmail = function()
    {
        if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(this))
            {
            return (true);
            }
        return (false);
    }
                
String.prototype.asc = function()
{
    var sSymbols = ' !\"#$%&\()*+\'-./0123456789:;<=>?@';
	var sLetters = 'abcdefghijklmnopqrstuvwxyz';
	var sValues;
	var lPos;
	var lRetVal=0;
	
	sValues=sSymbols;
	sValues += sLetters.toUpperCase();
	sValues += '[\\]^_`';
	sValues += sLetters;
	sValues += '{|}~';
	
	lPos = sValues.indexOf(this.toString(),1);
	if(lPos > -1)
	{ 
		lRetVal=32 + lPos;
	}
	
	return lRetVal;
}

String.prototype.isDate = function()
{
    return !isNaN(new Date(this.toString()));
}

String.prototype.formatCurrency = function(DecimalPlaces, CurrencySymbol, DecimalPointSymbol, Separator)
{
	var dValue;
	var iDecimalPlaces=DecimalPlaces;
	var sCurrencySymbol=CurrencySymbol;
	var sDecimalPointSymbol=DecimalPointSymbol;
	var sSeparator=Separator;
	var sIntegerPart;
	var sDecimalPart;
	var sRetVal='';
	var iPos;
	var iDigit;
	var sZeroPad;

    dValue=parseFloat(this.replace(/[£,]/g,''));
	dValue=Math.round(dValue*Math.pow(10,iDecimalPlaces));
	dValue=dValue/Math.pow(10,iDecimalPlaces);
    
	//defaults
	if(isNaN(dValue)) {dValue=0;}
	if(isNaN(iDecimalPlaces)) {iDecimalPlaces=2;}
	if(sCurrencySymbol == null) {sCurrencySymbol='£';}
	if(sDecimalPointSymbol == null) {sDecimalPointSymbol='.';}
	if(sSeparator == null) {sSeparator=',';}

	bPositive=(dValue>=0);
	dIntegerPart=Math.floor(Math.abs(dValue));
	dDecimalPart=Math.round((Math.abs(dValue)-Math.floor(Math.abs(dValue)))*Math.pow(10,iDecimalPlaces));

	//Build formatted string
	if(!bPositive)
	{
		sRetVal += '-';
	}
	sRetVal += sCurrencySymbol;

	sIntegerPart=dIntegerPart.toString();
	for(iPos=0;iPos<sIntegerPart.length;iPos++)
	{
		sRetVal += sIntegerPart.charAt(iPos);
		if((sIntegerPart.length-iPos) % 3 == 1 && (sIntegerPart.length-iPos)>=3)
		{
			sRetVal += sSeparator;
		}
	}

	if(iDecimalPlaces>0)
	{
		sZeroPad=Math.pow(10,iDecimalPlaces).toString().substring(1)
		sDecimalPart=sZeroPad + dDecimalPart.toString()
		sRetVal += sDecimalPointSymbol + sDecimalPart.substring(sDecimalPart.length-iDecimalPlaces);
	}

	return sRetVal;
}
//*** Class Definitions
function clsCollection() 
{ 
    var collection = {}; 
    var order = [];
    
    if(typeof clsCollection._initialized =='undefined')
    {
        clsCollection.prototype.add = function(key, value)
        { 
            if(!this.exists(key))
            { 
                collection[key] = value; 
                order.push(key); 
            }
        } 

        clsCollection.prototype.remove = function(key)
        { 
            collection[key] = null; 
            
            var ii = order.length; 
            
            while(ii-- > 0)
            { 
                if(order[ii] == key)
                { 
                    order[ii] = null;
                    break; 
                } 
            }
        }

        clsCollection.prototype.toString = function()
        { 
            var output = []; 
            
            for(var ii = 0; ii < order.length; ++ii)
            { 
                if(order[ii] != null)
                { 
                    output.push(collection[order[ii]]);
                } 
            } 
            
            return output;
        }

        clsCollection.prototype.getKeys = function()
        { 
            var keys = []; 
            
            for(var ii = 0; ii < order.length; ++ii)
            { 
                if(order[ii] != null)
                {
                    keys.push(order[ii]);
                } 
            } 
            
            return keys; 
        }

        clsCollection.prototype.update = function(key, value)
        { 
            if (value != null)
            { 
                collection[key] = value; 
            } 
            
            var ii = order.length;
            
            while (ii-- > 0)
            { 
                if(order[ii] == key)
                { 
                    order[ii] = null;
                    order.push(key);
                    break; 
                } 
            }
        }

        clsCollection.prototype.exists = function(key)
        { 
            return collection[key] != null;
        }  
    
        clsCollection._initialized=true;
    }
}

