// functie generala de popup:
function LoadPopupBaseResize( url, w, h, namepop )
{
	if (!w) w=400;
	if (!h) h=400;
	if (!namepop) namepop="Popup";
  	win = window.open( url, namepop, 'scrollbars=yes, status=no, toolbar=0,menubar=0,titlebar=0,resizable=1, dependent=1, z-lock=1, width='+w+',height='+h );

	if ( !win )
	{
		alert('It appears that pop-up blockers are enabled on your computer, which may prevent\nsome components from functioning properly. Please temporarily disable any\npop-up blockers.\n\nTo disable the Windows XP pop-up blocker, from the Tools menu in Internet Explorer,\nselect Pop-up Blocker, then Turn Off Pop-up Blocker. To disable other pop-up blockers\nthat are part of a search engine or toolbar, right-click on a toolbar in Internet Explorer\nand click to deselect all toolbars except Standard Buttons, Address Bar, and Links.');
	}
	else
	{
		win.moveTo( screen.width/2-w/2, screen.height/2-h/2);
		win.focus();
	}
}
// functie generala de popup:
function LoadPopupBase( url, w, h, namepop )
{
	if (!w) w=400; 
	if (!h) h=400; 
	if (!namepop) namepop="Popup";
  	win = window.open( url, namepop, 'status=no,toolbar=0,scrollbars=1,menubar=0,titlebar=0,resizable=1,dependent=yes, z-lock=yes, width='+w+',height='+h );
 	
	if ( !win )
	{
		alert('It appears that pop-up blockers are enabled on your computer, which may prevent\nsome components from functioning properly. Please temporarily disable any\npop-up blockers.\n\nTo disable the Windows XP pop-up blocker, from the Tools menu in Internet Explorer,\nselect Pop-up Blocker, then Turn Off Pop-up Blocker. To disable other pop-up blockers\nthat are part of a search engine or toolbar, right-click on a toolbar in Internet Explorer\nand click to deselect all toolbars except Standard Buttons, Address Bar, and Links.');
	}	
	else
	{		
		win.moveTo( screen.width/2-w/2, screen.height/2-h/2);
		win.focus();
	}
}

function formatCurrency(num)
{
    //num = num.toString().replace(/\$|\,/g,'');
    if(isNaN(num))
    num = "0";
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num*100+0.50000000001);
    cents = num%100;
    num = Math.floor(num/100).toString();
    if(cents<10)
    cents = "0" + cents;

    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
    num = num.substring(0,num.length-(4*i+3))+','+
    num.substring(num.length-(4*i+3));

    var newnumber = ((sign)?'':'-') + num;
    //if ( cents != '00' ) newnumber += '.' + cents;
    newnumber += '.' + cents;
    return ( newnumber );
}

function selectAll( nameSelect, act ) 
 {
	var sel = document.getElementById( nameSelect ); 
	
	for( i = 0 ; i < sel.length ; i++ )
	{
		sel.options[i].selected = act;
	}
 }
 
 
// popup pentru manager de fisiere:
function popupMyFiles ( link_mfiles ) 
{
	return window.open( link_mfiles, "popMyFiles", "width=575, height=425, status=no");
}


// popup pentru vizualizare imagine:
function viewImage ( camp_imagine ) 
{
	var el = document.getElementById( camp_imagine ); 
	if ( el.value )
		return window.open( el.value, "Image", "width=575, height=425, status=no");
	else 
		return false;
}


// id-ul pentru campul de tip imagine:
var camp_imagine;

// preluare link imagine din popup-up:
function sendImage( link_fisier ) 
{
	if ( camp_imagine ) 
	{
		var el = document.getElementById( camp_imagine );
		el.value = link_fisier;
	}
	
	return false;
}
