/*


                      ,:rhZb7
                    .72XpbPQQQU
                 .7thhh0DMXt2RQQf,      :hQRF:
                  .rtXDDS2h1crtQQQ9i:7QQQQQQQQ7  ,
                 :JFtr.,    .7JRQQQQMRQQQQQQQQQQQQQ
              .fQ0r,       .LFPQQQQQQYipr, .JQQQQQQ
            ,XQ2.        ,hR2cchRQQQQQQ  ,.rriQQQRQi
           cQ2       ,,, rQbQQQQREQQQQQpQQQJ2XQQ7,F
          DQ.     ,,,,,, ,XSQQQ:1QQRQQQQQQQQQQQQQL7
        ,Q9    ,,,,,,,,,  rUFEQS:iRQQQQQQQQQQQQQQJ
        Rp    ,,,,,,,,,,  ,h2JtDR7i20RQQQQQQQQQQQQ:
       UR   ,,,,,,,,,,,,  .99XShSMDt77YUth9bEMRQQQQQD:
      .Q.  ,,,,,,,,,,,,,  Lpt0P9b9bRDp9SFUL77rYfpMQQQQQr
      10  ,,,,,,,,,,,,,, ,1Jr0XhXbMDEDRQRZ0XStr:itDQQQQQQ,
      R7  ,,,,,,,,,,,,,, .t7rEQ9110RQMEDEEDRQQQQh7fQQQQQQD
     ,Q.  ,,,,,,,,,,,,,, :trYDQQQQQQQQQQQQQQQQQQQQQQQQQQf
     ,Q.  ,,,,,,,,,,,,,, 7trURQQQQQQQQSLriii::::YXQRi.,
     ,Q:  ,,,,,,,,,,,,,  rtiJQQQQQQQJ             r:  :XQQh
      QY  ,,,,,,,,,,,,,  :ti7RQQQQQQ             .QQQQQQQQQ
      UQ  ,,,,,,,,,,,,,  :tir0QQQQQL            iQQQQQbEQQQi.
       Qr  ,,,,,,,,,,,,  .JiiPQQQQQ:  ,,,,,,,,, DQQ:      QQQQt   0Q,                                :QQR
       7Q.  ,,,,,,,,,,,  .tirPRQQQQX  ,,,,,,,,  QQi       jQQQQ,  QQQc.    .          ,ZQQt         7QQQ:
        bQ,      ,,,,,,, ,ji:2ZRQQQQ   ,,,,,,  ZQQQZQQQQ.  :Ri  :9QQQQQJ pQQQ. i.    7QQQQQ  r7:   .QQQQh:
         0Qhptr.  ,,,,,   Li.7fS0QQQQ,  ,,,,  1QQQQQQQQQQ  .QR QQQ2XQQQQ7QQZQQQQQQc LQQ.QQ1 QQQQQh 1QJ ZQQ
          UQQQQQY  ,,,,,.:Lri7ct1hDQQQr     .PpQQQZjri:L.  QQQ rQR  RQR,QQ   QQQrQQRQQS77. DQf .QQELQ
           .XQQQX   ,,icYc7JhXF2tftLLSZJ  ,YQY  QQ         QQQ  SQQQF   QQ   QQ7  QQQQ7iQQrQQ    QQiQQR2cr,
             :pQt,   :Lri7JttJ7LLci.rLYciJQ9,   QQ,        .QQRQQQQQR.  QQ   .Qr  RQirQQQc:QQ    ,Q. YQQQQX
               .SMPJri:i7L7i::::ii..:Lt9bU,      Y           QQ  .2QQQQ ,.                 ..
                 ,729PfjY7riirrrrcJftj7.                     QQ,   iQQQ
                      .ir7JtF2Jc7r:,                          DQQQQQQQr 	JavaScript Framework
                                                                :c7:
*/
var Figment = {
	/**
	 * Converts an object literal to a multi-instance capable object
	 * class.
	 */
	Class: function()
	{
		return function()
		{
			this.initialize.apply( this,arguments );
		};
	},

	/**
	 * Creates a new container for preventing methods from interfering
	 * with other namespaces or the default namespace of window.  The
	 * new namespace is added to the window object.
	 * <p>
	 * A namespace is made up of objects that are children of each other.
	 *
	 * @param	arguments	is a dot seperated name for the container
	 */
	Namespace: function()
	{
		var iLen = arguments.length;
		var listOfParts = null;
		var root = window;
		var jLen = 0;
		var j = 0;
		var i = 0;

		for( i=0; i < iLen; i++ )
		{
			listOfParts = arguments[i].split( '.' );
			jLen = listOfParts.length;

			for( j=0; j < jLen; j++ )
			{
				if( !root[ listOfParts[j] ] )
				{
					// Create a blank object for this part of the namespace
					root[ listOfParts[j] ] = {};
				}
				root = root[ listOfParts[j] ];
			}
		}

		delete listOfParts;
		delete root;
	},

	/**
	 * Attempts to retrieve and load script from another file after
	 * determining that the specified namespace is not already loaded.
	 *
	 * @param	strScript		fully-qualified name of the namespace (a.k.a. fileName) to import
	 * @param	strStartURL		name of an alternate URL to retrieve the file from (can be relative or absolute)
	 * @param	bDotsAreFolders	determines whether to treat dots in the namespace as folders instead of dots in the filename
	 */
	Import: function( strScript,strStartURL,bDotsAreFolders )
	{
		
		var bImport = false;
		var strNamespace = null;
		var listOfNamespaces = null;
		var root = null;
		var iLen = null;
		var i = 0;
		var objHead = null;
		var strJs = null;
		var objScript = null;
		var ajaxRequestor = null;

		strNamespace = strScript;
		if( arguments.length === 3 && bDotsAreFolders )
		{
			strScript = strScript.replaceAll( '.','/' );
		}
		strScript += '.js';

		if( arguments.length < 2 )
		{
			strStartURL = '';
		}
		else
		{
			if( strStartURL !== null && strStartURL !== '' && !strStartURL.endsWith( '/' ) )
			{
				strStartURL += '/';
			}
		}

		listOfNamespaces = strNamespace.split( '.' );
		root = window;
		iLen = listOfNamespaces.length;
		for( i=0; i < iLen; i++ )
		{
			if( !root[ listOfNamespaces[i] ] )
			{
				bImport = true;
				break;
			}
			root = root[ listOfNamespaces[i] ];
		}

		// Label the import section
		markImport:

			if( bImport )
			{
				ajaxRequestor = Figment.Try( function(){ return new window.ActiveXObject( 'Msxml2.XMLHTTP' ); },function(){ return new window.ActiveXObject( 'Microsoft.XMLHTTP' ); },function(){ return new window.XMLHttpRequest(); } ) || false;
				if( ajaxRequestor )
				{
					try
					{
						ajaxRequestor.open( 'get', strStartURL + strScript, false );
						ajaxRequestor.send( null );

						try
						{
							if( ajaxRequestor.status >= 200 && ajaxRequestor.status <= 300 )
							{
								strJs = ajaxRequestor.responseText;
								objScript = document.createElement( "SCRIPT" );
								objHead = document.getElementsByTagName( "HEAD" );
								if( objHead.length > 0 )
								{
									objHead = objHead[0];
								}
								else
								{
									alert( "Script not loaded" );
									break markImport;
								}
								objScript.type = "text/javascript";
								if( window.ActiveXObject )
								{
									// For IE (who won't add childNodes to SCRIPT elements
									objScript.text = strJs;
								}
								else
								{
									// For W3C DOM Standard Compliant browsers
									objScript.appendChild( document.createTextNode( strJs ) );
								}
								objHead.appendChild( objScript );

								delete objScript;
								delete objHead;
							}
						}catch( ex ){}
					}catch( e ){
						alert( "Script not found: " + strStartURL + strScript );
					}
					delete ajaxRequestor;
				}
			}
		delete listOfNamespaces;
		delete root;
	},

	/**
	 * Determines if the specified class already exists.
	 *
	 * @param	strFQClassName	is the fully-qualified name of the class to check for
	 * @return	true or false if the class exists
	 */
	doesClassExist: function( strFQClassName )
	{
		var listOfameSpaces = strFQClassName.split( "." );
		var iLen = listOfNameSpaces.length;
		var oNameSpace = null;
		var oPackage = null;
		var bResult = true;
		var i = 0;

		for( i=0; i < iLen; i++ )
		{
			oPackage = listOfNameSpaces[ i ];
			oNameSpace = oNameSpace !== null ? oNameSpace[oPackage] : eval(oPackage); //oNameSpace = listOfNameSpaces[ iLen ];
			if( typeof oNameSpace === 'undefined' )
			{
				bResult = false;
			}
		}

		delete listOfNameSpaces;
		delete oNameSpace;
		return bResult;
	},

	/**
	 * Attempts to run code in the order in which they are passed in by arguments.  Upon the
	 * first successful completion, the method will return the result and stop processing
	 * additional arguments.
	 *
	 * @param	arguments	individual portions of code to attempt to run
	 * @return	result of the first successful code in the arguments list
	 */
	Try: function()
	{
		var returnValue = null;
		var iLen = arguments.length;
		var i = 0;
		var lambda = null;

		for( i=0; i < iLen; i++ )
		{
			lambda = arguments[i];
			try
			{
				returnValue = lambda();
				break;
			} catch (e) {}
		}
		return returnValue;
	},

	EmptyFunction: function(){},

	CONST_JS_ROOT_ID: 'jsroot',

	CONST_WEB_ROOT_ROOT_ID: 'webroot',
	CONST_MEDIA_ROOT_ID: 'mediaroot',
	CONST_BASE_ROOT_ID: 'baseuri',
	JS_ROOT_VALUE: null,
	WEB_ROOT_VALUE: null,
	MEDIA_ROOT_VALUE: null,
	BASE_ROOT_VALUE: null,

	loadRoots: function()
	{
		var metas = document.getElementsByTagName("META");
		for( var i=0; i<metas.length; i++)
		{
			var meta = metas[i];
			if( meta.name === Figment.CONST_JS_ROOT_ID )
			{			
				jsFolder = "/js/";
				Figment.JS_ROOT_VALUE = "/" + meta.content + jsFolder;										
			}
			else if( meta.name === Figment.CONST_WEB_ROOT_ROOT_ID )
			{
				Figment.WEB_ROOT_VALUE = "/" + meta.content + "/";
			}
			else if( meta.name === Figment.CONST_MEDIA_ROOT_ID )
			{
				Figment.MEDIA_ROOT_VALUE = "/" + meta.content + "/media/";
			}
			else if ( meta.name === Figment.CONST_BASE_ROOT_ID )
			{
				Figment.BASE_ROOT_VALUE = meta.content;
			}
		}
	},

	getJSRoot: function()
	{
		if( Figment.JS_ROOT_VALUE === null )
		{
			Figment.loadRoots();
		}
		return Figment.JS_ROOT_VALUE;
	},

	getWebRoot: function()
	{
		if( Figment.WEB_ROOT_VALUE === null )
		{
			Figment.loadRoots();
		}
		return Figment.WEB_ROOT_VALUE;
	},

	getMediaRoot: function()
	{
		if( Figment.MEDIA_ROOT_VALUE === null )
		{
			Figment.loadRoots();
		}
		return Figment.MEDIA_ROOT_VALUE;
	},

	getBase: function()
	{
		if( Figment.BASE_ROOT_VALUE === null )
		{
			Figment.loadRoots();
		}
		return Figment.BASE_ROOT_VALUE;
	}
}

