Solved

Hide Field in CRM 4 Form

Posted on 2011-03-15
17
1,428 Views
Last Modified: 2012-05-11
I need to hide a field called currencytransactionid or the label name is currency in a MSFT CRM 4 form.  I have a attached the javascript that we run onload and was not sure how or where to hide the field.  Any help would be appreciated.
0
Comment
Question by:bduenges
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 7
17 Comments
 

Author Comment

by:bduenges
ID: 35141949
Here is the file
Deal-Screen-on-Load.txt
0
 
LVL 7

Expert Comment

by:stacko111
ID: 35142151
Try putting this code in the onLoad event of the Form. You can put it anywhere but I would put it at the top for ease:

//Hide Currency Field
crmForm.all.currencytransactionid_c.style.visibility = 'hidden';
crmForm.all.currencytransactionid_d.style.visibility = 'hidden';
0
 

Author Comment

by:bduenges
ID: 35142177
Thanks.  when I add the code and preview the form I receive the following error:

Field: window
Event: onload
error: 'crmform.all.currencytransactionid_c.style'is null or not an object
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 7

Expert Comment

by:stacko111
ID: 35142191
That would suggest the field isn't on the form, are you sure it is on there? Is it called something else?
0
 
LVL 1

Expert Comment

by:smartapp
ID: 35142194
Hi,

To hide this field add these lines :

crmForm.all.currencytransactioni_c.style.display = 'none';
crmForm.all.currencytransactioni_d.style.display = 'none';
0
 

Author Comment

by:bduenges
ID: 35147590
I have verified that the field is there.  I have also tried what smartapp suggested.  The error I receive now that crmform is undefined.
0
 
LVL 7

Expert Comment

by:stacko111
ID: 35147897
Can you post the full code for the onload event with the new code so I can check please.
0
 

Author Comment

by:bduenges
ID: 35147922
I have attached the code.

Thanks

/*Business Solution Partners - Deal OnLoad script*/



crmForm.all.currencytransactionid_c.style.display = 'none';
crmForm.all.currencytransactionid_d.style.display = 'none';


var ayr_upfrontcost = 0;
var ayr_upfrontcost2 = 0;
var ayr_upfrontcost3 = 0;
var ayr_upfrontcost4 = 0;
var ayr_upfrontcost5 = 0;
var ayr_upfrontcost6 = 0;
var ayr_upfrontcost7 = 0;
var ayr_upfrontcost8 = 0;
var ayr_upfrontcost9 = 0;
var ayr_upfrontcost10 = 0;
var ayr_bidperaircraft = 0;
var ayr_bidperaircraft2 = 0;
var ayr_bidperaircraft3 = 0;
var ayr_bidperaircraft4 = 0;
var ayr_bidperaircraft5 = 0;
var ayr_bidperaircraft6 = 0;
var ayr_bidperaircraft7 = 0;
var ayr_bidperaircraft8 = 0;
var ayr_bidperaircraft9 = 0;
var ayr_bidperaircraft10 = 0;
var ayr_leaseratevalue = 0;
var ayr_leaseratevalue2 = 0;
var ayr_leaseratevalue3 = 0;
var ayr_leaseratevalue4 = 0;
var ayr_leaseratevalue5 = 0;
var ayr_leaseratevalue6 = 0;
var ayr_leaseratevalue7 = 0;
var ayr_leaseratevalue8 = 0;
var ayr_leaseratevalue9 = 0;
var ayr_leaseratevalue10 = 0;
var ayr_numberofaircraftdealid = 0;
var createToolbarCustomButtonsExecuted = false;
var UPDATETYPE = 2;
var READONLY = 3;
var DISABLED = 4;
var QUICKCREATE = 5;
var grandTotalsStyle = "";

//remove sales process nav item
var navnavSalesProcess = document.getElementById("navSalesProcess");
if (navnavSalesProcess != null) {
	var lbArea = navnavSalesProcess.parentNode;
	if (lbArea != null) {
		lbArea.removeChild(navnavSalesProcess);}
}

//remove activity nav item
/*
var navActivities = document.getElementById("navActivities");
if (navActivities != null) {
	var lbArea = navActivities.parentNode;
	if (lbArea != null) {
		lbArea.removeChild(navActivities);}
}
*/

/*
Tasks_OnClick = function(action) {	
	switch(action) {
    case 1 :
    case 2 :
			var name = "";
			if (crmForm.all.name != null) {
				name = crmForm.all.name.DataValue;
				
			}
			var url = "/AircastleLimited/activities/task/edit.aspx?pId=" + crmForm.ObjectId + "&pType=" + crmForm.ObjectTypeCode + "&pName=" + name + "&pAction=" + action;
			alert(crmForm.ObjectId + " : " +crmForm.ObjectTypeCode + " : " + name + " :" +action )
			winRef = window.open(url,'', 'width=820,height=560');
		break;
	case 3 :
	case 4 :
	
			var msg = "";
			if(action == 3){
				msg = "No Status Update Tasks Exist";
			}else{msg = "No Recent Pricing Tasks Exist";}
			var url = "/_bsp/web/GetActivityTaskId.aspx?Id=" + crmForm.ObjectId + "&action=" + (action - 2);
            if (typeof ActiveXObject != 'undefined') 
            {
            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
            xmlDoc.async = false; 
            xmlDoc.load(url); 
            //var getname = xmlDoc.documentElement.getElementsByTagName("activityId");
            var getname = xmlDoc.getElementsByTagName('activityId'); 
            }
            var oXmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");  
			oXmlHTTP.Open("GET",url, false,"crmadmin","Aircastle1");  
			oXmlHTTP.Send();
			var activityId = oXmlHTTP.responseXML.selectSingleNode("activityId"); 
			if(activityId != null){
				if(activityId.text != "00000000-0000-0000-0000-000000000000"){
					var url = "/activities/task/edit.aspx?Id=" + activityId.text;
					winRef = window.open(url,'', 'width=820,height=560');
				}else{alert(msg);}
			}else{alert('Call Failed!');
			}

		break;
	default :
		break;
  }	
	
}

function CreateToolbarCustomButtons() {
	if (createToolbarCustomButtonsExecuted) {
		return;
	}
	var toolbar = document.all.mnuBar1.rows(0).cells(0);
	if(crmForm.FormType == UPDATETYPE){
		var statushtml = "<IMG src='/_imgs/mnu_hSpacer.gif'><SPAN tabindex='0' class='menu' style='padding:3px 3px 0px 3px' pl='3' pr='3' title='Add Status Update' onclick='Tasks_OnClick(1)' id='btnStatusUpdate'><DIV class='mnuBtn'><IMG src='/_imgs/ico_16_134.gif' class='mnuBtn'>Add Status Update</DIV></SPAN>";
		toolbar.insertAdjacentHTML("beforeEnd", statushtml);
		
		var pricinghtml = "<IMG src='/_imgs/mnu_hSpacer.gif'><SPAN tabindex='0' class='menu' style='padding:3px 3px 0px 3px' pl='3' pr='3' title='Add Pricing File' onclick='Tasks_OnClick(2)' id='btnPricing'><DIV class='mnuBtn'><IMG src='/_imgs/ico_16_1022.gif' class='mnuBtn'>Add Pricing File</DIV></SPAN>";
		toolbar.insertAdjacentHTML("beforeEnd", pricinghtml);
	}
	var recentstatushtml = "<IMG src='/_imgs/mnu_hSpacer.gif'><SPAN tabindex='0' class='menu' style='padding:3px 3px 0px 3px' pl='3' pr='3' title='Display Latest Status' onclick='Tasks_OnClick(3)' id='btnRecentStatusUpdate'><DIV class='mnuBtn'><IMG src='/_imgs/ico_16_134.gif' class='mnuBtn'>Display Latest Status</DIV></SPAN>";
	toolbar.insertAdjacentHTML("beforeEnd", recentstatushtml);
	
	var recentpricinghtml = "<IMG src='/_imgs/mnu_hSpacer.gif'><SPAN tabindex='0' class='menu' style='padding:3px 3px 0px 3px' pl='3' pr='3' title='Display Latest Pricing' onclick='Tasks_OnClick(4)' id='btnRecentPricing'><DIV class='mnuBtn'><IMG src='/_imgs/ico_16_1022.gif' class='mnuBtn'>Display Latest Pricing</DIV></SPAN>";
	toolbar.insertAdjacentHTML("beforeEnd", recentpricinghtml);

	createToolbarCustomButtonsExecuted = true;
}

*/

//Hide Show ayr_remarketid
/*
var fnHideShowFields = function(){
	var dealstatus = "";
	var typeofopportunity = "";
	
	//Get the dropdown custom fields text
	if (crmForm.all.new_typeofopportunity != null) {
		typeofopportunity = crmForm.all.new_typeofopportunity.SelectedText;
	}
	if (crmForm.all.ayr_dealstatus != null) {
		dealstatus = crmForm.all.ayr_dealstatus.SelectedText;
	}
	
	var hideValues = (dealstatus=="AYR Remarketing Aircraft") || (typeofopportunity=="Purchase w/o Lease");
	var displayStyle = hideValues ? "" : "none";

	if(crmForm.all.ayr_remarketid != null) { 
		crmForm.all.ayr_remarketid.style.display = displayStyle;
		if(crmForm.all.ayr_remarketid_c != null){
			crmForm.all.ayr_remarketid_c.style.display = displayStyle;}
		if(crmForm.all.ayr_remarketid_d != null){
		crmForm.all.ayr_remarketid_d.style.display = displayStyle;}
		if(crmForm.FormType ==QUICKCREATE){
			crmForm.all.ayr_remarketid.parentElement.parentElement.style.display= displayStyle;}
	} 
	
}

*/

