﻿function DisplayBDCN (){
var bD = BoDauMV.split('|');
var bDTit= "&nbsp;Sắc&nbsp;|&nbsp;Huyền&nbsp;|&nbsp;Hỏi&nbsp;|&nbsp;Ngã&nbsp;|&nbsp;Nặng&nbsp;|&nbsp;Nón&nbsp;|&nbsp;Móc&nbsp;|&nbsp;Trăng&nbsp;|&nbsp;Gạch&nbsp;|&nbsp;Xóa&nbsp;|&nbsp;Thoát&nbsp;|&nbsp;Thay&nbsp;".split('|');
var strBDCN="<table border='1' cellspacing='0' cellpadding='0'><tr>"; 
    var headMV = "<td align='center' bgcolor='#E7e7e7'>"
    headMV += "<SPAN CLASS='TitleDau'> ";
 
   var tailMV = "</SPAN><br><SPAN CLASS='Dau'>";
   var endMV = "</SPAN></td>";
for (var i =0; i< 11; i++){ 
  if (bD[i].length==0) bD[i]="&nbsp;";
  strBDCN  += headMV+ bDTit[i]+ tailMV+ bD[i]+ endMV; 
}
strBDCN  += headMV+ bDTit[11]+ tailMV
strBDCN  += "<img src='mviet/icon_pencil.gif' onClick=\"if (document.all) kieugodiv.innerHTML=Kh3+iFr1+mvKG+iFr2+Kh2; else document.getElementById('kieugodiv').innerHTML=Kh1+iFr1+mvKG+iFr2+Kh2;\" alt='Kiểu gõ'  width='12' height='16'>" + endMV; 

strBDCN  += headMV+ "<input name='SOS' type='button' value='SOS' class='mvbutton2' onClick='window.focus();checkBDCD();'>" +tailMV

strBDCN  += "</tr></table>";
  return strBDCN;	
}

function whatFile() { window.location= 'file:///' + document.form1.cmuds.value;}

var MVOnButton = "<img name='onbutton' src='mviet/off.gif' onClick='window.focus();MVietOnOffButton();' alt='Turn On'>";
var MVOffButton = "<img name='offbutton' src='mviet/on.gif' onClick='window.focus();MVietOnOffButton();' alt='Turn Off'>";
//off.gif = green
function MVietOnOffButton (){
  if (MVOff) {MVOff=false; MVietOnOff.innerHTML=MVOnButton;} 
  else {MVOff =true; MVietOnOff.innerHTML=MVOffButton;} 
}
function MVResize (khungType){   //1= full; 2=split
  var currentText = document.post.message.value;
  if (mviettext) { 
    if (khungType == 2){
       mviettext.innerHTML=Kh4+KhText2+parent.Kh2;  
       document.post.message.value= currentText;  
       MVMessage=document.post.message;
       if (htmlOn) editor_generate('message');  // leave it at bottom
       }
    else {
       mvietdiv.innerHTML=''; 
       mviettext.innerHTML= Kh4+KhText1+Kh2;
       document.post.message.value= currentText;
       MVMessage=document.post.message;
       if (htmlOn) editor_generate('message'); // leave it at bottom
       } 
   if (!htmlOn) GetFont(); //to reset font when change the textsize
  }  
}  


var MVMessage;
var mvh= 380; var mvh2=mvh; 
var mvw= 800;
var mvp= Math.floor( mvw / 3); 
var mvw2=mvw-mvp;

var iFr1 ="<iframe src='mviet/"; 
var mvHN = "hoinga.htm' width="+mvp+"  height="+mvh+"align=center"; 
var mvHN0 = "hoinga0.htm' width="+mvp+"  height="+mvh+"align=center"; 
var mvHC = "hoanchuyen.htm' width="+mvp+"  height="+mvh+"align=center"; 
var mvHC0 = "hoanchuyen0.htm' width="+mvp+"  height="+mvh+"align=center"; 
var mvTT = "timthe.htm' width="+mvp+" height="+mvh+" align=center"; 
var mvTT0 = "timthe0.htm' width="+mvp+" height="+mvh+" align=center"; 
var mvTK = "tocky.htm' width="+mvp+" height="+mvh+" align=center";
var mvTK0 = "tocky0.htm' width="+mvp+" height="+mvh+" align=center";    
var mvKG = "kieugo.htm' width=380 height=97 align=center"; 
var mvM = "color.htm' width=350 height=67 align=center"; 
var mvTD = "tudien.htm' width="+mvp+"  height="+mvh+"  align=center"; 
var iFr2 = " frameborder='0' id='mvframe' marginwidth='0' marginheight='0' scrolling='no'></iframe>";