//#######################################################################
//#	BROWSER OBJECT EXTENSION & ENHANCEMENTS								#
//#	The following methods will either fix or extend default methods		#
//#	available to different objects in base language of JavaScript.		#
//#######################################################################
if( !Function.prototype.apply )
{
	// Based on code from http://www.youngpup.net/
	Function.prototype.apply = function( object,parameters )
	{
		var parameterStrings = [];
		if( !object ){ object = window; }
		if( !parameters ){ parameters = []; }

		for( var i=0; i < parameters.length; i++ )
		{
			parameterStrings[i] = 'parameters[' + i + ']';
		}

		object.__apply__ = this;
		var result = eval( 'object.__apply__(' + parameterStrings.join(', ') + ')' );
		object.__apply__ = null;
		return result;
	};
}
if( !Function.prototype.bind )
{
	Function.prototype.bind = function( object )
	{
		var __method = this;
		return function()
		{
			try
			{
				__method.apply( object,arguments );
			} catch(e) {}
		};
	};
}
if( !Object.extend )
{
	Object.extend = function( destination,source )
	{
		var property;
		for( property in source )
		{
			destination[property] = source[property];
		}
		return destination;
	};
}
/**
 * Extends an object to contain the specified object's properties and/or methods.
 *
 * @param	object	to append to the other object
 * @return	result of merged objects
 */
