<!--
// ajax start
function do_ajax(id)
{

var whichdiv = 'commentclick' + id ;
inner(whichdiv, null, 'Loading ...');

var this_url = 'show_ajax_comments.php' ;
var send = 'id=' + id ;

ajaxpack.getAjaxRequest(this_url, send, inline_comment, "txt");

}
// end ajax




function inline_comment()
{

var myajax=ajaxpack.ajaxobj
var myfiletype=ajaxpack.filetype
if (myajax.readyState == 4){ //if request of file completed
if (myajax.status==200 || window.location.href.indexOf("http")==-1){ // if request was successful or running script locally
if (myfiletype=="txt")
{

var response = myajax.responseText;
// alert(response);
var zero = response.split('|');

var digit = zero[0]; // this is the unique post id
var msg_comments = zero[1];
var msg_comment_status = zero[2];
var msg_post = zero[3];

var cd;
if ( msg_comments == 1 ) { cd = '1 comment'; } else if ( msg_comments > 1 ) { cd = msg_comments + ' comments'; } else { cd = ''; } 

var comment_div = '';
if ( msg_comment_status == 1 ) {

comment_div = '<div id="post' + digit + '"><a href="javascript:;" onclick="post(' + digit + ',\'toseef\',0,\'toseef@gmail.com\',\'http://\',1,0);">Post a comment</a> &nbsp; <a href="javascript:;" onclick="post(' + digit + ',\'toseef\',0,\'toseef@gmail.com\',\'http://\',1,1);">Track comments</a></div>';

}

var show_dis_msg = '<br clear="all"><br/>  <div id="comments">' + cd + msg_post + comment_div + '</div>' ;

var clickdiv = 'commentclick' + digit ;
inner(clickdiv, null, '');

var whichdiv = 'commentdiv' + digit ;

inner(whichdiv, null, show_dis_msg);
showdiv(whichdiv);

}
else
 {
alert(myajax.responseText);
 }

}
}

}




//Basic Ajax Routine- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: Jan 15th, 06'

function createAjaxObj(){
var httprequest=false
if (window.XMLHttpRequest){ // if Mozilla, Safari etc
httprequest=new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
}
else if (window.ActiveXObject){ // if IE
try {
httprequest=new ActiveXObject("Msxml2.XMLHTTP");
} 
catch (e){
try{
httprequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){}
}
}
return httprequest
}

var ajaxpack=new Object()
ajaxpack.basedomain="http://"+window.location.hostname
ajaxpack.ajaxobj=createAjaxObj()
ajaxpack.filetype="txt"
ajaxpack.addrandomnumber=1 //Set to 1 or 0. See documentation.

ajaxpack.getAjaxRequest=function(url, parameters, callbackfunc, filetype){
ajaxpack.ajaxobj=createAjaxObj() //recreate ajax object to defeat cache problem in IE
if (ajaxpack.addrandomnumber==1) //Further defeat caching problem in IE?
var parameters=parameters+"&ajaxcachebust="+new Date().getTime()
if (this.ajaxobj){
this.filetype=filetype
this.ajaxobj.onreadystatechange=callbackfunc
this.ajaxobj.open('GET', url+"?"+parameters, true)
this.ajaxobj.send(null)
}
}

ajaxpack.postAjaxRequest=function(url, parameters, callbackfunc, filetype){
ajaxpack.ajaxobj=createAjaxObj() //recreate ajax object to defeat cache problem in IE
if (this.ajaxobj){
this.filetype=filetype
this.ajaxobj.onreadystatechange = callbackfunc;
this.ajaxobj.open('POST', url, true);
this.ajaxobj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
this.ajaxobj.setRequestHeader("Content-length", parameters.length);
this.ajaxobj.setRequestHeader("Connection", "close");
this.ajaxobj.send(parameters);
}
}

//ACCESSIBLE VARIABLES (for use within your callback functions):
//1) ajaxpack.ajaxobj //points to the current ajax object
//2) ajaxpack.filetype //The expected file type of the external file ("txt" or "xml")
//3) ajaxpack.basedomain //The root domain executing this ajax script, taking into account the possible "www" prefix.
//4) ajaxpack.addrandomnumber //Set to 0 or 1. When set to 1, a random number will be added to the end of the query string of GET requests to bust file caching of the external file in IE. See docs for more info.

//ACCESSIBLE FUNCTIONS:
//1) ajaxpack.getAjaxRequest(url, parameters, callbackfunc, filetype)
//2) ajaxpack.postAjaxRequest(url, parameters, callbackfunc, filetype)

///////////END OF ROUTINE HERE////////////////////////
















function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

//-->