﻿/* 전역변수 선언 */
var explorer = (navigator.appName.indexOf("Microsoft") != -1);   // Explorer 구분자
var firefox = (navigator.appName.indexOf("Netscape") != -1);    // FireFox 구분자

function $(id) {
    var element = "";
    element = document.getElementById(id);
    return element;
}

/*
IE/FF별 Flash Object 생성
*/
function fctMakeFlashObject(source, id, width, height) {
    var str = ""

    str = "<embed src=\"" + source + "\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#ffffff\" "
    + "width=\"" + width + "\" height=\"" + height + "\" name=\"" + id + "\" "
    + "align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" "
    + "type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer_kr\" />"
    
    document.write(str);
}

function MakeFlashString(source, id, width, height, wmode, otherParam) {
    return "<embed src=" + source + " quality=high wmode=" + wmode + " type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width=" + width + " height=" + height + "></embed>";
}

function MakeObjectString(classid, codebase, name, id, width, height, param) {
    return "<object classid=" + classid + " codebase=" + codebase + " name=" + name + " width=" + width + " height=" + height + " id=" + id + "><param name=wmode value=" + wmode + " />" + param + "</object>";
}

// innerHTML Type
function SetInnerHTML(target, code) {
    target.innerHTML = code;
}

// Direct Write Type
function DocumentWrite(src) {
    document.write(src);
}

function fct_Open_Contact_us() {

    strFeature = "toolbar=no,location=no,directories=no,status=no,";
    strFeature += "menubar=no,scrollbars=no,resizable=no,left=50,top=50,width=600,height=560";

    strUrl = "/etc/Contactus.aspx";

    window.open(strUrl, "Contact_us", strFeature);
}

function fct_Close() {
    window.close();
}

function fctEmptyElementCheck(strElementName, strAlertMessage, strAction) {
    var strElementValue = eval("document.getElementById(\"" + strElementName + "\").value");

    if (strElementValue == "") {
        alert(strAlertMessage);

        if (strAction != "") {
            eval("document.getElementById(\"" + strElementName + "\")." + strAction);
        }

        return false;
    }
    else {
        return true;
    }
}

function fct_EmptyCheck() {
    if (!fctEmptyElementCheck("txtName", "You have not entered your Name", "focus();")) { return false; }
    if (!fctEmptyElementCheck("txtEmail", "You have not entered your E-mail", "focus();")) { return false; }
    if (!fctEmptyElementCheck("txtEmail2", "You have not entered your E-mail", "focus();")) { return false; }
    if (!fctEmptyElementCheck("txtPhone", "You have not entered your phone number", "focus();")) { return false; }
    if (!fctEmptyElementCheck("txtPhone2", "You have not entered your phone number", "focus();")) { return false; }
    if (!fctEmptyElementCheck("txtPhone3", "You have not entered your phone number", "focus();")) { return false; }
    if (!fctEmptyElementCheck("txtCountry", "You have not entered country", "focus();")) { return false; }
    if (!fctEmptyElementCheck("txtMessage", "You have not entered message", "focus();")) { return false; }

    return true;
}
