<!--
//  Title:       Region Summary
//  Developer:   Wade McDonough
//  Verion:      1.0
//  Date:        3 Nov 2006
//  Description: 
// 
/////////////////////////////

function crop_detail_onclick(x_button)
{
	if (x_button == 'save')
	{
		if(crop_detail_validate() == false)
			return;
		
		ajax_showdiv('div_form_1');

		var x_id = document.getElementById('crop_id').value;

		var url = 'modules/crop/crop_detail.php';
		
		var param = 'mode=update';
		param += '&crop_id=' 				+ x_id;
		param += '&crop_status_id=' 	+ document.getElementById('crop_status_id').value;
		param += '&crop_client_id=' 	+ document.getElementById('crop_client_id').value;

		param += '&crop_reference=' 	+ encodeURIComponent(document.getElementById('crop_reference').value);
		
		param += '&crop_filename_1=' 		+ document.getElementById('crop_filename_1').value;
		param += '&crop_filename_1_ref=' 	+ document.getElementById('crop_filename_1_ref').value;

		param += '&crop_notes=' 		+ encodeURIComponent(document.getElementById('crop_notes').value);

		param += '&crop_con_1_w=' 	+ document.getElementById('crop_con_1_w').value;
		param += '&crop_con_1_h=' 	+ document.getElementById('crop_con_1_h').value;
		param += '&crop_con_1_t=' 	+ document.getElementById('crop_con_1_t').value;
		param += '&crop_con_1_l=' 	+ document.getElementById('crop_con_1_l').value;

//		param += '&crop_con_2_w=' 	+ document.getElementById('crop_con_2_w').value;
//		param += '&crop_con_2_h=' 	+ document.getElementById('crop_con_2_h').value;
//		param += '&crop_con_2_t=' 	+ document.getElementById('crop_con_2_t').value;
//		param += '&crop_con_2_l=' 	+ document.getElementById('crop_con_2_l').value;

		param += '&crop_acc_1_w=' 	+ document.getElementById('crop_acc_1_w').value;
		param += '&crop_acc_1_h=' 	+ document.getElementById('crop_acc_1_h').value;
		param += '&crop_acc_1_t=' 	+ document.getElementById('crop_acc_1_t').value;
		param += '&crop_acc_1_l=' 	+ document.getElementById('crop_acc_1_l').value;

		param += '&crop_acc_2_w=' 	+ document.getElementById('crop_acc_2_w').value;
		param += '&crop_acc_2_h=' 	+ document.getElementById('crop_acc_2_h').value;
		param += '&crop_acc_2_t=' 	+ document.getElementById('crop_acc_2_t').value;
		param += '&crop_acc_2_l=' 	+ document.getElementById('crop_acc_2_l').value;

		param += '&crop_match_string=' 	+ encodeURIComponent(document.getElementById('crop_match_string').value);

		param += '&crop_pick_1_w=' 	+ document.getElementById('crop_pick_1_w').value;
		param += '&crop_pick_1_h=' 	+ document.getElementById('crop_pick_1_h').value;
		param += '&crop_pick_1_t=' 	+ document.getElementById('crop_pick_1_t').value;
		param += '&crop_pick_1_l=' 	+ document.getElementById('crop_pick_1_l').value;

		param += '&crop_pick_2_w=' 	+ document.getElementById('crop_pick_2_w').value;
		param += '&crop_pick_2_h=' 	+ document.getElementById('crop_pick_2_h').value;
		param += '&crop_pick_2_t=' 	+ document.getElementById('crop_pick_2_t').value;
		param += '&crop_pick_2_l=' 	+ document.getElementById('crop_pick_2_l').value;

		param += '&crop_pick_3_w=' 	+ document.getElementById('crop_pick_3_w').value;
		param += '&crop_pick_3_h=' 	+ document.getElementById('crop_pick_3_h').value;
		param += '&crop_pick_3_t=' 	+ document.getElementById('crop_pick_3_t').value;
		param += '&crop_pick_3_l=' 	+ document.getElementById('crop_pick_3_l').value;

		param += '&crop_pick_4_w=' 	+ document.getElementById('crop_pick_4_w').value;
		param += '&crop_pick_4_h=' 	+ document.getElementById('crop_pick_4_h').value;
		param += '&crop_pick_4_t=' 	+ document.getElementById('crop_pick_4_t').value;
		param += '&crop_pick_4_l=' 	+ document.getElementById('crop_pick_4_l').value;

		param += '&crop_pick_5_w=' 	+ document.getElementById('crop_pick_5_w').value;
		param += '&crop_pick_5_h=' 	+ document.getElementById('crop_pick_5_h').value;
		param += '&crop_pick_5_t=' 	+ document.getElementById('crop_pick_5_t').value;
		param += '&crop_pick_5_l=' 	+ document.getElementById('crop_pick_5_l').value;

		param += '&crop_pick_6_w=' 	+ document.getElementById('crop_pick_6_w').value;
		param += '&crop_pick_6_h=' 	+ document.getElementById('crop_pick_6_h').value;
		param += '&crop_pick_6_t=' 	+ document.getElementById('crop_pick_6_t').value;
		param += '&crop_pick_6_l=' 	+ document.getElementById('crop_pick_6_l').value;

		param += '&crop_pick_7_w=' 	+ document.getElementById('crop_pick_7_w').value;
		param += '&crop_pick_7_h=' 	+ document.getElementById('crop_pick_7_h').value;
		param += '&crop_pick_7_t=' 	+ document.getElementById('crop_pick_7_t').value;
		param += '&crop_pick_7_l=' 	+ document.getElementById('crop_pick_7_l').value;

		param += '&crop_pick_8_w=' 	+ document.getElementById('crop_pick_8_w').value;
		param += '&crop_pick_8_h=' 	+ document.getElementById('crop_pick_8_h').value;
		param += '&crop_pick_8_t=' 	+ document.getElementById('crop_pick_8_t').value;
		param += '&crop_pick_8_l=' 	+ document.getElementById('crop_pick_8_l').value;

		param += '&crop_pick_9_w=' 	+ document.getElementById('crop_pick_9_w').value;
		param += '&crop_pick_9_h=' 	+ document.getElementById('crop_pick_9_h').value;
		param += '&crop_pick_9_t=' 	+ document.getElementById('crop_pick_9_t').value;
		param += '&crop_pick_9_l=' 	+ document.getElementById('crop_pick_9_l').value;

		param += '&crop_pick_10_w=' 	+ document.getElementById('crop_pick_10_w').value;
		param += '&crop_pick_10_h=' 	+ document.getElementById('crop_pick_10_h').value;
		param += '&crop_pick_10_t=' 	+ document.getElementById('crop_pick_10_t').value;
		param += '&crop_pick_10_l=' 	+ document.getElementById('crop_pick_10_l').value;

		param += '&crop_del_1_w=' 	+ document.getElementById('crop_del_1_w').value;
		param += '&crop_del_1_h=' 	+ document.getElementById('crop_del_1_h').value;
		param += '&crop_del_1_t=' 	+ document.getElementById('crop_del_1_t').value;
		param += '&crop_del_1_l=' 	+ document.getElementById('crop_del_1_l').value;

		param += '&crop_del_2_w=' 	+ document.getElementById('crop_del_2_w').value;
		param += '&crop_del_2_h=' 	+ document.getElementById('crop_del_2_h').value;
		param += '&crop_del_2_t=' 	+ document.getElementById('crop_del_2_t').value;
		param += '&crop_del_2_l=' 	+ document.getElementById('crop_del_2_l').value;

		param += '&crop_del_3_w=' 	+ document.getElementById('crop_del_3_w').value;
		param += '&crop_del_3_h=' 	+ document.getElementById('crop_del_3_h').value;
		param += '&crop_del_3_t=' 	+ document.getElementById('crop_del_3_t').value;
		param += '&crop_del_3_l=' 	+ document.getElementById('crop_del_3_l').value;

		param += '&crop_del_4_w=' 	+ document.getElementById('crop_del_4_w').value;
		param += '&crop_del_4_h=' 	+ document.getElementById('crop_del_4_h').value;
		param += '&crop_del_4_t=' 	+ document.getElementById('crop_del_4_t').value;
		param += '&crop_del_4_l=' 	+ document.getElementById('crop_del_4_l').value;

		param += '&crop_del_5_w=' 	+ document.getElementById('crop_del_5_w').value;
		param += '&crop_del_5_h=' 	+ document.getElementById('crop_del_5_h').value;
		param += '&crop_del_5_t=' 	+ document.getElementById('crop_del_5_t').value;
		param += '&crop_del_5_l=' 	+ document.getElementById('crop_del_5_l').value;

		param += '&crop_del_6_w=' 	+ document.getElementById('crop_del_6_w').value;
		param += '&crop_del_6_h=' 	+ document.getElementById('crop_del_6_h').value;
		param += '&crop_del_6_t=' 	+ document.getElementById('crop_del_6_t').value;
		param += '&crop_del_6_l=' 	+ document.getElementById('crop_del_6_l').value;

		param += '&crop_del_7_w=' 	+ document.getElementById('crop_del_7_w').value;
		param += '&crop_del_7_h=' 	+ document.getElementById('crop_del_7_h').value;
		param += '&crop_del_7_t=' 	+ document.getElementById('crop_del_7_t').value;
		param += '&crop_del_7_l=' 	+ document.getElementById('crop_del_7_l').value;

		param += '&crop_del_8_w=' 	+ document.getElementById('crop_del_8_w').value;
		param += '&crop_del_8_h=' 	+ document.getElementById('crop_del_8_h').value;
		param += '&crop_del_8_t=' 	+ document.getElementById('crop_del_8_t').value;
		param += '&crop_del_8_l=' 	+ document.getElementById('crop_del_8_l').value;

		param += '&crop_del_9_w=' 	+ document.getElementById('crop_del_9_w').value;
		param += '&crop_del_9_h=' 	+ document.getElementById('crop_del_9_h').value;
		param += '&crop_del_9_t=' 	+ document.getElementById('crop_del_9_t').value;
		param += '&crop_del_9_l=' 	+ document.getElementById('crop_del_9_l').value;

		param += '&crop_del_10_w=' 	+ document.getElementById('crop_del_10_w').value;
		param += '&crop_del_10_h=' 	+ document.getElementById('crop_del_10_h').value;
		param += '&crop_del_10_t=' 	+ document.getElementById('crop_del_10_t').value;
		param += '&crop_del_10_l=' 	+ document.getElementById('crop_del_10_l').value;

		param += '&crop_fr_1_w=' 	+ document.getElementById('crop_fr_1_w').value;
		param += '&crop_fr_1_h=' 	+ document.getElementById('crop_fr_1_h').value;
		param += '&crop_fr_1_t=' 	+ document.getElementById('crop_fr_1_t').value;
		param += '&crop_fr_1_l=' 	+ document.getElementById('crop_fr_1_l').value;

		param += '&crop_fr_2_w=' 	+ document.getElementById('crop_fr_2_w').value;
		param += '&crop_fr_2_h=' 	+ document.getElementById('crop_fr_2_h').value;
		param += '&crop_fr_2_t=' 	+ document.getElementById('crop_fr_2_t').value;
		param += '&crop_fr_2_l=' 	+ document.getElementById('crop_fr_2_l').value;

		param += '&crop_fr_3_w=' 	+ document.getElementById('crop_fr_3_w').value;
		param += '&crop_fr_3_h=' 	+ document.getElementById('crop_fr_3_h').value;
		param += '&crop_fr_3_t=' 	+ document.getElementById('crop_fr_3_t').value;
		param += '&crop_fr_3_l=' 	+ document.getElementById('crop_fr_3_l').value;

		param += '&crop_fr_4_w=' 	+ document.getElementById('crop_fr_4_w').value;
		param += '&crop_fr_4_h=' 	+ document.getElementById('crop_fr_4_h').value;
		param += '&crop_fr_4_t=' 	+ document.getElementById('crop_fr_4_t').value;
		param += '&crop_fr_4_l=' 	+ document.getElementById('crop_fr_4_l').value;

		param += '&crop_fr_5_w=' 	+ document.getElementById('crop_fr_5_w').value;
		param += '&crop_fr_5_h=' 	+ document.getElementById('crop_fr_5_h').value;
		param += '&crop_fr_5_t=' 	+ document.getElementById('crop_fr_5_t').value;
		param += '&crop_fr_5_l=' 	+ document.getElementById('crop_fr_5_l').value;

		param += '&crop_date_1_w=' 	+ document.getElementById('crop_date_1_w').value;
		param += '&crop_date_1_h=' 	+ document.getElementById('crop_date_1_h').value;
		param += '&crop_date_1_t=' 	+ document.getElementById('crop_date_1_t').value;
		param += '&crop_date_1_l=' 	+ document.getElementById('crop_date_1_l').value;

		var div = 'div_popup_1';
		var callback = "index_location('connote', 'crop', 'summary', '" + x_id + "')";
		ajax_processRequestPost(url,param,div,callback)
		return false;
	}
	return false;
}

