function arata_filtru(x)
{
	elx=locate_el(x);
	if(elx)
		{
			elx.style.display='block';
		}
}
function ascunde_filtru(x)
{
	elx=locate_el(x);
	if(elx)
		{
			elx.style.display='none';
		}
}


function selecteazatot()
{
	fel=locate_el('formmultipla');
	n=fel.elements.length;
	for(i=0; i<n; i++)
		{
			if(fel.elements[i].type)
				{
					if(fel.elements[i].type=='checkbox')
						{
							fel.elements[i].checked=true;
						}
				}
		}
}


function deselecteazatot()
{
	fel=locate_el('formmultipla');
	n=fel.elements.length;
	for(i=0; i<n; i++)
		{
			if(fel.elements[i].type)
				{
					if(fel.elements[i].type=='checkbox')
						{
							fel.elements[i].checked=false;
						}
				}
		}
}

function locate_elm(n, d)
	{
		var p,i,x;
		
		if(!d) d=document;
		
		if((p=n.indexOf("?"))>0&&parent.frames.length)
			{
				d=parent.frames[n.substring(p+1)].document;
				n=n.substring(0,p);
			}
		
		if(!(x=d[n])&&d.all)
		x=d.all[n];
		
		for (i=0;!x&&i<d.forms.length;i++)
		x=d.forms[i][n];
		
		for(i=0;!x&&d.layers&&i<d.layers.length;i++)
		x=locate_elm(n,d.layers[i].document);
		
		if(!x && d.getElementById)
		x=d.getElementById(n);
		
		return x;
	}
	


/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}



	
var cursor = {x:0, y:0};
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
	
	
function new_win_user(s, p, lang)
	{
			
		if(document.all)
			{
				sx=window.screenLeft;
				sy=window.screenTop;
			}
		else
			{
				sx=window.screenX;
				sy=window.screenY;
			}
			
		if(document.all)
			{
				if(document.compatMode == "CSS1Compat")
					{
						tx=document.body.parentNode.scrollLeft;
						ty=document.body.parentNode.scrollTop;
					}
				else
					{
						tx=document.body.scrollLeft;
						ty=document.body.scrollTop;
					}
			}
		else
			{
				tx=window.scrollX;
				ty=window.scrollY;
			}
		
		if(cursor.y<130)
			{
				y=10;
			}
		else
			{
				y=cursor.y-130;
			}
		if(cursor.x<380)
			{
				x=10;
			}
		else
			{
				x=cursor.x-380;
			}
		
		x=x+sx-tx;
		y=y+sy-ty;
  		window.open("pop.php?id="+s+"&pagina="+p+"&lang="+lang,"","WIDTH=600,HEIGHT=520, TOP="+y+" ,LEFT="+x+"");
	}
	

function new_win_user2(s, p, lang)
	{
			
		if(document.all)
			{
				sx=window.screenLeft;
				sy=window.screenTop;
			}
		else
			{
				sx=window.screenX;
				sy=window.screenY;
			}
			
		if(document.all)
			{
				if(document.compatMode == "CSS1Compat")
					{
						tx=document.body.parentNode.scrollLeft;
						ty=document.body.parentNode.scrollTop;
					}
				else
					{
						tx=document.body.scrollLeft;
						ty=document.body.scrollTop;
					}
			}
		else
			{
				tx=window.scrollX;
				ty=window.scrollY;
			}
		
		if(cursor.y<130)
			{
				y=10;
			}
		else
			{
				y=cursor.y-130;
			}
		if(cursor.x<380)
			{
				x=10;
			}
		else
			{
				x=cursor.x-380;
			}
		
		x=x+sx-tx;
		y=y+sy-ty;
  		window.open("pop2.php?id="+s+"&pagina="+p+"&lang="+lang,"","WIDTH=600,HEIGHT=600, TOP="+y+" ,LEFT="+x+"");
	}



	

function new_win_print(ucn)
	{
			
		if(document.all)
			{
				sx=window.screenLeft;
				sy=window.screenTop;
			}
		else
			{
				sx=window.screenX;
				sy=window.screenY;
			}
			
		if(document.all)
			{
				if(document.compatMode == "CSS1Compat")
					{
						tx=document.body.parentNode.scrollLeft;
						ty=document.body.parentNode.scrollTop;
					}
				else
					{
						tx=document.body.scrollLeft;
						ty=document.body.scrollTop;
					}
			}
		else
			{
				tx=window.scrollX;
				ty=window.scrollY;
			}
		
		if(cursor.y<130)
			{
				y=10;
			}
		else
			{
				y=cursor.y-130;
			}
		if(cursor.x<380)
			{
				x=10;
			}
		else
			{
				x=cursor.x-380;
			}
		
		x=x+sx-tx;
		y=y+sy-ty;
  		window.open("print?ucn="+ucn, "", "WIDTH=620,HEIGHT=520, scrollbars=yes, TOP="+y+" ,LEFT="+x+"");
	}

