// Function to add the code for bold italic centre and underline, to the message
function Add_banhang_Content_Code(code, promptText, InsertText) {

	if (code != "") {
		insertCode = prompt(promptText + "\n[" + code + "]xxx[/" + code + "]", InsertText);
			if ((insertCode != null) && (insertCode != "")){
				document.form1.banhang_Content.value += "[" + code + "]" + insertCode + "[/" + code + "]";
			}
	}
				
	document.form1.banhang_Content.focus();
}

//Function to add the URL, indent, list, and Email code to the message
function Add_banhang_Content_List(code) {

	//For the URL code
	if ((code != "") && (code == "URL")) {
		insertText = prompt("Nhap ten lien ket", "");
			
			if ((insertText != null) && (insertText != "") && (code == "URL")){
				insertCode = prompt("Nhap dia chi lien ket", "http://");
					
					if ((insertCode != null) && (insertCode != "") && (insertCode != "http://")){					
						document.form1.banhang_Content.value += "[" + code + "=" + insertCode + "]" + insertText + "[/" + code + "]";
					}
			}
	}
	
	
	//For the email code
	if ((code != "") && (code == "EMAIL")) {
		insertText = prompt("Nhap ten Email muon hien thi", "");
			
			if ((insertText != null) && (insertText != "")){
				insertCode = prompt("Nhap dia chi Email", "");
					
					if ((insertCode != null) && (insertCode != "")){					
					document.form1.banhang_Content.value += "[" + code + "=" + insertCode + "]" + insertText + "[/" + code + "]";
				}
			}
	}
	
	//For the list code
	if ((code != "") && (code == "LIST")) {
		listType = prompt("Kieu danh sach: \nNhap so \'1\' la danh so thu tu, de trang la gach dau dong", "");
		
		while ((listType != null) && (listType != "") && (listType != "1")) {
			listType = prompt("Hay nhap lai kieu danh sach: \nNhap so \'1\' la danh so thu tu, de trang la gach dau dong", "");
		}
		
		if (listType != null) {			
			var listItem = "1";
			var insertCode = "";
			
			while ((listItem != "") && (listItem != null)) {
				listItem = prompt("Nhap noi dung hien thi, de trang neu muon ket thuc",""); 
				if (listItem != "") {             
					insertCode += "[LI]" + listItem + "[/LI]"; 
				}                   
			} 
			
			if (listType == "") {
				document.form1.banhang_Content.value += "[" + code + "]" + insertCode + "[/" + code + "]";
			} else {
				document.form1.banhang_Content.value += "[" + code + "=" + listType + "]" + insertCode + "[/" + code + "=" + listType + "]";
			} 
			
		}
	}
	
	
	//For the indent
	if ((code != "") && (code == "INDENT")) {
						
			document.form1.banhang_Content.value += "      ";				
	}

				
	document.form1.banhang_Content.focus();
}
