﻿var Browser = new Object();
/**
* 判断是否为IE旧版浏览器
* @type boolean
*/
Browser.isIE = window.ActiveXObject ? true : false;

/**
* 判断是否为IE7浏览器
* @type boolean
*/
Browser.isIE7 = Browser.isIE && window.XMLHttpRequest;

/**
* 判断是否为Mozilla浏览器
* @type boolean
*/
Browser.isMozilla = Browser.isIE ? false : (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument != 'undefined');

/**
* 判断是否为Firefox浏览器
* @type boolean
*/
Browser.isFirefox = Browser.isIE ? false : (navigator.userAgent.toLowerCase().indexOf("firefox") != -1);

/**
* 判断是否为Safari浏览器
* @type boolean
*/
Browser.isSafari = Browser.isIE ? false : (navigator.userAgent.toLowerCase().indexOf("safari") != -1);

/**
* 判断是否为Opera浏览器
* @type boolean
*/
Browser.isOpera = Browser.isIE ? false : (navigator.userAgent.toLowerCase().indexOf("opera") != -1);

function serachQuoteByQuoteNo() {
    var quoteNo = document.getElementById("txtQuoteNo").value;
    if (quoteNo.length == 0 || quoteNo == "输入报价单号") {
        alert("报价单号不能为空！");
        return false;
    }
    return true;
}

function serachQuoteByQuoteNoTo() {
    var quoteNo = document.getElementById("txtQuoteNo").value;
    if (serachQuoteByQuoteNo()) {
        window.location.href = "SelectResult.aspx?qn=" + quoteNo;
    }
}

function serachOrderByOrderNo() {
    var orderNo = document.getElementById("txtOrderNo").value;
    if (orderNo.substring(0, 1) != "B" && orderNo.substring(0, 1) != "X") {
        alert("订单号不正确！");
    } else {
        window.location.href = "OrderDetails.aspx?orderNo=" + orderNo;
    }
}

function isUploadForLogin() {
    var name = "";
    if (Browser.isIE7) {
        name = document.getElementById("ctl00_LoginState").innerText;
    }

    if (Browser.isFirefox) {
        name = document.getElementById("ctl00_LoginState").textContent;
    }

    if (name.length == 13) {
        alert("要上传文件，请先登录！");
    } else {
        window.open("ordersys/default.aspx?openparam=0");
    }
}

function OpenChatWindow() {
    var element = document.getElementById("live800iconlink");
    if (element.click) element.click();
    else if (element.fireEvent) element.fireEvent('onclick');
    else if (document.createEvent) {
        var evt = document.createEvent("MouseEvents");
        evt.initEvent("click", true, true);
        element.dispatchEvent(evt);
    }
}

function clearInputSourceStrForQuote(thisObj) {
    if (thisObj.value == "输入报价单号") {
        thisObj.value = "";
    }
}

function setInputSourceStrForQuote(thisObj) {
    if (thisObj.value.length == 0) {
        thisObj.value = "输入报价单号";
    }
}

function clearInputSourceStrForOrder(thisObj) {
    if (thisObj.value == "请输入订单号") {
        thisObj.value = "";
    }
}

function setInputSourceStrForOrder(thisObj) {
    if (thisObj.value.length == 0) {
        thisObj.value = "请输入订单号";
    }
}