
/* reports */
function buildBasicReport(){
	path = '/images/building_report.html';
	new Ajax.Updater(	
			'basic_report_content', 			
			path,
			{
				asynchronous:false,
				evalScripts:true
			});
			
	path = '/includes/ajax/reports.ajax.php';
	new Ajax.Updater(			
		'basic_report_content', 			
		path, 
		{ 
			asynchronous:true,
			evalScripts:true,
			method: 'get', 
			parameters: $('frmBasicReport').serialize(true)
		}
	);
}

function buildAccountReport(){
	path = '/images/building_report.html';
	new Ajax.Updater(	
			'account_report_content', 			
			path,
			{
				asynchronous:false,
				evalScripts:true
			});
			
	path = '/includes/ajax/reports.ajax.php';
	new Ajax.Updater(			
		'account_report_content', 			
		path, 
		{ 
			asynchronous:true,
			evalScripts:true,
			method: 'get', 
			parameters: $('frmAccountReport').serialize(true)
		}
	);
}


function buildAdvancedReport(){
	path = '/images/building_report.html';
	new Ajax.Updater(			
			'advanced_report_content', 			
			path);
			
			
	// Later in your application, when you need the selected dates 
	var arrDates = start_date.getSelectedDates(); 
	for (var i = 0; i < arrDates.length; ++i) { 
	    var date = arrDates[i]; 
	 
	    // Work with selected date... 
	     var displayMonth = date.getMonth() + 1; 
	     var displayYear = date.getFullYear(); 
	     var displayDate = date.getDate(); 
	      document.frmAdvancedReport.start_month.value 	= displayMonth;
		     document.frmAdvancedReport.start_day.value 	= displayDate;
		     document.frmAdvancedReport.start_year.value 	= displayYear;
	}    
			
	// Later in your application, when you need the selected dates 
	var arrDates = end_date.getSelectedDates(); 
	for (var i = 0; i < arrDates.length; ++i) { 
	    var date = arrDates[i]; 
	 
	    // Work with selected date... 
	     var displayMonth = date.getMonth() + 1; 
	     var displayYear = date.getFullYear(); 
	     var displayDate = date.getDate(); 
	     document.frmAdvancedReport.end_month.value 	= displayMonth;
	     document.frmAdvancedReport.end_day.value 	= displayDate;
	     document.frmAdvancedReport.end_year.value 	= displayYear;
	}    
	path = '/includes/ajax/reports.ajax.php';
	new Ajax.Updater(			
			'advanced_report_content', 			
			path, { 
			method: 'get', parameters: $('frmAdvancedReport').serialize(true)});
}

function loadRoyaltiesDetails(divid,report_account_id,royalty_type,payment_id){
	var div_open = divid+'_open';
	if( $(div_open).value != 1){
		new Effect.Appear(divid);
		path = '/includes/ajax/reports.ajax.php';
		new Ajax.Updater(			
			divid, 			
			path, 
			{ 
				asynchronous:true, 
				evalScripts:true,
				method: 'get', 
				parameters: {
					block: 'report_account_royalty_details',
					report_account_id: report_account_id,
					royalty_type: royalty_type,
					royalty_details_divid: divid,
					payment_id: payment_id
				}
			}
		);
		$(div_open).value = 1;
	} else {
		//HideContentDisplay(divid);
		new Effect.Fade(divid);
		$(div_open).value = 0;
	}
}
function loadRoyaltiesDetailsTitle(divid,report_account_id,title_id,royalty_type,payment_id) {
	var div_open_title = royalty_type+title_id+'_open';
	if( $(div_open_title).value != 1){
		path = '/includes/ajax/reports.ajax.php';
		new Effect.Appear(divid);
		new Ajax.Updater(			
			divid, 			
			path, 
			{ 
				asynchronous:false, 
				evalScripts:true,
				method: 'get', 
				parameters: {
					block: 'report_account_royalty_details_title',
					report_account_id: report_account_id,
					royalty_type: royalty_type,
					royalty_title_details_divid: divid,
					title_id: title_id,
					payment_id: payment_id
				}
			}
		);
		$(div_open_title).value = 1;
	} else {
		//HideContentDisplay(divid);
		new Effect.Fade(divid);
		$(div_open_title).value = 0;
	}
}