/**
 * SWFAddress v1.1: Deep linking for Flash - http://www.asual.com/swfaddress/
 *
 * SWFAddress is (c) 2006 Rostislav Hristov and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof asual=="undefined"){
	var asual=new Object();
}
if(typeof asual.util=="undefined"){
	asual.util=new Object();
}

asual.util.Browser=new function(){
	var _1=navigator.userAgent;
	this.supported=false;
	this.ie=false;
	this.gecko=false;
	this.safari=false;
	this.opera=false;
	this.version=-1;
	if(/MSIE/.test(_1)){
		this.ie=true;
		this.version=parseFloat(_1.substring(_1.indexOf("MSIE")+4));
		this.supported=this.version>=6;
	}else{
		if(/AppleWebKit/.test(_1)){
			this.safari=true;
			this.version=parseFloat(_1.substring(_1.indexOf("Safari")+7));
			this.supported=this.version>=312;
		}else{
			if(/Opera/.test(_1)){
				this.opera=true;
				this.version=parseFloat(navigator.appVersion);
				this.supported=this.version>=9.02;
			}else{
				if(/Firefox/.test(_1)){
					this.gecko=true;
					this.version=parseFloat(_1.substring(_1.indexOf("Firefox")+8));
					this.supported=this.version>=1;
				}else{
					if(/Camino/.test(_1)){
						this.gecko=true;this.version=parseFloat(_1.substring(_1.indexOf("Camino")+7));
						this.supported=this.version>=1;
					}else{
						if(/Netscape/.test(_1)){
							this.gecko=true;
							this.version=parseFloat(_1.substring(_1.indexOf("Netscape")+9));
							this.supported=this.version>=8;
						}else{
							if(/Mozilla/.test(_1)&&/rv:/.test(_1)){
								this.gecko=true;
								this.version=parseFloat(_1.substring(_1.indexOf("rv:")+3));
								this.supported=this.version>=1.8;
							}
						}
					}
				}
			}
		}
	}
	if(!this.supported&&top.location.href.indexOf("#")!=-1){
		document.open();
		document.write("<html><head><meta http-equiv=\"refresh\" content=\"0;url="+top.location.href.substr(0,top.location.href.indexOf("#"))+"\" /></head></html>");
		document.close();
	}
};
asual.util.Functions=new function(){
	this.extend=function(_2,_3){
		function inheritance(){}
		inheritance.prototype=_2.prototype;
		_3.prototype=new inheritance();
		_3.prototype.constructor=_3;
		_3.superConstructor=_2;
		_3.superClass=_2.prototype;
		return _3;
	};
	this.bindAsListener=function(_4,_5,_6){
		return function(_7){
			return _4.call(_5,_7||((_6)?_6.event:window.event));
		};
	};
};
asual.util.Events=new function(){
	var _8=new Array();
	this.addListener=function(_9,_a,_b){
		if(_9.addEventListener){
			_9.addEventListener(_a,_b,false);
		}else{
			if(_9.attachEvent){
				_9.attachEvent("on"+_a,_b);
			}else{
				_9["on"+_a]=_b;
			}
		}
		_8.push({o:_9,t:_a,l:_b});
	};
	this.removeListener=function(_c,_d,_e){
		if(_c.removeEventListener){
			_c.removeEventListener(_d,_e,false);
		}else{
			if(_c.detachEvent){
				_c.detachEvent("on"+_d,_e);
			}else{
				_c["on"+_d]=_e;
			}
		}
	};
	var _f=function(){
		for(var i=0,evt;evt=_8[i];i++){
			asual.util.Events.removeListener(evt.o,evt.t,evt.l);
		}
	};
	if(asual.util.Browser.ie||asual.util.Browser.safari){
		this.addListener(window,"unload",asual.util.Functions.bindAsListener(_f,this));
	}
};
asual.SWFAddress=new function(){
	var _12=asual.util.Browser;
	var _13=_12.supported;
	var _14,_15;
	var _16,_17,_18=false;
	var _19=document.title;
	var _1a=history.length;
	var _1b=new Array();
	var js="swfaddress.js";
	var _1d="swfaddress.html";
	var _1e=function(){
		var _1f=top.location.href.indexOf("#");
		if(_1f!=-1){
			return top.location.href.substring(_1f);
		}
		return "";
	};
	var _20=_1e();
	var _21=function(){
		if(_12.safari){
			if(_1a!=history.length&&!_18){
				_1a=history.length;
				if(typeof _1b[_1a-1]!="undefined"){
					_20=_1b[_1a-1];
				}_22();
			}
		}else{
			if(_12.ie){
				if(_20!=_1e()){
					if(_12.version<7){
						top.location.reload();
					}else{
						asual.SWFAddress.setValue(_1e().replace(/#/g,""));
					}
				}
				if(top.document.title!=_19){
					asual.SWFAddress.setTitle(_19);
				}
			}else{
				if(_20!=top.location.hash){
					_20=top.location.hash;
					_22();
				}
			}
		}
	};
	var _22=function(){
		var _23=_20.replace(/#/g,"");
		if(_23!=_16){
			_16=_23;
			var obj=document[_17]||document.getElementById(_17);
			if(obj){
				obj.setSWFAddressValue(_23);
			}
		}
	};
	var _25=function(){
		if(_14.contentWindow&&_14.contentWindow.location){
			var win=_14.contentWindow;
			win.document.title=top.document.title=_19;
			var src=win.location.href;
			if(src.indexOf("?")>-1){
				_20="#"+src.substring(src.indexOf("?")+1);
			}else{
				_20="#";
			}
			if(_20!=_1e()){
				_22();
				top.location.hash=_20;
			}
		}
	};
	var _28=function(){
		if(_12.ie||_12.safari){
			var _29=document.createElement("div");
			_29.id="swfaddress";
			var _2a=document.getElementsByTagName("script");
			for(var i=0,s;s=_2a[i];i++){
				if(s.src.indexOf(js)>-1){
					_1d=(new String(s.src)).replace(js,_1d);
				}
			}
			_29.innerHTML="<iframe id=\"swfaddress-iframe\" src=\""+_1d+_1e().replace(/#/g,"?")+"\" frameborder=\"no\" scrolling=\"no\"></iframe>";
			document.body.appendChild(_29);
			_29.style.position="absolute";
			_29.style.left=_29.style.top="-9999px";
			_14=_29.getElementsByTagName("iframe")[0];
		}
		if(_12.ie){
			asual.util.Events.addListener(_14,"load",asual.util.Functions.bindAsListener(_25,this));
		}
		if(_12.safari){
			_15=document.createElement("form");
			_15.id="swfaddress-form";
			_15.method="get";
			_29.appendChild(_15);
			if(typeof top.document.location.swfaddress=="undefined"){
				top.document.location.swfaddress=new Object();
			}
			if(typeof top.document.location.swfaddress.history!="undefined"){
				_1b=top.document.location.swfaddress.history.split(",");
			}
		}
		_2d.call(this);
		_22.call(this);
		setInterval(_21,50);
	};
	var _2d=function(){
		if(typeof urchinTracker!="undefined"){
			var _2e=top.location.pathname+this.getValue();
			_2e=_2e.replace(/\/\//,"/");
			_2e=_2e.replace(/^\/$/,"");
			urchinTracker(_2e);
		}
	};
	this.getId=function(){
		if(!_13){
			return null;
		}
		return _17;
	};
	this.setId=function(id){
		if(!_13){
			return null;
		}
		_17=id;
	};
	this.getTitle=function(){
		if(!_13){
			return null;
		}
		return top.document.title;
	};
	this.setTitle=function(_30){
		if(!_13){
			return null;
		}
		if(_30=="null"){
			_30="";
		}
		if(typeof _30!="undefined"){
			_19=_30;
			top.document.title=_19;
		}
	};
	this.getStatus=function(){
		if(!_13){
			return null;
		}
		return top.status;
	};
	this.setStatus=function(_31){
		if(!_13){
			return null;
		}
		if(!_12.safari){
			if(_31=="null"||typeof _31=="undefined"){
				_31="";
			}
			var _32=top.location.href.indexOf("#");
			if(_32==-1){
				_31=top.location.href+"#"+_31;
			}else{
				_31=top.location.href.substr(0,_32)+"#"+_31;
			}
			top.status=_31;
		}
	};
	this.resetStatus=function(){
		top.status="";
	};
	this.getValue=function(){
		if(!_13){
			return null;
		}
		var _33=_20.replace(/#/gi,"");
		return _33;
	};
	this.setValue=function(_34){
		if(!_13){
			return null;
		}
		if(_34=="null"){
			_34="";
		}
		if(_16==_34){
			return;
		}
		var _35;
		var obj=document[_17]||document.getElementById(_17);
		if(obj){
			_35=obj.getSWFAddressValue();
			if(_35=="null"){
				_35="";
			}
		}
		_20="#"+_34;
		if(_35==_34){
			_16=_34;
			_22();
		}else{
			_22();
			_16=_34;
		}
		if(_12.safari){
			_15.action=_20;
			_1b[history.length]=_20;
			top.document.location.swfaddress.history=_1b.toString();
			_18=true;
			_1a=history.length+1;
			_15.submit();
			_18=false;
		}else{
			if(_35==_34){
				top.location.hash=_20;
			}
		}
		if(_12.ie){
			var win=_14.contentWindow;
			var _38="?"+_1e().substring(_20.indexOf("#")+1);
			win.location.assign(win.location.pathname+_38);
		}
		_2d.call(this);
	};
	if(!_13){
		return;
	}
	if(_12.safari){
		for(var i=1;i<_1a;i++){
			_1b.push("");
		}
		_1b.push(top.location.hash);
	}
	if(_12.ie){
		if(_20==""){
			top.location.hash="#";
		}else{
			top.location.hash=_1e();
		}
	}
	asual.util.Events.addListener(window,"load",asual.util.Functions.bindAsListener(_28,this));
	_16=this.getValue();
};
if(typeof deconcept!="undefined"&&deconcept.SWFObject){
	asual.SWFAddressObject=asual.util.Functions.extend(deconcept.SWFObject,function(swf,id,w,h,ver,c,_40,_41,_42,_43){asual.SWFAddressObject.superConstructor.apply(this,arguments);asual.SWFAddress.setId(id);});
	SWFObject=deconcept.SWFObject=asual.SWFAddressObject;
}
SWFAddress=asual.SWFAddress;
