try{
	jQuery(document).ready(function($){

		if ($('body').hasClass('tpl-1')){
			var tpl = 'tpl-1';
		}
		
		if ($('body').hasClass('tpl-2')){
			var tpl = 'tpl-2';
		}
		
		if (location.pathname == '/dialogue/') {
			$("body").addClass("newsPage");
		}

		$(".children").hide();
		$(".current_page_item .children").show();
		$(".current_page_parent .children").show();
		$(".current_page_ancestor .children").show();
		$(".page-item-20").removeClass("page_item");
		
		//templates switch
		$(".page_item a").click(function(){
			//$(".main_height").width(465);
			$("body").removeClass("newsPage").removeClass("tpl-1").removeClass("mapCont").addClass('tpl-2');
			$('.twitter-widget').hide();
			$(".top_menu").animate({height: '425px'}, 'slow');
			if($(".small_tpl").css('width')=='435px') {
				$(".main_height").width(465);
			}
			//$("body").removeClass("mapCont");
			$(".small_tpl").animate({opacity: 'hide', width: '0'}, 'slow', function() {
				$(".small_tpl").addClass("white_right");
				$(".white_right").removeClass("small_tpl");
			});
			$(".white_right").removeClass("map");
			$(".flash").animate({top: '0px'}, 'slow', function() {
				$(".top_news").animate({opacity: 'hide'}, 'slow', function() {
					$(".flash").animate({width:'210px'}, 'slow');					
					$(".main_height").animate({width:'240px'}, 'slow', function() {					
						$(".footwide").animate({width: '1017px'}, 'slow');
						$(".white_right").animate({opacity: 'show', width: '752px'}, 'slow', function() {
							//custom scroll
// Temporary disabeled due to jScrollPane errors
							$('.white_right .scroll').jScrollPane();
						});
					});						
				});				
			});
		});		
		//thumbs click

		$(".thumbs a").live("click", function(){
			setTimeout(function() {
				$('.white_right .scroll').jScrollPane();
			}, 2000);
		});
		//contct us.onClick
		$(".page-item-20 a").click(function() {
			$('.twitter-widget').hide();
			$("body").removeClass("newsPage").removeClass("tpl-2").addClass('tpl-1');
			if($(".small_tpl").css('width')=='435px') {				
				$('.small_tpl .scroll').jScrollPane();
			}
			$(".small_tpl").addClass("map");
			$(".white_right").removeClass("map");
			$(".white_right").animate({opacity: 'hide', width: '0px'}, 'slow', function() {
				$(".main_height").animate({width:'435px'}, 'slow');
				$(".footwide").animate({width: '450px'}, 'slow');
				$(".flash").animate({width:'435px'}, 'slow', function() {
					$(".top_news").animate({opacity: 'show'}, 'slow', function() {
						$(".flash").animate({top: '15px'}, 'slow');					
						$(".top_menu").animate({height: '170px'}, 'slow');
						$(".white_right").addClass("small_tpl");						
						$(".small_tpl").addClass("map");
						$(".small_tpl").removeClass("white_right");
						$("body").removeClass("extended");
						$(".small_tpl").animate({width: '435px', opacity: 'show'}, 'slow', function() {
							//custom scroll
							$('.small_tpl .scroll').jScrollPane();
						});
					});				
				});
			});
		});
		
		//logo.onClick
		$(".logo a").click(function() {
			$(".menu .page-item-20 a").css("color", "#75a5cc");
			$('.twitter-widget').hide();
			$("body").removeClass("newsPage").removeClass("tpl-2").addClass('tpl-1');
			if($(".small_tpl").css('width')=='435px') {
				$('.small_tpl .scroll').jScrollPane();
			}
			$(".small_tpl").removeClass("map");
			$("body").removeClass("mapCont");
			$(".white_right").animate({opacity: 'hide', width: '0px'}, 'slow', function() {				
				$(".footwide").animate({width: '450px'}, 'slow');
				$(".main_height").animate({width:'435px'}, 'slow');
				$(".flash").animate({width:'435px'}, 'slow', function() {
					$(".top_news").animate({opacity: 'show'}, 'slow', function() {
						$(".flash").animate({top: '15px'}, 'slow');
						$(".children").slideUp('slow');
						$(".menu .page_item a").css("color", "#75a5cc");
						$(".page-item-20 a").css("color", "#75a5cc");
						$(".top_menu").animate({height: '170px'}, 'slow');
						$(".white_right").addClass("small_tpl");
						$(".small_tpl").removeClass("map");
						$(".small_tpl").removeClass("white_right");
						$("body").removeClass("extended");
						$(".small_tpl").animate({width: '435px', opacity: 'show'}, 'slow', function() {
							//custom scroll
							$('.small_tpl .scroll').jScrollPane();
						});
					});				
				});
			});
			$(".menu .page_item a").css("color", "#75a5cc");
		});
		
		//News page
		$(".menu .page-item-18 a").click(function(){	
			$("#sidebar .social-icons").hide();
			$(".footwide").hide();
			$("body").removeClass("mapCont").removeClass("tpl-1").addClass("newsPage").addClass('tpl-2');
			$(".small_tpl").removeClass("map");
			$("body").removeClass("mapCont");		
			$(".page-item-18 a").addClass("active");
			$(".flash").animate({top: '0px'}, 'slow', function() {
				$(".main_height").animate({width:'240px'}, 'slow', function() {	
					$(".white_right").animate({opacity: 'show', width: '752px'}, 'slow', function() {							
					});					
					$('.twitter-widget').animate({height: '490px', opacity: 'show'}, 'slow', function() {
						//do something
					});					
					$("#sidebar .social-icons").show();
					$(".footwide").show();
				});
			});
		});
		
		// menu accordion
		$(".menu .page_item a").click(function(){
			$(this).next(".children").slideDown("slow");
			$(this).parent().siblings().find(".children:visible").slideUp("slow");
			$(this).parent().siblings().find("a").css("color", "#75a5cc");
			$(this).parent().siblings().find("ul").find("a").css("color", "#9b9382");
			$(this).css("color", "#6b6351");
		 });
		
		$(".menu .page-item-20 a").click(function(){		
			$(this).parent().siblings().find(".children:visible").slideUp("slow");
			$(this).parent().siblings().find("a").css("color", "#75a5cc");
			$(this).parent().siblings().find("ul").find("a").css("color", "#9b9382");
			$(this).css("color", "#6b6351");	
		});
		
//		$(".logo a").click(function() {
//			$(".menu .page-item-20 a").css("color", "#75a5cc");
//		});
		
		$(".menu .page-item-2 a").click(function(){
			$(".menu .page_item ul a").css("color", "#9b9382");
			$(".menu .page-item-8 a").css("color", "#75a5cc");			
		});
		
		 $(".menu .page_item ul a").click(function(){
			$(this).parent().parent().find("a").css("color", "#9b9382");
			$(".menu .page-item-8 a").css("color", "#9b9382");
			$(this).css("color", "#75A5CC");
		 });
		
		
		//Our Team images
		$(".team_photo_item .img img").live('mouseover mouseout',function(event){
			if (event.type == 'mouseover') {
				var currentCl = $(this).attr('class');				
				$(".team_info div").animate({opacity: 'hide'}, 'slow');
				$(".team_photo .img").animate({top: '0', left: '0'}, '700');
				$(".team_photo .img img").animate({width: '100px', height: '100px'}, '700');
				
				$(".team_info div."+currentCl).animate({opacity: 'show'}, 'slow');
				$(this).parent().animate({top: '-12px', left: '-12px'}, '700');
				$(".team_photo img."+currentCl).animate({width: '124px', height: '124px'}, '700');
				
			} else {
				/*var currentCl = $(this).attr('class');
				$(".team_info div."+currentCl).animate({opacity: 'hide'}, 'slow');
				$(".team_photo img."+currentCl).animate({width: '100px', height: '100px'}, 'fast');
				$(this).parent().animate({top: '0', left: '0'}, 'fast');*/
			}
		});		
		
		$('.scroll').jScrollPane();

});
	
}
catch(e){}


