var browser='';var defaultUrl='';var curUrl=document.location.href;var initialUrl=document.location.href;var flickr=false;var historyFrameSourcePrefix='h.html?';if(initialUrl.indexOf('flickr.com/')!=-1){historyFrameSourcePrefix='/picnik/hflickr.html?';flickr=true;}else if(initialUrl.indexOf('/flickr/')!=-1){historyFrameSourcePrefix='/flickr/picnik/hflickr.html?';flickr=true;}
var curHistoryLength=-1;var historyHash=new Array();var fCanUpdateHref=true;function getBrowser()
{var name=navigator.appName;var agent=navigator.userAgent.toLowerCase();if(name.indexOf('Microsoft')!=-1)
{if(agent.indexOf('mac')==-1)
{browser='IE';}}
else if(agent.indexOf('safari')!=-1)
{browser='Safari';}
else if(agent.indexOf('firefox')!=-1)
{browser='Firefox';}}
function getPlayer()
{var player=document.getElementById(getPlayerId());if(player==null)
player=document.getElementsByTagName('object')[0];return player;}
function getHash()
{var idx=document.location.href.indexOf('#');return(idx>=0)?document.location.href.substr(idx+1):'';}
function setBrowserUrl(flexAppUrl)
{if(!fCanUpdateHref)return;var pos=document.location.href.indexOf('#');var baseUrl=pos!=-1?document.location.href.substr(0,pos):document.location.href;var newUrl=baseUrl+'#'+flexAppUrl;if(document.location.href!=newUrl&&document.location.href+'#'!=newUrl)
{curUrl=newUrl;addHistoryEntry(baseUrl,newUrl,flexAppUrl);curHistoryLength=history.length;}
return false;}
function addHistoryEntry(baseUrl,newUrl,flexAppUrl)
{if(!fCanUpdateHref)return;if(browser=='IE')
{if(document.location.href.indexOf('host=facebook')>0){fCanUpdateHref=false;return;}
if(flexAppUrl==defaultUrl&&document.location.href==initialUrl)
{curUrl=initialUrl;return;}
if(!flexAppUrl)
{newUrl=baseUrl+'#'+defaultUrl;}
else
{getHistoryFrame().src=historyFrameSourcePrefix+flexAppUrl;}
document.location.href=newUrl;fCanUpdateHref=(document.location.href==newUrl);}
else
{if(browser=='Safari')
{if(document.location.href.indexOf('host=facebook')>0){fCanUpdateHref=false;return;}
var strSafari='safari/';var agent=navigator.userAgent.toLowerCase();var strVersion=agent.substr(agent.indexOf(strSafari)+strSafari.length);var nVersion=parseFloat(strVersion);if(nVersion>500){document.location.href=newUrl;}else{if(flickr&&nVersion==419.3){}else{getFormElement().innerHTML='<form name="historyForm" action="'+newUrl+'" method="GET"></form>';document.forms.historyForm.submit();}}
historyHash[history.length]=flexAppUrl;}
else
{addAnchor(flexAppUrl);document.location.hash=flexAppUrl;}}}
function checkForUrlChange()
{if(!fCanUpdateHref)return;if(browser=='IE')
{if(curUrl!=document.location.href)
{curUrl=document.location.href;document.location.reload();}}
else if(browser=='Safari')
{if(curHistoryLength>=0&&history.length!=curHistoryLength)
{curHistoryLength=history.length;var flexAppUrl=historyHash[curHistoryLength];if(flexAppUrl=='')
flexAppUrl=defaultUrl;getPlayer().setPlayerUrl(flexAppUrl);}}
else
{if(curUrl!=document.location.href)
{curUrl=document.location.href;var flexAppUrl=getHash();if(flexAppUrl=='')
flexAppUrl=defaultUrl;getPlayer().setPlayerUrl(flexAppUrl);}}
setTimeout(checkForUrlChange,250);}
function setDefaultUrl(def)
{defaultUrl=def;if(browser=='IE')
{getHistoryFrame().src=historyFrameSourcePrefix+defaultUrl;}
else if(browser=='Safari')
{curHistoryLength=history.length;historyHash[curHistoryLength]=defaultUrl;}}
function setTitle(title)
{document.title=title;}
function getTitle()
{return document.title;}
function addAnchor(flexAppUrl)
{if(document.getElementsByName(flexAppUrl).length==0)
{getAnchorElement().innerHTML+="<a name='"+flexAppUrl+"'>"+flexAppUrl+"</a>";}}
function getHistoryFrame()
{return document.getElementById('historyFrame');}
function getAnchorElement()
{return document.getElementById('anchorDiv');}
function getFormElement()
{return document.getElementById('formDiv');}
getBrowser();setTimeout(checkForUrlChange,250);