var clicked_link;
var menu_timeout;
var top_over_timeout;
var current_image;
var load_images=[];

$(function(){
	if ($.cookie('size')) {
		$('body').addClass('size_'+$.cookie('size'));
	}

	$.reject({
		 imagePath: '/default/js/reject/images/',
		paragraph1:'The Waterfront Toronto website looks best in a current version of Firefox, Chrome, Safari or Internet Explorer (version 7 and above).  If you choose to continue with your current browser, please be aware that some website features may not work optimally.',
		paragraph2:'Below are alternatives to newer versions of web browers:',
         display: [  ], // Reject all renderers for demo
         closeCookie: true,
		 closeMessage:''
    });

    $('.Clickthrough,.BlockReadMoreBottom').hover(function(){
        $(this).closest('.block').addClass('over');
    },function(){
        $(this).closest('.block').removeClass('over')
    }).click(function(e){

        if (!$(e.originalTarget).attr('href')) {
            var a_tag=$(this).closest('.block').children(':last').find('a');
            if (a_tag.hasClass('popup') || a_tag.hasClass('popup_flash')) {
                if (a_tag.hasClass('popup_flash')) {
                    clicked_link=a_tag;
                    $.facebox('<div id="popup_date" style="width:800px;height:600px;"></div>',function() {
                        tryFlashPopup();
                    });
                    return false;
                }
                a_tag.click();
            }else{
                window.location.href=a_tag.attr('href');
            }
        }
    })

    $('.block_homepage_what_do_you_think .bg_left.over,.block_homepage_what_do_you_think .bg_right.over').live('click',function(e){
        if (e && e.originalTarget && e.originalTarget.tagName && e.originalTarget.tagName.toLowerCase()=='a') {
            return;
        }
        var more_class=$(this).hasClass('bg_left')?'LeftSide':'RightSide';
        window.location.href=$(this).find('.'+more_class+' .MoreButton').attr('href');
    });
    $('.block_homepage_what_do_you_think .MoreButton').each(function(){
        var more_class=$(this).parent().hasClass('LeftSide')?'LeftSide':'RightSide';
        var block=$(this).closest('.block_homepage_what_do_you_think');
        var bg_left=$(this).closest('.bg_left');
        var bg_right=$(this).closest('.bg_right');
        
        block.find('.'+more_class).hover(function(){
            if (more_class=='LeftSide') {
                bg_left.addClass('over');
            }else{
                bg_right.addClass('over');
            }
        },function(){
            if (more_class=='LeftSide') {
                bg_left.removeClass('over');
            }else{
                bg_right.removeClass('over');
            }
        });
    })

    $("#HomeImageNav").HomeNav();
    $('.search_holder input,#query').click(function() {
        if ($(this).val()=='Search') {
            $(this).val('');
        }
		
    });

	$('#facebox_overlay').live('click',function(){
		if (!$(this).prev().is(':visible')) {
			$(this).remove();
		}
	})
	
    $('.popup_flash').live('click',function(e) {
        e.preventDefault();
        clicked_link=$(this);
        $.facebox('<div id="popup_date" style="width:800px;height:600px;"></div>',function() {
            tryFlashPopup();
			
        });
    });
    if ($('#top_navigation').attr('data-selected')) {
        var selected_nav=$('#top_navigation').attr('data-selected').split(',');
        for (var i=0;i<selected_nav.length;i++) {
            $('#top_navigation [data-selected-id='+selected_nav[i]+']').addClass('current_page');
            $('#top_navigation [data-piece-id='+selected_nav[i]+']').addClass('selected_page');
            $('#top_navigation [data-status-piece-id='+selected_nav[i]+']').addClass('selected_page');
            if ($('#top_navigation [data-status-piece-id='+selected_nav[i]+']').length>0) {
                $('#top_navigation [data-status-piece-id='+selected_nav[i]+']').closest('.second_level_button').addClass('current_page');
            }
        }
    }
	
    $('#newsletter').click(function() {
        if ($(this).val()=='Sign up for our newsletter: enter your email') {
            $(this).val('');
        }
    })
	$('.gallery_container li').hide();
	$('.gallery_container').each(function(){
		$(this).find('li:first').show();
	})
    $('.gallery_container .controls .next').click(function(e) {
        e.preventDefault();

            var ul_item=$(this).parent().prev();
            var li_item=ul_item.children('li:visible');
            var next_li_item;

            if (li_item.next().length>0) {
                    next_li_item=li_item.next().show();
            }else{
                    next_li_item=ul_item.children('li:first').show();
            }
            li_item.fadeOut('fast');

            $(this).parent().children('.title').text(next_li_item.find('span a').attr('title'));
    });
    $('.gallery_container .controls .view').click(function(e){
        e.preventDefault();
        if ($(this).closest('.block_new_images').length>0) {

            var new_window=window.open($(this).parent().prev().find('li:visible a').attr('href'));
            if (!new_window) {
                window.location.href=$(this).parent().prev().find('li:visible a').attr('href');
            }
        }else{
            $(this).parent().prev().find('li:visible a').click();
        }
    })
    $('.gallery_container .controls .previous').click(function(e) {
        e.preventDefault();
        
        var ul_item=$(this).parent().prev();
        var li_item=ul_item.children('li:visible');

        if (li_item.prev().length>0) {
                li_item.prev().show();
        }else{
                ul_item.children('li:last').show();
        }
        li_item.fadeOut('fast');
    });
	
    $('a.facebox').each(function(){
        $(this).facebox();
    });
    //$('.category_inner > div').hide();
    //$('.category_inner > div:first').show();
    //$('.category_explore_projects .browse_by:first').addClass('Active');
    //$('.dropdown').hide();
	
    /*$('.expand_dropdown').click(function(e) {
        e.preventDefault();
		$('.dropdown:not(.'+$(this).attr('id')+')').hide();
        $('.'+$(this).attr('id')).toggle();
		
		$('.category_inner > div.category_always_show').show();
    })
    $('.category_inner > div[title="Design Team"]').hide();
    $('.category_explore_projects .browse_by').click(function(e) {
        e.preventDefault();
        $('.category_explore_projects .browse_by').removeClass('Active');
		
        $(this).addClass('Active');
		
        $('.category_inner > div').hide();
        $('.category_inner > div[title="'+$(this).text()+'"]').show();
        $('.category_inner ul').hide();
        $('.category_inner .category_list').removeClass('Active');
        $('.category_inner > div[title="'+$(this).text()+'"]').find('ul:first').show();
        $('.category_inner > div[title="'+$(this).text()+'"]').find('.category_list:first').addClass('Active');
    });
    $('.category').each(function() {
		$(this).children('div:first').addClass('Active').find('ul').show();
	});
    $('.category_list').mouseover(function(e) {
        $(this).addClass('Hover');
    });
    $('.category_list').mouseout(function(e) {
        $(this).removeClass('Hover');
    });
    $('.category_list').click(function(e) {
        $(this).parent().find('.category_list').removeClass('Active');
        $(this).parent().find('ul').hide();
        $(this).find('ul').show();
        $(this).addClass('Active');
    });
	
    //*/
    $('.InnerLinks .Small').click(function(){
		$('body').removeClass('size_medium').removeClass('size_large').addClass('size_small');
		$.cookie('size','small');
	});
	$('.InnerLinks .Medium').click(function(){
		$('body').removeClass('size_large').removeClass('size_small').addClass('size_medium');
		$.cookie('size','medium');
	});
	$('.InnerLinks .Large').click(function(){
		$('body').removeClass('size_medium').removeClass('size_small').addClass('size_large');
		$.cookie('size','large');
	});
   /* var sizeableClasses=['.CoreMiddle .Content .section1 .column .block .content'];
    //on entry
    var ratio=0;
    var step=5;
     if($.cookie("font_style")=='Small'){
        ratio=0;
    }else if($.cookie("font_style")=='Medium'){
        ratio=step;
    }else if($.cookie("font_style")=='Large'){
        ratio=step+step;
    }else{
        $.cookie("font_style",'Small');
    }
    $.each(sizeableClasses, function(index, css){
            var $mainText = $(css);
            var currentSize = $mainText.css('font-size');
            var currentLineHeight = $mainText.css('line-height');
            var num = parseFloat(currentSize, 10);
            var height = parseFloat(currentLineHeight, 10);
            var unit = 'px';
            var line_unit = 'px';
            num = num + ratio;
            height =height + ratio;
            $mainText.css('font-size', num + unit);
            $mainText.css('line-height', height + line_unit);
      } );
    
    $('.SmallMenu .Text a').click(function(e) {
        
        
        if($(this).hasClass('Small')){
                if($.cookie("font_style")=='Medium'){
                    ratio=-step;
                }else if($.cookie("font_style")=='Large'){
                    ratio=-(step*2);
                }else{
                    ratio=0;
                }
                $.cookie("font_style", "Small");

            }
            if($(this).hasClass('Medium')){
                if($.cookie("font_style")=='Large'){
                    ratio=-step;
                }else if($.cookie("font_style")=='Small'){
                    ratio=step;
                }else{
                    ratio=0;
                }
                $.cookie("font_style", "Medium");
            }
            if($(this).hasClass('Large')){
                if($.cookie("font_style")=='Medium'){
                    ratio=step;
                }else if($.cookie("font_style")=='Small'){
                    ratio=(2*step);
                }else{
                    ratio=0;
                }
                $.cookie("font_style", "Large");
            }
        $.each(sizeableClasses, function(index, css){
            var $mainText = $(css);
            var currentSize = $mainText.css('font-size');
            var currentLineHeight = $mainText.css('line-height');
            var num = parseFloat(currentSize, 10);
            var height = parseFloat(currentLineHeight, 10);
            var unit = currentSize.slice(-2);
            var line_unit = currentLineHeight.slice(-2);
            num = num + ratio;
            height =height + ratio;
            $mainText.css('font-size', num + unit);
            $mainText.css('line-height', height + line_unit);
            } );
            return false;
    } );*/
    $('.ContactForm .ButtonDiv #send_action').click(function(e) {
        var clean=true;
        $('.ContactForm input').each(function(index){
            if($(this).attr('id')!='reset' && $(this).attr('id')!='send_action' && $(this).attr('id')!='subscribe'){
                if($(this).val()==''){
                    clean=false;
                }
            }
        });
        if($('#message').val()==''){
                clean=false;
            }
        if(clean==false){
        alert('Some mandatory fields were left empty!');
            return false;
        }else{
            return true;
        }
      });
    $('.dropdown .Close').click(function(e) {
        $('.dropdown').hide();
    });
    $('.view_map').click(function(e){
        e.preventDefault();
        open_imap();
    })
   

    //procurement
    $('a.procurement').click(function(e){
        e.preventDefault();
		
        $.get($(this).attr('href'),{},function(data) {
            $.facebox(data.content);
			if (data.list_id) {
				$('#ProcurementForm_form').submit();
				$('#facebox').hide();
				$('#facebox_overlay').remove();
			}

			$('#ProcurementForm_form').submit(function(e){
				
				$('#ProcurementForm_form .ProcurementForm input,#ProcurementForm_form .ProcurementForm select').css('background-color','#FFFFFF');
				if ($('#list_id').val()) {
					$('#facebox').hide();
					$('#facebox_overlay').remove();
					return true;
				}

				if ($('#full_proc_form').is(':visible')) {
					if ($('#ProcurementForm_form #full_proc_form [rel="required"]:text[value=""]').css('background-color','#FFDFDF').length>0) {
						//e.preventDefault();
						alert('Please fill in all the required fields');
						return false;
					}
				}else{
					//e.preventDefault();
					if ($('#ProcurementForm_form #half_proc_form [rel="required"]:text[value=""]').css('background-color','#FFDFDF').length>0) {

						alert('Please fill in your email address');
						return false;
					}else{
						//e.preventDefault();
						$.post('/widgets_procurement/check-form',{email:$('#check_email').val()},function(data) {
							if (data.is_valid) {
								if (data.exists) {
									$('#list_id').val(data.list_id);
									$('#ProcurementForm_form').unbind('submit');
									$('#ProcurementForm_form').submit();
								}else{
									$('#half_proc_form').hide();
									$('#email').val($('#check_email').val());
									$('#full_proc_form').fadeIn();

								}
							}else{
								alert('Please enter a valid email address');
							}
						}, "json")
					}
					return false;
				}
				return true;
			});
        },'json');//end $.get
			
    });
	
    $('a.event').live('click',function(e){
            e.preventDefault();
            id = $(this).attr('id').split('_');
            $.post('/widgets_calendar/get-event-by-id',{event_id:id[1]}, function(data) {
                    $.facebox(data);
            });

    });

    $('.block_project_list .previous').css('visibility','hidden');
    $('.block_project_list div.nav.previous a').click(function(e){
            e.preventDefault();

            var ul_element=$(this).parent().next().children('ul');
            if (ul_element.attr('data-animating')=='true') {
                    return;
            }


            if ((ul_element.position().left*-1- 141) >=0) {
                    ul_element.attr('data-animating','true');

                    if ((ul_element.position().left*-1- 141) <=0) {
                            $(this).parent().css('visibility','hidden');
                    }
                    $(this).parents('.list').find('.next').css('visibility','visible');
                    ul_element.animate({left:ul_element.position().left+141},500,function(){
                            ul_element.attr('data-animating','false');
                    });
            }


    });
    $('.block_project_list div.nav.next a').click(function(e){
            e.preventDefault();

            var ul_element=$(this).parent().prev().children('ul');

            if (ul_element.attr('data-animating')=='true') {
                    return;
            }

            if ((ul_element.position().left) < (ul_element.width()-(6 * 141))) {
                    ul_element.attr('data-animating','true');

                    if ((ul_element.position().left*-1) >= (ul_element.width()-(7 * 141))) {
                            $(this).parent().css('visibility','hidden');
                    }
                    $(this).parents('.list').find('.previous').css('visibility','visible');

                    ul_element.animate({left:ul_element.position().left-141},500,function(){
                            ul_element.attr('data-animating','false');
                    });
            }


    });

    $('.block_images').each(function(){
            $(this).find('.image a').lightBox();
    });
    $('.content_images_search').each(function(){
            $(this).find('.image a').lightBox();
    });

    $('.normal_popup').each(function(){
            $(this).popupWindow({
                    height:600,
                    width:800,
                    centerBrowser:1,
                    scrollbars:1,
                    resizable:1
            });
    });

    $('.advanced_search').click(function(){
        $.get('/widgets_navigation/advanced-search',function(data){
            $('.search_dropdown').hide();
            $.facebox(data);

        });
    });

    $('#search input').focus(function(){
            $('.search_dropdown').show();

            $('body').bind('click',function(e){
                if ($(e.target).parents('#search').length<=0) {
                    $('.search_dropdown').hide();
                    $('body').unbind('click');
                }
            });


    });


    $('.block_search .more,.search_block .more').live('click',function(){
        $.get('/widgets_info/get-search',{block_id:$(this).attr('data-block-id')},function(data){
            $.facebox(data);
        });
    });


    //new nav
    $('#top_level .top_button').hover(function() {
        var hovered_button=$(this);
        clearTimeout($('#top_navigation').data('timeout_top'));
        $('#top_navigation').data('timeout_top',setTimeout(function(){
            $('#top_level').find('.over').removeClass('over');
            hovered_button.parent().addClass('over');
            $('#top_navigation').removeClass('not_over');
        },200));
        
        clear_menu_timeout();
    },timeout_menu);
    
    $('#top_level .second_level').hover(function() {
        clearTimeout($('#top_navigation').data('timeout_top'));
        $(this).closest('.main_nav_button').addClass('over');
        $('#top_navigation').removeClass('not_over');
        
        clear_menu_timeout();
    },timeout_menu);
    $('#nav_category_explore_projects li').hover(function(){
        $('#top_navigation .nav_category .over').removeClass('over');

        clearTimeout($('#top_navigation').data('timeout_top'));
        clear_menu_timeout();
    });

    $('#nav_category_explore_projects li').click(function(){
        $.cookie('explore_project',$.trim($(this).text()), { path: '/' });
        $('#nav_category_explore_projects li.active').removeClass('active');
        $('#top_navigation .nav_category.active').removeClass('active');

        $(this).closest('#nav_category_explore_projects').next().children('ul.nav_category_'+$(this).attr('class')).addClass('active');
        $(this).addClass('active');

        clearTimeout($('#top_navigation').data('timeout_top'));
        clear_menu_timeout();
    });
    if ($.cookie('explore_project')) {
        $('#nav_category_explore_projects .'+$.trim($.cookie('explore_project'))).click();
    }
    $('#top_level .second_level_button').hover(function(){
        $('#top_level .second_level_button.over').removeClass('over');
        $(this).addClass('over');
        $('.third_level_large_preview').hide();
        $(this).children('.third_level_large_preview').show();
        //clear_menu_timeout();
    });

    $('.preview_mode').each(function(){
        $(this).data('old_html',$(this).html());
    })
    $('#top_level .third_level a').hover(function() {
        var preview_mode=$(this).closest('.second_level_button').find('.preview_mode');
        clearTimeout(preview_mode.data('timeout_outside'));
        preview_mode.find('.image').html($(this).attr('data-image')?$('<img />').attr('src',$(this).attr('data-image')):'');
        preview_mode.find('.status').text($(this).children('.status').text()?('Status: ' + $(this).children('.status').text()):'');
        preview_mode.find('.type').text($(this).children('.type').text()?('Type: ' + $(this).children('.type').text()):'');
        preview_mode.find('.title').text($(this).children('.title').text());
    },function(){
        var preview_mode=$(this).closest('.second_level_button').find('.preview_mode');
        preview_mode.data('timeout_outside',setTimeout(function(){
            preview_mode.html(preview_mode.data('old_html'));
        },300));
    });

    $('.block_document_library .title').click(function(){
        $(this).parent().toggleClass('active');
    });
    $('.block_document_library .more span').live('click',function(){
        var more_button=$(this).parent();
        var article_block=more_button.prev();
        if (!more_button.hasClass('loading')) {
            $(this).text('Loading ...');
            more_button.addClass('loading');
            $.get('/widgets_info/load-more-search',{block_id:more_button.attr('data-block-id'),min:more_button.data('min'),limit:more_button.data('limit')},function(data){
                if (!data) {
                    more_button.fadeOut();
                }else{
                    more_button.data('min',more_button.data('min')?(more_button.data('min')+more_button.data('limit')*1):5)
                    more_button.data('limit',more_button.data('limit')?(more_button.data('limit')*1+5):5);
                    article_block.append(data);
                    more_button.removeClass('loading');
                    more_button.children().text('Load More');
                }
            });
        }
    });

    //gallery
    var location_href=window.location.href.split('#');
    


    $('.gallery_pagination .numbers a').click(function(){
        current_image=$(this).parent();
        
        //pagination
        $(this).closest('.numbers').children().hide();
        var current_item=$(this).parent();
        
        for (var i=-5;i<=5;i++) {
            
            if (i<0 && current_item.length>0) {
                current_item=current_item.prev();
            }else if(i==0) {
                current_item=$(this).parent();
            }else if(current_item.length>0){
                current_item=current_item.next();
            }
            if (current_item.length>0) {
                current_item.show();
            }
        }
        
        if ($(this).parent().next().length>0) {
            $(this).parent().next().show();
            if ($(this).parent().next().next().length>0) {
                $(this).parent().next().next().show();
            }
        }

        $(this).parent().prev();


        $(this).closest('.numbers').children('.current').removeClass('current')
        $(this).parent().addClass('current');
        $('.full_photo .image').html($('<img />').attr('src',$(this).attr('data-photo-url')));
        $('.GalleryHead .section_title').text($(this).attr('data-photo-title'));
        $('.gallery_bottom .title').text($(this).attr('data-photo-title'));
        $('.gallery_bottom .description').html($('<p />').html($(this).attr('data-photo-caption')));
        $('.gallery_bottom .description').html($('<p />').html($(this).attr('data-photo-caption')));
        
        if ($(this).parent().next().length>0) {
            $('.full_photo .next').attr('data-temp-href',$(this).parent().next().children().attr('href'))
            $('.gallery_pagination .next a').attr('data-temp-href',$(this).parent().next().children().attr('href'))
        }else{
            $('.full_photo .next').attr('data-temp-href',$(this).parent().children().attr('href'))
            $('.gallery_pagination .next a').attr('data-temp-href',$(this).parent().children().attr('href'))
        }
        if ($(this).parent().prev().length>0) {
            $('.full_photo .previous').attr('data-temp-href',$(this).parent().prev().children().attr('href'))
            $('.gallery_pagination .previous a').attr('data-temp-href',$(this).parent().prev().children().attr('href'))
        }else{
            $('.full_photo .previous').attr('data-temp-href',$(this).parent().children().attr('href'))
            $('.gallery_pagination .previous a').attr('data-temp-href',$(this).parent().children().attr('href'))
        }
        $('.facebook_like').html('<iframe src="http://www.facebook.com/plugins/like.php?href='+$('.facebook_like').attr('data-like-url')+$(this).attr('href').replace("#","?")+'&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>');
        if ($(this).attr('data-hires')) {
            $('.Tags .hires').attr('href',$(this).attr('data-hires')).css('display','block');
        }else{
            $('.Tags .hires').css('display','none');
        }

         load_images=[];
        if ($(this).parent().prev().length>0) {
            load_images.push($(this).parent().prev());
        }

        if ($(this).parent().next().length>0) {
            load_images.push($(this).parent().next());
        }
        $('.full_photo .preload').html('');
        for (var i=0;i<load_images.length;i++) {
            $('.full_photo .preload').append($('<img />').attr('src',load_images[i].children('a').attr('data-photo-url')));
        }



    })
    $('.gallery_pagination > :not(.numbers) a,.full_photo .next,.full_photo .previous').click(function(){
        $('.GalleryTemplate [data-temp-href]').each(function(){
            $(this).attr('href',$(this).attr('data-temp-href')).attr('data-temp-href','');
        })
        $('.gallery_pagination .numbers a[href='+$(this).attr('href')+']').click();
    })
    $('.gallery_pagination .first a').attr('href',$('.gallery_pagination .numbers .number:first a').attr('href'))
    $('.gallery_pagination .last a').attr('href',$('.gallery_pagination .numbers .number:last a').attr('href'))
    current_image=$('.gallery_pagination .number:first');
    if (location_href.length>1) {
        var found_link=$('.gallery_pagination .number a[data-photo-id='+location_href[1]+']').parent();

        if (found_link.length>0) {

            current_image=found_link;
            current_image.children('a').click();
        }
    }else{
        $('.gallery_pagination .current a').click();
    }
    
            
            
});
function open_imap()
{

    if ($('#map_wrapper').hasClass('animating')) {
                return;
        }
        if (!$('#map_wrapper').hasClass('loading')) {
                $('#map_wrapper').addClass('loading');
                load_map();

        }
        $('#map_wrapper').addClass('animating');

       if ($('#map_wrapper').is(':visible')) {
            $('.view_map').removeClass('open');
            $('#map_wrapper').animate({top:-1000},function(){$(this).hide();$('#map_wrapper').removeClass('animating');});
            $('.MapThingy').css('background-position','0 0');
            $('.dropdown').hide();
       }else{
           $('.view_map').addClass('open');
            $('#map_wrapper').css('top','-1000px').show().animate({top:0},function(){$('#map_wrapper').removeClass('animating');});
			$('.MapThingy').css('background-position','0 -287px');
            $('.dropdown').hide();
        }
}
function timeout_menu(e)
{
    menu_timeout=setTimeout(function(e){
       $('#top_navigation').find('.over').removeClass('over');
       $('.third_level_large_preview').hide();
        $('#top_navigation').addClass('not_over');
        
    },400);
}
function clear_menu_timeout(){
    if (menu_timeout) {
        clearTimeout(menu_timeout);
    }
}
function tryFlashPopup()
{
    if (swfobject.getObjectById('popup_date')) {
        clicked_link='';
        return;
    }
    swfobject.embedSWF(clicked_link.attr('href'), "popup_date", "800", "600", "9.0.0",false,{},{
        allowfullscreen:"true",
        allowscriptaccess:"always",
        bgcolor:'FFFFFF'
    },{});
    if (clicked_link) {
        setTimeout(tryFlashPopup,1000);
    }
}


