$(document).ready(function() {

	$("a[@href^=http]").each(function(){
		if(this.href.indexOf(location.hostname) == -1 ) {
	      $(this).addClass('external'); 
	    }
	});

	$('a.external').click( function(e)
	{ 
		 window.open(this.href);return false;
	});
	
	$('.block-text').each(function(){
		 this.onselectstart = function() { return false; }; 
         this.unselectable = "on"; 
         jQuery(this).css('-moz-user-select', 'none');
	});
	
	
	//slideshow
    $('.slideshow').cycle({
		fx: 'fade' 
	});
    
    //subitem
    $('.sub-item > div ').hide();
    $(".sub-item > h3 a").after(" [<strong>&darr;</strong>] ");
    $('.sub-item > h3 a').css('cursor','pointer');
    $('.sub-item > h3 a').click(function() 
    {
    	
    	var body = $(this).parent().next();
    	var strong = $(this).next("strong");
    	if (body.is(":hidden"))
    	{
    		$('.sub-item > div:visible ').slideUp(300);
    		$('.sub-item > h3 >  strong ').html("&darr;");
    		body.slideDown(600);
    		strong.html("&uarr;");
    	}else{
    		$('.sub-item > div:visible ').hide(300);
    		$('.sub-item > h3 > strong ').html("&darr;");
    		/*body.slideUp(300);
    		strong.html("&darr;");*/
    	}
    });
    
    var locationS = document.location.hash;
    if(!locationS.length)
    { 
      locationS = $(".sub-item:first > h3 a").attr('href');
      if(locationS !='' && locationS != undefined)
      {
    	  document.location.hash = locationS;
      }
    }

    $(".sub-item > h3 a[href="+locationS+"]").click();

    
    
});