if( !Object.prototype.extend )
{
	Object.prototype.extend = function( object )
	{
		return Figment.Object.extend.apply( this,[this,object] );
	};
}
/**
 * Trims the start of a string only.
 *
 * @return	the string trimmed
 */
if( !String.prototype.lTrim )
{
	String.prototype.lTrim = function()
	{
		return this.replace( /^\s*/,'' );
	};
}
/**
 * Trims the end of a string only.
 *
 * @return	the string trimmed
 */
if( !String.prototype.rTrim )
{
	String.prototype.rTrim = function()
	{
		return this.replace( /\s*$/,'' );
	};
}
/**
 * Trims both the beginning and end of a string.
 *
 * @return	the string trimmed
 */
if( !String.prototype.trim )
{
	String.prototype.trim = function()
	{
		return this.rTrim().lTrim();
	};
}
/**
 * Determines if a string ends with the specified string.
 *
 * @param	string	is the string to check for
 * @return	whether or not the string ends with the specified string
 */
if( !String.prototype.endsWith )
{
	String.prototype.endsWith = function( string )
	{
		return this.substr( this.length-string.length )===string;
	};
}
/**
 * Determines if a string starts with the specified string.
 *
 * @param	string	is the string to check for
 * @return	whether or not the string starts with the specified string
 */
