memu_crr="";
	function bodytext(url,menu_id){
		window.location.hash=url.replace("danhsachbaiviet","index").replace("baiviet","index").replace("search","index")+"&a=0";
		$("#bodytext").html("<img src='Images/loading.gif'/>");
		$.get(url,function(data){
			$("#bodytext").html(data);
		});
		format_menu(menu_id);
	}
	function format_menu(menu_id){
		menu_crr=menu_id;
		sg();
		set_bg(menu_id,"M",1);
		set_bg(menu_id,"N",1);
		}
	function stp_search(){
		var dk;
		if(navigator.userAgent.indexOf("MSIE")>=0){
				var arr = document.getElementsByName("dk");
				url = "index.php?a=0&dk="+arr[0].value;
				window.location=url;
		}else{
			dk=document.getElementById("dk").value;
			url = "search.php?dk=" + dk;
			bodytext(url);
		}
		
	}
	function sg(){
		var arr = document.getElementsByName("top_menu_it");
		for(i=0;i<arr.length;i++){
			 	arr[i].style.background = 'url(Buttons/button_menu.png)';
				arr[i].style.color = '#FFFFFF';
				arr[i].style.fontSize = '14px';
				arr[i].style.fontWeight = 'bold';
		}
		
		arr = document.getElementsByName("left_menu_it");
		for(i=0;i<arr.length;i++){
				arr[i].style.background = '#FFFFFF';
				arr[i].style.color = '#408080';
				
		}
		
	}
	function menu_top(page){
		src = "menu_top.php?page="+page;
		$.get(src,function(data){
			$("#top_bar").html(data);
		});
	}
	function menu_left(page){
		src = "menu_left.php?page="+page;
		$.get(src,function(data){
			$("#left_bar").html(data);
		});
	}
	function show_context_menu(menu_id){
		
		if(	menu_crr!=menu_id){
			set_bg(menu_id,"M",1);
		}
		document.getElementById(menu_id).style.visibility = 'visible';
	}
	function hide_context_menu(menu_id){
		if(	menu_crr!=menu_id){
			set_bg(menu_id,"M",0);
		}
		document.getElementById(menu_id).style.visibility = 'hidden';
	}
	function show_context_menuL(menu_id){
		menu_id2 = menu_id.substring(0,menu_id.length-1);
		if(	menu_crr!=menu_id2){
			set_bg(menu_id2,"N",1);
		}
		document.getElementById(menu_id).style.visibility = 'visible';
	}
	function hide_context_menuL(menu_id){
		menu_id2 = menu_id.substring(0,menu_id.length-1);
		if(	menu_crr!=menu_id2){
			set_bg(menu_id2,"N",0);
		}
		
		document.getElementById(menu_id).style.visibility = 'hidden';
		
	}
	
	function set_bg(menu_id,type,show){
		menu_id =menu_id+type;
		if(type=="M"){
			if(show==1)
				document.getElementById(menu_id).style.background = 'url(Buttons/button_menu_2.png)';
			else 
				document.getElementById(menu_id).style.background = 'url(Buttons/button_menu.png)';
		}else{
			if(show==1){
				document.getElementById(menu_id).style.background = '#51A2A2';
				document.getElementById(menu_id).style.color = '#FFFFFF';}
			else {
				document.getElementById(menu_id).style.background = 'white';
				document.getElementById(menu_id).style.color = '#408080';}
		}
	}
	function mnitem_hover(mnitem){
		//t = /MSIE (\d+\.\d+);/.test(navigator.userAgent);
		if(navigator.userAgent.indexOf("MSIE")>=0){
			arr = document.getElementsByTagName("li");
		
			for(i=0;i<arr.length;i++){
						if(arr[i].name=='mndropitem'){
							arr[i].style.background = "#408080";
				}
			}
			mnitem.style.background="#999999";
		}else{
			arr = document.getElementsByName("mndropitem");
			for(i=0;i<arr.length;i++){
						arr[i].style.background = "#408080";
			}
			mnitem.style.background="#999999";
		}
		
	}
function check(){
	var valid = true;
		if (document.fsendemail.name.value==""){
			valid = false;
			alert("Quy khach chua nhap ho va ten nguoi gui!");
			document.fsendemail.name.focus();
			return valid;
		}
		
		if (document.fsendemail.cust2.value==""){
			valid = false;
			alert("Quy khach chua nhap dia chi lien lac!");
			document.fsendemail.cust2.focus();
			return valid;
		}
		
		if (document.fsendemail.email.value==""){
			valid = false;
			alert("Quy khach chua nhap dia chi Email!");
			document.fsendemail.email.focus();
			return valid;
		}
		if (document.fsendemail.dienthoai.value==""){
			valid = false;
			alert("Quy khach chua nhap so dien thoai lien he!");
			document.fsendemail.dienthoai.focus();
			return valid;
		}
	return valid;
}


