//<![CDATA[
/* =================Encapsoluated JS ==== No Need to Change === Begin Ajax information ================== */
/**
* function getHTTPObject
* This function is set up to 
* allow access to the XMLHttpRequest Object
* within JavaScript
*/
function getHTTPObject() { 
	var xmlhttp; 
	/*@cc_on 
	@if (@_jscript_version >= 5) 
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
		} catch (e) { 
			try { 
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
			} catch (E) { 
				xmlhttp = false; 
			} 
		} 
	@else 
		xmlhttp = false; 
	@end @*/	
		
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { 
		try { 
			xmlhttp = new XMLHttpRequest(); 
		} catch (e) {
			xmlhttp = false; 
		} 
	} 
	return xmlhttp; 
} /* End function getHTTPObject */

/* Load the getHTTPObject into the JavaScript http varaible */
var http = getHTTPObject(); // We create the HTTP Object 

/* =================Encapsoluated JS ==== No Need to Change === End Ajax information ================== */

/**
* function ajaxFunction()
*/
function ajaxFunction(name, value, mode, month, page) {
	//send to ajax 
	if (mode == 'newcomment') queryString = 'name=' + name + '&value=' + value + '&mode=' + mode + '&postername=' + window.postername;
	else queryString = name + '=' + value + '&mode' + '=' + mode + '&page=' + page + '&month=' + month;
	http.open("GET", 'inc/ajax.php' + '?' + queryString, true);
	switch (mode) {	 
		case 'changeMain': http.onreadystatechange = ajaxChangeMain;break;
		case 'selectMonth': http.onreadystatechange = ajaxSelectMonth;break;
		case 'restoreMonth': http.onreadystatechange = ajaxRestoreMonth;break;
		case 'newcomment': http.onreadystatechange = ajaxNewComment;break;
		case 'loadcomment': http.onreadystatechange = ajaxLoadComment;break;
	}
	//http.onreadystatechange_changeMain = ajaxFunctionResponse;
	http.send(null);
} 
function ajaxChangeMain() {
	//hide('blog2');hide('blog3');hide('blog4');hide('blog5');
	//document.getElementById('blogContainer').innerHTML = 'loading1';
	//if (http.readystate==4 && http.status==200) document.getElementById('localnews').innerHTML = http.responseText;
	if (http.status==200 && http.readyState==4) document.getElementById('blogContainer').innerHTML = http.responseText;
} 
function ajaxSelectMonth() {
	//document.getElementById('months').innerHTML = '<div class="groundcont"><div class="groundtop"><img src="gtl.gif" alt="" width="15" height="15" class="corner" style="display: none" /></div><div id="universalPadding">loading2</div><div class="groundbottom"><img src="gbl.gif" alt="" width="15" height="15" class="corner" style="display: none" /></div></div>';
	//if (http.readystate==4 && http.status==200) document.getElementById('localnews').innerHTML = http.responseText;
	if (http.status==200 && http.readyState==4) document.getElementById('months').innerHTML = http.responseText;
} 
function ajaxRestoreMonth() {
	//document.getElementById('months').innerHTML = 'loading3';
	//if (http.readystate==4 && http.status==200) document.getElementById('localnews').innerHTML = http.responseText;
	if (http.status==200 && http.readyState==4) document.getElementById('months').innerHTML = http.responseText;
} 
function ajaxNewComment() {
	if (http.status==200 && http.readyState==4) {
		alert('Comment was saved you may refresh to view');
	}
}
function ajaxLoadComment() {
	
}
//]]>