//Hide Show Pricing Section for Aircraft 1
var fnHideShowSections_1 = function(){
	HideShowPriceSection(1);
	HideShowDealTotals();
}
//Hide Show Pricing Section for Aircraft 2
var fnHideShowSections_2 = function(){
	HideShowPriceSection(2);
	HideShowDealTotals();
}
//Hide Show Pricing Section for Aircraft 3
var fnHideShowSections_3 = function(){
	HideShowPriceSection(3);
	HideShowDealTotals();
}
//Hide Show Pricing Section for Aircraft 4
var fnHideShowSections_4 = function(){
	HideShowPriceSection(4);
	HideShowDealTotals();
}
//Hide Show Pricing Section for Aircraft 5
var fnHideShowSections_5 = function(){
	HideShowPriceSection(5);
	HideShowDealTotals();
}
//Hide Show Pricing Section for Aircraft 6
var fnHideShowSections_6 = function(){
	HideShowPriceSection(6);
	HideShowDealTotals();
}
//Hide Show Pricing Section for Aircraft 7
var fnHideShowSections_7 = function(){
	HideShowPriceSection(7);
	HideShowDealTotals();
}
//Hide Show Pricing Section for Aircraft 8
var fnHideShowSections_8 = function(){
	HideShowPriceSection(8);
	HideShowDealTotals();
}
//Hide Show Pricing Section for Aircraft 9
var fnHideShowSections_9 = function(){
	HideShowPriceSection(9);
	HideShowDealTotals();
}
//Hide Show Pricing Section for Aircraft 10
var fnHideShowSections_10 = function(){
	HideShowPriceSection(10);
	HideShowDealTotals();
}
function HideShowPriceSection(section){
	var dealpriced = "";
	
	switch(section) {
    case 1 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_dealpriced != null) {
			dealpriced = crmForm.all.ayr_dealpriced.SelectedText;
		}
		var hideValues = (dealpriced=="No") || (dealpriced=="");
		var displayStyle = hideValues ? "none" : "";
		if(crmForm.all.ayr_msn_c != null){
			crmForm.all.ayr_msn_c.parentElement.parentElement.parentElement.style.display= displayStyle;
			crmForm.all.ayr_maintenancereserves_d.style.display = displayStyle;
			crmForm.all.ayr_etoextoption_d.style.display = displayStyle;
			crmForm.all.ayr_securitydeposit_d.style.display = displayStyle;
			crmForm.all.ayr_financialadjustments_d.style.display = displayStyle;}
		
		if(hideValues)
		{
			//clear all pricing fields
			crmForm.all.ayr_msn.DataValue = null;
			crmForm.all.ayr_registrationnumber.DataValue = null;
			crmForm.all.ayr_bidperaircraft.DataValue = null;
			crmForm.all.ayr_totalcapital.DataValue = null;
			crmForm.all.ayr_maintenancereserves.DataValue = null;
			crmForm.all.ayr_financialadjustments.DataValue = null;
			crmForm.all.ayr_etoextoption.DataValue = null;
			crmForm.all.ayr_biddeadline.DataValue = null;
			crmForm.all.ayr_securitydeposit.DataValue = null;
			crmForm.all.ayr_securitydepositamount.DataValue = null;
			crmForm.all.ayr_leaseratefactor.DataValue = null;
			crmForm.all.ayr_upfrontcost.DataValue = null;
			crmForm.all.ayr_unleveredirr.DataValue = null;
			crmForm.all.ayr_1styearcashyld.DataValue = null;
			crmForm.all.ayr_1styeareconyld.DataValue = null;
			crmForm.all.ayr_annualdeprc.DataValue = null;
			crmForm.all.ayr_residualvalue.DataValue = null;
	
			
			//recalculate Grand totals
			fnGrandTotalUpfrontCost();
			fnGrandTotalBidPrice();
		}
		
	break;

    case 2 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_dealpriced2 != null) {
			dealpriced = crmForm.all.ayr_dealpriced2.SelectedText;
		}
		var hideValues = (dealpriced=="No") || (dealpriced=="");
		var displayStyle = hideValues ? "none" : "";
		if(crmForm.all.ayr_msn2_c != null){
		crmForm.all.ayr_msn2_c.parentElement.parentElement.parentElement.style.display= displayStyle;
		crmForm.all.ayr_maintenancereserves2_d.style.display = displayStyle;
		crmForm.all.ayr_etoextoption2_d.style.display = displayStyle;
		crmForm.all.ayr_securitydeposit2_d.style.display = displayStyle;
		crmForm.all.ayr_financialadjustments2_d.style.display = displayStyle;}
		
		if(hideValues)
		{
			//clear all pricing fields
			crmForm.all.ayr_msn2.DataValue = null;
			crmForm.all.ayr_registrationnumber2.DataValue = null;
			crmForm.all.ayr_bidperaircraft2.DataValue = null;
			crmForm.all.ayr_totalcapital2.DataValue = null;
			crmForm.all.ayr_maintenancereserves2.DataValue = null;
			crmForm.all.ayr_financialadjustments2.DataValue = null;
			crmForm.all.ayr_etoextoption2.DataValue = null;
			crmForm.all.ayr_biddeadline2.DataValue = null;
			crmForm.all.ayr_securitydeposit2.DataValue = null;
			crmForm.all.ayr_securitydepositamount2.DataValue = null;
			crmForm.all.ayr_leaseratefactor2.DataValue = null;
			crmForm.all.ayr_upfrontcost2.DataValue = null;
			crmForm.all.ayr_unleveredirr2.DataValue = null;
			crmForm.all.ayr_1styearcashyld2.DataValue = null;
			crmForm.all.ayr_1styeareconyld2.DataValue = null;
			crmForm.all.ayr_annualdeprc2.DataValue = null;
			crmForm.all.ayr_residualvalue2.DataValue = null;
			
			//recalculate Grand totals
			fnGrandTotalUpfrontCost();
			fnGrandTotalBidPrice();
		}
    break;

   case 3 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_dealpriced3 != null) {
			dealpriced = crmForm.all.ayr_dealpriced3.SelectedText;
		}
		var hideValues = (dealpriced=="No") || (dealpriced=="");
		var displayStyle = hideValues ? "none" : "";
		if(crmForm.all.ayr_msn3_c != null){
		crmForm.all.ayr_msn3_c.parentElement.parentElement.parentElement.style.display= displayStyle;
		crmForm.all.ayr_maintenancereserves3_d.style.display = displayStyle;
		crmForm.all.ayr_etoextoption3_d.style.display = displayStyle;
		crmForm.all.ayr_securitydeposit3_d.style.display = displayStyle;
		crmForm.all.ayr_financialadjustments3_d.style.display = displayStyle;}
		
		if(hideValues)
		{
			//clear all pricing fields
			crmForm.all.ayr_msn3.DataValue = null;
			crmForm.all.ayr_registrationnumber3.DataValue = null;
			crmForm.all.ayr_bidperaircraft3.DataValue = null;
			crmForm.all.ayr_totalcapital3.DataValue = null;
			crmForm.all.ayr_maintenancereserves3.DataValue = null;
			crmForm.all.ayr_financialadjustments3.DataValue = null;
			crmForm.all.ayr_etoextoption3.DataValue = null;
			crmForm.all.ayr_biddeadline3.DataValue = null;
			crmForm.all.ayr_securitydeposit3.DataValue = null;
			crmForm.all.ayr_securitydepositamount3.DataValue = null;
			crmForm.all.ayr_leaseratefactor3.DataValue = null;
			crmForm.all.ayr_upfrontcost3.DataValue = null;
			crmForm.all.ayr_unleveredirr3.DataValue = null;
			crmForm.all.ayr_1styearcashyld3.DataValue = null;
			crmForm.all.ayr_1styeareconyld3.DataValue = null;
			crmForm.all.ayr_annualdeprc3.DataValue = null;
			crmForm.all.ayr_residualvalue3.DataValue = null;
			
			//recalculate Grand totals
			fnGrandTotalUpfrontCost();
			fnGrandTotalBidPrice();
		}
	break;

   case 4 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_dealpriced4 != null) {
			dealpriced = crmForm.all.ayr_dealpriced4.SelectedText;
		}
		var hideValues = (dealpriced=="No") || (dealpriced=="");
		var displayStyle = hideValues ? "none" : "";
		if(crmForm.all.ayr_msn4_c != null){
		crmForm.all.ayr_msn4_c.parentElement.parentElement.parentElement.style.display= displayStyle;
		crmForm.all.ayr_maintenancereserves4_d.style.display = displayStyle;
		crmForm.all.ayr_etoextoption4_d.style.display = displayStyle;
		crmForm.all.ayr_securitydeposit4_d.style.display = displayStyle;
		crmForm.all.ayr_financialadjustments4_d.style.display = displayStyle;}
				
		if(hideValues)
		{
			//clear all pricing fields
			crmForm.all.ayr_msn4.DataValue = null;
			crmForm.all.ayr_registrationnumber4.DataValue = null;
			crmForm.all.ayr_bidperaircraft4.DataValue = null;
			crmForm.all.ayr_totalcapital4.DataValue = null;
			crmForm.all.ayr_maintenancereserves4.DataValue = null;
			crmForm.all.ayr_financialadjustments4.DataValue = null;
			crmForm.all.ayr_etoextoption4.DataValue = null;
			crmForm.all.ayr_biddeadline4.DataValue = null;
			crmForm.all.ayr_securitydeposit4.DataValue = null;
			crmForm.all.ayr_securitydepositamount4.DataValue = null;
			crmForm.all.ayr_leaseratefactor4.DataValue = null;
			crmForm.all.ayr_upfrontcost4.DataValue = null;
			crmForm.all.ayr_unleveredirr4.DataValue = null;
			crmForm.all.ayr_1styearcashyld4.DataValue = null;
			crmForm.all.ayr_1styeareconyld4.DataValue = null;
			crmForm.all.ayr_annualdeprc4.DataValue = null;
			crmForm.all.ayr_residualvalue4.DataValue = null;
			
			//recalculate Grand totals
			fnGrandTotalUpfrontCost();
			fnGrandTotalBidPrice();
		}
	break;

	case 5 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_dealpriced5 != null) {
			dealpriced = crmForm.all.ayr_dealpriced5.SelectedText;
		}
		var hideValues = (dealpriced=="No") || (dealpriced=="");
		var displayStyle = hideValues ? "none" : "";
		if(crmForm.all.ayr_msn5_c != null){
		crmForm.all.ayr_msn5_c.parentElement.parentElement.parentElement.style.display= displayStyle;
		crmForm.all.ayr_maintenancereserves5_d.style.display = displayStyle;
		crmForm.all.ayr_etoextoption5_d.style.display = displayStyle;
		crmForm.all.ayr_securitydeposit5_d.style.display = displayStyle;
		crmForm.all.ayr_financialadjustments5_d.style.display = displayStyle;}
				
		if(hideValues)
		{
			//clear all pricing fields
			crmForm.all.ayr_msn5.DataValue = null;
			crmForm.all.ayr_registrationnumber5.DataValue = null;
			crmForm.all.ayr_bidperaircraft5.DataValue = null;
			crmForm.all.ayr_totalcapital5.DataValue = null;
			crmForm.all.ayr_maintenancereserves5.DataValue = null;
			crmForm.all.ayr_financialadjustments5.DataValue = null;
			crmForm.all.ayr_etoextoption5.DataValue = null;
			crmForm.all.ayr_biddeadline5.DataValue = null;
			crmForm.all.ayr_securitydeposit5.DataValue = null;
			crmForm.all.ayr_securitydepositamount5.DataValue = null;
			crmForm.all.ayr_leaseratefactor5.DataValue = null;
			crmForm.all.ayr_upfrontcost5.DataValue = null;
			crmForm.all.ayr_unleveredirr5.DataValue = null;
			crmForm.all.ayr_1styearcashyld5.DataValue = null;
			crmForm.all.ayr_1styeareconyld5.DataValue = null;
			crmForm.all.ayr_annualdeprc5.DataValue = null;
			crmForm.all.ayr_residualvalue5.DataValue = null;
			
			//recalculate Grand totals
			fnGrandTotalUpfrontCost();
			fnGrandTotalBidPrice();
		}
	break;
	
	case 6 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_dealpriced6 != null) {
			dealpriced = crmForm.all.ayr_dealpriced6.SelectedText;
		}
		var hideValues = (dealpriced=="No") || (dealpriced=="");
		var displayStyle = hideValues ? "none" : "";
		if(crmForm.all.ayr_msn6_c != null){
		crmForm.all.ayr_msn6_c.parentElement.parentElement.parentElement.style.display= displayStyle;
		crmForm.all.ayr_maintenancereserves6_d.style.display = displayStyle;
		crmForm.all.ayr_etoextoption6_d.style.display = displayStyle;
		crmForm.all.ayr_securitydeposit6_d.style.display = displayStyle;
		crmForm.all.ayr_financialadjustments6_d.style.display = displayStyle;}
				
		if(hideValues)
		{
			//clear all pricing fields
			crmForm.all.ayr_msn6.DataValue = null;
			crmForm.all.ayr_registrationnumber6.DataValue = null;
			crmForm.all.ayr_bidperaircraft6.DataValue = null;
			crmForm.all.ayr_totalcapital6.DataValue = null;
			crmForm.all.ayr_maintenancereserves6.DataValue = null;
			crmForm.all.ayr_financialadjustments6.DataValue = null;
			crmForm.all.ayr_etoextoption6.DataValue = null;
			crmForm.all.ayr_biddeadline6.DataValue = null;
			crmForm.all.ayr_securitydeposit6.DataValue = null;
			crmForm.all.ayr_securitydepositamount6.DataValue = null;
			crmForm.all.ayr_leaseratefactor6.DataValue = null;
			crmForm.all.ayr_upfrontcost6.DataValue = null;
			crmForm.all.ayr_unleveredirr6.DataValue = null;
			crmForm.all.ayr_1styearcashyld6.DataValue = null;
			crmForm.all.ayr_1styeareconyld6.DataValue = null;
			crmForm.all.ayr_annualdeprc6.DataValue = null;
			crmForm.all.ayr_residualvalue6.DataValue = null;
			
			//recalculate Grand totals
			fnGrandTotalUpfrontCost();
			fnGrandTotalBidPrice();
		}
	break;
	
	case 7 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_dealpriced7 != null) {
			dealpriced = crmForm.all.ayr_dealpriced7.SelectedText;
		}
		var hideValues = (dealpriced=="No") || (dealpriced=="");
		var displayStyle = hideValues ? "none" : "";
		if(crmForm.all.ayr_msn7_c != null){
		crmForm.all.ayr_msn7_c.parentElement.parentElement.parentElement.style.display= displayStyle;
		crmForm.all.ayr_maintenancereserves7_d.style.display = displayStyle;
		crmForm.all.ayr_etoextoption7_d.style.display = displayStyle;
		crmForm.all.ayr_securitydeposit7_d.style.display = displayStyle;
		crmForm.all.ayr_financialadjustments7_d.style.display = displayStyle;}
				
		if(hideValues)
		{
			//clear all pricing fields
			crmForm.all.ayr_msn7.DataValue = null;
			crmForm.all.ayr_registrationnumber7.DataValue = null;
			crmForm.all.ayr_bidperaircraft7.DataValue = null;
			crmForm.all.ayr_totalcapital7.DataValue = null;
			crmForm.all.ayr_maintenancereserves7.DataValue = null;
			crmForm.all.ayr_financialadjustments7.DataValue = null;
			crmForm.all.ayr_etoextoption7.DataValue = null;
			crmForm.all.ayr_biddeadline7.DataValue = null;
			crmForm.all.ayr_securitydeposit7.DataValue = null;
			crmForm.all.ayr_securitydepositamount7.DataValue = null;
			crmForm.all.ayr_leaseratefactor7.DataValue = null;
			crmForm.all.ayr_upfrontcost7.DataValue = null;
			crmForm.all.ayr_unleveredirr7.DataValue = null;
			crmForm.all.ayr_1styearcashyld7.DataValue = null;
			crmForm.all.ayr_1styeareconyld7.DataValue = null;
			crmForm.all.ayr_annualdeprc7.DataValue = null;
			crmForm.all.ayr_residualvalue7.DataValue = null;
			
			//recalculate Grand totals
			fnGrandTotalUpfrontCost();
			fnGrandTotalBidPrice();
		}
	break;
	
	case 8 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_dealpriced8 != null) {
			dealpriced = crmForm.all.ayr_dealpriced8.SelectedText;
		}
		var hideValues = (dealpriced=="No") || (dealpriced=="");
		var displayStyle = hideValues ? "none" : "";
		if(crmForm.all.ayr_msn8_c != null){
		crmForm.all.ayr_msn8_c.parentElement.parentElement.parentElement.style.display= displayStyle;
		crmForm.all.ayr_maintenancereserves8_d.style.display = displayStyle;
		crmForm.all.ayr_etoextoption8_d.style.display = displayStyle;
		crmForm.all.ayr_securitydeposit8_d.style.display = displayStyle;
		crmForm.all.ayr_financialadjustments8_d.style.display = displayStyle;}
				
		if(hideValues)
		{
			//clear all pricing fields
			crmForm.all.ayr_msn8.DataValue = null;
			crmForm.all.ayr_registrationnumber8.DataValue = null;
			crmForm.all.ayr_bidperaircraft8.DataValue = null;
			crmForm.all.ayr_totalcapital8.DataValue = null;
			crmForm.all.ayr_maintenancereserves8.DataValue = null;
			crmForm.all.ayr_financialadjustments8.DataValue = null;
			crmForm.all.ayr_etoextoption8.DataValue = null;
			crmForm.all.ayr_biddeadline8.DataValue = null;
			crmForm.all.ayr_securitydeposit8.DataValue = null;
			crmForm.all.ayr_securitydepositamount8.DataValue = null;
			crmForm.all.ayr_leaseratefactor8.DataValue = null;
			crmForm.all.ayr_upfrontcost8.DataValue = null;
			crmForm.all.ayr_unleveredirr8.DataValue = null;
			crmForm.all.ayr_1styearcashyld8.DataValue = null;
			crmForm.all.ayr_1styeareconyld8.DataValue = null;
			crmForm.all.ayr_annualdeprc8.DataValue = null;
			crmForm.all.ayr_residualvalue8.DataValue = null;
			
			//recalculate Grand totals
			fnGrandTotalUpfrontCost();
			fnGrandTotalBidPrice();
		}
	break;
	
	case 9 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_dealpriced9 != null) {
			dealpriced = crmForm.all.ayr_dealpriced9.SelectedText;
		}
		var hideValues = (dealpriced=="No") || (dealpriced=="");
		var displayStyle = hideValues ? "none" : "";
		if(crmForm.all.ayr_msn9_c != null){
		crmForm.all.ayr_msn9_c.parentElement.parentElement.parentElement.style.display= displayStyle;
		crmForm.all.ayr_maintenancereserves9_d.style.display = displayStyle;
		crmForm.all.ayr_etoextoption9_d.style.display = displayStyle;
		crmForm.all.ayr_securitydeposit9_d.style.display = displayStyle;
		crmForm.all.ayr_financialadjustments9_d.style.display = displayStyle;}
				
		if(hideValues)
		{
			//clear all pricing fields
			crmForm.all.ayr_msn9.DataValue = null;
			crmForm.all.ayr_registrationnumber9.DataValue = null;
			crmForm.all.ayr_bidperaircraft9.DataValue = null;
			crmForm.all.ayr_totalcapital9.DataValue = null;
			crmForm.all.ayr_maintenancereserves9.DataValue = null;
			crmForm.all.ayr_financialadjustments9.DataValue = null;
			crmForm.all.ayr_etoextoption9.DataValue = null;
			crmForm.all.ayr_biddeadline9.DataValue = null;
			crmForm.all.ayr_securitydeposit9.DataValue = null;
			crmForm.all.ayr_securitydepositamount9.DataValue = null;
			crmForm.all.ayr_leaseratefactor9.DataValue = null;
			crmForm.all.ayr_upfrontcost9.DataValue = null;
			crmForm.all.ayr_unleveredirr9.DataValue = null;
			crmForm.all.ayr_1styearcashyld9.DataValue = null;
			crmForm.all.ayr_1styeareconyld9.DataValue = null;
			crmForm.all.ayr_annualdeprc9.DataValue = null;
			crmForm.all.ayr_residualvalue9.DataValue = null;
			
			//recalculate Grand totals
			fnGrandTotalUpfrontCost();
			fnGrandTotalBidPrice();
		}
	break;
	
	case 10 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_dealpriced10 != null) {
			dealpriced = crmForm.all.ayr_dealpriced10.SelectedText;
		}
		var hideValues = (dealpriced=="No") || (dealpriced=="");
		var displayStyle = hideValues ? "none" : "";
		if(crmForm.all.ayr_msn10_c != null){
		crmForm.all.ayr_msn10_c.parentElement.parentElement.parentElement.style.display= displayStyle;
		crmForm.all.ayr_maintenancereserves10_d.style.display = displayStyle;
		crmForm.all.ayr_etoextoption10_d.style.display = displayStyle;
		crmForm.all.ayr_securitydeposit10_d.style.display = displayStyle;
		crmForm.all.ayr_financialadjustments10_d.style.display = displayStyle;}
				
		if(hideValues)
		{
			//clear all pricing fields
			crmForm.all.ayr_msn10.DataValue = null;
			crmForm.all.ayr_registrationnumber10.DataValue = null;
			crmForm.all.ayr_bidperaircraft10.DataValue = null;
			crmForm.all.ayr_totalcapital10.DataValue = null;
			crmForm.all.ayr_maintenancereserves10.DataValue = null;
			crmForm.all.ayr_financialadjustments10.DataValue = null;
			crmForm.all.ayr_etoextoption10.DataValue = null;
			crmForm.all.ayr_biddeadline10.DataValue = null;
			crmForm.all.ayr_securitydeposit10.DataValue = null;
			crmForm.all.ayr_securitydepositamount10.DataValue = null;
			crmForm.all.ayr_leaseratefactor10.DataValue = null;
			crmForm.all.ayr_upfrontcost10.DataValue = null;
			crmForm.all.ayr_unleveredirr10.DataValue = null;
			crmForm.all.ayr_1styearcashyld10.DataValue = null;
			crmForm.all.ayr_1styeareconyld10.DataValue = null;
			crmForm.all.ayr_annualdeprc10.DataValue = null;
			crmForm.all.ayr_residualvalue10.DataValue = null;
			
			//recalculate Grand totals
			fnGrandTotalUpfrontCost();
			fnGrandTotalBidPrice();
		}
	break;
      
	default :
		break;
  }	
}

