$(document).ready(function() {
	$('#menuBar').find('li').each(function(){
		$(this).hover(
		function(){
			$(this).children('ul').css({display:'block'});
			$(this).parents('.imageContainer').find('img').each(function(){
			    $(this).attr('src',$(this).attr('src').replace('1','2'));
			});
		},
		function(){
			$(this).children('ul').css({display:'none'});
			$(this).parents('.imageContainer').find('img').each(function(){
			    $(this).attr('src',$(this).attr('src').replace('2','1'));
			});
		});
	});
	$('.menuTitle').each(function(){
	    $(this).hover(
		    function(){
		    	var src = $(this).attr('src').replace('1.jpg','2.jpg');
		    	$(this).attr('src',src);
		    },
		    function(){
			    var src = $(this).attr('src').replace('2.jpg','1.jpg');
		    	$(this).attr('src',src);
		    }
		);
	});
	$('.CaseStudyItem').each(function(){
	    $(this).hover(
	        function(){
	            $(this).css({backgroundColor:'white'});
	            $(this).find('.CaseStudyText').css({color:'#f68b0b'});
	            $img = $(this).find('.CaseStudyArrow').find('img');
	            $img.attr('src',$img.attr('src').replace('1','2'));
	            if ($(this).prev() != null) {
	                $(this).prev().find('.CaseStudyText').css({borderBottom:'solid 1px #f68b0b'});
	            }	            
	        },
	        function(){
	            $(this).css({backgroundColor:'#f68b0b'});
	            $(this).find('.CaseStudyText').css({color:'white'});
	            $img = $(this).find('.CaseStudyArrow').find('img');
	            $img.attr('src',$img.attr('src').replace('2','1'));
	            	            if ($(this).prev() != null) {
	                $(this).prev().find('.CaseStudyText').css({borderBottom:'solid 1px white'});
	            }	            
	        }
	    );
	});
	$('.CaseStudyBelowItem').each(function(){
	    $(this).hover(
	        function(){
	            $(this).css({backgroundColor:'white'});
	            $(this).find('.CaseStudyText').css({color:'#91C107'});
	            $img = $(this).find('.CaseStudyArrow').find('img');
	            $img.attr('src',$img.attr('src').replace('1','2'));
	            if ($(this).prev() != null) {
	                $(this).prev().find('.CaseStudyText').css({borderBottom:'solid 1px #f68b0b'});
	            }	            
	        },
	        function(){
	            $(this).css({backgroundColor:'#91C107'});
	            $(this).find('.CaseStudyText').css({color:'white'});
	            $img = $(this).find('.CaseStudyArrow').find('img');
	            $img.attr('src',$img.attr('src').replace('2','1'));
	            	            if ($(this).prev() != null) {
	                $(this).prev().find('.CaseStudyText').css({borderBottom:'solid 1px white'});
	            }	            
	        }
	    );
	});
	$('#Home').each(function(){
	    $(this).children(':first').css({marginTop:'7px'});
	    $(this).children(':last').css({marginBottom:'7px'});
	    $(this).find('li').hover(
	        function() {
	            $(this).css({backgroundColor:'#00B4F1'});
	        },
	        function() {
	            $(this).css({backgroundColor:'#0066A1'});
	        }
	    );
	});
	$('#Promotion').each(function(){
	    $(this).children(':first').css({marginTop:'7px'});
	    $(this).children(':last').css({marginBottom:'7px'});
	    $(this).find('li').hover(
	        function() {
	            $(this).css({backgroundColor:'#F58D0A'});
	        },
	        function() {
	            $(this).css({backgroundColor:'#0066A1'});
	        }
	    );
	});
	$('#BelowTheLine').each(function(){
	    $(this).children(':first').css({marginTop:'7px'});
	    $(this).children(':last').css({marginBottom:'7px'});
	    $(this).find('li').hover(
	        function() {
	            $(this).css({backgroundColor:'#00B4F1'});
	        },
	        function() {
	            $(this).css({backgroundColor:'#9DCA27'});
	        }
	    );
	});
	$('#Below').each(function(){
	    $(this).children(':first').css({marginTop:'7px'});
	    $(this).children(':last').css({marginBottom:'7px'});
	    $(this).find('li').hover(
	        function() {
	            $(this).css({backgroundColor:'#91C107'});
	        },
	        function() {
	            $(this).css({backgroundColor:'#0066A1'});
	        }
	    );
	});
	$('#Contact').each(function(){
	    $(this).children(':first').css({marginTop:'7px'});
	    $(this).children(':last').css({marginBottom:'7px'});
	    $(this).find('li').hover(
	        function() {
	            $(this).css({backgroundColor:'#E12F8A'});
	        },
	        function() {
	            $(this).css({backgroundColor:'#0066A1'});
	        }
	    );
	});
	$('.CaseStudyItem').each(function(){
	    $(this).click(function() {
	        window.location = '/CaseStudies/CaseStudy.aspx?casestudy=' + $(this).attr('id').replace('caseStudy','');
	    });
	});
	$('.CaseStudyBelowItem').each(function(){
	    $(this).click(function() {
	        window.location = '/BelowTheLine/CaseStudy.aspx?casestudy=' + $(this).attr('id').replace('caseStudy','');
	    });
	});
	$('.newsBlock').each(function(){
	    $(this).hover(function(){
	            $(this).css({border:'solid 2px #0066A1'});
	        },
	        function(){
	            $(this).css({border:'solid 2px white'});
	        }
	    );
	    $(this).click(function(){
	        window.location = "/Home/PressStory.aspx?index=" + $(this).attr('id');
	    });
	});
	$('.eventsBlock').each(function(){
	    $(this).hover(function(){
	            $(this).css({border:'solid 2px #0066A1'});
	        },
	        function(){
	            $(this).css({border:'solid 2px white'});
	        }
	    );
	    $(this).click(function(){
	        window.location = "/Home/Event.aspx?index=" + $(this).attr('id');
	    });
	});
	
	$('.socialBlock').each(function(){
	    $(this).hover(function(){
	            $(this).css({border:'solid 2px #0066A1'});
	        },
	        function(){
	            $(this).css({border:'solid 2px white'});
	        }
	    );
	    $(this).click(function(){
	        window.location = "/Home/SocialStory.aspx?index=" + $(this).attr('id');
	    });
	});
	
	$('.jobsBlock').each(function(){
	    $(this).hover(function(){
	            $(this).css({border:'solid 2px #0066A1'});
	        },
	        function(){
	            $(this).css({border:'solid 2px white'});
	        }
	    );
	    $(this).click(function(){
	        window.location = "/Home/JobsStory.aspx?index=" + $(this).attr('id');
	    });
	});
	$('#Arrow').each(function(){
	    $(this).click(function(){
	        history.go(-1);
	    })
	});
});
 
 
 
 