function crop_detail_validate()
{
	if (!isSelected('crop_client_id', 'Please select a \'Client\''))
		return false;

	if (!isEmpty('crop_reference', 'Please enter a \'Reference\''))
		return false;

	// All Good.
	return true;
}

function crop_detail_open(filename,other)
{
	var x_value = document.getElementById('crop_filename_1').value
	if (x_value == '')
	{
		alert("No Template File.\n\nPlease 'Select Browse and Attach a Template'");	
		return;
	}

	var url = "modules/crop/crop_window.php"; 
	url += "?mode=" + other;
	url += "&filename=" + x_value;

	var new_window = window.open(url,'print','width=900,height=700,resizable=yes,scrollbars=yes');
	new_window.focus();
}

function crop_detail_highlight()
{
	index_bg_color('crop_status_id','#99FF99');
	index_bg_color('crop_client_id','#99FF99');
	index_bg_color('crop_reference','#99FF99');
//	index_bg_color('crop_filename_1','#99FF99');
}

function crop_detail_format(x_id)
{
	index_conv_dec('crop_con_1_w','0');
	index_conv_dec('crop_con_1_h','0');
	index_conv_dec('crop_con_1_t','0');
	index_conv_dec('crop_con_1_l','0');

//	index_conv_dec('crop_con_2_w','0');
//	index_conv_dec('crop_con_2_h','0');
//	index_conv_dec('crop_con_2_t','0');
//	index_conv_dec('crop_con_2_l','0');

	index_conv_dec('crop_acc_1_w','0');
	index_conv_dec('crop_acc_1_h','0');
	index_conv_dec('crop_acc_1_t','0');
	index_conv_dec('crop_acc_1_l','0');

	index_conv_dec('crop_acc_2_w','0');
	index_conv_dec('crop_acc_2_h','0');
	index_conv_dec('crop_acc_2_t','0');
	index_conv_dec('crop_acc_2_l','0');

	index_conv_dec('crop_pick_1_w','0');
	index_conv_dec('crop_pick_1_h','0');
	index_conv_dec('crop_pick_1_t','0');
	index_conv_dec('crop_pick_1_l','0');

	index_conv_dec('crop_pick_2_w','0');
	index_conv_dec('crop_pick_2_h','0');
	index_conv_dec('crop_pick_2_t','0');
	index_conv_dec('crop_pick_2_l','0');

	index_conv_dec('crop_pick_3_w','0');
	index_conv_dec('crop_pick_3_h','0');
	index_conv_dec('crop_pick_3_t','0');
	index_conv_dec('crop_pick_3_l','0');

	index_conv_dec('crop_pick_4_w','0');
	index_conv_dec('crop_pick_4_h','0');
	index_conv_dec('crop_pick_4_t','0');
	index_conv_dec('crop_pick_4_l','0');

	index_conv_dec('crop_pick_5_w','0');
	index_conv_dec('crop_pick_5_h','0');
	index_conv_dec('crop_pick_5_t','0');
	index_conv_dec('crop_pick_5_l','0');

	index_conv_dec('crop_pick_6_w','0');
	index_conv_dec('crop_pick_6_h','0');
	index_conv_dec('crop_pick_6_t','0');
	index_conv_dec('crop_pick_6_l','0');

	index_conv_dec('crop_pick_7_w','0');
	index_conv_dec('crop_pick_7_h','0');
	index_conv_dec('crop_pick_7_t','0');
	index_conv_dec('crop_pick_7_l','0');

	index_conv_dec('crop_pick_8_w','0');
	index_conv_dec('crop_pick_8_h','0');
	index_conv_dec('crop_pick_8_t','0');
	index_conv_dec('crop_pick_8_l','0');

	index_conv_dec('crop_pick_9_w','0');
	index_conv_dec('crop_pick_9_h','0');
	index_conv_dec('crop_pick_9_t','0');
	index_conv_dec('crop_pick_9_l','0');

	index_conv_dec('crop_pick_10_w','0');
	index_conv_dec('crop_pick_10_h','0');
	index_conv_dec('crop_pick_10_t','0');
	index_conv_dec('crop_pick_10_l','0');

	index_conv_dec('crop_del_1_w','0');
	index_conv_dec('crop_del_1_h','0');
	index_conv_dec('crop_del_1_t','0');
	index_conv_dec('crop_del_1_l','0');

	index_conv_dec('crop_del_2_w','0');
	index_conv_dec('crop_del_2_h','0');
	index_conv_dec('crop_del_2_t','0');
	index_conv_dec('crop_del_2_l','0');

	index_conv_dec('crop_del_3_w','0');
	index_conv_dec('crop_del_3_h','0');
	index_conv_dec('crop_del_3_t','0');
	index_conv_dec('crop_del_3_l','0');

	index_conv_dec('crop_del_4_w','0');
	index_conv_dec('crop_del_4_h','0');
	index_conv_dec('crop_del_4_t','0');
	index_conv_dec('crop_del_4_l','0');

	index_conv_dec('crop_del_5_w','0');
	index_conv_dec('crop_del_5_h','0');
	index_conv_dec('crop_del_5_t','0');
	index_conv_dec('crop_del_5_l','0');

	index_conv_dec('crop_del_6_w','0');
	index_conv_dec('crop_del_6_h','0');
	index_conv_dec('crop_del_6_t','0');
	index_conv_dec('crop_del_6_l','0');

	index_conv_dec('crop_del_7_w','0');
	index_conv_dec('crop_del_7_h','0');
	index_conv_dec('crop_del_7_t','0');
	index_conv_dec('crop_del_7_l','0');

	index_conv_dec('crop_del_8_w','0');
	index_conv_dec('crop_del_8_h','0');
	index_conv_dec('crop_del_8_t','0');
	index_conv_dec('crop_del_8_l','0');

	index_conv_dec('crop_del_9_w','0');
	index_conv_dec('crop_del_9_h','0');
	index_conv_dec('crop_del_9_t','0');
	index_conv_dec('crop_del_9_l','0');

	index_conv_dec('crop_del_10_w','0');
	index_conv_dec('crop_del_10_h','0');
	index_conv_dec('crop_del_10_t','0');
	index_conv_dec('crop_del_10_l','0');

	index_conv_dec('crop_fr_1_w','0');
	index_conv_dec('crop_fr_1_h','0');
	index_conv_dec('crop_fr_1_t','0');
	index_conv_dec('crop_fr_1_l','0');

	index_conv_dec('crop_fr_2_w','0');
	index_conv_dec('crop_fr_2_h','0');
	index_conv_dec('crop_fr_2_t','0');
	index_conv_dec('crop_fr_2_l','0');

	index_conv_dec('crop_fr_3_w','0');
	index_conv_dec('crop_fr_3_h','0');
	index_conv_dec('crop_fr_3_t','0');
	index_conv_dec('crop_fr_3_l','0');

	index_conv_dec('crop_fr_4_w','0');
	index_conv_dec('crop_fr_4_h','0');
	index_conv_dec('crop_fr_4_t','0');
	index_conv_dec('crop_fr_4_l','0');

	index_conv_dec('crop_fr_5_w','0');
	index_conv_dec('crop_fr_5_h','0');
	index_conv_dec('crop_fr_5_t','0');
	index_conv_dec('crop_fr_5_l','0');

	index_conv_dec('crop_date_1_w','0');
	index_conv_dec('crop_date_1_h','0');
	index_conv_dec('crop_date_1_t','0');
	index_conv_dec('crop_date_1_l','0');

}

function crop_detail_onload(id)
{
	if ((id == 'insert')  || (id == 'edit') || (id == 'view'))
		ajax_showpopup('div_popup_1','div_result');

	crop_detail_highlight();
	crop_detail_format();
}

-->