function HideShowAirCraftTabs(){
	// get number of aircraft
	fnGetNumberOfAirCraft();
	var bTab1 = false;
	var bTab2 = false;
	
	//check if Tabs Exist
	oTab1 = crmForm.all.tab1Tab; 
	if(typeof(oTab1) != "undefined" && oTab1 != null) { 
		bTab1 = true;
	} 
	oTab2 = crmForm.all.tab2Tab; 
	if(typeof(oTab2) != "undefined" && oTab2 != null) { 
		bTab2 = true;
	}
	switch(ayr_numberofaircraftdealid) {
    case 0 :
    case 1 :
		//Hide 2-5, 6-10 Tabs
		if(bTab1){crmForm.all.tab1Tab.style.display="none";}
		if(bTab2){crmForm.all.tab2Tab.style.display="none";}
	break;
	case 2 :
	case 3 :
	case 4 :
    case 5 :
		//Show 2-5 and Hide 6-10 Tab
		if(bTab1){crmForm.all.tab1Tab.style.display="";}
		if(bTab2){crmForm.all.tab2Tab.style.display="none";}
    break;
    case 6 :
	case 7 :
	case 8 :
    case 9 :
    case 10 :
		//Show 2-5 and 6-10
		if(bTab1){crmForm.all.tab1Tab.style.display="";}
		if(bTab2){crmForm.all.tab2Tab.style.display="";}
    break;
	default :
		//Hide All
		if(bTab1){crmForm.all.tab1Tab.style.display="none";}
		if(bTab2){crmForm.all.tab2Tab.style.display="none";}
	break;
  }
}
function HideShowDealTotals(){
	grandTotalsStyle = crmForm.all.ayr_grandtotalbidprice_c.parentElement.parentElement.parentElement.style.display;
	// get number of aircraft
	fnGetNumberOfAirCraft();
	
	if(IsMoreThanOneDealPriced()>1 && (ayr_numberofaircraftdealid > 1)){
		crmForm.all.ayr_grandtotalbidprice_c.parentElement.parentElement.parentElement.style.display= "";
		//Change Added 12/17
		if(crmForm.all.ayr_clearedflag != null){
			if(crmForm.all.ayr_clearedflag.DataValue == false){
				if(grandTotalsStyle != ""){
					//User caused HideShowDealTotals to run, it was not triggered by form load
					//clear grand totals fields
					crmForm.all.ayr_grandtotalunleveredirr.DataValue = null;
					crmForm.all.ayr_grandtotalleaseratefactor.DataValue = null;
					crmForm.all.ayr_grandtotalannualdeprc.DataValue = null;
					crmForm.all.ayr_grandtotalresidualvalue.DataValue = null;
					crmForm.all.ayr_grandtotal1styeareconyld.DataValue = null;
					crmForm.all.ayr_grandtotal1styearcashyld.DataValue = null;
					crmForm.all.ayr_grandtotalsecuritydepositamount.DataValue = null;
				}
			}
		}
	}else{crmForm.all.ayr_grandtotalbidprice_c.parentElement.parentElement.parentElement.style.display= "none";}
}
function IsMoreThanOneDealPriced()
{
	var numberOfDealsPriced = 0;
	var dealpriced = "";
	if (crmForm.all.ayr_dealpriced != null) {
		dealpriced = crmForm.all.ayr_dealpriced.SelectedText;
		if(dealpriced=="Yes"){
			numberOfDealsPriced++;
		}
	}
	if (crmForm.all.ayr_dealpriced2 != null) {
		dealpriced = crmForm.all.ayr_dealpriced2.SelectedText;
		if(dealpriced=="Yes"){
			numberOfDealsPriced++;
		}
	}
	if (crmForm.all.ayr_dealpriced3 != null) {
		dealpriced = crmForm.all.ayr_dealpriced3.SelectedText;
		if(dealpriced=="Yes"){
			numberOfDealsPriced++;
		}
	}
	if (crmForm.all.ayr_dealpriced4 != null) {
		dealpriced = crmForm.all.ayr_dealpriced4.SelectedText;
		if(dealpriced=="Yes"){
			numberOfDealsPriced++;
		}
	}
	if (crmForm.all.ayr_dealpriced5 != null) {
		dealpriced = crmForm.all.ayr_dealpriced5.SelectedText;
		if(dealpriced=="Yes"){
			numberOfDealsPriced++;
		}
	}
	if (crmForm.all.ayr_dealpriced6 != null) {
		dealpriced = crmForm.all.ayr_dealpriced6.SelectedText;
		if(dealpriced=="Yes"){
			numberOfDealsPriced++;
		}
	}
	if (crmForm.all.ayr_dealpriced7 != null) {
		dealpriced = crmForm.all.ayr_dealpriced7.SelectedText;
		if(dealpriced=="Yes"){
			numberOfDealsPriced++;
		}
	}
	if (crmForm.all.ayr_dealpriced8 != null) {
		dealpriced = crmForm.all.ayr_dealpriced8.SelectedText;
		if(dealpriced=="Yes"){
			numberOfDealsPriced++;
		}
	}
	if (crmForm.all.ayr_dealpriced9 != null) {
		dealpriced = crmForm.all.ayr_dealpriced9.SelectedText;
		if(dealpriced=="Yes"){
			numberOfDealsPriced++;
		}
	}
	if (crmForm.all.ayr_dealpriced10 != null) {
		dealpriced = crmForm.all.ayr_dealpriced10.SelectedText;
		if(dealpriced=="Yes"){
			numberOfDealsPriced++;
		}
	}
	return numberOfDealsPriced;
}
function NotValidNumber(vValue)
{
	return (null == vValue || "" == vValue || isNaN(vValue));
}
var fnGetNumberOfAirCraft = function(){
	//check if the fields exists on the form
    if (crmForm.all.ayr_numberofaircraftdealid != null) {
		var lookup = crmForm.all.ayr_numberofaircraftdealid.DataValue;
		if(lookup != null){
			if (lookup[0] != null) {
				ayr_numberofaircraftdealid = lookup[0].name;
			}
		}
		if (NotValidNumber(ayr_numberofaircraftdealid)){
			ayr_numberofaircraftdealid = 0;	
		}
		ayr_numberofaircraftdealid = parseInt(ayr_numberofaircraftdealid);
	}
}
var fnGetUpFrontCosts = function(){
	//check if the fields exists on the form
	if (crmForm.all.ayr_upfrontcost != null) {
		ayr_upfrontcost = crmForm.all.ayr_upfrontcost.DataValue;
		if (NotValidNumber(ayr_upfrontcost)){
			ayr_upfrontcost = 0;	
		}
	}
	if (crmForm.all.ayr_upfrontcost2 != null) {
		ayr_upfrontcost2 = crmForm.all.ayr_upfrontcost2.DataValue;
		if (NotValidNumber(ayr_upfrontcost2)){
			ayr_upfrontcost2 = 0;	
		}
	}
	if (crmForm.all.ayr_upfrontcost3 != null) {
		ayr_upfrontcost3 = crmForm.all.ayr_upfrontcost3.DataValue;
		if (NotValidNumber(ayr_upfrontcost3)){
			ayr_upfrontcost3 = 0;	
		}
	}
	if (crmForm.all.ayr_upfrontcost4 != null) {
		ayr_upfrontcost4 = crmForm.all.ayr_upfrontcost4.DataValue;
		if (NotValidNumber(ayr_upfrontcost4)){
			ayr_upfrontcost4 = 0;	
		}
	}
	if (crmForm.all.ayr_upfrontcost5 != null) {
		ayr_upfrontcost5 = crmForm.all.ayr_upfrontcost5.DataValue;
		if (NotValidNumber(ayr_upfrontcost5)){
			ayr_upfrontcost5 = 0;	
		}
	}
	if (crmForm.all.ayr_upfrontcost6 != null) {
		ayr_upfrontcost6 = crmForm.all.ayr_upfrontcost6.DataValue;
		if (NotValidNumber(ayr_upfrontcost6)){
			ayr_upfrontcost6 = 0;	
		}
	}
	if (crmForm.all.ayr_upfrontcost7 != null) {
		ayr_upfrontcost7 = crmForm.all.ayr_upfrontcost7.DataValue;
		if (NotValidNumber(ayr_upfrontcost7)){
			ayr_upfrontcost7 = 0;	
		}
	}
	if (crmForm.all.ayr_upfrontcost8 != null) {
		ayr_upfrontcost8 = crmForm.all.ayr_upfrontcost8.DataValue;
		if (NotValidNumber(ayr_upfrontcost8)){
			ayr_upfrontcost8 = 0;	
		}
	}
	if (crmForm.all.ayr_upfrontcost9 != null) {
		ayr_upfrontcost9 = crmForm.all.ayr_upfrontcost9.DataValue;
		if (NotValidNumber(ayr_upfrontcost9)){
			ayr_upfrontcost9 = 0;	
		}
	}
	if (crmForm.all.ayr_upfrontcost10 != null) {
		ayr_upfrontcost10 = crmForm.all.ayr_upfrontcost10.DataValue;
		if (NotValidNumber(ayr_upfrontcost10)){
			ayr_upfrontcost10 = 0;	
		}
	}
}
var fnGetBidPerAircraft = function(){
	//check if the fields exists on the form
	if (crmForm.all.ayr_bidperaircraft != null) {
		ayr_bidperaircraft = crmForm.all.ayr_bidperaircraft.DataValue;
		if (NotValidNumber(ayr_bidperaircraft)){
			ayr_bidperaircraft = 0;	
		}
	}
	if (crmForm.all.ayr_bidperaircraft2 != null) {
		ayr_bidperaircraft2 = crmForm.all.ayr_bidperaircraft2.DataValue;
		if (NotValidNumber(ayr_bidperaircraft2)){
			ayr_bidperaircraft2 = 0;	
		}
	}
	if (crmForm.all.ayr_bidperaircraft3 != null) {
		ayr_bidperaircraft3 = crmForm.all.ayr_bidperaircraft3.DataValue;
		if (NotValidNumber(ayr_bidperaircraft3)){
			ayr_bidperaircraft3 = 0;	
		}
	}
	if (crmForm.all.ayr_bidperaircraft4 != null) {
		ayr_bidperaircraft4 = crmForm.all.ayr_bidperaircraft4.DataValue;
		if (NotValidNumber(ayr_bidperaircraft4)){
			ayr_bidperaircraft4 = 0;	
		}
	}
	if (crmForm.all.ayr_bidperaircraft5 != null) {
		ayr_bidperaircraft5 = crmForm.all.ayr_bidperaircraft5.DataValue;
		if (NotValidNumber(ayr_bidperaircraft5)){
			ayr_bidperaircraft5 = 0;	
		}
	}
	if (crmForm.all.ayr_bidperaircraft6 != null) {
		ayr_bidperaircraft6 = crmForm.all.ayr_bidperaircraft6.DataValue;
		if (NotValidNumber(ayr_bidperaircraft6)){
			ayr_bidperaircraft6 = 0;	
		}
	}
	if (crmForm.all.ayr_bidperaircraft7 != null) {
		ayr_bidperaircraft7 = crmForm.all.ayr_bidperaircraft7.DataValue;
		if (NotValidNumber(ayr_bidperaircraft7)){
			ayr_bidperaircraft7 = 0;	
		}
	}
	if (crmForm.all.ayr_bidperaircraft8 != null) {
		ayr_bidperaircraft8 = crmForm.all.ayr_bidperaircraft8.DataValue;
		if (NotValidNumber(ayr_bidperaircraft8)){
			ayr_bidperaircraft8 = 0;	
		}
	}
	if (crmForm.all.ayr_bidperaircraft9 != null) {
		ayr_bidperaircraft9 = crmForm.all.ayr_bidperaircraft9.DataValue;
		if (NotValidNumber(ayr_bidperaircraft9)){
			ayr_bidperaircraft9 = 0;	
		}
	}
	if (crmForm.all.ayr_bidperaircraft10 != null) {
		ayr_bidperaircraft10 = crmForm.all.ayr_bidperaircraft10.DataValue;
		if (NotValidNumber(ayr_bidperaircraft10)){
			ayr_bidperaircraft10 = 0;	
		}
	}
}

