$(function(){		

	if( $("#searchform").length)
	{
		$("#searchform").animate({opacity:1},1500).animate({opacity:0.7},500);
		$("#searchform").hover(function(){$(this).stop().animate({opacity:1},500)}, function(){$(this).stop().animate({opacity:0.7},500)});
	}

	if( $("a.ext").length )
	{
		$("a.ext").click(function(){
			window.open(this.href); // pop a new window
			return false; // return false to keep the actual link click from actuating				
		});		
	}

	$('.more').click(function(){			
		$(this).fadeOut("fast",function(){ $('.less').fadeIn("slow"); });			
		$('.hidden').slideToggle();
		return false; // return false to keep the actual link click from actuating		
	});
	$('.less').click(function(){									
		$(this).fadeOut("fast",function(){ $('.more').fadeIn("slow"); });			
		$('.hidden').slideToggle();
		return false; // return false to keep the actual link click from actuating		
	});		

	if( $('#db_results').length )
	{
		// Bind link to event detail in datatable
		/*$("tbody tr").click(function(){
			window.location=$(this).find(".datatable_title a").attr("href");
		});*/

		// Create datatable
		$('#db_results').dataTable( {
			// positioning of the elements
			"sDom": '<"datatable_top"if>rt<"datatable_bottom"p<"separator">',
			// unused features
			"bAutoWidth": false,
			"bLengthChange" : false,
			"bSortClasses" : false,
			"bJQueryUI" : false,
			//pagination
			"sPaginationType": "full_numbers",
			"iDisplayLength" : 10,
			// type of the column content
			"aoColumns": [
					//date start
					{ "sType": "html","sWidth": "60px" },
					//date end
					{ "sType": "html","sWidth": "60px" },				
					//title
					{ "sType": "html", "sClass": "datatable_title" , "sWidth": "300px" },
					//type
					{ "sClass": "datatable_type","sWidth": "90px" },
					//country
					{ "sType": "html", "sClass": "datatable_country" , "sWidth": "140px" }
			] 
		});			
	}

});