if( !String.prototype.startsWith )
{
	String.prototype.startsWith = function( e )
	{
		return this.substr( 0,e.length ) === e;
	};
}
/**
 * Decodes the string URI.
 *
 * @return	the decoded string URI
 */
if( !String.prototype.decodeURI )
{
	String.prototype.decodeURI = function()
	{
		return unescape( this );
	};
}
/**
 * Encodes the string URI for safe transmission via a QueryString.
 *
 * @return	the safely encoded string URI
 */
if( !String.prototype.encodeURI )
{
	String.prototype.encodeURI = function()
	{
		var returnString;
		returnString = escape( this );
		returnString = returnString.replace( /\+/g,'%2B' );
		return returnString;
	};
}
/**
 * Replaces all instances of one string with another string.
 *
 * @param	findStr	is the string to locate to replace
 * @param	repStr	is the string to replace each instance of the findStr found
 * @return	the modified string
 */
if( !String.prototype.replaceAll )
{
	String.prototype.replaceAll = function( findStr,repStr )
	{
	  var srchNdx = 0;
	  var newStr = "";
	  while( this.indexOf( findStr,srchNdx ) !== -1)
	  {
			newStr += this.substring( srchNdx,this.indexOf( findStr,srchNdx ) );
			newStr += repStr;
			srchNdx = ( this.indexOf( findStr,srchNdx ) + findStr.length );
	  }
	  newStr += this.substring( srchNdx,this.length );
	  return newStr;
	};
}
/**
 * Converts a string into camel-back (captializes each word and removes spacing between words).
 *
 * @return	string that is camel-backed
 */
if( !String.prototype.camelize )
{
	String.prototype.camelize = function()
	{
		var i = 0;
		var s = null;
		var oStringList = null;
		var camelizeString = null;
		var iLen = 0;

		oStringList = this.split( '-' );
		if( oStringList.length === 1 )
		{
			return oStringList[0];
		}

		camelizedString = this.indexOf( '-' ) == 0 ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) : oStringList[0];

		for( i=1,iLen=oStringList.length; i<len; i++ )
		{
			s = oStringList[i];
			camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
		}
		return camelizedString;
	}
}
/**
 * Adds one or more elements to the end of an array and returns the new length of the array.
 *
 * @param	arguments	the objects (as multiple arguments) to add to the array
 * @return	array with the new element(s) appended to the end
 */
if( !Array.prototype.push )
{
	Array.prototype.push = function()
	{
		var startLength = this.length;
		var i= 0;

		for( i=0; i < arguments.length; i++ )
		{
			this[ startLength + i ] = arguments[i];
		}
		return this.length;
	};
}
/**
 * Returns the first (least) index of an element within the array equal to the
 * specified value, or -1 if none is found.
 *
 * @param	object	is the object to attempt to find in the array
 * @return	the location of the specified object or -1 if not found
 */
if( !Array.prototype.indexOf )
{
	Array.prototype.indexOf = function( object )
	{
		var i = 0;

		for( i=0; i < this.length; i++ )
		{
			if( this[i] === object )
			{
				return i;
			}
		}
		return -1;
	};
}
/**
 * Returns whether the specified object is found inside the array.
 *
 * @param	object	is the object to attempt to find in the array
 * @return	whether or not the object was found in the array
 */
if( !Array.prototype.exists )
{
	Array.prototype.exists = function( object )
	{
		return this.indexOf( object ) !== -1;
	};
}
/**
 * Adds the specified object to the array.
 *
 * @param	object	to add to the array
 * @return	array with the new element appended to the end
 */
if( !Array.prototype.queue )
{
	Array.prototype.add = Array.prototype.queue = function( object )
	{
		this.push( object );
	};
}
/**
 * Add multiple objects to the array.
 *
 * @param	objects	the objects (as multiple array) to add to the array
 * @return	array with the new element(s) appended to the end
 *
 */
if( !Array.prototype.addRange )
{
	Array.prototype.addRange = function( objects )
	{
		var length = objects.length;
		var i = 0;

		if( length !== 0 )
		{
			for( i=0; i < length; i++ )
			{
				this.push( objects[i] );
			}
		}
	};
}
/**
 * Determines whether the specified object is contained inside the array.
 *
 * @param	object	to check for the existence of
 * @return	whether or not the object was found in the array
 */
if( !Array.prototype.contains )
{
	Array.prototype.contains = function( object )
	{
		var index = this.indexOf( object );
		return index >= 0;
	};
}
/**
 * Removes the last element in the array.
 *
 * @return	the element that was removed from the array
 */
if( !Array.prototype.dequeue )
{
	Array.prototype.dequeue = function()
	{
		return this.shift();
	};
}
/**
 * Inserts the specified object into the array at the specified position.
 *
 * @param	index	to place the object in the array
 * @param	object	to place into the array
 */
