
function isObject(a) {
    return (a && typeof a == 'object') || isFunction(a);
}

function isFunction(a) {
    return typeof a == 'function';
}

/*////////////////////////////////////////////////////////////////	

Class: adobe

Properties:
srcPath - string

////////////////////////////////////////////////////////////////*/
var adobe = (function() {
	var _scriptsSoFar,
	_libraryPath;
	
	var singl3ton = function() {
		_libraryPath = this.getMyPath();
		this.srcPath = _libraryPath;
	};
	singl3ton.prototype = {
/*////////////////////////////////////////////////////////////////	

Method: getMyPath

Returned Value:
The uri of this file

////////////////////////////////////////////////////////////////*/
		getMyPath: function() {
			var myPath = (_scriptsSoFar = document.getElementsByTagName("script"))[_scriptsSoFar.length - 1].getAttribute("src");
			return myPath.slice(0, myPath.lastIndexOf("/") + 1); 
		},
/*////////////////////////////////////////////////////////////////	

Method: setLibraryPath

Function: 
Specify the root path for dynamically loaded assets

Usage:
>	adobe.setLibraryPath("outside.app.com/lib/");
>	adobe.setLibraryPath(adobe.getMyPath() + "../../lib/");

Parameters:
myPath - String

Returned Value:
None

See also:
<Loader>

////////////////////////////////////////////////////////////////*/
		setLibraryPath: function(myPath) {
			 _libraryPath = myPath || this.getMyPath();
			 this.srcPath = _libraryPath; // backward compatible public property
		},
/*////////////////////////////////////////////////////////////////	

Method: getLibraryPath

Function: 
Get the root path for dynamically loaded assets

Returned Value:
String

////////////////////////////////////////////////////////////////*/
		getLibraryPath: function(myPath) {
			 return _libraryPath;
		},
/*////////////////////////////////////////////////////////////////	

Method: getLibraryPath

Function: 
Append ".compressed" to end of all dynamically loaded assets

Returned Value:
None

////////////////////////////////////////////////////////////////*/
		doJsCompress: function() {
			this.jscompress = 1;
			this.jscompress_path="compressed";
		}
	};
	
	return new singl3ton();
	
})();

adobe.hostEnv = (function() {
	var ua = new String(navigator.userAgent.toLowerCase()), //using new to speed up the many method calls below
		appV = parseInt(navigator.appVersion, 0),
		isSafari = ua.indexOf('safari') != -1,
		kitV = 0;
		
	if(isSafari) {
		var wk = 'applewebkit/',
			kitpos = ua.indexOf(wk);
		
		if(kitpos > -1) {
			var kit = ua.substring(kitpos+wk.length);
			kit = kit.substring(0,kit.indexOf(" "));
			kitV = parseInt(kit, 0);
		}
	}

	if(ua.indexOf('opera/7') != -1 || ua.indexOf('opera 7') != -1) { appV = 7; }
	
	var env = {
		"name":		window.location.hostname,
		"isSecure":	window.location.protocal == "https:",
		"appN":		navigator.appName.toLowerCase(),
		"appV":		appV,
		"ua":		ua, 
		"plt":		navigator.platform.toLowerCase(),
		"lang":		(navigator.language || navigator.userLanguage).substring(0,2),
		"ax":		typeof window.ActiveXObject != "undefined",
		"ieV":		(function() {
				/*@
					@if (@_jscript_version >= 5 && @_jscript_version < 5.5) { return 5; } @end;
					@if (@_jscript_version >= 5.5 && @_jscript_version < 5.6) { return 5.5; } @end;
					@if (@_jscript_version >= 5.6 && @_jscript_version < 5.7) { return 6; } @end;
					@if (@_jscript_version >= 5.7 && @_jscript_version < 5.8) { return 7; } @end;
				@*/
					return 0;
				})(),
		"isSafari": isSafari,
		"kitV":		kitV
	};
	
	return env;
})();

