﻿// JScript 文件

   
    var oEditer;
    
    function CustomValidate(source, arguments)
    {
        var value = oEditer.GetXHTML(true);
        if(value=="")
        {
           arguments.IsValid = false;     
        }
        else 
        { 
            arguments.IsValid = true; 
        } 
    }
    function FCKeditor_OnComplete( editorInstance )
    {  
        oEditer = editorInstance;
    }
      
 
        //实现GridView的CheckBox全部选择和全部取消
function CheckAll(checkbox)
{
    var elements = checkbox.form.elements;  
    for(var i = 0;i < elements.length;i++)
    {  
        if(elements[i].type == "checkbox"  &&  elements[i].id != checkbox.id)  
        {
            elements[i].checked = checkbox.checked;
        }
    } 
}
function checkedAll(Checkbox,CheckboxList)
        {
            var objcheck = Checkbox;
            if(objcheck.checked)
                    checkAll();
                else
                    deleteAll();
        }
        function checkAll(){
            for(var i=0;i<document.getElementById(CheckboxList).getElementsByTagName("input").length;i++)
            {
                document.getElementById(CheckboxList+"_"+i).checked=true;
            }            
        }

        function deleteAll(){
            for(var i=0;i<document.getElementById(CheckboxList).getElementsByTagName("input").length;i++)
             {
                document.getElementById(CheckboxList+"_"+i).checked = false;
            }
        }


function WinOpen(u, w, h,desc)
{ 
    var l = (screen.width - w) / 2; 
    var t = (screen.height - h) / 2; 
    var s = 'height=' + h + ',innerHeight=' + h +',width='+w+',innerWidth='+w +',Top=' + t + ',Left=' + l; 
    s += ',toolbar=no,menubar=no,scrollbars=auto,resizeable=yes,location=no,status=yes'; 
    window.open(u,desc,s); 
}

function addFavorites() {
    var title = document.title
    var url = document.location.href
    if (window.sidebar) window.sidebar.addPanel(title, url, "");
    else if (window.opera && window.print) {
        var mbm = document.createElement('a');
        mbm.setAttribute('rel', 'sidebar');
        mbm.setAttribute('href', url);
        mbm.setAttribute('title', title);
        mbm.click();
    }
    else if (document.all) window.external.AddFavorite(url, title);
}

function windowOpen(id,product, date1, date2,type) {

   
    window.open('ProductImg.aspx?id='+id+'&product='+product+'&date1='+date1+'&date2='+date2+'&type='+type+'', '', ' height = 300, width = 400,top=230, left=300');
}

//限制输入字符数调用:onkeyup="inputtext(this,25);" onkeydown="inputtext(this,25);"
   function inputtext(field, maxlimit) {
        if (field.value.length > maxlimit)
        field.value = field.value.substring(0, maxlimit);
    }


//关闭页面，根据不同浏览器
function CloseWin() 
{ 
    var ua=navigator.userAgent 
    var ie=navigator.appName=="Microsoft Internet Explorer"?true:false 
    if(ie){ 
        var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE ")))) 
     if(IEversion< 7){ 
            closeie6();
        } 
        else{ 
            closeie7();
        } 
    } 
    else{ 
        window.close() 
    } 
} 

function closeie6(){
window.opener=null;
window.close();
}
//关闭IE7不提示
function closeie7(){
window.open('','_top');
window.top.close();
}