if( !Array.prototype.insert )
{
	Array.prototype.insert = function( index,object )
	{
		this.splice( index,0,object );
	};
}
/**
 * Copies this array to a new array.
 *
 * @return	the copied array
 */
if( !Array.prototype.clone )
{
	Array.prototype.clone = function()
	{
		var clonedArray = [];
		var length = this.length;
		var i = 0;

		for( i=0; i < length; i++ )
		{
			clonedArray[i] = this[i];
		}
		return clonedArray;
	};
}
/**
 * Removes the element at the specified position from the array.
 *
 * @param	index	of the element to remove from the array
 * @return	the element that was removed
 */
if( !Array.prototype.removeAt )
{
	Array.prototype.removeAt = function( index )
	{
		return this.splice( index,1 );
	};
}
/**
 * Removes the specified object from the array.
 *
 * @param	object	to remove from the array
 * @return	the index of the element that contained the object
 */
if( !Array.prototype.remove )
{
	Array.prototype.remove = function( object )
	{
		var i = this.indexOf( object );
		if( i > -1 )
		{
			this.splice( i,1 );
		}
		return i > -1;
	};
}
/**
 * Removes all elements from the array.
 */
if( !Array.prototype.clear )
{
	Array.prototype.clear = function()
	{
		if( this.length > 0 )
		{
			this.splice( 0,this.length );
		}
	};
}

