var mainPreload;

function mainInit() {
    if (window.parent && window.parent != window) {
        window.parent.location.href = window.location.href;
    }
    var links = $('.main_img_link').add('.main_login_link');
    mainPreload = [];
    var shadowboxOptions = {
        width: '944',
        player: 'iframe',
        onClose: refreshMain
    }
    Shadowbox.setup('a.main_img_link, #main_footer a.main_footer_link,#m_fejlec area, .main_login_link', shadowboxOptions);
   
   // console.dir(Shadowbox);
    if (window.location.hash.match(/\bpage=([^&]+)/)) {
        setTimeout(function() {
            var target = window.location.hash.match(/\bpage=([^&]+)/)[1];
            Shadowbox.open({
                content: '/hu/'+target,
                player: 'iframe',
                width: '944',
                onClose: refreshMain
            });
        }, 300);
       
        
    } else if (window.location.hash.match(/\bvideo=([\d]+)/)) {
        setTimeout(function() {
            var videoNum = parseInt(window.location.hash.match(/\bvideo=([^&]+)/)[1]);
            var videoList = {1: 'http://static.generalitozsdejatek.hu/flv/capital.flv'}
            if (videoList[videoNum]) {
                Shadowbox.open({
                    content: videoList[videoNum],
                    player: 'flv',
                    width: '352',
                    height: '288'
                });
            }
        }, 500);
    }
}

function mainImgLinkOver() {
    //$('img', this).attr('src', '/images/main/'+this.rel+'_over.png');
}

function mainImgLinkOut() {
    //$('img', this).attr('src', '/images/main/'+this.rel+'.png');
}
function refreshMain() {
    window.parent.location.reload();
}
Shadowbox.init({
    skipSetup: true,
    players: ['iframe', 'flv']
})

$(document).ready(mainInit);
