$(document).ready(function() {

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
$(".tab_content2").hide(); //Hide all content
	$("ul.tabs2 li:first").addClass("active").show(); //Activate first tab
	$(".tab_content2:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs2 li").click(function() {
		$("ul.tabs2 li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content2").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	
	$(".tab_content03").hide(); //Hide all content
	$("ul.tabs03 li:first").addClass("active").show(); //Activate first tab
	$(".tab_content03:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs03 li").click(function() {
		$("ul.tabs03 li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content03").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
});

$(document).ready(function (){

	//hide video title div at home page. 

	$("#video div").hide();	



});



function sectionControl(secId){

	//hover menu section of secId

	$('#menu_sec_'+secId).addClass('hover');

}



$(document).ready(function(){

	/*search*/ 

	//clear search filed 

	$('#searchCurrentField').click(function(){

		if($('#searchCurrentField').val() == 'Search')

			$('#searchCurrentField').val('');	 

	});

	//set the href of search link  

	$("#searchCurrentLink").click(function(){

		if( $('#searchCurrentField').val().length < 3  ){

			getOut($('#searchErrors'), 'Please write at least 3 characters.');

		}else{

			$(this).attr('href', siteUrl+'/news/search/current/'+$('#searchCurrentField').val());

	 		return true;

		}

	});



});



function keyHighlight(key){

	//highlight search key in results

	//alert(key)

	key = key.toLowerCase();

	$('#searchResults .keyHighlight').each(function(){

		$(this).html( $(this).text().toLowerCase().replace(key, '<span class="highlight">'+key+'</span>') );

	})	

}



function getOut(obj, message){

	obj.text(message).fadeTo("slow", 1, function(){

		setTimeout(

			function() {obj.text('').fadeOut("slow" , 1); }, 

			3000

		);																		 

	});

	return false;

}
