function AddToFavorites(title,url)
{
	if (window.sidebar) { // Mozilla Firefox Bookmark
	window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
	window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
	return true; }
}

function search(_ca,lang,what)
{
	var the_path = _ca+lang+"/"+what;

	var companie		= document.getElementById('companie').value;
	var judet			= document.getElementById('judet').value;
	var localitate		= document.getElementById('localitate').value;
	var caen			= document.getElementById('caen').value;

	var minca			= document.getElementById('minca').value;
	var maxca			= document.getElementById('maxca').value;

	var minna			= document.getElementById('minna').value;
	var maxna			= document.getElementById('maxna').value;

	if(companie) the_path+= "/companie/"+companie;
	if(judet) the_path+= "/judet/"+judet;
	if(localitate) the_path+= "/localitate/"+localitate;
	if(caen) the_path+= "/caen/"+caen;

	if(minca) the_path+= "/minca/"+minca;
	if(maxca) the_path+= "/maxca/"+maxca;

	if(minna) the_path+= "/minna/"+minna;
	if(maxna) the_path+= "/maxna/"+maxna;

	document.location = the_path;
}

function search_produse(_ca,lang,what)
{
	var the_path = _ca+lang+"/"+what;

	var nume_produs		= document.getElementById('nume_produs').value;

	if(nume_produs) the_path+= "/nume/"+nume_produs;

	document.location = the_path;
}

function filtreaza_date(value)
{
	return trim(value);
}

function taburi_search(id_vizibil,cale_img,img_buton)
{
	document.getElementById('cautare_produse').style.display="none";
	document.getElementById('buton_produse').src=cale_img+"/"+"buton_produse"+"_off.gif";

	document.getElementById('cautare_companii').style.display="none";
	document.getElementById('buton_companie').src=cale_img+"/"+"buton_companie"+"_off.gif";

	document.getElementById('cautare_persoane').style.display="none";
	document.getElementById('buton_persoane').src=cale_img+"/"+"buton_persoane"+"_off.gif";
	

	document.getElementById(img_buton).src=cale_img+"/"+img_buton+"_on.gif";
	document.getElementById(id_vizibil).style.display="";
}

function search_persoane(_ca,lang,what)
{
	var the_path = _ca+lang+"/"+what;

	var nume	= document.getElementById('nume').value;
	var prenume = document.getElementById('prenume').value;

	if(nume)	the_path+= "/nume/"+nume;
	if(prenume) the_path+= "/prenume/"+prenume;

	document.location = the_path;
}

function paginatia(event,linkp1,pagina,linkp2)
{
	if(event.keyCode == 13)
	{	
		//alert(pagina);
		var pagina = document.getElementById('pagina').value;
		if(pagina<1) pagina = 1;
		if(pagina>5000) pagina = 1;

		document.location = linkp1+pagina+"/"+linkp2;
	}
}

function sari_la_pagina(linkp1,pagina,linkp2)
{
	if(pagina<1) pagina = 1;
	if(pagina>2000) pagina = 1;

	document.location = linkp1+pagina+"/"+linkp2;
}
