$(document).ready(function()
{
	touchScroll('content');
	
  $('.navi > li').hover(function() {
    var $subnavi = $('ul', this);
    
    if ($subnavi.size() > 0) {
      $(this).addClass('hover');
      $subnavi.show();
    }
  }, function() {
     
    var $subnavi = $('ul', this);
    if ($subnavi.size() > 0) {
      $(this).removeClass('hover');
      $subnavi.hide();
    }
  });
	
	Cufon.replace('#container h1');
	
	$('.model-item-field.blogi-1-fbshare a').click(function(){
		window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(document.title),'sharer','toolbar=0,status=0,width=626,height=436');    
    return false;
	});
});

function isTouchDevice(){
	try{
		document.createEvent("TouchEvent");
		return true;
	}catch(e){
		return false;
	}
}

function touchScroll(id){
	if(isTouchDevice()){ //if touch events exist...
		var el=document.getElementById(id);
		var scrollStartPos=0;

		document.getElementById(id).addEventListener("touchstart", function(event) {
			scrollStartPos=this.scrollTop+event.touches[0].pageY;
			event.preventDefault();
		},false);

		document.getElementById(id).addEventListener("touchmove", function(event) {
			this.scrollTop=scrollStartPos-event.touches[0].pageY;
			event.preventDefault();
		},false);
	}
}

