      var preview_window = 0;
      function SaveQ()
      {
        document.iForm.target="_top"
        document.iForm.action="./act/postQ.php"
        document.iForm.submit()
      }

      function SaveA()
      {
        document.iForm.target="_top"
        document.iForm.action="../act/postA.php"
        document.iForm.submit()
      }

function Save() 

	{

	if (document.Form1.catGroup.value == ""){
		alert("โปรดเลือกกลุ่ม");
		return false;
	}else{

  	Form1.myHTML.value = idContent.document.body.innerHTML;
  	/*Form1.action="./act/postQ.php";*/
  	Form1.submit();
	}

	}

var displayMode = "RICH"
function setDisplayMode() 
	{
	if(displayMode=='RICH')
		{
		idContent.document.body.clearAttributes;
		idContent.document.body.style.fontFamily = 'Tahoma, Ms Sans Serif, sans-serif, Thonburi, Helvetica';
		idContent.document.body.style.fontSize = '11px';
		idContent.document.body.innerText = idContent.document.body.innerHTML;
		idContent.document.body.innerHTML = "" + idContent.document.body.innerHTML + ""
		displayMode = 'HTML';
		idToolbar.style.display = "none"
		} 
	else 
		{
		idContent.document.body.clearAttributes;
		idContent.document.body.style.fontFamily = '';
		idContent.document.body.style.fontSize = '';
		idContent.document.body.innerHTML = idContent.document.body.innerText;
		displayMode = 'RICH';
		idToolbar.style.display = "block"
		}
	}
function GetElement(oElement,sMatchTag) 
	{
	while (oElement!=null && oElement.tagName!=sMatchTag) 
		{
		if(oElement.id=="idContent") return null;
		oElement = oElement.parentElement
		}
	return oElement
	}


function FormatText(command, option){
	
  	frames.idContent.document.execCommand(command, true, option);
  	frames.idContent.focus();
}

function AddImage(){	
	imagePath = prompt('Enter the web address of the image', 'http://');				
	
	if ((imagePath != null) && (imagePath != "")){					
		frames.idContent.document.execCommand('InsertImage', false, imagePath);
  		frames.idContent.focus();
	}
	frames.idContent.focus();			
}

function AddSmileyIcon(imagePath){	
									
	frames.idContent.document.execCommand('InsertImage', false, imagePath);
  	frames.idContent.focus();			
}

