
$(document).ready(function() {
						  			
			//Cufon----------------------------->
			Cufon.replace('h1, h2, h3, h4, h5, .dropcap, #nav ul li a', {
				fontFamily: 'PT Sans'
			});
			
			Cufon.replace('footer h4, h3.trigger', {
				fontFamily: 'PT Sans',
				textShadow: 'rgba(0, 0, 0, .6) 0px 1px 0px;'
			});
									
			Cufon.replace(' ', {
				fontFamily: 'PT Sans',
				textShadow: '#fff 0px 1px 0px;'
			});
			
			
			//Home widget---------------------------------------->
			 $('#home_widget_btn').click(function() {
				var $lefty = $(this).parent();
				if($lefty.css('right') == "-290px"){
					$lefty.animate({right:0});
					$(this).addClass("btn_open");
				}else{
					$lefty.animate({right:-290});
					$(this).removeClass("btn_open");
				}
			  });
			  
			  
			 //Main widget---------------------------------------->
			 $('#main_btn').click(function() {
				var $main = $("#main");
				var window_height = $(window).height();
				var header_height = $("#header").height();
				if($main.css('top') == "0px"){
					$main.animate({top: window_height - header_height -90});
					$(this).addClass("btn_open");
				}else{
					$main.animate({top:0});
					$(this).removeClass("btn_open");
				}
			  });
			  //Navigation Background Slider-------------->
			   $("#pauseplay").toggle(function () { 
				  $(this).addClass("pause");
				}, function () {
				  $(this).removeClass("pause");
				});
				
				

			
			//Lightbox
			$("a[rel^='prettyPhoto']").prettyPhoto({show_title: false, theme: 'dark_square'});
			
			//Gallery
			//If link to an Image do Prettyphoto
			attach = $(".gallery dl dt a").attr('href');
			comp = /attachment_id/;
			if(!comp.test(attach)){
			$(".gallery dl dt a").prettyPhoto({show_title: false, theme: 'dark_square'});
			}
			//Add class image-frame
			$(".gallery dl dt a").each(function(index) {
													$(this).attr('rel', 'prettyPhoto[pp_gal]')
													$(this).children("img").addClass("image-frame");
												});
			
			//Tabs
			$("ul.tabs").tabs("div.panes > div");
			$(".accordion").tabs(".accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
			
			//Hide (Collapse) the toggle containers on load
			$(".toggle_container").hide(); 
		
			//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
			$("h3.trigger").click(function(){
				$(this).children("a").toggleClass("active").parent().next().slideToggle("slow");
				return false; //Prevent the browser jump to the link anchor
			});
			
			
			//Quick Contact Form styling
			$(".quick_contact input").click(function(){
					$(this).next().fadeOut(100);
			});
			
			
			//Sidebar Menu Function
			$('#sidebar .widget ul li ul').parent().addClass('hasChildren').children('a').append("<span />");
			var children;
			$("#sidebar .widget ul li").hoverIntent(
										  function () {
											children = $(this).children("ul");
											if($(children).length > 0){
													$(children).stop(true, true).slideDown('fast');	   
											}
										  }, 
										  function () {
											  $(this).children('ul').stop(true, true).slideUp(500);
										  }
			);
			
			//Footer Menu Function
			$('footer .widget ul li ul').parent().addClass('hasChildren').children('a').append("<span />");
			var children;
			$("footer .widget ul li").hoverIntent(
										  function () {
											children = $(this).children("ul");
											if($(children).length > 0){
													$(children).stop(true, true).slideDown('fast');	   
											}
										  }, 
										  function () {
											  $(this).children('ul').stop(true, true).slideUp(500);
										  }
			);
														

});

