
	function OpenDateBrowser(root,obj)
	{
		var ret = null;
		var myBox = document.getElementById(obj);
		try
		{			
			ret = window.showModalDialog(root + 'Util/DateBrowser.aspx?value=' + escape(obj.value),'DateBrowser','status:no; resizable:yes; help:no; dialogWidth:240px; dialogHeight:300px; center:yes;scroll:no;');
			if(ret!=null)
			{
				myBox.value=ret;
			}
		}
		catch (ex)
		{
			alert("Popups are blocked for this site, you need to enable popups to access this function.");
		}		
		return false;
	}
	
	var iTimeoutId = null;
	var sleep = false;

	function OnClick(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12)
	{
		iTimeoutId = setTimeout('Sleep();', 500);
		
		var quantity = document.getElementById('quantity');
		var unit = document.getElementById('unit');
		var unitprice = document.getElementById('unitprice');
		var total = document.getElementById('total');
		var increase = document.getElementById('increase');
		var avgTrunc = document.getElementById('avgTrunc');
		var AssortmentNo = document.getElementById('AssortmentNo');
		var obstructionGrowth = document.getElementById('obstructionGrowth');
		var driveDistance = document.getElementById('driveDistance');
		var movingDistance = document.getElementById('movingDistance');
		var ownLumberVolume = document.getElementById('ownLumberVolume');
		
			
		quantity.innerHTML = s1;
		unit.innerHTML = s2;
		unitprice.innerHTML = s3;
		total.innerHTML = s4;
		increase.innerHTML = s5;
		
		avgTrunc.innerHTML = s6;
		AssortmentNo.innerHTML = s7;
		obstructionGrowth.innerHTML = s8;
		driveDistance.innerHTML = s9;
		movingDistance.innerHTML = s10;
		ownLumberVolume.innerHTML = s11;
	
				
	}
	
	function OnDblClick(URL)
	{
		window.clearTimeout(iTimeoutId);
		window.location = URL;
	}
	
	function Sleep()
	{
		sleep = "true";
	}
	
	

	function calendarPicker(strField, strDaysDelay)
	{
		var currentForm = document.forms[0].id;
		var as = document.getElementsByTagName('input');
		
		for(var i=0;i<as.length;i++)
		{
								
			if( as[i].id.match(strField))
			{
				var tbName = as[i].id;
			}
		}
		var formandname = currentForm + '.' + tbName;
		
		window.open('DatePicker.aspx?field=' + formandname+ '&delay='+strDaysDelay,'calendarPopup','width=260,height=290,top=200,left=350,location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no');
	}
	
	function calendarPicker2(strField, strField2, strDaysDelay)
	{
		var currentForm = document.forms[0].id;
		var as = document.getElementsByTagName('input');
		
		for(var i=0;i<as.length;i++)
		{
								
			if( as[i].id.match(strField))
			{
				var tbName = as[i].id;
			}
			if( as[i].id.match(strField2))
			{
				var tbName2 = as[i].id;
			}
			
		}
		var formandname = currentForm + '.' + tbName;
		var formandname2 = currentForm + '.' + tbName2;
		
		window.open('DatePicker.aspx?field=' + formandname+ '&field2='+formandname2 + '&delay='+strDaysDelay,'calendarPopup','width=260,height=290,top=200,left=350,location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no');
	}
	
	function AttachFiles(URL)
	{
	  window.open(URL,'filelist','width=780,height=400,top=200,left=350,location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no');
	}
	function AttachFilesEWF(URL)
	{
	  window.open(URL,'filelist','width=780,height=400,top=200,left=200,location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no');
	}
	/*
function OpenActionCodePicker(ctl,ctlValue,w,h, iActionCodeFunctionId, sPD, sEntityId, sContractYear, sOriginCode, sTaskCode, sAuthorityLevel, sMode, returnTxt)
{
    var PopupWindow=null;
    
    settings="width=" + w + ",height=" + h + ",top=200,left=350,location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=no,dependent=no";
    PopupWindow=window.open("../templates/ActionCodePicker.aspx?Ctl=" + ctl + "&sActionCode=" + ctlValue + "&iActionCodeFunctionId=" + iActionCodeFunctionId + "&sPD=" + sPD + "&sEntityId=" + sEntityId + "&sContractYear=" + sContractYear + "&sOriginCode=" + sOriginCode + "&sTaskCode=" + sTaskCode +  "&sAuthorityLevel=" + sAuthorityLevel + "&sMode=" + sMode + "&returnTxt=" + returnTxt ,'DatePicker', settings);
    PopupWindow.focus();
}*/
function OpenActionCodePicker(ctl,ctlValue,w,h, iActionCodeFunctionId, sPD, sEntityId, sContractYear, sOriginCode, sTaskCode, sAuthorityLevel, sMode, returnTxt)
{
	var PopupWindow=null;

	settings="width=" + w + ",height=" + h + ",top=200,left=350,location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=no,dependent=no";
	PopupWindow=window.open("../templates/ActionCodePicker.aspx?Ctl=" + ctl + "&sActionCode=" + ctlValue + "&iActionCodeFunctionId=" + iActionCodeFunctionId + "&sPD=" + sPD + "&sEntityId=" + sEntityId + "&sContractYear=" + sContractYear + "&sOriginCode=" + sOriginCode + "&sTaskCode=" + sTaskCode + "&sAuthorityLevel=" + sAuthorityLevel + "&sMode=" + sMode + "&returnTxt=" + returnTxt ,'DatePicker', settings);
	PopupWindow.focus();
}


