// alterego, 9 Apr 08, Message id:  537609380

function CreateXmlHttp()
{
    if (typeof XMLHttpRequest != 'undefined') {
        /*
        The most common way - for Firefox, Mozilla, Opera and IE7.0
        */
        return new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        /*
        Create XmlHttpRequest via ActiveX

        For IE 6.0 and older
        */
        var xmlHttpAppIds = [
                    'MSXML2.XMLHttp.5.0',
                    'MSXML2.XMLHttp.4.0',
                    'MSXML2.XMLHttp.3.0',
                    'MSXML2.XMLHttp',
                    'Microsoft.XMLHttp'];

        for (var index in xmlHttpAppIds) {
            try {
                return new ActiveXObject(xmlHttpAppIds[index]);
            } catch (err) { }
        }
    }

    return null;
}

function GetQueryString(array)
{
    var qs = '';

    for (var key in array){
        if (key == '') return;
        if (qs != '') qs += '&';
        qs += escape(key) + '=' + escape(array[key]);
    }

    return qs;
}

function SendRequest(url, post_array, submitStarted, submitCompleted){
    if(url == null)
        return;
    submitStarted();

    var xmlhttp = CreateXmlHttp();
    xmlhttp.onreadystatechange = function() {
            // state code '4' indicates that request is completed
            if (xmlhttp.readyState != 4) return;

            // check HTTP status code
            if (xmlhttp.status != 200) {
                // pass error to submitCompletedHandler
                submitCompleted('HTTP error ' + xmlhttp.status);
            } else {
                // otherwise pass HTTP response
                submitCompleted(xmlhttp.responseText);
            }

            // enable form elements back
            //EnableFormElements(form, true);
    };
    xmlhttp.open("POST", url, true);
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    xmlhttp.send(GetQueryString(post_array));

    return false;
}

function newReleasesNext() {
	SendRequest(getNewReleasesUrl, '', newReleasesStarted, newReleasesCompleted);
} 

function newReleasesStarted() { 
}

function newReleasesCompleted(response) {
	var contentBox = document.getElementById("newReleasesBox");
	contentBox.innerHTML = "";
	eval(response);
	contentBox.innerHTML = '<A href="/store/customer/product.php?productid='+productId+'"><font color="006ca0"><b>'+productName+'</b></a></br>';
	contentBox.innerHTML += '<A href="/store/customer/product.php?productid='+productId+'"><img src="'+thmbnURL+'" width="100" border="0" /></A></br>';
	contentBox.innerHTML += '<A href="/store/customer/product.php?productid='+productId+'">'+lbl_see_details+'</A><br>';
	contentBox.innerHTML += '<b><font color="006ca0">Our Price: '+productPrice+'</font></b>'; 
}
