function launchApp(product, chipname, index, filter) {
    var path = "http://www2.dupont.com/Surfaces/en_US/assets/flash/gallery_colors/";
    var apps = ["colors", "gallery", "designer", "estimator", "selector"];
    product = (product != undefined) ? product : "c";
    switch (product.toLowerCase()) {
        case "c":
            b = "corian";
            break;
        case "z":
            b = "zodiaq";
            break;
        case "s":
            b = "simplicity";
            break;
        case "g":
            b = "granite";
            break;
    }
    var url = path + apps[index] + ".html?product=" + b;
    if (chipname) {
        url += "&chipname=" + chipname;
    }
    if (filter) {
        url += "&filter=" + filter;
    }
    openWin(url);
}

function openWin(url) {
    if (!newWin || newWin.closed) {
        newWin = window.open(url, "newWin", "resizable=no,scrollbars=no,status,height=560,width=780");
    } else {
        newWin.location.href = url;
    }
    newWin.focus();
}

function closeWin() {
    window.close();
}

function linkOpener(url, target) {
    if (target == "SELF") {
        window.location.href = url;
    }
    else if (target == "FUNCTION")
    {
    	//ColorDetail_Z(url);
    	color_index = ColorIndexFinder(url);
    	CountertopZoomOnly(ColorArray[color_index][0]);
    }
    else {
        if (window.opener != null && !window.opener.closed) {
            window.opener.location.href = url;
            window.opener.focus();
        } else {
            var win = window.open(url, "win");
            win.focus();
        }
    }
}

function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
            return pair[1];
        }
    }
}

function loadEstimator(url) {
    window.location.href = url;
}


function showMsg(msg) {
    alert(msg);
}

function ClearForm(the_field) {
    if (the_field.value == the_field.defaultValue) {
        the_field.value = "";
    }
}