var Xml = {
    useActiveX: (typeof ActiveXObject != "undefined"),
    useXmlHttp: (typeof XMLHttpRequest != "undefined")
};

function createXmlHttp (  ) {
	var ro;
	if ( Xml.useXmlHttp ) {
		ro = new XMLHttpRequest(  );
		return ro;
	} else if ( Xml.useActiveX ) {
		var aVersion = [ 
				"MSXML2.XmlHttp.6.0","MSXML2.XmlHttp.3.0" 
				];
		for ( var i = 0; i < aVersion.length; i++ ) {
			try { 
				ro = new ActiveXObject( aVersion[i] );
				return ro;
			} catch ( oError ) {
				//do nothing
			}	
		}
	}

	throw new Error( 'XmlHttp object could not be created' );
	
}

function updatetime ( id ) {
	var start = document.getElementById('start'+id).value;
	var mystring = encodeURIComponent( 'start='+start );

	var oXmlHttp = createXmlHttp(  );
	oXmlHttp.open("GET", "updatetimeperiod.php?"+mystring, true);
	oXmlHttp.onreadystatechange = function (  ) {
		if ( oXmlHttp.readyState == 4 ) {
			if ( oXmlHttp.status == 200 ) {
				alert( oXmlHttp.responseText );
			} else {
				alert( 'An Error Occurred' );
			}
		}
	}
	oXmlHttp.send(null);
}

function openCalendar ( id ) {
	var date;
	date = document.getElementById(id).value;
	var mystring = 'id='+id+'&date='+date;
	var mywindow = window.open('calendar.php?'+mystring+'', '', 'height=250,width=280');

}
