function go()
{
	document.location.href="produse.php?idcateg=<?=$idcateg?>";
}

function fereastra_poza(a,b,cale,produs,cod)
{
	var a,b,cale,produs,cod;
	document.open("poza.php?poza="+cale+"&produs="+produs+"&cod="+cod,"popwindow","width="+a+",height="+b+",top=335, left=435");
}

function cautaProdus()
{
	if(forma_cauta.cauta.value=="Cauta")
	{
		alert("Introduceti un cuvant de cautare !");
		return false;
	}
	
	if(forma_cauta.cauta.value=="Search" && forma_limba.limba.value=="EN")
	{
		alert("Please insert something to search !");
		return false;
	}
	
	if(forma_cauta.cauta.value=="")
	{
		alert("Introduceti un cuvant de cautare !");
		return false;
	}
	
	if(forma_cauta.cauta.value=="" && forma_limba.limba.value=="EN")
	{
		alert("Please insert something to search !");
		return false;
	}
	
	if(forma_cauta.cauta.value.length<2)
	{
		alert("Lungimea cuvantului cautat trebuie sa fie de cel putin 2 caractere !");
		return false;
	}
	
	if(forma_cauta.cauta.value.length<2 && forma_limba.limba.value=="EN")
	{
		alert("The length of the searched word must not be less than 2 characters !");
		return false;
	}
	
	//document.location.href="cauta.php?cauta="+forma_cauta.cauta.value;
	forma_cauta.submit();
}

function performAction(theForm, theAction)
{
	theForm.action = theAction;
	theForm.submit();
}

function UpdateTel()
{
	//document.getElementById("meniu").style.display="none";
                        
	//if(isIE())
		//document.getElementById("meniu").style.marginLeft="3px"; 
	//else
		//document.getElementById("meniu").style.marginLeft="3px"; 
}

function validareNewsletter()
{
	var filtru=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (!filtru.test(forma_newsletter.newsletter.value))
	{
		alert('Introduceti o adresa valida de E-mail!');
		forma_newsletter.newsletter.focus();
		return (false);
	}
	
	if (forma_newsletter.newsletter.value=="")
	{
		alert('Introduceti o adresa de E-mail!');
		forma_newsletter.newsletter.focus();
		return (false);
	}

	forma_newsletter.submit();
}

function playSound(sunet)
{
	document.all['BGSOUND_ID'].src=sunet;
	//self.document.Sunet.play()
}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function redirect()
{
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			//document.formular.codprodus.value = ajaxRequest.responseText;
			//document.getElementById("label_user").innerHTML = ajaxRequest.responseText;
			var check;
			check=ajaxRequest.responseText;
			if(check=="succes")
			window.open("http://www.obdtuning.ro");
		}
	}
	ajaxRequest.open("GET", "forum/includes/counter.php", true);
	ajaxRequest.send(null); 	
}

//---rollover effect APEX

var arrayOfRolloverClasses = new Array();
	var arrayOfClickClasses = new Array();
	var activeRow = false;
	var activeRowClickArray = new Array();
	
	function highlightTableRow()
	{
		var tableObj = this.parentNode;
		if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;

		if(this!=activeRow){
			this.setAttribute('origCl',this.className);
			this.origCl = this.className;
		}
		this.className = arrayOfRolloverClasses[tableObj.id];
		
		activeRow = this;
		
	}
	
	function clickOnTableRow()
	{
		var tableObj = this.parentNode;
		if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;		
		
		if(activeRowClickArray[tableObj.id] && this!=activeRowClickArray[tableObj.id]){
			activeRowClickArray[tableObj.id].className='';
		}
		this.className = arrayOfClickClasses[tableObj.id];
		
		activeRowClickArray[tableObj.id] = this;
				
	}
	
	function resetRowStyle()
	{
		var tableObj = this.parentNode;
		if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;

		if(activeRowClickArray[tableObj.id] && this==activeRowClickArray[tableObj.id]){
			this.className = arrayOfClickClasses[tableObj.id];
			return;	
		}
		
		var origCl = this.getAttribute('origCl');
		if(!origCl)origCl = this.origCl;
		this.className=origCl;
		
	}
		
	function addTableRolloverEffect(tableId,whichClass,whichClassOnClick)
	{
		arrayOfRolloverClasses[tableId] = whichClass;
		arrayOfClickClasses[tableId] = whichClassOnClick;
		
		var tableObj = document.getElementById(tableId);
		var tBody = tableObj.getElementsByTagName('TBODY');
		if(tBody){
			var rows = tBody[0].getElementsByTagName('TR');
		}else{
			var rows = tableObj.getElementsByTagName('TR');
		}
		for(var no=0;no<rows.length;no++){
			rows[no].onmouseover = highlightTableRow;
			rows[no].onmouseout = resetRowStyle;
			
			if(whichClassOnClick){
				rows[no].onclick = clickOnTableRow;	
			}
		}
		
	}
	
//----end rollover effect APEX

function hide_all()
{
	var divs, i, xReg;
	xReg = /^comanda/i;
	divs = document.getElementsByTagName("img");
	for (i=0;i<divs.length;i++)
		if( xReg.test(divs[i].id) )
			divs[i].style.display = 'none';
}

function show_comentarii()
{
		document.getElementById("tabela_comentarii").style.display='';
}