/********************************************
*	函數名稱：_common$createAjaxObject(創建AJAX服務對象)
*	傳遞參數：null
*	開發日期：2009.10.16
*	工作人員：C.K
*********************************************/
function _common$createAjaxObject() {
    var xmlHttp = false;
    try {
        xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
            try {
                xmlHttp = new XMLHttpRequest();
            } catch (e) {
                xmlHttp = false;
            }
        }
    }
    return xmlHttp;
}

/********************************************
*	函數名稱：_common$requestFile(返回文件內容)
*	傳遞參數：url文件地址(絕對或相對路徑)
*	開發日期：2009.10.16
*	工作人員：C.K
*********************************************/
function _common$requestFile(url) {
    var xmlHttp = _common$createAjaxObject();
    xmlHttp.open('GET', url + "?randID=" + Math.random(), false);

    xmlHttp.send(null);
    return xmlHttp.responseText;
}

function _common$requestFile2(url) {

    var xmlHttp = _common$createAjaxObject();
    xmlHttp.open('GET', url + "&randID=" + Math.random(), true);

    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            document.getElementById("productContent").innerHTML = xmlHttp.responseText;
        }
    }

    xmlHttp.send(null);
    document.getElementById("productContent").innerHTML = "<img width=\"50'\" src=\"images/loading.gif\" alt=\"loading..\" />";
    
}

function _common$getObj(id) { return document.getElementById(id); }

String.prototype.LTrim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

function MM_openBrWindow(theURL, winName, features) { //v2.0
    window.open(theURL, winName, features);
}

function popupGlossaryImage(ImageName, winName) {

    MM_openBrWindow('/images/' + ImageName, winName, 'toolbar=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=no,width=300,height=270');
}

function CheckSamplesForm() {

    var ErrorMsg = "";
    if (document.order.name.value == "")
        ErrorMsg += "Please enter your name.\n";
    if (document.order.email.value == "")
        ErrorMsg += "Please enter your e-mail address.\n";
    if (document.order.address.value == "")
        ErrorMsg += "Please enter your shipping address.\n";
    if (document.order.city.value == "")
        ErrorMsg += "Please enter your shipping city.\n";
    if (document.order.state.value == "")
        ErrorMsg += "Please enter your shipping state.\n";
    if (document.order.zip.value == "")
        ErrorMsg += "Please enter your shipping zip.\n";
    if (document.order.phone.value == "")
        ErrorMsg += "Please enter your phone number.\n";
    if (document.order.question.value == "")
        ErrorMsg += "Please enter the swatches you want to see.\n";

    if (ErrorMsg == "") {
        return true;
    }
    else {
        alert(ErrorMsg);
        return false;
    }

}

function CheckEmail3() {

    var ErrorMsg = "";
    if (document.order.name.value == "")
        ErrorMsg += "Please enter your name.\n";
    if (document.order.email.value == "")
        ErrorMsg += "Please enter your e-mail address.\n";
    if (document.order.friendsemail.value == "")
        ErrorMsg += "Please enter your the email address to which you send this product to.\n";

    if (ErrorMsg == "") {
        return true;
    }
    else {
        alert(ErrorMsg);
        return false;
    }

}

function CheckEmail2() {

    var ErrorMsg = "";
    if (document.order.name.value == "")
        ErrorMsg += "Please enter your name.\n";
    if (document.order.email.value == "")
        ErrorMsg += "Please enter your e-mail address.\n";
    if (document.order.phone.value == "")
        ErrorMsg += "Please enter your phone number.\n";
    if (document.order.state.value == "")
        ErrorMsg += "Please enter your state.\n";
    if (document.order.question.value == "")
        ErrorMsg += "Please enter your question.\n";

    if (ErrorMsg == "") {
        return true;
    }
    else {
        alert(ErrorMsg);
        return false;
    }

}


