function resetCallbackAjax(){
	xajax.callback.global.onRequest = function() {xajax.$('loadingDiv').style.display = 'block';}
	xajax.callback.global.beforeResponseProcessing = function() {xajax.$('loadingDiv').style.display='none';}		
}

function next(){
	myGallery.navigate("next");
}
	
function previous(){
	myGallery.navigate("prev");
}

function open(id){
	$('#'+id).jqm({
		overlay: 70,
		modal: true						
	});
	$('#'+id).jqmShow();
}

function close(id){
	$('#'+id).jqmHide();	
	str = id.substring(0,1);
	strAlt = id.replace(str, str.toUpperCase());	

	clearFields( "form"+strAlt );
}

function getPhotos( div, id, page, containerId ) {
	//showDiv( div );
	xajax_getPhotos( div, id, page, containerId );
}

function getMonitoring( classifiedId, month){
	yearValue = $("#year").val();		
	//yearValue = ano[document.getElementById('year').selectedIndex].value;
	var curClass = '';
	
	for (i=1;i<=12;i++)
	{
		curClass = document.getElementById('mesMoni'+i);
		if ( curClass.className == 'mesAtivo' )
			curClass.className = 'mes';	
		
		if ( i == month )
			curClass.className = 'mesAtivo';	
	}
	
	xajax_getMonitoringByDate( classifiedId, month, yearValue);
}


function refreshMonths(classifiedId, select, monthNow){
	var year = $("#year").val();
	xajax_getMonthsByYear(classifiedId, year);
	
	if (monthNow && year==new Date().getFullYear())
		getMonthBasedCurrent(classifiedId, year);
	else
		getFirstMonth(classifiedId, year);
}

function getLastMonth(classifiedId, year){
	xajax_getMonitoringByLastMonth(classifiedId, year);
}

function getFirstMonth(classifiedId, year){
	xajax_getMonitoringByFirstMonth(classifiedId, year);
}

function getMonthBasedCurrent(classifiedId, year){
	xajax_getMonthBasedCurrent(classifiedId, new Date().getMonth() +1, year);	
}


/*Photos*/
function getPhotosByDate(pictureSetId, classifiedId, month){
	yearValue = $("#yearPhotos").val();	
	
	var curClass = '';
	
	for (i=1;i<=12;i++)
	{
		curClass = document.getElementById('mesPhoto'+i);
		if ( curClass.className == 'mesAtivo' )
			curClass.className = 'mes';	
		
		if ( i == month )
			curClass.className = 'mesAtivo';	
	}
	
	xajax_getPhotosByDate( pictureSetId, classifiedId, month, yearValue);
}

function refreshMonthsPhotos(pictureSetId, classifiedId, select, monthNow){	
	var year = $("#yearPhotos").val();
		
	xajax_getMonthsPhotosByYear(pictureSetId, classifiedId, year);	
	
	if (monthNow && year==new Date().getFullYear())
		getMonthPhotosBasedCurrent(pictureSetId, classifiedId, year);
	else
		getFirstMonth(pictureSetId, classifiedId, year);
}

function getLastMonthPhotos(classifiedId, year){
	xajax_getPhotosByLastMonth(classifiedId, year);
}

function getFirstMonthPhotos(classifiedId, year){
	xajax_getPhotosByFirstMonth(classifiedId, year);
}

function getMonthPhotosBasedCurrent(pictureSetId, classifiedId, year){
	xajax_getMonthPhotosBasedCurrent(pictureSetId, classifiedId, new Date().getMonth() +1, year);	
}





function selectByValue( select, value ){
	if (select) {
	for ( i=0;i<select.length;i++){
		if (select.options[i].value == value)
			select.options[i].selected = true;
	}		
	}
}