

	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)
	{
		subject_id = div_id;
		content = document.getElementById(content_id).value;
	       	http.open("GET", "includes/script_page.php?content=" + escape(content), true);
		http.onreadystatechange = handleHttpResponse;
		http.send(null);
		if(content.length>0)
			box('1');
		else
			box('0');

	}

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

	}

	function highlight(action,id)
	{
		//alert(id);
	  if(action)
	  {
		document.getElementById('word'+id).bgColor = "#D3D3D3";
		
	  }
	  else
	  {
		document.getElementById('word'+id).bgColor = "#F8F8F8";
	  }
	}
	function display(word)
	{
		var elem = word;
		var colorArray = elem.split("~");
		var productname= colorArray[0] ;
		var message= colorArray[1] ;	
		document.getElementById('text_content').value = productname;		
		document.getElementById('txtpid').value = message;
		//alert(document.getElementById('txtpid').value);
		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 login(showhide)
  {
    if(showhide == "show"){
        document.getElementById('popupbox').style.visibility="visible"; /* If the function is called with the variable 'show', show the login box */
    }else if(showhide == "hide"){
        document.getElementById('popupbox').style.visibility="hidden"; /* If the function is called with the variable 'hide', hide the login box */
    }
  }
  function login_neww(showhide)
  {
       if(showhide == "show"){
        document.getElementById('popupbox').style.visibility="visible"; /* If the function is called with the variable 'show', show the login box */
    }else if(showhide == "hide"){
        document.getElementById('popupbox').style.visibility="hidden"; /* If the function is called with the variable 'hide', hide the login box */
    }
  }

  function clearText(field){
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;

}

function sub()
{
var elem = document.getElementById("txtpid").value;
var content_elem = document.getElementById("text_content").value;
if(elem=='')
{
   var elem = document.getElementById("text_content").value;
   document.write("<?php echo 'Processing!'; ?>");
   window.location = "http://industrialsupplyco.net/search.php?pg=1&stext="+elem;
//window.location = "http://industrialsupplyco.net/search.php";
//var elem = "text";
}else {

//alert(elem);
  document.write("<?php echo 'Processing!'; ?>");
  //window.location = "http://industrialsupplyco.net/search.php";
  window.location = "http://industrialsupplyco.net/proddetail.php?prod="+elem;
  }
}

