function GetXmlHttpObject()
{
	var xmlHttp=null;
	try {xmlHttp=new XMLHttpRequest();}
	catch (e) {try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");} catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
	return xmlHttp;
}

function showResult(str)
{
	if (str.length==0)
	{
		document.getElementById("livesearch").innerHTML="";
		document.getElementById("livesearch").style.border="0px";
		return;
	}

	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}

	var url=site_url + '/search.php?q=' + str;
	xmlHttp.onreadystatechange=stateChanged ;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function hideResult()
{
	setTimeout("document.getElementById(\"livesearch\").innerHTML=\"\";",1000);
}

function stateChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById("livesearch").innerHTML=xmlHttp.responseText;
		document.getElementById("livesearch").style.border="1px solid #A5ACB2";
	}
}

function activateDeactivate(link, id)
{
	if (document.getElementById(id))
	{
		var i = document.getElementById(id).src;

		xmlHttp=GetXmlHttpObject()

		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request");
			return;
		}

		xmlHttp.open("GET",link,true);
		xmlHttp.send(null);

		var parts = new Array();
		parts = i.split('/');
		var image = parts[parts.length - 1];
		//alert(image);

		if (image == 'active.png'){document.getElementById(id).src = '../images/icons/inactive.png';}
		else document.getElementById(id).src = '../images/icons/active.png';
	}
}

function ShowHideMenu(id)
{
	if (document.getElementById('jd' + id).src == 'http://www.graficard.ro/images/icons/nolines_plus.gif')
	{
		document.getElementById('jd' + id).src = 'http://www.graficard.ro/images/icons/nolines_minus.gif';
		document.getElementById('dd' + id).style.display = '';
	}else
	{
		document.getElementById('jd' + id).src = 'http://www.graficard.ro/images/icons/nolines_plus.gif';
		document.getElementById('dd' + id).style.display = 'none';
	}
}

function comanda()
{
	document.cart_form.action = '&comanda=y';
	document.cart_form.submit();
}

function recalculeaza()
{
	document.cart_form.submit();
}