/*
    CREATE AN AJAX OBJECT FOR AJAX CALLS
*/
var AJC = createHTTPXMLObj();
function createHTTPXMLObj()
{
    if(window.XMLHttpRequest)
    return new XMLHttpRequest();
    else if(window.ActiveXObject)
    return new ActiveXObject("Microsoft.XMLHTTP");
    else return false;
}
function changeCaptcha()
{
    AJC.open("POST","../src/getNewCaptchaHash.php",true);
	AJC.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	AJC.onreadystatechange = changeCaptchaImage;
	AJC.send("");
}
function changeCaptchaImage()
{
	if(AJC.readyState==4&&AJC.status==200)
	{
		var rn = AJC.responseXML.getElementsByTagName("h");
		if(rn.length>0)
		{
            var picPath = document.getElementById("CAPTCHA_PIC").src;
            var nPicPath = picPath.substr(0,picPath.length-20);
            var newHash = rn[0].firstChild.nodeValue;
            document.getElementById("CAPTCHA_PIC").src = nPicPath + newHash;
            document.getElementById("VALIDATIONHASH").value = newHash;
        }
    }
}
function syncPerforce()
{
    AJC.open("POST","../p4sync.php",true);
	AJC.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	AJC.send("");
}
