// JavaScript Document

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
	// Firefox, Opera 8.0+, Safari
	xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
	// Internet Explorer
	try
	{
	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	}
	return xmlHttp;
}

function show(item_code, item_type){
	/*	item_type = 1 -- Pitol,  2 -- Furniture*/
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	var url = 'getItemDetails.php';
	var param = "item_code=" + item_code + "&item_type=" + item_type;
	//alert(url+param);
	/*xmlHttp.onreadystatechange = getItemDetailsReply;
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", param.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(param);*/
	window.location = url+"?"+param;
}

function getItemDetailsReply(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState==200)
	{
		var ss = xmlHttp.responseText;
		alert(ss);
		customFunctionCreateItem(false,300,200,100,50,ss)
	}
}
function customFunctionCreateItem(urlToExternalFile,width,height,left,top,ss)
	{		
		var divId3 = createNewWindow(width,height,left,top);
		document.getElementById('windowContent' + divId3).innerHTML = ss;			
		
	}