var fnGetLeaseRate = function(){
	if (crmForm.all.ayr_leaseratevalue != null) {
		ayr_leaseratevalue = crmForm.all.ayr_leaseratevalue.DataValue;
		if (NotValidNumber(ayr_leaseratevalue)){
			ayr_leaseratevalue = 0;	
		}
	}
	if (crmForm.all.ayr_leaseratevalue2 != null) {
		ayr_leaseratevalue2 = crmForm.all.ayr_leaseratevalue2.DataValue;
		if (NotValidNumber(ayr_leaseratevalue2)){
			ayr_leaseratevalue2 = 0;	
		}
	}
	if (crmForm.all.ayr_leaseratevalue3 != null) {
		ayr_leaseratevalue3 = crmForm.all.ayr_leaseratevalue3.DataValue;
		if (NotValidNumber(ayr_leaseratevalue3)){
			ayr_leaseratevalue3 = 0;	
		}
	}
	if (crmForm.all.ayr_leaseratevalue4 != null) {
		ayr_leaseratevalue4 = crmForm.all.ayr_leaseratevalue4.DataValue;
		if (NotValidNumber(ayr_leaseratevalue4)){
			ayr_leaseratevalue4 = 0;	
		}
	}
	if (crmForm.all.ayr_leaseratevalue5 != null) {
		ayr_leaseratevalue5 = crmForm.all.ayr_leaseratevalue5.DataValue;
		if (NotValidNumber(ayr_leaseratevalue5)){
			ayr_leaseratevalue5 = 0;	
		}
	}
	if (crmForm.all.ayr_leaseratevalue6 != null) {
		ayr_leaseratevalue6 = crmForm.all.ayr_leaseratevalue6.DataValue;
		if (NotValidNumber(ayr_leaseratevalue6)){
			ayr_leaseratevalue6 = 0;	
		}
	}
	if (crmForm.all.ayr_leaseratevalue7 != null) {
		ayr_leaseratevalue7 = crmForm.all.ayr_leaseratevalue7.DataValue;
		if (NotValidNumber(ayr_leaseratevalue7)){
			ayr_leaseratevalue7 = 0;	
		}
	}
	if (crmForm.all.ayr_leaseratevalue8 != null) {
		ayr_leaseratevalue8 = crmForm.all.ayr_leaseratevalue8.DataValue;
		if (NotValidNumber(ayr_leaseratevalue8)){
			ayr_leaseratevalue8 = 0;	
		}
	}
	if (crmForm.all.ayr_leaseratevalue9 != null) {
		ayr_leaseratevalue9 = crmForm.all.ayr_leaseratevalue9.DataValue;
		if (NotValidNumber(ayr_leaseratevalue9)){
			ayr_leaseratevalue9 = 0;	
		}
	}
	if (crmForm.all.ayr_leaseratevalue10 != null) {
		ayr_leaseratevalue10 = crmForm.all.ayr_leaseratevalue10.DataValue;
		if (NotValidNumber(ayr_leaseratevalue10)){
			ayr_leaseratevalue10 = 0;	
		}
	}
}
var fnGrandTotalUpfrontCost = function() {
    var grandtotalupfrontcost = 0;
   
    // get bid up front cost values
    fnGetUpFrontCosts();
    
	//calculate total upfront cost
	grandtotalupfrontcost = ayr_upfrontcost + 
							ayr_upfrontcost2 +
							ayr_upfrontcost3 +
							ayr_upfrontcost4 +
							ayr_upfrontcost5 +
							ayr_upfrontcost6 +
							ayr_upfrontcost7 +
							ayr_upfrontcost8 +
							ayr_upfrontcost9 +
							ayr_upfrontcost10;
							
							
	//Update the ayr_grandtotalupfrontcost field
	if (crmForm.all.ayr_grandtotalupfrontcost != null) {
		crmForm.all.ayr_grandtotalupfrontcost.DataValue = grandtotalupfrontcost;
	}
 }

