var xmlHttp

var htotalms = 400;
var hstep = 15;
var hh = 250;
var hms = Math.floor((htotalms*hstep)/hh);

function incHeight()
{
	var hact = document.getElementById("produse_details").style.height;
	
	hact = hact.substr(0,hact.length-2);
	hact = parseInt(hact,0)+hstep;
	document.getElementById("produse_details").style.height = hact+"px";
	if (hact<hh) to = setTimeout("incHeight()", hms);
}

function decHeight()
{
	var hact = document.getElementById("produse_details").style.height;
	hact = hact.substr(0,hact.length-2);
	hact = parseInt(hact,0)-hstep;
	if (hact>0) document.getElementById("produse_details").style.height = hact+"px";
	if (hact>0) to = setTimeout("decHeight()", hms);
	else 
	{
		document.getElementById("hattercseres").style.backgroundColor = '';
		document.getElementById("produse_details").style.display = "none";
		document.getElementById("produse_details").style.height = "0px";
	}
}

function CloseDetails()
{
	var to = setTimeout("decHeight()", 1);
}

function showContainer()
{
	document.getElementById("produse_details").style.display = "";
	document.getElementById("produse_details").style.height = "10px";
	
	var to = setTimeout("incHeight()", 1);
}

function ShowDetails(str, lnggg)
{ 
	document.getElementById("hattercseres").style.backgroundColor = '#FFFFFF';
	if (document.getElementById("produse_details").style.display == "none") showContainer();
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="http://www.corund-ceramica.ro/detalii.php";
	url=url+"?productid="+str;
	url=url+"&langgg="+lnggg;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{
		document.getElementById("product_details").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;
}
