$(document).ready( function() {
        $('img[roadmap]').each(function(){
        textimg = $('div.roadmap_title[position=' + $(this).attr('roadmap') + ']').html();
        if(textimg){
            $('div.roadmap_title[position=' + $(this).attr('roadmap') + ']').html(textimg + '<br/>' +$('img[roadmap=' + $(this).attr('roadmap') + ']').attr('title'));
        }else{
            $('div.roadmap_title[position=' + $(this).attr('roadmap') + ']').html($('img[roadmap=' + $(this).attr('roadmap') + ']').attr('title'));
        }
    });
    $('div[roadmap]').each(function(){
        textimg = $('div.roadmap_title[position=' + $(this).attr('roadmap') + ']').html();
        if(textimg){
            $('div.roadmap_title[position=' + $(this).attr('roadmap') + ']').html(textimg + '<br/>' +$('div[roadmap=' + $(this).attr('roadmap') + ']').attr('title'));
        }else{
            $('div.roadmap_title[position=' + $(this).attr('roadmap') + ']').html($('div[roadmap=' + $(this).attr('roadmap') + ']').attr('title'));
        }
    });


    $('img[roadmap]').click(function(){
        $('div#lightbox_background').css('display', 'block');        
        //$('div#lightbox_background').css('height', $("#content").height() + 160);
        $("#lightbox_background").css('height',$("#wrapper").height() - 0 + $("#user_online_ie").height());
        var pagescroll = document.documentElement.scrollTop;
        if(pagescroll == 0){
            pagescroll = document.body.scrollTop;
        }
        $('div#roadmap_parent').css('top',pagescroll+50);
        var img_width = $('div[position=' + $(this).attr('roadmap') + '] > div > img').attr('imgwidth');
        img_width = img_width - 0 + 50;
        $('div#roadmap_parent').css('width', img_width);
        if(screen.width < img_width){
            $('div#roadmap_parent').css('left', '0');
        }else{
            var lefter = screen.width/2 - img_width/2;
            $('div#roadmap_parent').css('left', lefter);
        }

        $('div#roadmap_parent').css('display', 'block');
        $('div[position=' + $(this).attr('roadmap') + ']').css('display', 'block');
        $('.roadmap_element[position !='+ $(this).attr('roadmap') +']').css('display','none');
    });
    $('div[roadmap]').click(function(){
        var pagescroll = document.documentElement.scrollTop;
        if(pagescroll == 0){
            pagescroll = document.body.scrollTop;
        }
        $('div#roadmap_parent').css('top',pagescroll+50);
        var img_width = $('div[position=' + $(this).attr('roadmap') + '] > div > img').attr('imgwidth');
        img_width = img_width - 0 + 50;
        $('div#roadmap_parent').css('width', img_width);
        if(screen.width < img_width){
            $('div#roadmap_parent').css('left', '0');
        }else{
            var lefter = screen.width/2 - img_width/2;
            $('div#roadmap_parent').css('left', lefter);
        }
        $('div#roadmap_parent').css('display', 'block');
        $('div[position=' + $(this).attr('roadmap') + ']').css('display', 'block');
        $('.roadmap_element[position !='+ $(this).attr('roadmap') +']').css('display','none');
    });
    $('a[roadmap_position]').click(function(){
        var pagescroll = document.documentElement.scrollTop;
        if(pagescroll == 0){
            pagescroll = document.body.scrollTop;
        }
        $('div#roadmap_parent').css('top',pagescroll+50);
        $('div[position=' + $(this).attr('roadmap_position') + ']').css('display', 'block');
        $('.roadmap_element[position !='+ $(this).attr('roadmap_position') +']').css('display','none');
        return false;
    });
    $('div#roadmap_close').click(function(){    
        $('.roadmap_element').css('display','none');
        $('div#roadmap_parent').css('display', 'none');
        $('div#lightbox_background').css('display', 'none');
    });
    $('area').click(function(){
        var pagescroll = document.documentElement.scrollTop;
        if(pagescroll == 0){
            pagescroll = document.body.scrollTop;
        }
        $('div#roadmap_parent').css('top',pagescroll+50);
        $('div[position=' + $(this).attr('href') + ']').css('display', 'block');
        $('.roadmap_element[position !='+ $(this).attr('href') +']').css('display','none');
        return false;
    });
    $('a[close]').click(function(){
        $('.roadmap_element').css('display','none');
        $('div#roadmap_parent').css('display', 'none');
        $('div#lightbox_background').css('display', 'none');
        return false;
    });
});
