//<script>
// Standard variables
var isNN = ( navigator.appName == "Netscape" ) ? true : false;
var isIE = ( navigator.appName.indexOf( "Microsoft" ) != -1 ) ? true : false;

function AddTimeStampToUrl( url )
{
	// Empty check
	if ( IsEmpty( url ) )
		return null;
		
	// Append ? if necessary
	if ( url.indexOf( '?' ) == -1 )
		url += '?' ;
		
	// Make url unique
	return url + '&timestamp=' + (new Date()).getTime();
}

// AssembleQueryString
function AssembleQueryString( parametersArray )
{
	var length = parametersArray.length;
	var key, value;
	var queryString = '';
	for( key in parametersArray )
	{
	   value = parametersArray[ key ];
	   if ( value != null )
		   queryString += '&' + key + '=' + encodeURIComponent( value );
	}
	
	// Trim first &
	return queryString.substr( 1 );
}

// Attach event handler
// ==============================================================
// htmlElement : element to attach event to
// event       : name of the browser event
// delegate    : function to handle this event
//
// When [event] fires on the object, the object's [event] handler is called 
// before [delegate]. If you attach multiple delegates to the same event on
// the same object, the delegates are called in random order, immediately after
// the object's event handler is called.
// ==============================================================
function AttachEventHandler( htmlElement, eventName, delegate )
{
   // Lower event
   eventName = eventName.toLowerCase();
   
   // Check if a event list is available
   var eventList = htmlElement.eventList;
   if ( eventList == null )
   {
      eventList = new Array();
      htmlElement.eventList = eventList;
   }
   
   // Check if a delegate list is avalable
   var delegateList = eventList[ eventName ];
   if ( delegateList == null )
   {
      delegateList = new Array();
      eventList[ eventName ] = delegateList;
      
      // Attach event
      eval( 'htmlElement.' + eventName + '= function(actualEvent) {' +
               'FireEvent( htmlElement, eventName, actualEvent ); }' );
   }
   
   // Add delegate to list
   delegateList.push( delegate );  
}

// Change querystring
// ==============================================================
// activeWindow   : Window for which the query string has to be changed 
// queryString    : Parameters in query string format
// replace        : If true the current query string is completely
//                  replaced by this one. Else parameters from 
//                  this query string are appended to the existing
//                  query string. If the a parameter already exists
//                  it is replaced.
// ==============================================================
function ChangeQueryString( activeWindow, queryString, replace )
{
   // Check replace
   if ( replace == true )
   {
      activeWindow.location.search = queryString;
   }
   else
   {
      // Set query string
      activeWindow.location.search = ChangeValuesOfQueryString( activeWindow.location.search, queryString );
   }

   // Set scrollPosition for maintaining position
   var currentScrollPosition = 0;
   if ( activeWindow.document.documentElement && activeWindow.document.documentElement.scrollTop)
		// IE6 +4.01 and user has scrolled
		currentScrollPosition = activeWindow.document.documentElement.scrollTop;
	else if ( activeWindow.document.body && activeWindow.document.body.scrollTop)
		// IE5 or DTD 3.2
	   currentScrollPosition = activeWindow.document.body.scrollTop;
	   
   SetCookie( activeWindow, 'scrollPosition', currentScrollPosition );

}

// Change values of querystring
// ==============================================================
// input          : Parameters in query string format
// newvalues          : Parameters in query string format
// returns  new querystring with newvalues inserted into the input querystring
// ==============================================================
function ChangeValuesOfQueryString( input, newvalues )
{
   // Get old and new parameters
   var queryParameters = ParseQueryString( input );
   var newParameters = ParseQueryString( newvalues );
   
   // Append and replace new parameters
   for ( var parameter in newParameters )
      queryParameters[ parameter ] = newParameters[ parameter ];
      
   // Assemble new query string
   return AssembleQueryString( queryParameters );

}

