/*how-to-play MLs*/
if(siteConfig.lang!="en"&&location.pathname.indexOf('/how-to-play')>-1){
    location.href='/how_to_play.html';
}

//AC - temp fixfor DA pre launch
if(location.hostname=='da.partypoker.com'||location.hostname=='dk.partypoker.com'){
    siteConfig['clientUrl']='http://dk.partypoker.com/Downloads/da/'+siteConfig['currentWM']+'/PartyPokerSetup.exe';
}

/*redirect/hide mac version*/
if(siteConfig.isMac)siteConfig.spawnExe=false;
if(siteConfig.lang=="en"&&siteConfig.isMac){
    siteConfig.clientUrl='http://www1.partypoker.com/MacPoker/Installer/PartyPoker.pkg';
    siteConfig.spawnExe=true;
    app.redirect("/instant_play", "/download.html");
}else if(siteConfig.lang!="en"&&siteConfig.isMac){
    app.redirect("/download", "/instant_play.html");
}

function hidemacpagasorredirect(){
    var macarray={
        "/how-to-play/playing-on-our-tables/software-features/keyboard-shortcuts":1,
        "/how-to-play/playing-on-our-tables/software-features/table-focus":1,
        "/how-to-play/playing-on-our-tables/software-features/table-preview":1,
        "/how-to-play/playing-on-our-tables/software-features/tournament-calendar":1,
        "/how-to-play/playing-on-our-tables/software-features/quick-seat":1,
        "/how-to-play/playing-on-our-tables/software-features/hand-history-replayer":1,
        "/how-to-play/playing-on-our-tables/software-features/table-stacking":1,
        "/how-to-play/playing-on-our-tables/software-features/syncronised-breaks":1,
        "/how-to-play/playing-on-our-tables/software-features/single-click-session":1,
        "/how-to-play/playing-on-our-tables/software-features/favourites":1,
        "/how-to-play/playing-on-our-tables/software-features/synchronised-breaks":1,
        "/how-to-play/playing-on-our-tables/getting-started/tournament-dollars":1
    };
    var currentpage=location.pathname.replace(/.html$|\/$/g,'');
    if(typeof(macarray[currentpage])!="undefined")location.href=currentpage.replace(/[^/]+$/g,'').replace(/\/$/g,'')+'.html';
    else{
        $(function(){
            $(".navigationleft a").each(function(){
                if(typeof(macarray[$(this).attr('href').replace(/^http:\/\/www.partypoker.com|.html$|\/$/g,'')])!="undefined")$(this).remove();
            });
        });
    }
}
if(siteConfig.lang=="en"&&siteConfig.isMac&&location.pathname.indexOf('/how-to-play/playing-on-our-tables/')>-1)hidemacpagasorredirect();

/*mobile redirect for www.partypoker.com*/
siteConfig['ua']=navigator.userAgent.toLowerCase();
siteConfig['mobile']=siteConfig['ua'].match(/(iphone)|(ipod)/)?'iph':(siteConfig['ua'].match(/(android)/)?'and':(siteConfig['ua'].match(/(blackberry)/)?'bla':siteConfig['ua'].match(/(up.browser)|(up.link)|(windowssce)|(iemobile)|(windows\ ce)|(symbian)|(vodafone)|(nokia)|(sonyericsson)|(samsung)|(motorola)|(palm)|(mot-)|(sec-sgh)|(lge-)/)?'mob':''));
siteConfig['showmobilelp']==false;
if(siteConfig['mobile']!=""&&siteConfig['lang']=="en"){
    if(location.pathname=="/"||location.pathname.indexOf("/index-")>-1){
        var mobhpvisit=utils.getCookie("mobhpvisit");
        if(mobhpvisit!="1"){
            utils.setCookie("mobhpvisit","1");
            location.href="/mobile/";
        }
    }else if(location.pathname=="/download/"||location.pathname=="/download.html"||location.pathname.indexOf('/td/')>-1||location.pathname.indexOf('/marketing/')>-1)location.href="/mobile/";
}
/*****/


app['lobbyWindow']=null;
app['launchPoker']=function(event){
    event.preventDefault();
    if(app.lobbyWindow!=null&&!app.lobbyWindow.closed){if(app.lobbyWindow.isInitialized()){app.lobbyWindow.top.frames[6].document.GameLobby.doJob("36","","")}else{app.lobbyWindow.focus()}return}
    if(utils.getCookie("TDSET")==""&&typeof(siteConfig.tdpeh)!="undefined"){
        $("body").append('<img src="https://secure.partyaccount.com/earlyexp/setTDUID.do?TDUID='+siteConfig.tdpeh+'" height="1" width="1" border="0" />');
        utils.setDefaultCookie('TDSET','1',siteConfig.domain);
    }
    var D=new Date();
    var a=parseInt(Math.round((window.screen.width-1005)/2,0)+"");
    var b=parseInt(Math.round((window.screen.height-700)/2,0)+"");
    var B="FlashClient"+D.getHours()+""+D.getMinutes()+""+D.getSeconds()+""+D.getMilliseconds();
    app.lobbyWindow=window.open("https://poker.partyaccount.com/client.html?lid="+siteConfig.lang_id+"&wm="+siteConfig.currentWM+"",""+B,"resizable=no,toolbar=no,status=no,height=700,width=1005,screenX="+a+",screenY="+b+",left="+a+",top="+b);
    if($(this).attr('href').replace(/#/g,'')!="")location.href=$(this).attr('href');

    //location.href="/anywhere/index-holding.html";
}


$(function(){
    $('a.launchPoker,div.launchPoker a').click(app['launchPoker']);
    $('#product-navigation a[href*="intertrader"]').attr('href',function(){return $(this).attr('href')+'?wm='+siteConfig.currentWM})    
});