Date.prototype.formatDate = function( input,time )
{
    var daysLong =    ["Sunday", "Monday", "Tuesday", "Wednesday",
                       "Thursday", "Friday", "Saturday"];
    var daysShort =   ["Sun", "Mon", "Tue", "Wed",
                       "Thu", "Fri", "Sat"];
    var monthsShort = ["Jan", "Feb", "Mar", "Apr",
                       "May", "Jun", "Jul", "Aug", "Sep",
                       "Oct", "Nov", "Dec"];
    var monthsLong =  ["January", "February", "March", "April",
                       "May", "June", "July", "August", "September",
                       "October", "November", "December"];

    var switches = { // switches object

        a : function () {
            // Lowercase Ante meridiem and Post meridiem
            return date.getHours() > 11? "pm" : "am";
        },

        A : function () {
            // Uppercase Ante meridiem and Post meridiem
            return (this.a().toUpperCase ());
        },

        B : function (){
            // Swatch internet time. code simply grabbed from ppk,
            // since I was feeling lazy:
            // http://www.xs4all.nl/~ppk/js/beat.html
            var off = (date.getTimezoneOffset() + 60)*60;
            var theSeconds = (date.getHours() * 3600) +
                             (date.getMinutes() * 60) +
                              date.getSeconds() + off;
            var beat = Math.floor(theSeconds/86.4);
            if (beat > 1000) beat -= 1000;
            if (beat < 0) beat += 1000;
            if ((String(beat)).length == 1) beat = "00"+beat;
            if ((String(beat)).length == 2) beat = "0"+beat;
            return beat;
        },

        c : function () {
            // ISO 8601 date (e.g.: "2004-02-12T15:19:21+00:00"), as per
            // http://www.cl.cam.ac.uk/~mgk25/iso-time.html
            return (this.Y() + "-" + this.m() + "-" + this.d() + "T" +
                    this.h() + ":" + this.i() + ":" + this.s() + this.P());
        },

        d : function () {
            // Day of the month, 2 digits with leading zeros
            var j = String(this.j());
            return (j.length == 1 ? "0"+j : j);
        },

        D : function () {
            // A textual representation of a day, three letters
            return daysShort[date.getDay()];
        },

        F : function () {
            // A full textual representation of a month
            return monthsLong[date.getMonth()];
        },

        g : function () {
            // 12-hour format of an hour without leading zeros
            return date.getHours() > 12? date.getHours()-12 : date.getHours();
        },

        G : function () {
            // 24-hour format of an hour without leading zeros
            return date.getHours();
        },

        h : function () {
            // 12-hour format of an hour with leading zeros
            var g = String(this.g());
            return (g.length == 1 ? "0"+g : g);
        },

        H : function () {
            // 24-hour format of an hour with leading zeros
            var G = String(this.G());
            return (G.length == 1 ? "0"+G : G);
        },

        i : function () {
            // Minutes with leading zeros
            var min = String (date.getMinutes ());
            return (min.length == 1 ? "0" + min : min);
        },

        I : function () {
            // Whether or not the date is in daylight saving time (DST)
            // note that this has no bearing in actual DST mechanics,
            // and is just a pure guess. buyer beware.
            var noDST = new Date ("January 1 " + this.Y() + " 00:00:00");
            return (noDST.getTimezoneOffset () ==
                    date.getTimezoneOffset () ? 0 : 1);
        },

        j : function () {
            // Day of the month without leading zeros
            return date.getDate();
        },

        l : function () {
            // A full textual representation of the day of the week
            return daysLong[date.getDay()];
        },

        L : function () {
            // leap year or not. 1 if leap year, 0 if not.
            // the logic should match iso's 8601 standard.
            // http://www.uic.edu/depts/accc/software/isodates/leapyear.html
            var Y = this.Y();
            if (
                (Y % 4 == 0 && Y % 100 != 0) ||
                (Y % 4 == 0 && Y % 100 == 0 && Y % 400 == 0)
                ) {
                return 1;
            } else {
                return 0;
            }
        },

        m : function () {
            // Numeric representation of a month, with leading zeros
            var n = String(this.n());
            return (n.length == 1 ? "0"+n : n);
        },

        M : function () {
            // A short textual representation of a month, three letters
            return monthsShort[date.getMonth()];
        },

        n : function () {
            // Numeric representation of a month, without leading zeros
            return date.getMonth()+1;
        },

        N : function () {
            // ISO-8601 numeric representation of the day of the week
            var w = this.w();
            return (w == 0 ? 7 : w);
        },

        O : function () {
            // Difference to Greenwich time (GMT) in hours
            var os = Math.abs(date.getTimezoneOffset());
            var h = String(Math.floor(os/60));
            var m = String(os%60);
            h.length == 1? h = "0"+h:1;
            m.length == 1? m = "0"+m:1;
            return date.getTimezoneOffset() < 0 ? "+"+h+m : "-"+h+m;
        },

        P : function () {
            // Difference to GMT, with colon between hours and minutes
            var O = this.O();
            return (O.substr(0, 3) + ":" + O.substr(3, 2));
        },

        r : function () {
            // RFC 822 formatted date
            var r; // result
            //  Thu         ,     21               Dec              2000
            r = this.D() + ", " + this.d() + " " + this.M() + " " + this.Y() +
            //    16          :    01          :    07               0200
            " " + this.H() + ":" + this.i() + ":" + this.s() + " " + this.O();
            return r;
        },

        s : function () {
            // Seconds, with leading zeros
            var sec = String (date.getSeconds ());
            return (sec.length == 1 ? "0" + sec : sec);
        },

        S : function () {
            // English ordinal suffix for the day of the month, 2 characters
            switch (date.getDate ()) {
                case  1: return ("st");
                case  2: return ("nd");
                case  3: return ("rd");
                case 21: return ("st");
                case 22: return ("nd");
                case 23: return ("rd");
                case 31: return ("st");
                default: return ("th");
            }
        },

        t : function () {
            // thanks to Matt Bannon for some much needed code-fixes here!
            var daysinmonths = [null,31,28,31,30,31,30,31,31,30,31,30,31];
            if (this.L()==1 && this.n()==2) return 29; // ~leap day
            return daysinmonths[this.n()];
        },

        U : function () {
            // Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
            return Math.round(date.getTime()/1000);
        },

        w : function () {
            // Numeric representation of the day of the week
            return date.getDay();
        },

        W : function () {
            // Weeknumber, as per ISO specification:
            // http://www.cl.cam.ac.uk/~mgk25/iso-time.html

            var DoW = this.N ();
            var DoY = this.z ();

            // If the day is 3 days before New Year's Eve and is Thursday or earlier,
            // it's week 1 of next year.
            var daysToNY = 364 + this.L () - DoY;
            if (daysToNY <= 2 && DoW <= (3 - daysToNY)) {
                return 1;
            }

            // If the day is within 3 days after New Year's Eve and is Friday or later,
            // it belongs to the old year.
            if (DoY <= 2 && DoW >= 5) {
                return new Date (this.Y () - 1, 11, 31).formatDate ("W");
            }

            var nyDoW = new Date (this.Y (), 0, 1).getDay ();
            nyDoW = nyDoW != 0 ? nyDoW - 1 : 6;

            if (nyDoW <= 3) { // First day of the year is a Thursday or earlier
                return (1 + Math.floor ((DoY + nyDoW) / 7));
            } else {  // First day of the year is a Friday or later
                return (1 + Math.floor ((DoY - (7 - nyDoW)) / 7));
            }
        },

        y : function () {
            // A two-digit representation of a year
            var y = String(this.Y());
            return y.substring(y.length-2,y.length);
        },

        Y : function () {
            // A full numeric representation of a year, 4 digits

            // we first check, if getFullYear is supported. if it
            // is, we just use that. ppks code is nice, but wont
            // work with dates outside 1900-2038, or something like that
            if (date.getFullYear) {
                var newDate = new Date("January 1 2001 00:00:00 +0000");
                var x = newDate .getFullYear();
                if (x == 2001) {
                    // i trust the method now
                    return date.getFullYear();
                }
            }
            // else, do this:
            // codes thanks to ppk:
            // http://www.xs4all.nl/~ppk/js/introdate.html
            var x = date.getYear();
            var y = x % 100;
            y += (y < 38) ? 2000 : 1900;
            return y;
        },


        z : function () {
            // The day of the year, zero indexed! 0 through 366
            var t = new Date("January 1 " + this.Y() + " 00:00:00");
            var diff = date.getTime() - t.getTime();
            return Math.floor(diff/1000/60/60/24);
        },

        Z : function () {
            // Timezone offset in seconds
            return (date.getTimezoneOffset () * -60);
        }

    }

    function getSwitch(str) {
        if (switches[str] != undefined) {
            return switches[str]();
        } else {
            return str;
        }
    }

    var date;
    if (time) {
        var date = new Date (time);
    } else {
        var date = this;
    }

    var formatString = input.split("");
    var i = 0;
    while (i < formatString.length) {
        if (formatString[i] == "\\") {
            // this is our way of allowing users to escape stuff
            formatString.splice(i,1);
        } else {
            formatString[i] = getSwitch(formatString[i]);
        }
        i++;
    }

    return formatString.join("");
}

