/** read the cookie **/
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function ajaxRequest(str) 
{
    var AJAX = null; // Initialize the AJAX variable.
    if (window.XMLHttpRequest) 
    { // Does this browser have an XMLHttpRequest object?
        AJAX=new XMLHttpRequest(); // Yes -- initialize it.
    } 
    else 
    { // No, try to initialize it IE style
        AJAX=new ActiveXObject("Microsoft.XMLHTTP"); // Wheee, ActiveX, how do we format c: again?
    } // End setup Ajax.
    if (AJAX==null) 
    { 
        // If we couldn't initialize Ajax...
        return false // Return false, couldn't set up ajax
    }
    var url='http://www.hentaicounter.com/js/cookie.php'; // This is the URL we will call.
    url=url+"?q="+str;
    AJAX.open("GET", url, true); // Open the url this object was set-up with.
    AJAX.send(str); // Send the request.
}
function initAll()
{
    var x = readCookie('counter');
    ajaxRequest(x);
}
//grab the shit on window load
window.onload = initAll;