function new_win_print_factura_admin(id_factura)
	{
			
		if(document.all)
			{
				sx=window.screenLeft;
				sy=window.screenTop;
			}
		else
			{
				sx=window.screenX;
				sy=window.screenY;
			}
			
		if(document.all)
			{
				if(document.compatMode == "CSS1Compat")
					{
						tx=document.body.parentNode.scrollLeft;
						ty=document.body.parentNode.scrollTop;
					}
				else
					{
						tx=document.body.scrollLeft;
						ty=document.body.scrollTop;
					}
			}
		else
			{
				tx=window.scrollX;
				ty=window.scrollY;
			}
		
		if(cursor.y<130)
			{
				y=10;
			}
		else
			{
				y=cursor.y-130;
			}
		if(cursor.x<380)
			{
				x=10;
			}
		else
			{
				x=cursor.x-380;
			}
		
		x=x+sx-tx;
		y=y+sy-ty;
  		window.open("print-factura-admin?id="+id_factura, "", "WIDTH=620,HEIGHT=520, scrollbars=yes, TOP="+y+" ,LEFT="+x+"");
	}
	
function new_win_print_factura(id_factura)
	{
			
		if(document.all)
			{
				sx=window.screenLeft;
				sy=window.screenTop;
			}
		else
			{
				sx=window.screenX;
				sy=window.screenY;
			}
			
		if(document.all)
			{
				if(document.compatMode == "CSS1Compat")
					{
						tx=document.body.parentNode.scrollLeft;
						ty=document.body.parentNode.scrollTop;
					}
				else
					{
						tx=document.body.scrollLeft;
						ty=document.body.scrollTop;
					}
			}
		else
			{
				tx=window.scrollX;
				ty=window.scrollY;
			}
		
		if(cursor.y<130)
			{
				y=10;
			}
		else
			{
				y=cursor.y-130;
			}
		if(cursor.x<380)
			{
				x=10;
			}
		else
			{
				x=cursor.x-380;
			}
		
		x=x+sx-tx;
		y=y+sy-ty;
  		window.open("print-factura?id="+id_factura, "", "WIDTH=620,HEIGHT=520, scrollbars=yes, TOP="+y+" ,LEFT="+x+"");
	}
	
	
function new_win_print_nir(id_factura)
	{
			
		if(document.all)
			{
				sx=window.screenLeft;
				sy=window.screenTop;
			}
		else
			{
				sx=window.screenX;
				sy=window.screenY;
			}
			
		if(document.all)
			{
				if(document.compatMode == "CSS1Compat")
					{
						tx=document.body.parentNode.scrollLeft;
						ty=document.body.parentNode.scrollTop;
					}
				else
					{
						tx=document.body.scrollLeft;
						ty=document.body.scrollTop;
					}
			}
		else
			{
				tx=window.scrollX;
				ty=window.scrollY;
			}
		
		if(cursor.y<130)
			{
				y=10;
			}
		else
			{
				y=cursor.y-130;
			}
		if(cursor.x<380)
			{
				x=10;
			}
		else
			{
				x=cursor.x-380;
			}
		
		x=x+sx-tx;
		y=y+sy-ty;
  		window.open("print-nir?id="+id_factura, "", "WIDTH=620,HEIGHT=520, scrollbars=yes, TOP="+y+" ,LEFT="+x+"");
	}
	


function UpdateCursorPosition(e)
	{
		cursor.x = e.pageX;
		cursor.y = e.pageY;
	}
function UpdateCursorPositionDocAll(e)
	{
		cursor.x = event.clientX;
		cursor.y = event.clientY;
	}// JavaScript Document
	
	
	

jQuery(document).ready(function () 
{
	nr_bannv=jQuery("#nr_bann").val();
	if(nr_bannv>3)
		{
			jQuery("#eden_prev_spec").click(function () {
				b_move_left();
			});
			jQuery("#eden_next_spec").click(function () {
				b_move_right();
			});
		}
	jQuery('a[rel=jqlb]').lightBox();
}
);


function b_move_right()
{
	ml=jQuery("#m_left").val();
	nr_bannv=jQuery("#nr_bann").val();
	
	m_n=parseInt(ml);
	n_b=parseInt(nr_bannv);
	max_ml=(n_b-3)*(-310);
	
	if(max_ml<m_n)
		{
			ml_nou=parseInt(ml)-310;
			jQuery("#eden_bann").animate( { marginLeft: ml_nou.toString()+"px" }, 1000);
			ml=jQuery("#m_left").val(ml_nou.toString());
		}
	else
		{
			ml_nou=0;
			jQuery("#eden_bann").animate( { marginLeft: ml_nou.toString()+"px" }, 1000);
			ml=jQuery("#m_left").val(ml_nou.toString());

		}
}
function b_move_left()
{
	ml=jQuery("#m_left").val();
	nr_bannv=jQuery("#nr_bann").val();
	
	m_n=parseInt(ml);
	n_b=parseInt(nr_bannv);
	max_ml=(n_b-3)*(-310);
	
	if(m_n<0)
		{
			ml_nou=parseInt(ml)+310;
			jQuery("#eden_bann").animate( { marginLeft: ml_nou.toString()+"px" }, 1000);
			ml=jQuery("#m_left").val(ml_nou.toString());
		}
	else
		{
			ml_nou=max_ml;
			jQuery("#eden_bann").animate( { marginLeft: ml_nou.toString()+"px" }, 1000);
			ml=jQuery("#m_left").val(ml_nou.toString());

		}
}
