nav = navigator.appName.indexOf("Microsoft")!= -1 ? 1 : 2;

function popup(url, name, width, height, scroll, modal, resizable) {
	width=Math.min(screen.availWidth,width);
	height=Math.min(screen.availHeight-40,height);
	var poz_x=(screen.availWidth-width)/2;
	var poz_y=(screen.availHeight-height-30)/2;
	newwin=window.open(url, name, 'scrollbars='+scroll+', menubar=no, width='+width+', height='+height+', resizable=no,toolbar=no, left='+poz_x+', top='+poz_y+', location=no, status=no');
	if(modal){
		popInt=setInterval(function(n){
			if(typeof(newwin.name)=="string"){
				if(newwin.document.body){
					openerfocus=function(){
						if(typeof(newwin.name)=="string"){
							newwin.focus();
						}else{
							document.body.onfocus=null;
						}
					}
					document.body.onfocus=openerfocus;
					newwin.window.document.body.onunload=function(){}
					newwin.focus();
					/*with(newwin){
						self.focus()
						opener.document.body.onfocus=function(){self.focus();opener.alert(4);}
						self.document.body.onunload=function(){opener.document.body.onfocus=null}
					}*/
					clearInterval(popInt);
				}
			}else{
				clearInterval(popInt)
			}
		},1)
	}
}



function setValueOfSumaRamburs(id,sum)
	{
	if (document.getElementById)
		document.getElementById(id).value = sum
	else if (document.all)
		return document.all.id.value = sum
	}

function changeElementClassName()
{
	x = getHtmlObject();
	/*x.style.height = x.offsetheight;
	x.style.lineHeight = x.offsetheight;*/
	/*x.className = "tdh1title";*/
	x.className = "tdh1title";
	
	if (x.clientHeight > 26 && x.clientHeight <= 44)
	{
		x.className = "tdh1title_2";
	}

if (x.clientHeight > 46)
	{
		x.className = "tdh1title_3";
	}


}


function getHtmlObject()
	{
	if (document.getElementById)
		return document.getElementById("tdh1_new");
	else if (document.all)
		return document.all.tdh1_new;
	}


function actDeactCasetaStrictInsirCuv(starechk){
	if (starechk == true)
	{
	
		if (document.getElementById)
			{
				if (document.getElementById("strict").disabled == true)
				{
					document.getElementById("strict").disabled = false;
				}
			}	
		else
			{
				if (document.all)
				{
					if (document.all.strict.disabled == true )
					{
						document.all.strict.disabled = false;
					}
				}
			}
			
	}
	else
	{
	
		
		if (document.getElementById)
			{
				if (document.getElementById("strict").disabled == false)
				{
					document.getElementById("strict").disabled = true;
				}
			}	
		else 
			{
			
				if (document.all)
				{
					if (document.all.strict.disabled == false )
					{
						document.all.strict.disabled = true;
					}
				}
			}
		
	}

}



function selecteazaMetodaDePlataCorelata(iteratie, nrcrt_transport, nrcrt_plata)
	{
		if (iteratie == nrcrt_transport)
		{
			debifeazaIncativeaza();

			//bifeaza metoda de plata urmarita
			var plataid1 = "aa11" + nrcrt_plata;
			document.finalizare.modalitate_plata[nrcrt_plata].checked = true;
			document.finalizare.modalitate_plata[nrcrt_plata].disabled = false;
			afiseazaCostulMetodeiDePlata(plataid1);
						
		}


	}

	function debifeazaIncativeaza()
		{
			
			var plataid = "";
			for (var i = 0; i < document.finalizare.modalitate_plata.length; i++)
			{
				plataid = "aa11" + i;
				if (document.finalizare.modalitate_plata[i].checked)
				{
					document.finalizare.modalitate_plata[i].checked = false;
				}
				if (document.finalizare.modalitate_plata[i].disabled == false)
				{
					document.finalizare.modalitate_plata[i].disabled = true;
				}
				ascundeCostulMetodeiDePlata(plataid);

			}
			
		}
				

function afiseazaCostulMetodeiDePlata(plataid1)
	{

	campul = eval("document.finalizare['"+plataid1+"']");

	if (campul.style.display == "none")
	{
		campul.style.display = "";
	}
}

function ascundeCostulMetodeiDePlata(plataid)
	{
		
		campul = eval("document.finalizare['"+plataid+"']");
		campul.style.display = "none";
		
	}

	function activeazaToate()
		{

			for (var i = 0; i < document.finalizare.modalitate_plata.length; i++)
				{
					plataid = "aa11" + i;
					if (document.finalizare.modalitate_plata[i].disabled == true)
					{
						document.finalizare.modalitate_plata[i].disabled = false;
					}
				}
		}

		