var fnGrandTotalBidPrice = function() {
    var grandtotalbidprice = 0;
    
    // get bid per aircraft values
	fnGetBidPerAircraft();	
	
	//calculate total bid price
	grandtotalbidprice = ayr_bidperaircraft + 
							ayr_bidperaircraft2 +
							ayr_bidperaircraft3 +
							ayr_bidperaircraft4 +
							ayr_bidperaircraft5 +
							ayr_bidperaircraft6 +
							ayr_bidperaircraft7 +
							ayr_bidperaircraft8 +
							ayr_bidperaircraft9 +
							ayr_bidperaircraft10;
							
							
	//Update the ayr_grandtotalbidprice field
	if (crmForm.all.ayr_grandtotalbidprice != null) {
		crmForm.all.ayr_grandtotalbidprice.DataValue = grandtotalbidprice;
	}
 }
var fnLeaseRateFactor = function() {
	var leaseratefactor = 0.00;
    var leaseratefactor2 = 0.00;
    var leaseratefactor3 = 0.00;
	var leaseratefactor4 = 0.00;
	var leaseratefactor5 = 0.00;
	var leaseratefactor6 = 0.00;
	var leaseratefactor7 = 0.00;
	var leaseratefactor8 = 0.00;
	var leaseratefactor9 = 0.00;
	var leaseratefactor10 = 0.00;

	// get bid per aircraft values
	fnGetBidPerAircraft();
	
	// get bid lease rate values
    fnGetLeaseRate();

	//calculate lease rate factor
	
	leaseratefactor = ((ayr_bidperaircraft == 0) || isNaN(ayr_leaseratevalue/ayr_bidperaircraft)) ? 0.00 : ((ayr_leaseratevalue/ayr_bidperaircraft)*100);
	leaseratefactor2 = ((ayr_bidperaircraft2 == 0) || isNaN(ayr_leaseratevalue2/ayr_bidperaircraft2)) ? 0.00 : ((ayr_leaseratevalue2/ayr_bidperaircraft2)*100);
	leaseratefactor3 = ((ayr_bidperaircraft3 == 0) || isNaN(ayr_leaseratevalue3/ayr_bidperaircraft3)) ? 0.00 : ((ayr_leaseratevalue3/ayr_bidperaircraft3)*100);
	leaseratefactor4 = ((ayr_bidperaircraft4 == 0) || isNaN(ayr_leaseratevalue4/ayr_bidperaircraft4)) ? 0.00 : ((ayr_leaseratevalue4/ayr_bidperaircraft4)*100);
	leaseratefactor5 = ((ayr_bidperaircraft5 == 0) || isNaN(ayr_leaseratevalue5/ayr_bidperaircraft5)) ? 0.00 : ((ayr_leaseratevalue5/ayr_bidperaircraft5)*100);
	leaseratefactor6 = ((ayr_bidperaircraft6 == 0) || isNaN(ayr_leaseratevalue6/ayr_bidperaircraft6)) ? 0.00 : ((ayr_leaseratevalue6/ayr_bidperaircraft6)*100);
	leaseratefactor7 = ((ayr_bidperaircraft7 == 0) || isNaN(ayr_leaseratevalue7/ayr_bidperaircraft7)) ? 0.00 : ((ayr_leaseratevalue7/ayr_bidperaircraft7)*100);
	leaseratefactor8 = ((ayr_bidperaircraft8 == 0) || isNaN(ayr_leaseratevalue8/ayr_bidperaircraft8)) ? 0.00 : ((ayr_leaseratevalue8/ayr_bidperaircraft8)*100);
	leaseratefactor9 = ((ayr_bidperaircraft9 == 0) || isNaN(ayr_leaseratevalue9/ayr_bidperaircraft9)) ? 0.00 : ((ayr_leaseratevalue9/ayr_bidperaircraft9)*100);
	leaseratefactor10 = ((ayr_bidperaircraft10 == 0) || isNaN(ayr_leaseratevalue10/ayr_bidperaircraft10)) ? 0.00 : ((ayr_leaseratevalue10/ayr_bidperaircraft10)*100);
								
	//Update the ayr_leaseratefactor field
	if (crmForm.all.ayr_leaseratefactor != null) {
		crmForm.all.ayr_leaseratefactor.DataValue = leaseratefactor;
	}
	if (crmForm.all.ayr_leaseratefactor2 != null) {
		crmForm.all.ayr_leaseratefactor2.DataValue = leaseratefactor2;
	}
	if (crmForm.all.ayr_leaseratefactor3 != null) {
		crmForm.all.ayr_leaseratefactor3.DataValue = leaseratefactor3;
	}
	if (crmForm.all.ayr_leaseratefactor4 != null) {
		crmForm.all.ayr_leaseratefactor4.DataValue = leaseratefactor4;
	}
	if (crmForm.all.ayr_leaseratefactor5 != null) {
		crmForm.all.ayr_leaseratefactor5.DataValue = leaseratefactor5;
	}
	if (crmForm.all.ayr_leaseratefactor6 != null) {
		crmForm.all.ayr_leaseratefactor6.DataValue = leaseratefactor6;
	}
	if (crmForm.all.ayr_leaseratefactor7 != null) {
		crmForm.all.ayr_leaseratefactor7.DataValue = leaseratefactor7;
	}
	if (crmForm.all.ayr_leaseratefactor8 != null) {
		crmForm.all.ayr_leaseratefactor8.DataValue = leaseratefactor8;
	}
	if (crmForm.all.ayr_leaseratefactor9 != null) {
		crmForm.all.ayr_leaseratefactor9.DataValue = leaseratefactor9;
	}
	if (crmForm.all.ayr_leaseratefactor10 != null) {
		crmForm.all.ayr_leaseratefactor10.DataValue = leaseratefactor10;
	}
}    
var fnTotalCapital = function() {
    var totalcapital = 0;
    var totalcapital2 = 0;
    var totalcapital3 = 0;
    var totalcapital4 = 0;
    var totalcapital5 = 0;
    var totalcapital6 = 0;
    var totalcapital7 = 0;
    var totalcapital8 = 0;
    var totalcapital9 = 0;
    var totalcapital10 = 0;

	/*Business Solution Partners - Change Request 09/25/2007 change formula*/
	// get number of aircraft
	//fnGetNumberOfAirCraft();
	//totalcapital = (ayr_numberofaircraftdealid*(ayr_upfrontcost*ayr_bidperaircraft));
	/*Business Solution Partners - Change Request 09/25/2007 change formula*/
	
	// get bid up front cost values
    fnGetUpFrontCosts();
    
	// get bid per aircraft values
	fnGetBidPerAircraft();
	
	//calculate total capital
	totalcapital = (ayr_upfrontcost+ayr_bidperaircraft);
	totalcapital2 = (ayr_upfrontcost2+ayr_bidperaircraft2);
	totalcapital3 = (ayr_upfrontcost3+ayr_bidperaircraft3);
	totalcapital4 = (ayr_upfrontcost4+ayr_bidperaircraft4);
	totalcapital5 = (ayr_upfrontcost5+ayr_bidperaircraft5);
	totalcapital6 = (ayr_upfrontcost6+ayr_bidperaircraft6);
	totalcapital7 = (ayr_upfrontcost7+ayr_bidperaircraft7);
	totalcapital8 = (ayr_upfrontcost8+ayr_bidperaircraft8);
	totalcapital9 = (ayr_upfrontcost9+ayr_bidperaircraft9);
	totalcapital10 = (ayr_upfrontcost10+ayr_bidperaircraft10);

							
	//Update the ayr_leaseratefactor field
	if (crmForm.all.ayr_totalcapital != null) {
		crmForm.all.ayr_totalcapital.DataValue = totalcapital;
	}
	if (crmForm.all.ayr_totalcapital2 != null) {
		crmForm.all.ayr_totalcapital2.DataValue = totalcapital2;
	}
	if (crmForm.all.ayr_totalcapital3 != null) {
		crmForm.all.ayr_totalcapital3.DataValue = totalcapital3;
	}
	if (crmForm.all.ayr_totalcapital4 != null) {
		crmForm.all.ayr_totalcapital4.DataValue = totalcapital4;
	}
	if (crmForm.all.ayr_totalcapital5 != null) {
		crmForm.all.ayr_totalcapital5.DataValue = totalcapital5;
	}
	if (crmForm.all.ayr_totalcapital6 != null) {
		crmForm.all.ayr_totalcapital6.DataValue = totalcapital6;
	}
	if (crmForm.all.ayr_totalcapital7 != null) {
		crmForm.all.ayr_totalcapital7.DataValue = totalcapital7;
	}
	if (crmForm.all.ayr_totalcapital8 != null) {
		crmForm.all.ayr_totalcapital8.DataValue = totalcapital8;
	}
	if (crmForm.all.ayr_totalcapital9 != null) {
		crmForm.all.ayr_totalcapital9.DataValue = totalcapital9;
	}
	if (crmForm.all.ayr_totalcapital10 != null) {
		crmForm.all.ayr_totalcapital10.DataValue = totalcapital10;
	}
}   
var fnUpFrontCost = function() {
	fnGrandTotalUpfrontCost();
	fnTotalCapital();
} 
var fnBidPerAirCraft = function() {
	fnGrandTotalBidPrice();
	fnLeaseRateFactor();
	fnTotalCapital();
} 
var fnNumberOfAircraft = function() {
	/*Business Solution Partners - Change Request 09/25/2007 change formula*/
	//fnTotalCapital();
	HideShowAirCraftTabs();
	HideShowDealTotals();
} 
var fnHideShowLeaseRateValue = function(fieldNum){
	var leaseratetype = "";
	switch(fieldNum) {
    case 1 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_leaseratetype != null) {
			leaseratetype = crmForm.all.ayr_leaseratetype.SelectedText;
		}
		var hideValues = (leaseratetype=="") || (leaseratetype!="Enter Lease Rate");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leaseratevalue != null) {
			crmForm.all.ayr_leaseratevalue.style.display = displayStyle;
			crmForm.all.ayr_leaseratevalue_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leaseratevalue.DataValue = null;}
		}
		break;
    case 2 :
		if (crmForm.all.ayr_leaseratetype2 != null) {
			leaseratetype = crmForm.all.ayr_leaseratetype2.SelectedText;
		}
		var hideValues = (leaseratetype=="") || (leaseratetype!="Enter Lease Rate");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leaseratevalue2 != null) {
			crmForm.all.ayr_leaseratevalue2.style.display = displayStyle;
			crmForm.all.ayr_leaseratevalue2_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leaseratevalue2.DataValue = null;}
		}
		break;
	case 3 :
		if (crmForm.all.ayr_leaseratetype3 != null) {
			leaseratetype = crmForm.all.ayr_leaseratetype3.SelectedText;
		}
		var hideValues = (leaseratetype=="") || (leaseratetype!="Enter Lease Rate");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leaseratevalue3 != null) {
			crmForm.all.ayr_leaseratevalue3.style.display = displayStyle;
			crmForm.all.ayr_leaseratevalue3_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leaseratevalue3.DataValue = null;}
		}
	case 4 :
		if (crmForm.all.ayr_leaseratetype4 != null) {
			leaseratetype = crmForm.all.ayr_leaseratetype4.SelectedText;
		}
		var hideValues = (leaseratetype=="") || (leaseratetype!="Enter Lease Rate");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leaseratevalue4 != null) {
			crmForm.all.ayr_leaseratevalue4.style.display = displayStyle;
			crmForm.all.ayr_leaseratevalue4_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leaseratevalue4.DataValue = null;}
		}
	case 5 :
		if (crmForm.all.ayr_leaseratetype5 != null) {
			leaseratetype = crmForm.all.ayr_leaseratetype5.SelectedText;
		}
		var hideValues = (leaseratetype=="") || (leaseratetype!="Enter Lease Rate");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leaseratevalue5 != null) {
			crmForm.all.ayr_leaseratevalue5.style.display = displayStyle;
			crmForm.all.ayr_leaseratevalue5_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leaseratevalue5.DataValue = null;}
		}
	case 6 :
		if (crmForm.all.ayr_leaseratetype6 != null) {
			leaseratetype = crmForm.all.ayr_leaseratetype6.SelectedText;
		}
		var hideValues = (leaseratetype=="") || (leaseratetype!="Enter Lease Rate");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leaseratevalue6 != null) {
			crmForm.all.ayr_leaseratevalue6.style.display = displayStyle;
			crmForm.all.ayr_leaseratevalue6_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leaseratevalue6.DataValue = null;}
		}
	case 7 :
		if (crmForm.all.ayr_leaseratetype7 != null) {
			leaseratetype = crmForm.all.ayr_leaseratetype7.SelectedText;
		}
		var hideValues = (leaseratetype=="") || (leaseratetype!="Enter Lease Rate");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leaseratevalue7 != null) {
			crmForm.all.ayr_leaseratevalue7.style.display = displayStyle;
			crmForm.all.ayr_leaseratevalue7_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leaseratevalue7.DataValue = null;}
		}
	case 8 :
		if (crmForm.all.ayr_leaseratetype8 != null) {
			leaseratetype = crmForm.all.ayr_leaseratetype8.SelectedText;
		}
		var hideValues = (leaseratetype=="") || (leaseratetype!="Enter Lease Rate");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leaseratevalue8 != null) {
			crmForm.all.ayr_leaseratevalue8.style.display = displayStyle;
			crmForm.all.ayr_leaseratevalue8_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leaseratevalue8.DataValue = null;}
		}
	case 9 :
		if (crmForm.all.ayr_leaseratetype9 != null) {
			leaseratetype = crmForm.all.ayr_leaseratetype9.SelectedText;
		}
		var hideValues = (leaseratetype=="") || (leaseratetype!="Enter Lease Rate");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leaseratevalue9 != null) {
			crmForm.all.ayr_leaseratevalue9.style.display = displayStyle;
			crmForm.all.ayr_leaseratevalue9_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leaseratevalue9.DataValue = null;}
		}
	case 10 :
		if (crmForm.all.ayr_leaseratetype10 != null) {
			leaseratetype = crmForm.all.ayr_leaseratetype10.SelectedText;
		}	
		var hideValues = (leaseratetype=="") || (leaseratetype!="Enter Lease Rate");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leaseratevalue10 != null) {
			crmForm.all.ayr_leaseratevalue10.style.display = displayStyle;
			crmForm.all.ayr_leaseratevalue10_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leaseratevalue10.DataValue = null;}
		}				
	default :
		break;
	}
} 
var fnHideShowLeaseRateValue_1 = function(){
	fnHideShowLeaseRateValue(1);
	fnLeaseRateFactor();
}
var fnHideShowLeaseRateValue_2 = function(){
	fnHideShowLeaseRateValue(2);
	fnLeaseRateFactor();
}
var fnHideShowLeaseRateValue_3 = function(){
	fnHideShowLeaseRateValue(3);
	fnLeaseRateFactor();
}
var fnHideShowLeaseRateValue_4 = function(){
	fnHideShowLeaseRateValue(4);
	fnLeaseRateFactor();
}
var fnHideShowLeaseRateValue_5 = function(){
	fnHideShowLeaseRateValue(5);
	fnLeaseRateFactor();
}
var fnHideShowLeaseRateValue_6 = function(){
	fnHideShowLeaseRateValue(6);
	fnLeaseRateFactor();
}
var fnHideShowLeaseRateValue_7 = function(){
	fnHideShowLeaseRateValue(7);
	fnLeaseRateFactor();
}
var fnHideShowLeaseRateValue_8 = function(){
	fnHideShowLeaseRateValue(8);
	fnLeaseRateFactor();
}
var fnHideShowLeaseRateValue_9 = function(){
	fnHideShowLeaseRateValue(9);
	fnLeaseRateFactor();
}
var fnHideShowLeaseRateValue_10 = function(){
	fnHideShowLeaseRateValue(10);
	fnLeaseRateFactor();
}
var fnHideShowLeaseTermValue = function(fieldNum){
	var leaseterm = "";
	switch(fieldNum) {
    case 1 :
		//Get the dropdown custom fields text
		if (crmForm.all.ayr_leaseterm != null) {
			leaseterm = crmForm.all.ayr_leaseterm.SelectedText;
		}
		var hideValues = (leaseterm=="") || (leaseterm!="Enter Lease Term");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leasetermvalue != null) {
			crmForm.all.ayr_leasetermvalue.style.display = displayStyle;
			crmForm.all.ayr_leasetermvalue_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leasetermvalue.DataValue = null;}
		}
		break;
    case 2 :
		if (crmForm.all.ayr_leaseterm2 != null) {
			leaseterm = crmForm.all.ayr_leaseterm2.SelectedText;
		}
		var hideValues = (leaseterm=="") || (leaseterm!="Enter Lease Term");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leasetermvalue2 != null) {
			crmForm.all.ayr_leasetermvalue2.style.display = displayStyle;
			crmForm.all.ayr_leasetermvalue2_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leasetermvalue2.DataValue = null;}
		}
		break;
	case 3 :
		if (crmForm.all.ayr_leaseterm3 != null) {
			leaseterm = crmForm.all.ayr_leaseterm3.SelectedText;
		}
		var hideValues = (leaseterm=="") || (leaseterm!="Enter Lease Term");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leasetermvalue3 != null) {
			crmForm.all.ayr_leasetermvalue3.style.display = displayStyle;
			crmForm.all.ayr_leasetermvalue3_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leasetermvalue3.DataValue = null;}
		}
	case 4 :
		if (crmForm.all.ayr_leaseterm4 != null) {
			leaseterm = crmForm.all.ayr_leaseterm4.SelectedText;
		}
		var hideValues = (leaseterm=="") || (leaseterm!="Enter Lease Term");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leasetermvalue4 != null) {
			crmForm.all.ayr_leasetermvalue4.style.display = displayStyle;
			crmForm.all.ayr_leasetermvalue4_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leasetermvalue4.DataValue = null;}
		}
	case 5 :
		if (crmForm.all.ayr_leaseterm5 != null) {
			leaseterm = crmForm.all.ayr_leaseterm5.SelectedText;
		}
		var hideValues = (leaseterm=="") || (leaseterm!="Enter Lease Term");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leasetermvalue5 != null) {
			crmForm.all.ayr_leasetermvalue5.style.display = displayStyle;
			crmForm.all.ayr_leasetermvalue5_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leasetermvalue5.DataValue = null;}
		}
	case 6 :
		if (crmForm.all.ayr_leaseterm6 != null) {
			leaseterm = crmForm.all.ayr_leaseterm6.SelectedText;
		}
		var hideValues = (leaseterm=="") || (leaseterm!="Enter Lease Term");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leasetermvalue6 != null) {
			crmForm.all.ayr_leasetermvalue6.style.display = displayStyle;
			crmForm.all.ayr_leasetermvalue6_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leasetermvalue6.DataValue = null;}
		}
	case 7 :
		if (crmForm.all.ayr_leaseterm7 != null) {
			leaseterm = crmForm.all.ayr_leaseterm7.SelectedText;
		}
		var hideValues = (leaseterm=="") || (leaseterm!="Enter Lease Term");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leasetermvalue7 != null) {
			crmForm.all.ayr_leasetermvalue7.style.display = displayStyle;
			crmForm.all.ayr_leasetermvalue7_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leasetermvalue7.DataValue = null;}
		}
	case 8 :
		if (crmForm.all.ayr_leaseterm8 != null) {
			leaseterm = crmForm.all.ayr_leaseterm8.SelectedText;
		}
		var hideValues = (leaseterm=="") || (leaseterm!="Enter Lease Term");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leasetermvalue8 != null) {
			crmForm.all.ayr_leasetermvalue8.style.display = displayStyle;
			crmForm.all.ayr_leasetermvalue8_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leasetermvalue8.DataValue = null;}
		}
	case 9 :
		if (crmForm.all.ayr_leaseterm9 != null) {
			leaseterm = crmForm.all.ayr_leaseterm9.SelectedText;
		}
		var hideValues = (leaseterm=="") || (leaseterm!="Enter Lease Term");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leasetermvalue9 != null) {
			crmForm.all.ayr_leasetermvalue9.style.display = displayStyle;
			crmForm.all.ayr_leasetermvalue9_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leasetermvalue9.DataValue = null;}
		}
	case 10 :
		if (crmForm.all.ayr_leaseterm10 != null) {
			leaseterm = crmForm.all.ayr_leaseterm10.SelectedText;
		}	
		var hideValues = (leaseterm=="") || (leaseterm!="Enter Lease Term");
		var displayStyle = hideValues ? "none" : "";
		if (crmForm.all.ayr_leasetermvalue10 != null) {
			crmForm.all.ayr_leasetermvalue10.style.display = displayStyle;
			crmForm.all.ayr_leasetermvalue10_c.style.display = displayStyle;
			if(hideValues){
			crmForm.all.ayr_leasetermvalue10.DataValue = null;}
		}				
	default :
		break;
	}
} 
var fnHideShowLeaseTermValue_1 = function(){
	fnHideShowLeaseTermValue(1);
}
var fnHideShowLeaseTermValue_2 = function(){
	fnHideShowLeaseTermValue(2);
}
var fnHideShowLeaseTermValue_3 = function(){
	fnHideShowLeaseTermValue(3);
}
var fnHideShowLeaseTermValue_4 = function(){
	fnHideShowLeaseTermValue(4);
}
var fnHideShowLeaseTermValue_5 = function(){
	fnHideShowLeaseTermValue(5);
}
var fnHideShowLeaseTermValue_6 = function(){
	fnHideShowLeaseTermValue(6);
}
var fnHideShowLeaseTermValue_7 = function(){
	fnHideShowLeaseTermValue(7);
}
var fnHideShowLeaseTermValue_8 = function(){
	fnHideShowLeaseTermValue(8);
}
var fnHideShowLeaseTermValue_9 = function(){
	fnHideShowLeaseTermValue(9);
}
var fnHideShowLeaseTermValue_10 = function(){
	fnHideShowLeaseTermValue(10);
}
//Add the event handler to all fields and check if the fields exists on the form
	if (crmForm.all.ayr_upfrontcost != null) {
		crmForm.all.ayr_upfrontcost.onchange = fnUpFrontCost;
	}
	if (crmForm.all.ayr_upfrontcost2 != null) {
		crmForm.all.ayr_upfrontcost2.onchange = fnUpFrontCost;	
	}
	if (crmForm.all.ayr_upfrontcost3 != null) {
		crmForm.all.ayr_upfrontcost3.onchange = fnUpFrontCost;
	}
	if (crmForm.all.ayr_upfrontcost4 != null) {
		crmForm.all.ayr_upfrontcost4.onchange = fnUpFrontCost;
	}
	if (crmForm.all.ayr_upfrontcost5 != null) {
		crmForm.all.ayr_upfrontcost5.onchange = fnUpFrontCost;
	}
	if (crmForm.all.ayr_upfrontcost6 != null) {
		crmForm.all.ayr_upfrontcost6.onchange = fnUpFrontCost;
	}
	if (crmForm.all.ayr_upfrontcost7 != null) {
		crmForm.all.ayr_upfrontcost7.onchange = fnUpFrontCost;
	}
	if (crmForm.all.ayr_upfrontcost8 != null) {
		crmForm.all.ayr_upfrontcost8.onchange = fnUpFrontCost;
	}
	if (crmForm.all.ayr_upfrontcost9 != null) {
		crmForm.all.ayr_upfrontcost9.onchange = fnUpFrontCost;
	}
	if (crmForm.all.ayr_upfrontcost10 != null) {
		crmForm.all.ayr_upfrontcost10.onchange = fnUpFrontCost;
	}
	if (crmForm.all.ayr_bidperaircraft != null) {
		crmForm.all.ayr_bidperaircraft.onchange = fnBidPerAirCraft;
	}
	if (crmForm.all.ayr_bidperaircraft2 != null) {
		crmForm.all.ayr_bidperaircraft2.onchange = fnBidPerAirCraft;
	}
	if (crmForm.all.ayr_bidperaircraft3 != null) {
		crmForm.all.ayr_bidperaircraft3.onchange = fnBidPerAirCraft;
	}
	if (crmForm.all.ayr_bidperaircraft4 != null) {
		crmForm.all.ayr_bidperaircraft4.onchange = fnBidPerAirCraft;
	}
	if (crmForm.all.ayr_bidperaircraft5 != null) {
		crmForm.all.ayr_bidperaircraft5.onchange = fnBidPerAirCraft;
	}
	if (crmForm.all.ayr_bidperaircraft6 != null) {
		crmForm.all.ayr_bidperaircraft6.onchange = fnBidPerAirCraft;
	}
	if (crmForm.all.ayr_bidperaircraft7 != null) {
		crmForm.all.ayr_bidperaircraft7.onchange = fnBidPerAirCraft;
	}
	if (crmForm.all.ayr_bidperaircraft8 != null) {
		crmForm.all.ayr_bidperaircraft8.onchange = fnBidPerAirCraft;
	}
	if (crmForm.all.ayr_bidperaircraft9 != null) {
		crmForm.all.ayr_bidperaircraft9.onchange = fnBidPerAirCraft;
	}
	if (crmForm.all.ayr_bidperaircraft10 != null) {
		crmForm.all.ayr_bidperaircraft10.onchange = fnBidPerAirCraft;
	}
	if (crmForm.all.ayr_leaseratevalue != null) {
		crmForm.all.ayr_leaseratevalue.onchange = fnLeaseRateFactor;
	}
	if (crmForm.all.ayr_leaseratevalue2 != null) {
		crmForm.all.ayr_leaseratevalue2.onchange = fnLeaseRateFactor;
	}
	if (crmForm.all.ayr_leaseratevalue3 != null) {
		crmForm.all.ayr_leaseratevalue3.onchange = fnLeaseRateFactor;
	}
	if (crmForm.all.ayr_leaseratevalue4 != null) {
		crmForm.all.ayr_leaseratevalue4.onchange = fnLeaseRateFactor;
	}
	if (crmForm.all.ayr_leaseratevalue5 != null) {
		crmForm.all.ayr_leaseratevalue5.onchange = fnLeaseRateFactor;
	}
	if (crmForm.all.ayr_leaseratevalue6 != null) {
		crmForm.all.ayr_leaseratevalue6.onchange = fnLeaseRateFactor;
	}
	if (crmForm.all.ayr_leaseratevalue7 != null) {
		crmForm.all.ayr_leaseratevalue7.onchange = fnLeaseRateFactor;
	}
	if (crmForm.all.ayr_leaseratevalue8 != null) {
		crmForm.all.ayr_leaseratevalue8.onchange = fnLeaseRateFactor;
	}
	if (crmForm.all.ayr_leaseratevalue9 != null) {
		crmForm.all.ayr_leaseratevalue9.onchange = fnLeaseRateFactor;
	}
	if (crmForm.all.ayr_leaseratevalue10 != null) {
		crmForm.all.ayr_leaseratevalue10.onchange = fnLeaseRateFactor;
	}
	if (crmForm.all.ayr_numberofaircraftdealid != null) {
		crmForm.all.ayr_numberofaircraftdealid.onchange = fnNumberOfAircraft;
	}
	
	if (crmForm.all.new_typeofopportunity != null) {
		//crmForm.all.new_typeofopportunity.onchange = fnHideShowFields;
	}
	if (crmForm.all.ayr_dealstatus != null) {
		//crmForm.all.ayr_dealstatus.onchange = fnHideShowFields;
	}
	if (crmForm.all.ayr_dealpriced != null) {
		crmForm.all.ayr_dealpriced.onchange = fnHideShowSections_1;
	}
	if (crmForm.all.ayr_dealpriced2 != null) {
		crmForm.all.ayr_dealpriced2.onchange = fnHideShowSections_2;
	}
	if (crmForm.all.ayr_dealpriced3 != null) {
		crmForm.all.ayr_dealpriced3.onchange = fnHideShowSections_3;
	}
	if (crmForm.all.ayr_dealpriced4 != null) {
		crmForm.all.ayr_dealpriced4.onchange = fnHideShowSections_4;
	}
	if (crmForm.all.ayr_dealpriced5 != null) {
		crmForm.all.ayr_dealpriced5.onchange = fnHideShowSections_5;
	}
	if (crmForm.all.ayr_dealpriced6 != null) {
		crmForm.all.ayr_dealpriced6.onchange = fnHideShowSections_6;
	}
	if (crmForm.all.ayr_dealpriced7 != null) {
		crmForm.all.ayr_dealpriced7.onchange = fnHideShowSections_7;
	}
	if (crmForm.all.ayr_dealpriced8 != null) {
		crmForm.all.ayr_dealpriced8.onchange = fnHideShowSections_8;
	}
	if (crmForm.all.ayr_dealpriced9 != null) {
		crmForm.all.ayr_dealpriced9.onchange = fnHideShowSections_9;
	}
	if (crmForm.all.ayr_dealpriced10 != null) {
		crmForm.all.ayr_dealpriced10.onchange = fnHideShowSections_10;
	}
	if (crmForm.all.ayr_leaseratetype != null) {
		crmForm.all.ayr_leaseratetype.onchange = fnHideShowLeaseRateValue_1;
	}
	if (crmForm.all.ayr_leaseratetype2 != null) {
		crmForm.all.ayr_leaseratetype2.onchange = fnHideShowLeaseRateValue_2;
	}
	if (crmForm.all.ayr_leaseratetype3 != null) {
		crmForm.all.ayr_leaseratetype3.onchange = fnHideShowLeaseRateValue_3;
	}
	if (crmForm.all.ayr_leaseratetype4 != null) {
		crmForm.all.ayr_leaseratetype4.onchange = fnHideShowLeaseRateValue_4;
	}
	if (crmForm.all.ayr_leaseratetype5 != null) {
		crmForm.all.ayr_leaseratetype5.onchange = fnHideShowLeaseRateValue_5;
	}
	if (crmForm.all.ayr_leaseratetype6 != null) {
		crmForm.all.ayr_leaseratetype6.onchange = fnHideShowLeaseRateValue_6;
	}
	if (crmForm.all.ayr_leaseratetype7 != null) {
		crmForm.all.ayr_leaseratetype7.onchange = fnHideShowLeaseRateValue_7;
	}
	if (crmForm.all.ayr_leaseratetype8 != null) {
		crmForm.all.ayr_leaseratetype8.onchange = fnHideShowLeaseRateValue_8;
	}
	if (crmForm.all.ayr_leaseratetype9 != null) {
		crmForm.all.ayr_leaseratetype9.onchange = fnHideShowLeaseRateValue_9;
	}
	if (crmForm.all.ayr_leaseratetype10 != null) {
		crmForm.all.ayr_leaseratetype10.onchange = fnHideShowLeaseRateValue_10;
	}
	if (crmForm.all.ayr_leaseterm != null) {
		crmForm.all.ayr_leaseterm.onchange = fnHideShowLeaseTermValue_1;
	}
	if (crmForm.all.ayr_leaseterm2 != null) {
		crmForm.all.ayr_leaseterm2.onchange = fnHideShowLeaseTermValue_2;
	}
	if (crmForm.all.ayr_leaseterm3 != null) {
		crmForm.all.ayr_leaseterm3.onchange = fnHideShowLeaseTermValue_3;
	}
	if (crmForm.all.ayr_leaseterm4 != null) {
		crmForm.all.ayr_leaseterm4.onchange = fnHideShowLeaseTermValue_4;
	}
	if (crmForm.all.ayr_leaseterm5 != null) {
		crmForm.all.ayr_leaseterm5.onchange = fnHideShowLeaseTermValue_5;
	}
	if (crmForm.all.ayr_leaseterm6 != null) {
		crmForm.all.ayr_leaseterm6.onchange = fnHideShowLeaseTermValue_6;
	}
	if (crmForm.all.ayr_leaseterm7 != null) {
		crmForm.all.ayr_leaseterm7.onchange = fnHideShowLeaseTermValue_7;
	}
	if (crmForm.all.ayr_leaseterm8 != null) {
		crmForm.all.ayr_leaseterm8.onchange = fnHideShowLeaseTermValue_8;
	}
	if (crmForm.all.ayr_leaseterm9 != null) {
		crmForm.all.ayr_leaseterm9.onchange = fnHideShowLeaseTermValue_9;
	}
	if (crmForm.all.ayr_leaseterm10 != null) {
		crmForm.all.ayr_leaseterm10.onchange = fnHideShowLeaseTermValue_10;
	}