(((com={}).adobe = {}).www = {
	"is": true,
	isSecure: adobe.hostEnv.isSecure
});

adobe.util = adobe.util || {};

/*////////////////////////////////////////////////////////////////	

ON DOM READY
@author www.vivabit.com
temporary home for bug fix #63221

////////////////////////////////////////////////////////////////*/
Object.extend(Event, {
	 _domReady : function() {
		 if (arguments.callee.done) { return; }
		 arguments.callee.done = true;
		 
		 if (this._timer) { clearInterval(this._timer); }
		 this._readyCallbacks.each(function(f) { f(); });
		 this._readyCallbacks = null;
	},
	onDOMReady : function(f) {
		if (!this._readyCallbacks) {
			var domReady = this._domReady.bind(this);
     		if (document.addEventListener) {
				document.addEventListener("DOMContentLoaded", domReady, false);
			}
			/*@if (@_win32)
					document.write("<script id=__ie_onload defer src=//:><\/script>");
					document.getElementById("__ie_onload").onreadystatechange = function() {
						if (this.readyState == "complete") { 
							domReady();
						}
					}
				@end; @*/
			
			if (/WebKit/i.test(navigator.userAgent)) { 
				this._timer = setInterval(function() {
            		if (/loaded|complete/.test(document.readyState)) { domReady(); } }, 10);}
			
			Event.observe(window, 'load', domReady);
			Event._readyCallbacks =  [];
		}
		Event._readyCallbacks.push(f);
	}
});

/*////////////////////////////////////////////////////////////////

@author btapley

Class: Cookie

*/
adobe.Cookie = {
/*////////////////////////////////////////////////////////////////
	
	Method: set
	
	Parameters:
	name - string
	value - string
	duration - number (of days)
	path - string
	domain - string
	secure - boolean
		
////////////////////////////////////////////////////////////////*/
	set: function(name, value, duration, path, domain, secure){
		var cookie = [];
		cookie.push(name+"="+escape(value));
		if(duration) {
			var date = new Date();
			date.setTime(date.getTime() + (duration*86400000));
			cookie.push("expires=" + date.toGMTString());
		}
		if(path) {
			cookie.push("path=" + path || "/");	
		}
		if(domain) {
			cookie.push("domain=" + domain);
		}
		if(secure) {
			cookie.push("secure");
		}
		document.cookie = cookie.join(";");
	},
/*////////////////////////////////////////////////////////////////
	
	Method: get
	
	Parameters:
	name - string
		
////////////////////////////////////////////////////////////////*/
	get: function(name){
		var result, test, rexp = new RegExp(name + "=(.*)");
		document.cookie.split(";").detect(function(cookie){
			if((test = cookie.match(rexp))) {
				result = unescape(decodeURI(test[1]));
			} 
			return test;
		});
		return result;
	},
/*////////////////////////////////////////////////////////////////

	Method: remove
	
	Parameters:
	name - string
	
////////////////////////////////////////////////////////////////*/
	remove: function(name){
		this.set(name, '', -1);
	}
};



/* SWF OBJECT QUEUE
 to control when objects are written in the document
*/

registerSWFObject = (function() {

	 if(adobe.hostEnv.ax && !adobe.hostEnv.isSafari) {
		 var fobjs = {},
		 called = false;

		 function writeFObjects() {

			 for(var id in fobjs) {
				 fobjs[id].write( id );
				 document.getElementById( id ).style.visibility="visible";
			 }
			 fobjs = {};
			 return true;

		 }

		 return function ( fobj, domID ) { // IE Active X

		 if(!called) { //lazy init
			 Event.observe(window, "load", writeFObjects);
			 called = true;
		 }

		 document.getElementById(domID).style.visibility="hidden";

		 fobjs[domID] = fobj;
		 };

	 }

	 return function( fobj, domtarg ) { // not IE Active X
	 fobj.write( domtarg );

	 };

})();
