$(document).ready(function() { 
	var mobileDevice = (navigator.userAgent.match(/(?:iPhone|iPad|iPod|Android)/i) != null);
	if(mobileDevice === false){
		init_scrollable_footer();
	}
	
	/* Clickable block Start */
	$('.block').click(function(){
		  window.location=$(this).find("a").attr("href"); return false;
	});
	/* Clickable block End */
	
	
	/* content height */
	function checkContentHeight(){
		$sidebarHeight = $('#sidebar').height();
		$contentHeight = $('#content').height();
		if($sidebarHeight > $contentHeight){
	
			$('#content .inner').height($sidebarHeight-100);
		}
	}
	checkContentHeight();
	/**/
  $('.clear').each(function() {
    $(this)
      .data('default', $(this).val())
      .addClass('inactive')
      .focus(function() {
        $(this).removeClass('inactive');
        if($(this).val() == $(this).data('default') || '') {
          $(this).val('');
        }
      })
      .blur(function() {
        var default_val = $(this).data('default');
        if($(this).val() == '') {
          $(this).addClass('inactive');
          $(this).val($(this).data('default'));
        }
      });
  });

			
			
	
		
			$footerClicked = false;
			$animated = false;
			
			function footerClick(){

				if($footerClicked == false && $animated == false){
					$('#footer').stop().animate({"bottom": "0"}, 150);
					$footerClicked = true;
				}else{
					$('#footer').stop().animate({"bottom": "-86px"}, 150);
					if($animated){
						$animated = false;
					}
					
					if($footerClicked){
						$footerClicked = false;
					}
				}
			}
			$('#footer-btn').click(function(){
				footerClick();										
			});
			
			
			function footerExpand(){
				if($footerExpand == false){
					$('#footer').stop().animate({"bottom": "0"}, 150);
					$footerExpand = true;
				}else{
					$('#footer').stop().animate({"bottom": "-86px"}, 150);
					$footerExpand = false;
				}
			}
			
			
	
	if($("#slide").size() > 0){
		$('#slide-parent').cycle({ 
			fx:     'scrollHorz', 
			timeout: 5000,
			speed: 500,
			pager: "#slide-navigation",
			pagerAnchorBuilder: function(idx, slide) { 
				return '#slide-navigation a:eq(' + idx + ')'; 
			},
			next: "#next",
			autostop: 0,
			onPagerEvent: function () {
				$('#slide-parent').cycle('pause');
			},
			 onPrevNextEvent: function () {
				$('#slide-parent').cycle('pause');
			}
		});
	}
	
	
	
	if($("#network-btn").size() > 0){
		//$bloglistHeight = $("#local-page-header .bloglist ul:nth-child(2)").height() + 10;		
		$bloglistHeight = $("#local-page-header .bloglist ul").height() + 10;		
		$("#network-btn").toggle(function(){
			$("#local-page-header .bloglist").stop().animate({height:$bloglistHeight},200,function(){$(this).addClass("show");}); 
		},function(){
			$("#local-page-header .bloglist").stop().animate({height:'0'},200,function(){$(this).removeClass("show");}); 
		})
	}
	
	
	$(".tweet").tweet({
            username: ["Makalosa"],
            count: 1,
			//filter: function(t){ return ! /^@\w+/.test(t["tweet_raw_text"]); },
			template: "{text}",
            loading_text: "Laddar twitter"
		}).bind("loaded",function(){$(this).find("a").attr("target","_blank");
	});
     
	
	
});


Cufon.replace('.label.blue a', {
	textShadow: '0 -1px #2da1a5',
	hover: {
		textShadow: '0 -1px #2da1a5'
	}
});
Cufon.replace('.label.yellow a', {
	textShadow: '0 -1px #d19615',
	hover: {
		textShadow: '0 -1px #d19615'
	}
});
Cufon.replace('.label a', {
	textShadow: '0 -1px #538e18',
	hover: {
		textShadow: '0 -1px #538e18'
	}
});
Cufon.replace('h1,h2,h3,h4,h5,h6,#access a,.btn,#facebook-btn,.date .day,#calender-archive',{hover:true});
Cufon.replace('.label', {textShadow: '0 -1px #538e18'});
Cufon.replace('.label.blue', {textShadow: '0 -1px #2da1a5'});
Cufon.replace('.label.yellow', {textShadow: '0 -1px #d19615'});
