var xmlHttp
var space = /^[ \ ]*$/;

function showProducts1(ProductId)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="Include/productdetails.asp";
url=url+"?pid="+ProductId;
url=url+"&sid="+Math.random();
//alert(url);
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")  
	{   
		document.getElementById("popupMain").innerHTML=xmlHttp.responseText;
	}
}

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 showProducts(ProductId) 
{
	document.getElementById('backGray').style.display = "inline";
	//document.getElementById('backGray').style.height = screen.height - 170;
	document.getElementById('popupMain').style.display = "inline";

	if(screen.width > 1024)
	{
		if(screen.width == 1366)
		{
			leftpos= (screen.width / 4);
			toppos = (screen.height / 4)-100;
			screenwidth = screen.width-20;
			screenheight = screen.height -100;
		}
		else
		{
			leftpos= (screen.width / 4)+100;
			toppos = (screen.height / 4)-100;
			screenwidth = screen.width-20;
			screenheight = screen.height -100;
		}
	}
	else
	{
		leftpos= (screen.width / 4);
		toppos = (screen.height / 4)-100;
		screenwidth = screen.width -18;
		screenheight = screen.height -195;
	}
	
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		document.getElementById('popupMain').style.left = leftpos;
		document.getElementById('popupMain').style.top = toppos;
		document.getElementById('backGray').style.left = "0px";
		document.getElementById('backGray').style.top = "0px";
		document.getElementById('backGray').style.height = "1200px";

	}
	else
	{
		document.getElementById('popupMain').style.left = leftpos+"px";
		document.getElementById('popupMain').style.top = toppos+"px";
		document.getElementById('backGray').style.left = "0px";
		document.getElementById('backGray').style.top = "0px";
		document.getElementById('backGray').style.height = "1200px";
	}

	/*if(screen.width > 1024)
	{
		document.getElementById('popupMain').style.left = (screen.width / 2)-390+"px";
		document.getElementById('popupMain').style.top = (screen.height / 2)-290+"px";
	}*/
	showProducts1(ProductId);
}

function ClosePopUp()
{
	document.getElementById('backGray').style.display = "none";
	document.getElementById('popupMain').style.display = "none";
}
