
	subject_id = '';
	function handleHttpResponse() {
		if (http.readyState == 4) {
			if (subject_id != '') {
				document.getElementById(subject_id).innerHTML = http.responseText;
			}
		}
	}
	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,store_id)
	{
		subject_id = div_id;
		content = document.getElementById(content_id).value;
		http.open("GET", "/images/js/ajax-search/script_page.php?content=" + escape(content) + "&storeid=" + store_id, true);
		http.onreadystatechange = handleHttpResponse;
		http.send(null);
		if(content.length>0)
			box('1');
		else
			box('0');

	}	

	function highlight(action,id)
	{
	  if(action)	
		document.getElementById('word'+id).bgColor = "#B3CEDF";
	  else
		document.getElementById('word'+id).bgColor = "#F8F8F8";
	}
	function display(word)
	{
		document.getElementById('text_content').value = word;
		document.getElementById('box').style.display = 'none';
		document.getElementById('text_content').focus();
	}
	function box(act)
	{
	  if(act=='0')	
	  {
		document.getElementById('box').style.display = 'none';

	  }
	  else
		document.getElementById('box').style.display = 'block';
	}

		
		//function ajaxclose()
		//{
		//	document.getElementById('box').style.display = 'none';
		//}

		
		 
		// function hide() {
		//	elm = document.getElementById('box')
  
		//	elm.style.display == "none" ? elm.style.display = "block" : elm.style.display = "none"
		//}
  
		 
		// document.onmousedown = function() {
		//	hide('hide')
		//}

document.onclick = function (e) {
	e = e || event
	var target = e.target || e.srcElement
	var box = document.getElementById("box")
	var box2 = document.getElementById("ajax_tooltip_content")
	do {
		if (box == target || box2 == target) {
			// Click occured inside the box, do nothing.
			return
		}
		target = target.parentNode
	} while (target)
	// Click was outside the box, hide it.
	box.style.display = "none"
}