//Create Toolbar Custom buttons
if((crmForm.FormType == UPDATETYPE) || (crmForm.FormType == READONLY) || (crmForm.FormType == DISABLED)){
	//CreateToolbarCustomButtons(); //Commented By Task# 152
}	
//Hide Show Tabls	
HideShowAirCraftTabs();

//Hide Show ayr_remarketid	
//fnHideShowFields();

//Hide Show ayr_dealpriced section	
if(crmForm.FormType != QUICKCREATE){
	for (var i = 1; i <= 10; i++){
		HideShowPriceSection(i);}
	HideShowDealTotals();
}
//Hide Show ayr_leaseratetype	
if(crmForm.FormType != QUICKCREATE){
	for (var i = 1; i <= 10; i++){
		fnHideShowLeaseRateValue(i);}
	fnLeaseRateFactor();
}

//Hide Show ayr_leaseterm	
if(crmForm.FormType != QUICKCREATE){
for (var i = 1; i <= 10; i++){
	fnHideShowLeaseTermValue(i);}
}

/* Hide Administration Tab */
oTab3 = crmForm.all.tab3Tab; 
if(typeof(oTab3) != "undefined" && oTab3 != null) 
{ 
	crmForm.all.tab3Tab.style.display="none";
} 

/* Hide Notes Tab*/
oTab4 = crmForm.all.tab4Tab; 
if(typeof(oTab4) != "undefined" && oTab4 != null) 
{ 
	crmForm.all.tab4Tab.style.display="none";
} 
/* set flag*/
//Change Added 12/17
if(crmForm.all.ayr_clearedflag != null){
	crmForm.all.ayr_clearedflag.DataValue = false;
}

