// JavaScript Document

function popup_calendar ( mode, idn, day, month, year ) {

	//alert( mode +' '+ idn +' '+ day +' '+ month +' '+ year );
	
	if ( mode == 'dropdown' ) {
		
		//popup_main_category = idn;
		
		//alert(pop_month + ' ' +pop_year);
				
		popup_calendar ( 'month', 'category', '', pop_month, pop_year );
		
		
		
	} else if ( mode == 'day' ) {
		
		
		var internal_cat = document.getElementById('pop_cantegory').value;
		
		if ( internal_cat == 'none' ) { popup_main_category = ''; target_file = 'days'; } else { popup_main_category = internal_cat; target_file = 'days-c-' + popup_main_category; }
		
		if ( day.length == 0 ) {} else { target_file = target_file + '-d-' + day;  }
		
		document.getElementById('right_popup').innerHTML = '';
		
		document.getElementById('right_popup').style.background = 'url('+theme_path_images+'images/white-ajax-loader.gif) no-repeat center';
		
		
		url_target = home_path+"home_calendar/"+ month +"/"+ year +"/"+ target_file +".html";
		
		$.get(url_target, function(data){ 
		
			if ( navigator.userAgent.search("MSIE 7") != '-1' || navigator.userAgent.search("MSIE 8") != '-1' ) {
		
				document.getElementById('right_popup').innerHTML = data;
	
			} else { 
			
				$("#right_popup").html(data);
			
			}
			
			document.getElementById('right_popup').style.background = '';
		

		
		});
		
		
		
	} else if ( mode == 'month' ) {
		
		var internal_cat = document.getElementById('pop_cantegory').value;
		
		if ( internal_cat == 'none' ) { popup_main_category = ''; target_file = 'mini'; } else { popup_main_category = internal_cat; target_file = 'cat-' + popup_main_category; }
		
		pop_month = month;
		
		pop_year = year;
		

		
		url_target = home_path+"home_calendar/"+ month +"/"+ year +"/"+ target_file +".html";
				
		document.getElementById('mini_cal_popup').innerHTML = '';
		
		$.get(url_target, function(data){ 
		
			if ( navigator.userAgent.search("MSIE 7") != '-1' || navigator.userAgent.search("MSIE 8") != '-1' ) {
		
				document.getElementById('mini_cal_popup').innerHTML = data;
	
			} else { 
			
				$("#mini_cal_popup").html(data);
			
			}
			
			
			popup_calendar ( 'day', 'category', '', pop_month, pop_year );
		

		
		});
		
	} else {}
	
}
