      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 rusure() { 

 if (confirm("Are you sure You want to Delete?")) { 
return true; 
 } else { 

return false; 
 } 
} 
function Save() 

	{
  	Form1.infoDetail.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 = 'MS Sans Serif';
		idContent.document.body.style.fontSize = '14px';
		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();			
}

function showNewColor(idChang) {

		var newColor = idChang;

		if((document.getElementById)&& (document.getElementById('tagID')!=null)) {

			var myElement = document.getElementById('tagID');

		 	if ((myElement.style)&& (myElement.style.backgroundColor!=null)) {

			    if(myElement.style.backgroundColor == 'white'){

					document.getElementById('tagID').style.backgroundColor = newColor;

				}else {

					document.getElementById('tagID').style.backgroundColor = newColor;      
    			}

  			}else {	

				return;

  			}

		}else {

		  return;

		}

	}
	
	
function CheckForm() {
	
var email=document.SaveForm.YourMail.value;
if (email==""){
alert("Please type your Email")
document.SaveForm.YourMail.focus()
return false
	}
	
	if (document.SaveForm.textName.value == ""){
		alert("Please type your Name");
		document.SaveForm.textName.focus();
		return false;
	}

	
	
	return true
}

function addicon(what)
{
	//var temp = window.prompt('ใส่ข้อความที่คุณต้องการทำเป็นตัวหนา',''); 
	//if(temp) setsmile('[b]'+temp+'[/b]');
	//frames.idContent.document.execCommand('InsertImage', false, what);
	//frames.idContent.document.iForm.idContent.value+" "+what;
  	//frames.idContent.focus();
	//document.iForm.elements.idContent.value+" "+what;
	//frames.idContent.document.value+" xx"+what;
	//frames.idContent.focus();
	//document.iForm.idContent.value = document.iForm.elements.idContent.value+" "+what;
	//document.iForm.idContent.focus();
	//frames.idContent.value = frames.elements.idContent.value+" "+what;
	frames.idContent.focus();
	frames.idContent.document.execCommand('InsertImage', false, what);
}
//function add_bb(m){
	//a=document.iForm.idContent;a.value=a.value+m
	//}