﻿$(document).ready(function(){
    var today = new Date();
    var day; var date; var hello; var wel;
    hour = new Date().getHours()
    if (hour < 6) hello = '凌晨好'
    else if (hour < 9) hello = '早上好'
    else if (hour < 12) hello = '上午好'
    else if (hour < 14) hello = '中午好'
    else if (hour < 17) hello = '下午好'
    else if (hour < 19) hello = '傍晚好'
    else if (hour < 22) hello = '晚上好'
    else { hello = '夜里好' }
    if (today.getDay() == 0) day = '星期日'
    else if (today.getDay() == 1) day = '星期一'
    else if (today.getDay() == 2) day = '星期二'
    else if (today.getDay() == 3) day = '星期三'
    else if (today.getDay() == 4) day = '星期四'
    else if (today.getDay() == 5) day = '星期五'
    else if (today.getDay() == 6) day = '星期六'
    date = (today.getYear()) + '年' + (today.getMonth() + 1) + '月' + today.getDate() + '日';
    document.getElementById("hello").innerHTML = hello + "！今天是" + date + ' ' + day + ' &nbsp;'
})
function s() {
    var m = document.getElementById("LeftSearch1_txt_Model").value;
    var n = document.getElementById("LeftSearch1_txt_Name").value;
    var c = document.getElementById("LeftSearch1_ddl_Company").value;
    var url = "/ProductSearch.aspx?m=" + m + "&n=" + n + "&c=" + c;
    location.href = url;
}
// JScript 文件
function ShowTypeImg(a,b)
{
    if(a.toLowerCase()=="true")
    {
        document.write("&nbsp;<img src=\"/Images/ico_help.gif\" alt=\"热点信息\" />");
    }
    if(b.toLowerCase()=="true")
    {
        document.write("&nbsp;<img src=\"/Images/new6.gif\" alt=\"最新信息\" />");
    }
}

//    document.onselectstart=onselectstart;
//    function onselectstart(){return false;}
//    
//    document.oncopy=oncopy;
//    function oncopy(){return false;}
//    
//    document.oncut=oncut;
//    function oncut(){return false;}

function getLength(source)
    {
        var a=0;
        for (var i=0;i<source.length;i++)
        {
            if (source.charCodeAt(i)>255)  
            {
                 a+=2;
            }
            else
            {
                 a++;
            }
        }
        return a;
    }
    function CheckValue()
    {
        var objs = document.getElementsByTagName("INPUT");
        for(var i=0;i<objs.length;i++)
        {
            if(objs.item(i).ValidateType && objs.item(i).ValidateType.toLowerCase()=="require")
            {
                if(objs.item(i).value.length==0)
                {
                    alert(objs.item(i).ErrMsg+" 必须填写！");
                    objs.item(i).select();
                    return false;
                    break;
                }
                if(getLength(objs.item(i).value.length)>objs.item(i).MaxLength)
                {
                    alert(objs.item(i).ErrMsg+" 长度超过限制！");
                    objs.item(i).select();
                    return false;
                    break;
                }
            }
        }
        objs = document.getElementsByTagName("textarea");
        for(var i=0;i<objs.length;i++)
        {
            if(objs.item(i).ValidateType && objs.item(i).ValidateType.toLowerCase()=="require")
            {
                if(objs.item(i).value.length==0)
                {
                    alert(objs.item(i).ErrMsg+" 必须填写！");
                    objs.item(i).select();
                    return false;
                    break;
                }
                if(getLength(objs.item(i).value.length)>objs.item(i).MaxLength)
                {
                    alert(objs.item(i).ErrMsg+" 长度超过限制！");
                    objs.item(i).select();
                    return false;
                    break;
                }
            }
        }
        return true;
    }