jQuery.fn.extend({
    HomeNav: function() {
        this.mouseout(function(){
            $("#Left").removeClass("Hide");
            $("#Right").removeClass("Hide");
            $("#MiddleHoverLeft").addClass("Hide");
            $("#MiddleHoverRight").addClass("Hide");
            $("#MiddleHoverMiddle").addClass("Hide");
            $("#MiddleLink").removeClass("Hide");
            $("#LeftLink").removeClass("Hide");
            $("#Middle").removeClass("Hide");
            $("#LeftHoverLeft").addClass("Hide");
            $("#LeftHoverRight").addClass("Hide");

            $("#RightLink").removeClass("Hide");
            $("#Left").removeClass("Hide");
            $("#Middle").removeClass("Hide");
            $("#RightHoverLeft").addClass("Hide");
            $("#RightHoverRight").addClass("Hide");
        });
        
        $("#Middle").mouseover(function(){
            $("#Left").addClass("Hide");
            $("#Right").addClass("Hide");
            $("#MiddleLink").addClass("Hide");
            $("#MiddleHoverLeft").removeClass("Hide");
            $("#MiddleHoverRight").removeClass("Hide");
            $("#MiddleHoverMiddle").removeClass("Hide");
        });
        $("#Left").mouseover(function(){
            $("#LeftLink").addClass("Hide");
            $("#Right").addClass("Hide");
            $("#Middle").addClass("Hide");
            $("#LeftHoverLeft").removeClass("Hide");
            $("#LeftHoverRight").removeClass("Hide");
        });
        $("#Right").mouseover(function(){
            $("#RightLink").addClass("Hide");
            $("#Left").addClass("Hide");
            $("#Middle").addClass("Hide");
            $("#RightHoverLeft").removeClass("Hide");
            $("#RightHoverRight").removeClass("Hide");
        });
  
    }

});



