function getStatus(statusId){
	
	var http=false; //Clear our fetching variable
	try {
			http = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object?
	} catch (e) {
			try {
					http = new
					ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
		} catch (E) {
			http = false;
					}
	}
	if (!http && typeof XMLHttpRequest!='undefined') {
			http = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
	}
	
	
	var url = '../_includes/s_get_status.php';
	var params = 'status_id=' + statusId;
	http.open('POST', url, true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	http.send(params);
	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			
			document.getElementById('statusDiv').innerHTML = String(http.responseText);

			
		}
	}
}

function getSideLink(linkId, label, linkUrl){
	
	var http=false; //Clear our fetching variable
	try {
			http = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object?
	} catch (e) {
			try {
					http = new
					ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
		} catch (E) {
			http = false;
					}
	}
	if (!http && typeof XMLHttpRequest!='undefined') {
			http = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
	}
	
	
	var url = '../_includes/s_get_link.php';
	var params = 'link_id=' + linkId + '&label=' + label + '&url=' + linkUrl;
	http.open('POST', url, true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	http.send(params);
	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			
			document.getElementById('allLinkDiv').innerHTML = String(http.responseText);
			
		}
	}
}


function getBlogComment(id, name, comment, blogId){
	
	var http=false; //Clear our fetching variable
	try {
			http = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object?
	} catch (e) {
			try {
					http = new
					ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
		} catch (E) {
			http = false;
					}
	}
	if (!http && typeof XMLHttpRequest!='undefined') {
			http = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
	}
	
	
	var url = '../_includes/s_get_blog_comment.php';
	var params = 'id=' + id + '&name=' + name + '&comment=' + comment + '&blog_id=' + blogId;
	http.open('POST', url, true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	http.send(params);
	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			
			document.getElementById('commentsDiv').innerHTML = String(http.responseText);
			document.getElementById('captchaDiv').innerHTML = "<input type=\"hidden\" id=\"wordMatch\" value=\"x\" /><input type=\"hidden\" id=\"matchWord\" value=\"x\" />";
			
		}
	}
}


function getApproveComment(id, method){
	
	var http=false; //Clear our fetching variable
	try {
			http = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object?
	} catch (e) {
			try {
					http = new
					ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
		} catch (E) {
			http = false;
					}
	}
	if (!http && typeof XMLHttpRequest!='undefined') {
			http = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
	}
	
	
	var url = '../_includes/s_get_blog_approve_comment.php';
	var params = 'id=' + id + '&method=' + method;
	http.open('POST', url, true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	http.send(params);
	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			
			document.getElementById('commentsDiv').innerHTML = String(http.responseText);
			
		}
	}
}


function hide(divId){

	document.getElementById(divId).style.visibility='hidden';
	document.getElementById(divId).style.position='absolute';
	document.getElementById(divId).style.zIndex='-1';
	
}

function reveal(divId){

	document.getElementById(divId).style.visibility='visible';
	document.getElementById(divId).style.position='static';
	document.getElementById(divId).style.zIndex='3';
	
}

function disable(id){
	document.getElementById(id).disabled=true;
	document.getElementById(id).style.filter='alpha(opacity=50)';
	document.getElementById(id).style.opacity='.5';
	document.getElementById(id).style.cursor='no-drop';
}

function enable(id){
	document.getElementById(id).disabled=false;
	document.getElementById(id).style.filter='alpha(opacity=100)';
	document.getElementById(id).style.opacity='1';
	document.getElementById(id).style.cursor='pointer';
}

function toggleDiv(hide, show){
	
	if(hide.length>0){
		document.getElementById(hide).style.visibility="hidden";
		document.getElementById(hide).style.zIndex="-1";
		document.getElementById(hide).style.position="absolute";
	}
	if(show.length>0){
		document.getElementById(show).style.visibility="visible";
		document.getElementById(show).style.zIndex="3";
		document.getElementById(show).style.position="static";
	}
}

function restoreField(id, restoreText){
	document.getElementById(id).value=restoreText;
}

function checkComment(commentId){
	
	if(commentId<1){
		var nameLength = document.getElementById('newCommentName').value.length;
		var bodyLength = document.getElementById('newCommentBody').value.length;
		var wordMatch = document.getElementById('wordMatch').value;
		var matchWord = document.getElementById('matchWord').value;
		
		if(nameLength>0 && bodyLength>0 && wordMatch==matchWord){
			document.getElementById('newCommentButton').disabled=false;	
		} else{
			document.getElementById('newCommentButton').disabled=true;
		}
	} else{
		
		var nameLength = document.getElementById('commentName'+commentId).value.length;
		var bodyLength = document.getElementById('commentBody'+commentId).value.length;
		
		if(nameLength>0 && bodyLength>0 && wordMatch==matchWord){
			document.getElementById('commentButton'+commentId).disabled=false;	
		} else{
			document.getElementById('commentButton'+commentId).disabled=true;
		}
	}
	
}


function getBookmark(bookmarkId, bookmarkType, method){
	
	var http=false; //Clear our fetching variable
	try {
			http = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object?
	} catch (e) {
			try {
					http = new
					ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
		} catch (E) {
			http = false;
					}
	}
	if (!http && typeof XMLHttpRequest!='undefined') {
			http = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
	}
	
	
	var url = '../_includes/s_get_bookmark.php';
	var params = 'bookmark_id=' + bookmarkId + '&bookmark_type=' + bookmarkType + '&method=' + method;
	http.open('POST', url, true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	http.send(params);
	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			
			document.getElementById('bookmarkDiv').innerHTML = http.responseText;
			
		}
	}
}


function getBookmarkList(method, id){
	
	var http=false; //Clear our fetching variable
	try {
			http = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object?
	} catch (e) {
			try {
					http = new
					ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
		} catch (E) {
			http = false;
					}
	}
	if (!http && typeof XMLHttpRequest!='undefined') {
			http = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
	}
	
	
	var url = '../_includes/s_get_bookmark_list.php';
	var params = 'method=' + method + '&id=' + id;
	http.open('POST', url, true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	http.send(params);
	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			
			document.getElementById('bookmarkListDiv').innerHTML = http.responseText;
			
		}
	}
}

function toggleCat(catId){
	var state=document.getElementById('catState'+catId).value;
	if(state=="closed"){
		reveal('catDiv'+catId);
		document.getElementById('catState'+catId).value="open";
	} else if(state=="open"){
		hide('catDiv'+catId);
		document.getElementById('catState'+catId).value="closed";
	}
}

function toggleDCat(catId){
	var state=document.getElementById('DcatState'+catId).value;
	if(state=="closed"){
		reveal('DcatDiv'+catId);
		document.getElementById('DcatState'+catId).value="open";
	} else if(state=="open"){
		hide('DcatDiv'+catId);
		document.getElementById('DcatState'+catId).value="closed";
	}
}

function toggle(divId){
	
	if(document.getElementById(divId).style.position=='absolute'){
		
		document.getElementById(divId).style.position='static';
		document.getElementById(divId).style.zIndex='3';
		document.getElementById(divId).style.visibility='visible';
		
	} else{
		
		document.getElementById(divId).style.position='absolute';
		document.getElementById(divId).style.zIndex='-1';
		document.getElementById(divId).style.visibility='hidden';
		
	}
	
}