if( typeof Document !== 'undefined' )
{
	Document.prototype.__defineGetter__("xml", function()
	{
	   return (new XMLSerializer()).serializeToString(this);
	});
}

if( typeof Element !== 'undefined' )
{
	Element.prototype.__defineGetter__("xml", function()
	{
	   return (new XMLSerializer()).serializeToString(this);
	});

	Element.prototype.__defineSetter__("innerHTML",function()
	{
		var r = this.ownerDocument.createRange();
		r.selectNodeContents(this);
		r.deleteContents();
		var df = r.createContextualFragment(str);
		this.appendChild(df);
	});

	Element.prototype.__defineSetter__("outerHTML",function()
	{
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var df = r.createContextualFragment(str);
		this.parentNode.replaceChild(df, this);
	});
}Figment.Namespace( 'Figment.EntryPoint' );
Figment.EntryPoint = {
	
	listOfObjects: [],
	
	add: function ( object ) {
		
		Figment.EntryPoint.listOfObjects.push( object );
		
	},
	
	execute: function () {
		
		if ( Figment.EntryPoint.listOfObjects !== null && Figment.EntryPoint.listOfObjects !== undefined && Figment.EntryPoint.listOfObjects.length > 0 ) {
			
			for ( var i=0; i < Figment.EntryPoint.listOfObjects.length; i++ ) {
				
				Figment.EntryPoint.listOfObjects[ i ].main();
				
			}
			
			delete listOfObjects;
			
		}
		
	}
}

if ( window.addEventListener ) {
	
	window.addEventListener( 'load', Figment.EntryPoint.execute, null );
	
} else if ( window.attachEvent ) {
	
	window.attachEvent('onload', Figment.EntryPoint.execute );
	
}Figment.Import( 'Figment.EventHandler',Figment.getJSRoot() + "_framework/" );
Figment.Import( 'Figment.DOM',Figment.getJSRoot() + "_framework/" );

var popUpWindowOpened = false;

function getObject(id) {
   if (document.getElementById(id)) {
     return document.getElementById(id);
   } else {
     return window.document[id];
   }
}

Figment.Namespace('Disney.DLR.IBC.PopUp.Events');