var Kh1="<table bgcolor='white' cellspacing='1' border='0' align='center'><tr><td width="+mvp+"  height="+mvh+" nowrap align='center' valign='top'>";
var Kh4="<table bgcolor='white' cellspacing='1' border='0' align='center'><tr><td width="+mvw2+" height="+mvh+" nowrap align='center' valign='top'>";
var Kh3="<table bgcolor='white' cellspacing='0' border='0' align='center'><tr><td width='380' height='95' nowrap align='center' valign='middle'>";
var Kh2="</td></tr></table>";
var Kh6="<table bgcolor='white' cellspacing='0' border='0' align='center'><tr><td  nowrap align='center' valign='middle'>";
  

var Kh5="<table bgcolor='white' cellspacing='0' border='0' align='center'><tr><td width='370' height='45' nowrap align='center' valign='middle'>";
var mvKC  = "kieuchu.htm' width=370 height=40 align=center"; 

var tudien = Kh1+iFr1+mvTD+iFr2+Kh2;
var kieugo = Kh3+iFr1+mvKG+iFr2+Kh2;

var hoanchuyen, tocky, hoinga,timthe, kieuchu;
if (htmlOn) {
   hoanchuyen=Kh1+iFr1+mvHC+iFr2+Kh2;
   tocky=Kh1+iFr1+mvTK+iFr2+Kh2;
   hoinga=Kh1+iFr1+mvHN+iFr2+Kh2;
   timthe=Kh1+iFr1+mvTT+iFr2+Kh2;
   kieuchu="";
}else { 
   hoanchuyen=Kh1+iFr1+mvHC0+iFr2+Kh2;
   tocky=Kh1+iFr1+mvTK0+iFr2+Kh2;
   hoinga=Kh1+iFr1+mvHN0+iFr2+Kh2;
   timthe=Kh1+iFr1+mvTT0+iFr2+Kh2;
   kieuchu=Kh5+iFr1+mvKC+iFr2+Kh2; 
}
var KhText1= '<textarea name="message" style="width:'+mvw+';   height:'+mvh2+';" ></textarea>';
var KhText2= '<textarea name="message" style="width:'+mvw2+'; height:'+mvh2+';" ></textarea>';

function GetFont(){ 

var PhongChuMV=getMV("PhongChuMV", "Verdana"); 
var CoChuMV=getMV("CoChuMV", "10pt");
var KieuChuMV=getMV("KieuChuMV", "normal");
var phongStr = '<font face="'+PhongChuMV + '" Size="4" color="#FF9900">' + PhongChuMV + '</font> ';
phongStr += '<font face="'+PhongChuMV + '" Size="3" color="#076C9F">' + CoChuMV + '</font> ';

//alert(phongStr);

   MVMessage.style.fontSize=CoChuMV;
   MVMessage.style.fontFamily=PhongChuMV; 
 phongStr += '<font face="'+PhongChuMV + '" Size="2" color="#ff550c">';   
   switch(KieuChuMV) {
     case '0':
       MVMessage.style.fontWeight='normal';
       MVMessage.style.fontStyle='normal';
       phongStr += 'thường</font>';
       break;
     case '1':
       MVMessage.style.fontWeight='bold';
       MVMessage.style.fontStyle='normal';
       phongStr += '<b>đậm</b></font>';
       break;
     case '2':
       MVMessage.style.fontWeight='normal';
       MVMessage.style.fontStyle='italic';
       phongStr += '<i>nghiêng</i></font>';
       break;
     case '3':
       MVMessage.style.fontWeight='bold';
       MVMessage.style.fontStyle='italic';
        phongStr += '<b><i>đậm&nghiêng</i><b></font>';
     
   } 
   
   phongStr += ' -- <font Size="3" color="#006600"><i>Kiểu gõ: </i><font Size="2">'+ parent.getMV("BoDau", "1|\'1|`2|?3|~4|5.|^6|+*7|(8|d9-||\\")+'</font></font>' ;

   return phongStr;
}