// JavaScript Document
function changeTab(i){
	$("#tab1").removeClass();
	$("#tab2").removeClass();
	if (i==1){
		$("#tab1").addClass("tinmoi");
		$("#tab2").addClass("tinmoi2");
		$("#tab1_content").attr("style", "display:block");
		$("#tab2_content").attr("style", "display:none");
	}else{
		$("#tab1").addClass("tinmoi2");
		$("#tab2").addClass("tinmoi");		
		$("#tab1_content").attr("style", "display:none");
		$("#tab2_content").attr("style", "display:block");
	}
}
function start_topnav(){
	$("ul#topnav li").hover(
		function() { //Hover over event on list item
			$(this).css({ 'background' : '#1376c9 url(../images/topnav_active.gif) repeat-x'}); //Add background color + image on hovered list item
			$(this).find("span").show(); //Show the subnav
		} , 
		function() { //on hover out...
			$(this).css({ 'background' : 'none'}); //Ditch the background
			$(this).find("span").hide(); //Hide the subnav
			$("#topnav_li_1").addClass("current");
			$("#topnav_span_1").show();
		}
	);
}
function setMenuClicked(i){
	var options = { path: '/', expires: 1 };
	$.cookie('menu_a_clicked', i, options);
}
function getMenuClicked(){
	return $.cookie('menu_a_clicked');
}
function deletetMenuClicked(){
	var options = { path: '/', expires: 1 };
	$.cookie('menu_a_clicked', null, options);
}
function setMenuActive(){
	var i;
	i = getMenuClicked();
	if (i==0 || i==null) i = 1;
	$("#menu_a_" + i).addClass("active");
}

function submitsearch(){
	var f = document.getElementById('sForm');
	var keyword1 = f.keyword.value;	
	if (keyword1=='Nhập từ khoá') return false;
	window.location.href = nvcms_url + "/?mod=news&keyword="+keyword1;
	return false;
}
function submitFormWithEnter(myfield,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;	
	if (keycode == 13)
	{
		var f = document.getElementById('sForm');
		var keyword1 = f.keyword.value;
		window.location.href = nvcms_url + "/?mod=news&keyword="+keyword1;
		return false;
	}
	else
	return true;
}

