subject_id = '';
function handleHttpResponse() {
	if (http.readyState == 4) {
		if (subject_id != '') {
			var cont = http.responseText
			if(cont != ''){
				document.getElementById(subject_id).innerHTML = cont;
				box('1');
				toggleContents1('1');
			}else{
				toggleContents1('0');
				box('0');
			}
		}
	}
}
function getHTTPObject() {
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				xmlhttp = false;
			}
		}
	@else
	xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp = false;
		}
	}
	return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object

function getScriptPage(div_id,content_id)
{
	subject_id = div_id;
	content = document.getElementById(content_id).value;
	http.open("GET", "suggest.php?content=" + escape(content), true);
	http.onreadystatechange = handleHttpResponse;
	http.send(null);
}	

function getScriptPageBox(div_id,content_id)
{
	subject_id = div_id;
	content = document.getElementById(content_id).value;
	http.open("GET", "suggestView.php?content=" + escape(content), true);
	http.onreadystatechange = handleHttpResponse;
	http.send(null);
	if(content.length>0)
		boxView('1');
	else
		boxView('0');

}	

function highlight(action,id)
{
  if(action)	
	document.getElementById('word'+id).bgColor = "#E6DEDE";
  else
	document.getElementById('word'+id).bgColor = "#F8F8F8";
}
function display(word)
{
	// alert(word)
	 document.searchform.searchkey.value=word;
	//document.getElementById('text_content').value = word;
	document.getElementById('box').style.display = 'none';
	toggleContents1('0');
	document.searchform.searchkey.focus();
}

function displayView(word)
{
	document.getElementById('text_contentView').value = word;
	document.getElementById('boxView').style.display = 'none';
	document.getElementById('text_contentView').focus();
}

function box(act)
{
  if(act=='0')	
  {
	document.getElementById('box').style.display = 'none';
  }
  else
	document.getElementById('box').style.display = 'block';
}

function boxView(act)
{
  if(act=='0')	
  {
	document.getElementById('boxView').style.display = 'none';

  }
  else
	document.getElementById('boxView').style.display = 'block';
}


