/**
* SwfStore - a JavaScript library for cross-domain flash cookies
*
* http://github.com/nfriedly/Javascript-Flash-Cookies
*
* Copyright (c) 2010 by Nathan Friedly - http://nfriedly.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

(function(){"use strict";var counter=0;var alpnum=/[^a-z0-9_]/ig;window.SwfStore=function(config){config=config||{};var defaults={swf_url:'storage.swf',namespace:'swfstore',debug:false,timeout:10,onready:null,onerror:null};var key;for(key in defaults){if(defaults.hasOwnProperty(key)){if(!config.hasOwnProperty(key)){config[key]=defaults[key];}}}
config.namespace=config.namespace.replace(alpnum,'_');if(window.SwfStore[config.namespace]){throw"There is already an instance of SwfStore using the '"+config.namespace+"' namespace. Use that instance or specify an alternate namespace in the config.";}
this.config=config;function id(){return"SwfStore_"+config.namespace+"_"+(counter++);}
function div(visible){var d=document.createElement('div');document.body.appendChild(d);d.id=id();if(!visible){d.style.position="absolute";d.style.top="-2000px";d.style.left="-2000px";}
return d;}
if(config.debug){if(typeof console==="undefined"){var loggerOutput=div(true);window.console={log:function(msg){var m=div(true);m.innerHTML=msg;loggerOutput.appendChild(m);}};}
this.log=function(type,source,msg){source=(source==='swfStore')?'swf':source;if(typeof(console[type])!=="undefined"){console[type]('SwfStore - '+config.namespace+' ('+source+'): '+msg);}else{console.log('SwfStore - '+config.namespace+": "+type+' ('+source+'): '+msg);}};}else{this.log=function(){};}
this.log('info','js','Initializing...');SwfStore[config.namespace]=this;var swfContainer=div(config.debug);var swfName=id();var flashvars="logfn=SwfStore."+config.namespace+".log&amp;"+"onload=SwfStore."+config.namespace+".onload&amp;"+"onerror=SwfStore."+config.namespace+".onerror&amp;"+"LSOName="+config.namespace;swfContainer.innerHTML='<object height="100" width="500" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+
swfName+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">'+' <param value="'+config.swf_url+'" name="movie">'+' <param value="'+flashvars+'" name="FlashVars">'+' <param value="always" name="allowScriptAccess">'+' <embed height="375" align="middle" width="500" pluginspage="http://www.macromedia.com/go/getflashplayer" '+'flashvars="'+flashvars+'" type="application/x-shockwave-flash" allowscriptaccess="always" quality="high" loop="false" play="true" '+'name="'+swfName+'" bgcolor="#ffffff" src="'+config.swf_url+'">'+'</object>';this.swf=document[swfName]||window[swfName];this._timeout=setTimeout(function(){SwfStore[config.namespace].log('error','js','Timeout reached, assuming '+config.swf_url+' failed to load and firing the onerror callback.');if(config.onerror){config.onerror();}},config.timeout*1000);};function checkData(data){if(typeof data==="function"){throw'SwfStore Error: Functions cannot be used as keys or values.';}}
SwfStore.prototype={version:"1.5",ready:false,set:function(key,value){this._checkReady();checkData(key);checkData(value);this.swf.set(key,value);},get:function(key){this._checkReady();checkData(key);return this.swf.get(key);},getAll:function(){this._checkReady();var data=this.swf.getAll();if(data.__flashBugFix){delete data.__flashBugFix;}
return data;},clear:function(key){this._checkReady();checkData(key);this.swf.clear(key);},_checkReady:function(){if(!this.ready){throw'SwfStore is not yet finished initializing. Pass a config.onready callback or wait until this.ready is true before trying to use a SwfStore instance.';}},"onload":function(){var that=this;setTimeout(function(){clearTimeout(that._timeout);that.ready=true;that.set('__flashBugFix','1');if(that.config.onready){that.config.onready();}},0);},onerror:function(){clearTimeout(this._timeout);if(this.config.onerror){this.config.onerror();}}};}());ONSUGAR.Event.observe(window, 'load', function(){ ONSUGAR.SSO.master('[]'); });