// Check scrollPosition set by ChangeQuerystring
setTimeout( 'CheckScrollPosition();', 10 );
function CheckScrollPosition()
{
	var scrollPosition = GetCookie( window, 'scrollPosition' );
	if ( scrollPosition != null )
	{
		if ( document.documentElement )
			// IE6 +4.01 and user has scrolled
			document.documentElement.scrollTop = scrollPosition;
		else if ( document.body )
			document.body.scrollTop = scrollPosition;
			
		DeleteCookie( window, 'scrollPosition' );
	}
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function DeleteCookie( currentWindow, name, path, domain) 
{
   if ( GetCookie(  currentWindow, name ) ) {
       currentWindow.document.cookie = name + "=" + 
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-1970 00:00:01 GMT";
   }
}

// Detach event handler
// ==============================================================
// htmlElement : element to detach event from
// event       : name of the browser event
// delegate    : function to handle this event
// ==============================================================
function DetachEventHandler( htmlElement, eventName, delegate )
{
   // Lower event
   eventName = eventName.toLowerCase();
   
   // Check if a event list is available
   var eventList = htmlElement.eventList;
   if ( eventList != null )
   {
      // Check if a delegate list is avalable
      var delegateList = eventList[ eventName ];
      if ( delegateList != null )
      {
         for ( var i = 0; i < delegateList.length; i++ )
         {
            if ( delegateList[ i ] == delegate )
            {
               // Remove delegate
               if ( delegateList.length > 1 )
               {
                  delegateList = delegateList.splice( i, 1 );
               }
               else
               {
                  eventList[ eventName ] = null;
               }
            }
         }         
      }
   }
}

// Execute all event handlers.
// If one returns something else than null, 
// something went wrong, and we stop 
// executing the event handlers
function FireEvent( htmlElement, eventName, actualEvent )
{
   // Check if a delegate list is available
   var eventList = htmlElement.eventList;
   if ( eventList != null )
   {
      // Get delegate list
      var delegateList = eventList[ eventName.toLowerCase() ];

   	// Loop over all delegates
      var result = null;
	   for ( var i=0; i<delegateList.length; i++ )
	   {
	      // Execute delegate
	      if ( actualEvent == null )
				actualEvent = window.event;
			
			result = delegateList[ i ]( actualEvent );
				
			if ( result != null )
			   return result;
	   }
   }
   
	// Default
	return null;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function GetCookie( currentWindow, name) 
{
   var dc = currentWindow.document.cookie;
   var prefix = name + "=";
   var begin = dc.indexOf("; " + prefix);
   if (begin == -1) {
      begin = dc.indexOf(prefix);
      if (begin != 0) return null;
   } else
      begin += 2;

   var end = currentWindow.document.cookie.indexOf(";", begin);
   if (end == -1)
      end = dc.length;

	return decodeURIComponent(dc.substring(begin + prefix.length, end));
}

// Calculate the left position of the element, relative to the body.
function GetElementLeft(element) {

	var left = 0; 
	while ( element ) {
		left	  += element.offsetLeft;
		element	= element.offsetParent;
	}
	return left;
}

// Calculate the top position of the element, relative to the body.
function GetElementTop(element) {

	var top = 0; 
	while (element) {
		top	  += element.offsetTop;
		element	= element.offsetParent;
	}
	return top;	
}

// Get style value from element
function GetStyle( element, styleName )
{
	// Mozilla
	if (document.defaultView && document.defaultView.getComputedStyle)
		return document.defaultView.getComputedStyle( element, null ).getPropertyValue( styleName );		
	// IE
	else if ( element.currentStyle) 
	{ 
		return element.currentStyle[ 
					styleName.replace( /-([^-])/g, 
						function(a,b) 
						{ return b.toUpperCase() } 
					) ];
	}
}


// function to emulate insertAdjacentElement
function InsertAdjacentElement( srcElement, where, element) 
{
	switch (where.toLowerCase()) 
	{
		case "beforebegin":
			srcElement.parentNode.insertBefore(element, srcElement);
			break;
		case "afterbegin":
			srcElement.insertBefore(element, srcElement.firstChild);
			break;
		case "beforeend":
			srcElement.appendChild(element);
			break;
		case "afterend":
			srcElement.parentNode.insertBefore(element, srcElement.nextSibling);
			break;
	}
}

// Is Blank Check
function IsBlank( input ) 
{
	return ( input == null || input == '' || TrimFast( input ) == '' );
}

// Is Empty Check
function IsEmpty(input) {
	return (input == null || input == '');
}

function IsInList( haystack, needle ) 
{
	if ( IsEmpty( haystack ) || IsEmpty( needle ) )
		return false;
		
	var list = ',' + haystack + ',';
	return ( list.indexOf(',' + needle.replace( ',', '&#044;' ) + ',') > -1 );
}

function IsTrue( value )
{
	if ( value == null )
		return false;
		
	switch( value.toString() )
	{
		case "true":
		case "1":
		case "yes":
		case "ok":
		case "on":
			return true;
		default:
			return false;		
	}
}

/*** Http Channel ******************************************************************/

// Static HttpChannel class
var HttpChannel = 
{
	AsyncRequest: _HttpChannel_AsyncRequest,
	GetXmlHttpObject: _HttpChannel_GetXmlHttpObject,
	Request: _HttpChannel_Request,
	Submit: _HttpChannel_Submit
}

// Method: request
/* Example how to use callbackObject 
var callbackObject = new Object();
callbackObject.Execute = function() 
{
   var test = callbackObject.xmlHTTP.readyState;
}

top.httpChannel.AsyncRequest( scriptUrl, callbackObject );
*/

function _HttpChannel_AsyncRequest( scriptUrl, callbackDelegate )
{
	// Null check
	if ( scriptUrl == null || scriptUrl.length == 0 )
		return null;
	
	scriptUrl = AddTimeStampToUrl( scriptUrl );

   // Prepare request
   var xmlHttp = this.GetXmlHttpObject();
   
   // Send request asynchronously ( = don't wait for answer )
   xmlHttp.open( "GET", scriptUrl, true );
   
   // Set callback function
   if ( callbackDelegate != null )
   {
      callbackDelegate.xmlHttp = xmlHttp;
      xmlHttp.onreadystatechange = callbackDelegate.Execute;
      callbackDelegate.Execute.xmlHttp = xmlHttp;
   }
   xmlHttp.send(null);
 }

// Method: Get Transport
function _HttpChannel_GetXmlHttpObject()
{
   var xmlHttp = null;
   if ( window.XMLHttpRequest ) 
   // If IE7, Mozilla, Safari, and so on: Use native object
      xmlHttp = new XMLHttpRequest();
   else
   // ...otherwise, use the ActiveX control for IE5.x and IE6
      xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP" );
  
   return xmlHttp;
}

// Method: request
function _HttpChannel_Request( scriptUrl )
{
	// Null check
	if ( scriptUrl == null || scriptUrl.length == 0 )
		return null;
	
	scriptUrl = AddTimeStampToUrl( scriptUrl );
	
   // Prepare request
   var xmlHttp = this.GetXmlHttpObject();
   
   // Send request synchroniously ( = wait for answer )
   xmlHttp.open( "GET", scriptUrl, false );
   xmlHttp.send(null);
   
   // Check valid response
   var html = xmlHttp.responseText;
   if ( html != null )
   {
      // Look for Lynkx comment
      var i = html.lastIndexOf( "<!-- Lynkx" );
      if ( i > 1 )
         html = html.substr( 0, i - 1 );
   }
   
   // Return
   return html; 
}

// Submit request and returns response
function _HttpChannel_Submit( scriptUrl, postDictionary )
{
	// Null check
	if ( scriptUrl == null || scriptUrl.length == 0 )
		return null;
	
	scriptUrl = AddTimeStampToUrl( scriptUrl );
	
	// Url encode request body
	var postRequest = '';
	if ( postDictionary != null )
	{
   	var key = '';
   	for( key in postDictionary ) 
      {
   	   postRequest += '&' + key + '=' + encodeURIComponent( postDictionary[ key ] );
   	}
   	
   	// Strip off first &
   	if ( postRequest != '' )
   	   postRequest = postRequest.substr( 1 );
	}
	
	// Prepare request
   var xmlHttp = this.GetXmlHttpObject();
	
	// Send request synchroniously ( = wait for answer )
	xmlHttp.open( "POST", scriptUrl, false );
	xmlHttp.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
	xmlHttp.send( postRequest );

   // Check valid response
   var html = xmlHttp.responseText;
   if ( html != null )
   {
      // Look for Lynkx comment
      var i = html.lastIndexOf( "<!-- Lynkx" );
      if ( i > 1 )
         html = html.substr( 0, i - 1 );
   }
   
   // Return
   return html; 
}

// CallbackDelegate ( calls functionName with parameters: xmlHttp.responseText, status )
function CallbackDelegate( functionName, parameters )
{
	if ( functionName == null )
		return null;
		
	var currentCallbackDelegate = this;
	this.Execute = function()
	{
		var xmlHttp = currentCallbackDelegate.xmlHttp;
		if ( xmlHttp == null )
			xmlHttp = this;

		// Onloaded event, execute function
		if ( xmlHttp.readyState == 4 )
			functionName( xmlHttp, parameters );						
	}
}

// ----------------------------------------------------------------------------------------------

// MD5 base 64.
function MD5Base64( input )
{
   // Base-64 pad character. "=" for strict RFC compliance
   var b64pad  = "=";

   // Bits per input character. 8 - ASCII; 16 - Unicode
   var chrsz = 16;

   // These functions implement the four basic operations the algorithm uses.
   function md5_cmn(q, a, b, x, s, t)
   {
      return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
   }
   
   function md5_ff(a, b, c, d, x, s, t)
   {
      return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
   }
   
   function md5_gg(a, b, c, d, x, s, t)
   {
      return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
   }
   
   function md5_hh(a, b, c, d, x, s, t)
   {
      return md5_cmn(b ^ c ^ d, a, b, x, s, t);
   }
   
   function md5_ii(a, b, c, d, x, s, t)
   {
      return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
   }

   // Add integers, wrapping at 2^32. This uses 16-bit operations internally
   // to work around bugs in some JS interpreters.
   function safe_add(x, y)
   {
      var lsw = (x & 0xFFFF) + (y & 0xFFFF);
      var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
      return (msw << 16) | (lsw & 0xFFFF);
   }

   // Bitwise rotate a 32-bit number to the left.
   function bit_rol(num, cnt)
   {
      return (num << cnt) | (num >>> (32 - cnt));
   }

   // Convert a string to an array of little-endian words
   // If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
   var x = Array();
   var mask = ( 1 << chrsz ) - 1;
   for( var i = 0; i < input.length * chrsz; i += chrsz )
      x[i>>5] |= ( input.charCodeAt(i / chrsz) & mask ) << ( i%32 );
      
   // Append padding
   var len = input.length * chrsz;
   x[len >> 5] |= 0x80 << ((len) % 32);
   x[(((len + 64) >>> 9) << 4) + 14] = len;

   var a =  1732584193;
   var b = -271733879;
   var c = -1732584194;
   var d =  271733878;

   for( var i = 0; i < x.length; i += 16 )
   {
      var olda = a;
      var oldb = b;
      var oldc = c;
      var oldd = d;

      a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
      d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
      c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
      b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
      a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
      d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
      c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
      b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
      a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
      d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
      c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
      b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
      a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
      d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
      c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
      b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);

      a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
      d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
      c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
      b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
      a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
      d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
      c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
      b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
      a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
      d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
      c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
      b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
      a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
      d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
      c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
      b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);

      a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
      d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
      c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
      b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
      a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
      d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
      c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
      b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
      a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
      d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
      c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
      b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
      a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
      d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
      c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
      b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);

      a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
      d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
      c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
      b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
      a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
      d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
      c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
      b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
      a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
      d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
      c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
      b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
      a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
      d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
      c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
      b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);

      a = safe_add(a, olda);
      b = safe_add(b, oldb);
      c = safe_add(c, oldc);
      d = safe_add(d, oldd);
   }
   x = Array(a, b, c, d);
   var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
   var str = "";
   for(var i = 0; i < x.length * 4; i += 3)
   {
      var triplet = (((x[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)
                  | (((x[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
                  |  ((x[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
      for(var j = 0; j < 4; j++)
      {
         if(i * 8 + j * 6 > x.length * 32) str += b64pad;
         else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
      }
   }
   return str;        
}

// ---------------------------------------------------------------------------------

// Return the query string as an assosiative array
function ParseQueryString( queryString )
{
	// Initialize variables
	var parameters = new Array();

	// Null check
	if ( queryString == null )
		return parameters;
		
	// strip ? from querystring
	var pos = queryString.indexOf('?');
	if ( pos > -1 )
		queryString = queryString.substr(pos+1);
	
	// Replace + by spaces ( decodeURI does not do that )	
	queryString = queryString.replace( /[+]/g, ' ' );

	// Get parameters
	var keyValuePairs = queryString.split( '&' );
	var equalPos = -1;
	var parameter;
	for ( var i in keyValuePairs )
	{
	   // Split on =
	   parameter = keyValuePairs[ i ];
	   equalPos = parameter.indexOf( '=' );
	   if ( equalPos > -1 )
	   	parameters[ decodeURIComponent( parameter.substr( 0, equalPos ) ) ] = decodeURIComponent( parameter.substr( equalPos + 1 ) );
	}
	
	// Return parameters
	return parameters;
}

// Prevent bubbling
function PreventBubbling( e )
{
	// Get event if empty
	if ( e == null )
		e = window.event;
		
	e.cancelBubble = true;
	e.returnValue = false;
	if ( e.preventDefault ) e.preventDefault();
	if ( e.stopPropagation ) e.stopPropagation();

	return false;
}

// Randomize order of array by fisher-Yates algorithm
function RandomizeArray ( myArray ) 
{
	if ( myArray == null )
		return;

	var i = myArray.length;
	if ( i < 2 ) 
		return;
	
	while ( --i ) 
	{
		var j = Math.floor( Math.random() * ( i + 1 ) );
		var tempi = myArray[i];
		var tempj = myArray[j];
		myArray[i] = tempj;
		myArray[j] = tempi;
	}
}

// Remove all event handlers.
function RemoveEvent( htmlElement, eventName )
{
   // Lower event
   eventName = eventName.toLowerCase();
   
   // Check if a event list is available
   if ( htmlElement.eventList != null )
   {
      // Delete delegate list
      delete htmlElement.eventList[ eventName ];
   }
   
   // Remove event
   eval( 'htmlElement.' + eventName + '= null');
}

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function SetCookie( currentWindow, name, value, expires, path, domain, secure) 
{
	var curCookie = name + "=" + encodeURIComponent(value) +
      ((expires) ? "; expires=" + expires : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
   currentWindow.document.cookie = curCookie;
}

// Fast trim function by http://blog.stevenlevithan.com/archives/faster-trim-javascript
function TrimFast( input )
{
	// Empty check
	if ( input == null || input == '' )
		return input;
		
	// trim whitespace at start
	input = input.replace(/^\s\s*/, '');
	
	var wsRegex = /\s/;
	var i = input.length;
	
	// Check whitespace at end
	while ( wsRegex.test( input.charAt(--i) ) );
	
	return input.slice(0, i + 1);
}

// Fast trim function by http://blog.stevenlevithan.com/archives/faster-trim-javascript
function TrimChar(input, charToTrim ) {
	// Empty check
	if (input == null || input == '')
		return input;

	if ( charToTrim == '[' 
	|| charToTrim == ']' 
	|| charToTrim == '(' 
	|| charToTrim == ')' 
	|| charToTrim == '\\' 
	|| charToTrim == '*' 
	|| charToTrim == '.' 
	|| charToTrim == '?' 
	|| charToTrim == '+' 
	|| charToTrim == '-' )
		charToTrim = '\\' + charToTrim;
	
	// trim whitespace at start
	input = input.replace( new RegExp( '^' + charToTrim + charToTrim + '*' ), '');

	var wsRegex = new RegExp( charToTrim );
	var i = input.length;

	// Check whitespace at end
	while (wsRegex.test(input.charAt(--i)));

	return input.slice(0, i + 1);
}

// Add indexOf support to IE by http://soledadpenades.com/2007/05/17/arrayindexof-in-internet-explorer/
function ArrayIndexOf(array, obj) 
{
	// Null check
	if (array == null)
		return -1;
		
	var length = array.length;
	for ( var i = 0; i < length; i++ )
	{
		if ( array[i] == obj )
			return i;
	}
	return -1;
}
//</script>