/* rename sales*/
var navSales= document.getElementById("_NA_SFA");
if (navSales!= null) 
{ 
	navSales.innerHTML= "<img src=\"/_imgs/navup.gif\" align=\"absmiddle\" /> Related Items:"
}



/* Hide Orders Link*/
var navOrders= document.getElementById("navOrders");
if (navOrders!= null) 
{ 
	navOrders.style.display="none";
}

/* Hide Invoices Link*/
var navInvoices= document.getElementById("navInvoices");
if (navInvoices!= null) 
{ 
	navInvoices.style.display="none";
}


/* Hide Competitors Link*/
var navComp= document.getElementById("navComp");
if (navComp!= null) 
{ 
	navComp.style.display="none";
}


/* rename history to activities*/
var navHistory= document.getElementById("navActivityHistory");
if (navHistory!= null) 
{ 
	navHistory.innerHTML= "<img class=\"icon\" src=\"/_imgs/ico_18_act.gif\" align=\"absMiddle\" /> <NOBR class=\"lbText\" title=\"View Activities\" style=\"WIDTH: 105px\">Activities</NOBR>"
}

//remove activity nav item
var navActivities = document.getElementById("navActivities");
if (navActivities != null) {
	var lbArea = navActivities.parentNode;
	if (lbArea != null) {
		lbArea.removeChild(navActivities);
		lbArea.style.display="none";
}
}



