/**
*	swfcontext v2.0.3
*	François Perreault <http://www.fperreault.ca/>
*/

var swfcontext=function(){var FUNCTION='function';UNDEFINED=undefined;var sRoute="";sProtocol="";sHost="";sPath="";sQuery="";oQuery=new Object();sDeeplink="";sDirectory="";sRoot=UNDEFINED;sFile=UNDEFINED;var sBrowser="";sBrowserVersion="";sOS="";var tracker;var oParamsDeeplink=new Object();var sFlashVersion="9.0.124";var browser={init:function(){this.name=this.searchString(this.dataBrowser)||"Browser inconnu";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"Version inconnu";this.os=this.searchString(this.dataOS)||"OS inconnu"},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)return data[i].identity}else if(dataProp)return data[i].identity}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};browser.init();sBrowser=browser["name"];sBrowserVersion=browser["version"];sOS=browser["os"];function getOjbectFrom(pString,pSep,pParam){var dataArray=getArrayFrom(pString,pSep);var dataObj=new Object();for(var str in dataArray){var elem=dataArray[str].split(pParam);if(elem[1]!=UNDEFINED)dataObj[elem[0]]=elem[1];else dataObj[elem[0]]=""}return dataObj}function getArrayFrom(pString,pSep){if(pSep==UNDEFINED)pSep="/";var sTemp=pString;if(sTemp.charAt(0)==pSep)sTemp=sTemp.substring(1);if(sTemp.charAt(sTemp.length-1)==pSep)sTemp=sTemp.substring(0,sTemp.length-1);return sTemp.split(pSep)}function getTrimRoute(pIgnoreId,pDefaultValue){if(pIgnoreId==-1)return"";var aDirectory=getArrayFrom(sDirectory);if(aDirectory.length<pIgnoreId)return pDefaultValue;var sNewPath="";for(var i=0;i<=pIgnoreId;i++)sNewPath+="/"+aDirectory[i];return sNewPath.charAt(0)=="/"?sNewPath.substring(1):"/"+sNewPath}return{setupRoute:function(pRoute){var key=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","deeplink"];var q={name:"params",parser:/(?:^|&)([^&=]*)=?([^&]*)/g};var parser=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;var m=parser.exec(pRoute);var uri=new Object();var i=key.length;while(i--)uri[key[i]]=m[i]||"";uri[q.name]=new Object();uri[key[12]].replace(q.parser,function(pParams,pId,pValue){if(pId)uri[q.name][pId]=pValue});sProtocol=uri["protocol"];sHost=uri["host"];sRoute=uri["source"];sPath=uri["protocol"]+"://"+uri["host"]+uri["directory"];oQuery=uri["params"];sQuery=uri["query"];sDeeplink=uri["deeplink"];sDirectory=uri["directory"];sFile=uri["file"]},setTracker:function(pValue){if(typeof pValue==FUNCTION)tracker=pValue},track:function(pValue){if(typeof tracker==FUNCTION)tracker(pValue);else alert("Error: fonction de tracking invalide")},getProtocol:function(){return sProtocol},getHost:function(){return sHost},getDomain:function(){var domain=sProtocol!="file"?sProtocol+"://"+sHost:sProtocol+"://"+sDirectory;if(domain.charAt(domain.length-1)=="/")domain=domain.substring(0,domain.length-1);return domain},getRoute:function(pValue){if(pValue==UNDEFINED&&sProtocol=="file")return sRoute;else{var aDirectory=getArrayFrom(sDirectory);return aDirectory[pValue-1]!=UNDEFINED?aDirectory[pValue-1]:UNDEFINED}},getPath:function(pIgnoreRouteAfterId){if(pIgnoreRouteAfterId==UNDEFINED)return sPath.charAt(sPath.length-1)=="/"?sPath:sPath+"/";else{return this.getDomain()+"/"+this.getDirectory(pIgnoreRouteAfterId)}},getDirectory:function(pIgnoreRouteAfterId){if(pIgnoreRouteAfterId==UNDEFINED)return sDirectory.charAt(sDirectory.length-1)=="/"?sDirectory:sDirectory+"/";else return getTrimRoute(pIgnoreRouteAfterId-1,sDirectory)},getQuery:function(pValue){if(pValue==UNDEFINED)return sQuery;else return oQuery[pValue]},getDeeplink:function(pValue){if(pValue==UNDEFINED)return sDeeplink;else{var aDeeplink=getArrayFrom(sDeeplink);return aDeeplink[pValue-1]!=UNDEFINED?aDeeplink[pValue-1]:UNDEFINED}},getFile:function(){return sFile==""?UNDEFINED:sFile},getRoot:function(){if(sRoot==UNDEFINED){if(sProtocol!="file")sRoot=this.getDomain()+"/";else sRoot=this.getDomain()+"/"+this.getDirectory(0)}return sRoot},setRoot:function(pValue){return sRoot=pValue.charAt(pValue.length-1)=="/"?pValue:pValue+"/"},getBrowser:function(){return sBrowser},getBrowserVersion:function(){return sBrowserVersion},getOS:function(){return sOS},getFlashVersion:function(){return sFlashVersion},setFlashVersion:function(pValue){sFlashVersion=pValue},setDeeplinkQuery:function(pArrayParams){oParamsDeeplink=getOjbectFrom(pArrayParams.toString(),",","=")},getDeepRedirect:function(pParams,pDeepId){if(pParams==UNDEFINED)pParams=false;var sFirstPart="";var sParamsDeep="";var sRedirectDeep="";if(pParams&&sQuery!=""){for(var i in oQuery){if(i!=pDeepId){if(oParamsDeeplink[i]!=UNDEFINED){if(sParamsDeep=="")sParamsDeep+="?"+i+"="+oQuery[i];else sParamsDeep+="&"+i+"="+oQuery[i]}else{if(sFirstPart=="")sFirstPart+="?"+i+"="+oQuery[i];else sFirstPart+="&"+i+"="+oQuery[i]}}}}if(pDeepId==UNDEFINED)sRedirectDeep=this.getPath().split(this.getRoot()).join("");else sRedirectDeep=this.getQuery(pDeepId)!=UNDEFINED?this.getQuery(pDeepId):"";if(sRedirectDeep.charAt(0)=="/")sRedirectDeep=sRedirectDeep.substring(1);if(sFile!=""&&sFile!="noflash.html")sFirstPart=sFile+sFirstPart;if(sRedirectDeep+sParamsDeep!="")return this.getRoot()+sFirstPart+"#/"+sRedirectDeep+sParamsDeep;else return this.getRoot()+sFirstPart},getNoFlashRedirect:function(pPath,pParams,pDeepId){if(pParams==UNDEFINED)pParams=false;var sFirstPart=pPath.indexOf(this.getProtocol()+"://")!=-1?pPath:this.getPath()+pPath;if(pParams&&sQuery!="")sFirstPart=pPath+"?"+sQuery;if(this.getDeeplink()!=""){if(pDeepId!=UNDEFINED){if(sFirstPart.indexOf("?")!=-1)sFirstPart+="&"+pDeepId+"="+this.getDeeplink();else sFirstPart+="?"+pDeepId+"="+this.getDeeplink()}}if(sProtocol!="file"){var sRedirectNoFlash=this.getPath().split(this.getRoot()).join("");if(sRedirectNoFlash.charAt(0)=="/")sRedirectNoFlash=sRedirectNoFlash.substring(1);if(sRedirectNoFlash!=""){if(pDeepId!=UNDEFINED){if(sFirstPart.indexOf("?")!=-1)return sFirstPart+"&"+pDeepId+"="+sRedirectNoFlash;else return sFirstPart+"?"+pDeepId+"="+sRedirectNoFlash}else return sFirstPart}else return sFirstPart}else return sFirstPart},getUserFlashVersion:function(){return swfobject.getFlashPlayerVersion().major+"."+swfobject.getFlashPlayerVersion().minor+"."+swfobject.getFlashPlayerVersion().release},hasFlashVersion:function(){return swfobject.hasFlashPlayerVersion(this.getFlashVersion())},hasDeepQuery:function(){var hasDeep=false;for(var i in oQuery){if(oParamsDeeplink[i]!=UNDEFINED)hasDeep=true}return hasDeep},embedSWF:function(pRuntime){if(this["runtime"]==UNDEFINED)this["runtime"]="medias/swf/runtime.swf";if(this["target"]==UNDEFINED)this["target"]="flash";if(this["width"]==UNDEFINED)this["width"]="100%";if(this["height"]==UNDEFINED)this["height"]="100%";if(this["name"]==UNDEFINED)this["name"]="main";if(this["expressInstall"]==UNDEFINED)this["expressInstall"]="";if(this["flashVars"]==UNDEFINED)this["flashVars"]={};if(this["parameters"]==UNDEFINED)this["parameters"]={menu:false};if(this["flashVars"].swMin==UNDEFINED)this["swMin"]=1230;else this["swMin"]=this["flashVars"].swMin;if(this["flashVars"].shMin==UNDEFINED)this["shMin"]=680;else this["shMin"]=this["flashVars"].shMin;if(this["attributes"]==UNDEFINED)this["attributes"]={id:this["name"],name:this["name"],bgcolor:"#DCDCDC"};else{this["attributes"].id=this["name"];this["attributes"].name=this["name"]};if(pRuntime==UNDEFINED){swfobject.embedSWF(this.runtime,this.target,this.width,this.height,this.getFlashVersion(),this.expressInstall,this.flashVars,this.parameters,this.attributes)}else{swfobject.embedSWF(pRuntime,this.target,this.width,this.height,this.getFlashVersion(),this.expressInstall,this.flashVars,this.parameters,this.attributes)}},redirectTo:function(pValue){document.location=pValue}}}();swfcontext.setupRoute(window.location.toString());