Disney.DLR.IBC.PopUp.Events = {

	main: function(evt){

		var arrElements = ("a" == "*" && document.all)? document.all : document.getElementsByTagName("a");
		var arrReturnElements = new Array();
		strClassName = "popUpLink".replace(/\-/g, "\\-");
		var oRegExp = new RegExp("(^|\\s)" + "popUpLink" + "(\\s|$)");
		var oElement;
		for(var i=0; i<arrElements.length; i++){
			oElement = arrElements[i];
			if(oRegExp.test(oElement.className)){
				Figment.EventHandler.addEvent( oElement,'click',Disney.DLR.IBC.PopUp.Events.EVENT_link_onClick );
			}
		}
	},

	EVENT_link_onClick: function(evt){
		var objWindowEvent = Figment.EventHandler.getEvent( evt );
		var objElement = objWindowEvent.element;
		
		//handle different behavior in IE, if there is an element inside anchor tag, objElement points to that element instead of the <a> tag
		if (!objElement.href || (objElement.href+"" == "undefined"))
		{
			objElement	= objElement.parentNode;
		}
		
		var pageURL = objElement.href.replace(/.*#(.*)\?.*/,"$1");

		var parameterString = objElement.href.replace(/.*\?(.*)/, "$1");
		var parameterTokens = parameterString.split("&");
		var parameterList = {}

		for (i = 0; i < parameterTokens.length; i++)
		{
			var parameterName = parameterTokens[i].replace(/(.*)=.*/, "$1");
			var parameterValue = parameterTokens[i].replace(/.*=(.*)/, "$1");
			parameterList[parameterName] = parameterValue;
		}

		strURL = parameterList["webRoot"] + pageURL;
		strPopUpName = parameterList["popUpName"];
		strURL = strURL + "?strPageName=" + strPopUpName;

		var strAttribute = "";
		if (parameterList["width"] != null) {
			strAttribute = strAttribute + "width=" + parameterList["width"];
		}
		if (parameterList["height"] != null) {
			if (strAttribute != "") {
				strAttribute = strAttribute + ", ";
			}
			strAttribute = strAttribute + "height=" + parameterList["height"];
		}
		if (parameterList["xPosition"] != null) {
			if (strAttribute != "") {
				strAttribute = strAttribute + ", ";
			}
			strAttribute = strAttribute + "left=" + parameterList["xPosition"];
		}
		if (parameterList["yPosition"] != null) {
			if (strAttribute != "") {
				strAttribute = strAttribute + ", ";
			}
			strAttribute = strAttribute + "top=" + parameterList["yPosition"];
		}
		if (parameterList["windowDirectories"] != null) {
			if (strAttribute != "") {
				strAttribute = strAttribute + ", ";
			}
			if (parameterList["windowDirectories"] == "true") {
				strAttribute = strAttribute + "directories=yes";
			} else {
				strAttribute = strAttribute + "directories=no";
			}
		}
		if (parameterList["windowLocation"] != null) {
			if (strAttribute != "") {
				strAttribute = strAttribute + ", ";
			}
			if (parameterList["windowLocation"] == "true") {
				strAttribute = strAttribute + "location=yes";
			} else {
				strAttribute = strAttribute + "location=no";
			}
		}
		if (parameterList["windowMenu"] != null) {
			if (strAttribute != "") {
				strAttribute = strAttribute + ", ";
			}
			if (parameterList["windowMenu"] == "true") {
				strAttribute = strAttribute + "menubar=yes";
			} else {
				strAttribute = strAttribute + "menubar=no";
			}
		}
		if (parameterList["windowResizable"] != null) {
			if (strAttribute != "") {
				strAttribute = strAttribute + ", ";
			}
			if (parameterList["windowResizable"] == "true") {
				strAttribute = strAttribute + "resizable=yes";
			} else {
				strAttribute = strAttribute + "resizable=no";
			}
		}
		if (parameterList["windowScrollbars"] != null) {
			if (strAttribute != "") {
				strAttribute = strAttribute + ", ";
			}
			if (parameterList["windowScrollbars"] == "true") {
				strAttribute = strAttribute + "scrollbars=yes";
			} else {
				strAttribute = strAttribute + "scrollbars=no";
			}
		}
		if (parameterList["windowStatus"] != null) {
			if (strAttribute != "") {
				strAttribute = strAttribute + ", ";
			}
			if (parameterList["windowStatus"] == "true") {
				strAttribute = strAttribute + "status=yes";
			} else {
				strAttribute = strAttribute + "status=no";
			}
		}
		if (parameterList["windowToolbar"] != null) {
			if (strAttribute != "") {
				strAttribute = strAttribute + ", ";
			}
			if (parameterList["windowToolbar"] == "true") {
				strAttribute = strAttribute + "toolbar=yes";
			} else {
				strAttribute = strAttribute + "toolbar=no";
			}
		}

		popUpWindowOpened = window.open(strURL, 'Popup', strAttribute);

		/*
		// alert(strURL);
		if (popUpWindowOpened == true) {
			window.location.href = strURL;
		} // if
		else {
			popUpWindowOpened = window.open(strURL, 'Popup', strAttribute);
		} // else
		*/

		return false;
	}
}


Figment.EntryPoint.add( Disney.DLR.IBC.PopUp.Events );var chromeColor = "#434343";
var chromeWidth = 760;
var legalFooterColor = "#000000";
var legalFtrLine1 = "<strong>Disneyland.com</strong>";
var legalFtrLine2 = '<a  href="JavaScript:popup.focus();" onclick="popup=window.open(\'http://secure.audienceprofiler.com/ussurvey/dis710B/dis710B_pop2.html\',\'new\',\'width=350,height=350,toolbar=false,scrollbars=no,menubar=no,status=false,location=no,resizable=no\');">Site Survey: Tell us what you think</a>';
var legalFtrOpts = ["Disneyland.com Help", "http://disneyland.disney.go.com/disneyland/en_US/help/landing?name=HelpLandingPage","Disneyland FAQ", "http://disneyland.disney.go.com/disneyland/en_US/help/landing?name=FAQLandingPage","Disneyland.com Site Map", "http://disneyland.disney.go.com/disneyland/en_US/general/siteMap?name=SiteMapPage","Disneyland Guest Services", "http://disneyland.disney.go.com/disneyland/en_US/help/gsLanding?name=GuestServicesLandingPage","Contact Us", "https://secure.disney.go.com/disneyland/en_US/help/contactUs?name=ContactUsPage"];