//remove Workflow nav item
var navAsyncOperations = document.getElementById("navAsyncOperations");
if (navAsyncOperations != null) {
	var lbArea = navAsyncOperations.parentNode;
	if (lbArea != null) {
		lbArea.removeChild(navAsyncOperations);
		lbArea.style.display="none";
}
}


//remove Workflow nav item
var navActivityHistory = document.getElementById("navActivityHistory");
if (navActivityHistory != null) {
	var lbArea = navActivityHistory.parentNode;
	if (lbArea != null) {
		lbArea.removeChild(navActivityHistory);
		lbArea.style.display="none";
}
}



/*End Script* - deal script*/

Open in new window

0
 
LVL 7

Expert Comment

by:stacko111
ID: 35147995
Is the field a custom field or a system standard one?
0
 

Author Comment

by:bduenges
ID: 35148021
The field is a custom field that is also a lookup field.
0
 
LVL 7

Assisted Solution

by:stacko111
stacko111 earned 500 total points
ID: 35148053
Ok well then from your code it should either have 'ayr_' or 'new_' in front of the field name in my code. It depends how your system is set up.

Find the field in the attributes list of the form and look at what the schema name is, this is what should be put in the code I gave you:

crmForm.all.fieldname_c.style.visibility = 'hidden';
crmForm.all.fieldname_d.style.visibility = 'hidden';
0
 

Author Comment

by:bduenges
ID: 35148076
When I look at the attribute for that field, it does not have ayr or new infront of it, but rather what I posted.  Does it matter that this field is required to have data in it?
0
 
LVL 7

Expert Comment

by:stacko111
ID: 35148176
If it does not have those in front of it then it isn't a custom field, it's a system one. It shouldn't matter if it has data in or not. At a glance I can't see anything in the rest of the code that would cause a conflict but I guess this must be the problem.

Try putting the code I gave you at the very bottom of the onLoad code, after the /*End Script* - deal script*/
0
 

Author Comment

by:bduenges
ID: 35148559
I tried placing that code at the bottom and that also did not work.  I tried hiding another field and that worked fine.  So the problem is with this currency field which I will just have to leave on the form.

0
 
LVL 7

Expert Comment

by:stacko111
ID: 35149011
Hard to know what the problem is, you could check if there is any code in the OnChange event of the field itself, although I can't see how that would effect it.

Are you able to hide other lookup fields on the form? If so then I would say it must be something within the rest of the OnLoad code that is conflicting with it.
0
 

Accepted Solution

by:
bduenges earned 0 total points
ID: 35235376
I ended up just backing up the customizations and deleting fields that I do not need.
0
 

Author Closing Comment

by:bduenges
ID: 35304315
I was able to hide some fields with the instructions provided, however some other fields would not hide.  So I just deleted them,
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part I
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part II
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question