// JavaScript Document
function showPopCalendar(id){
	
	var calendar = document.getElementById('popCalendar' + id);
	
	if(calendar){
		if(calendar.style.display == 'block'){
			calendar.style.display = 'none';
		}else{
			calendar.style.display = 'block';
		}
		
	}
	
}


function selectDay(date,id){
	
	var textbox = document.getElementById(id);
	
	if(textbox){
		textbox.value = date;
	}
	
	var calendar = document.getElementById('popCalendar' + id);
	
	if(calendar){
		calendar.style.display = 'none';
	}	
	
}

var xmlHttp;
var name;

function moveCalendar(direction,month,year,id){
	
	name = id
	
	//make sure ajax is supported
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null){
  		alert ("Your browser does not support AJAX!");
  		return;
  	}
	
	//alert(direction + ' ' + month + ' ' + year + ' ' + id);
	
	var url = "/utilities/popCalendar/moveCalendarByMonth.asp?operation=" + direction + "&month=" + month + "&year=" + year + "&id=" + id		
	
	xmlHttp.onreadystatechange=stateChangedCalendar;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
}


function stateChangedCalendar(){
	if(xmlHttp.readyState==4){
		//alert(xmlHttp.responseText);
		document.getElementById("popCalendar" + name).innerHTML = xmlHttp.responseText;
		
	}
	
}

