var nav = navigator.appName.substr(0,1);

// openNewWindow opens a new popup window
function openNewWindow(theURL,winName,features) {
    window.open(theURL,winName,features);
}

function makePOSTRequest(url, parameters, callbackFunction) {
    http_request = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) { 
            http_request.overrideMimeType('text/html');
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!http_request) {
        alert('Cannot create XMLHTTP instance');
        return false;
    }

    http_request.open('POST', url, false);
    http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http_request.setRequestHeader("Content-length", parameters.length);
    http_request.setRequestHeader("Connection", "close");
    http_request.send(parameters);
    if (http_request.status == 200) {
        if (document.getElementById(callbackFunction)) {
            document.getElementById(callbackFunction).innerHTML = http_request.responseText
        }else {
            eval(callbackFunction + '(http_request.responseText)');
        }
    }
}

function displayImage(im,name) {
    document.getElementById("imageName").innerHTML = name
    document.getElementById("imageDisplay").src = "/show_image.php?im=" + im + "&size=300"
    document.getElementById("imageDisplay").style.display = "block"
    document.getElementById("imageName").style.display = "block"
}
function hideImage() {
    document.getElementById("imageDisplay").src = "/white.jpg"
    document.getElementById("imageDisplay").style.display = "none"
    document.getElementById("imageName").style.display = "none"
}

function urlencode(input) {
    output = escape(input)
    output.replace("*","%2A")
    output.replace("+","%2B")
    output.replace("/","%2F")
    output.replace("@","%40")
    output.replace("%20","+")
    return output
}

function popPKWIN()
{   window.open("http://www.stagemakeuponline.com/pkwin.php","KITWIN",'menubar=no,scrollbars=no,resizable=no,width=600,height=440,left=0,top=100');
}
function popTCKWIN()
{   window.open("http://www.stagemakeuponline.com/tckwin.php","KITWIN",'menubar=no,scrollbars=no,resizable=no,width=600,height=460,left=0,top=100');
}
function popTKWIN()
{   window.open("http://www.stagemakeuponline.com/tkwin.php","KITWIN",'menubar=no,scrollbars=no,resizable=no,width=600,height=440,left=0,top=100');
}
function popFKWIN()
{   window.open("http://www.stagemakeuponline.com/fkwin.php","KITWIN",'menubar=no,scrollbars=no,resizable=no,width=600,height=440,left=0,top=100');
}
