﻿// JScript 文件
ie4=(document.all)?true:false;
ns4=(document.layers)?true:false;

//文本框接收回车、提交指定按钮
function submitKeyClick(button) 
{    
	if (event.keyCode == 13) 
	{        
		event.keyCode=9; 
		event.returnValue = false; 
		document.all[button].click(); 
	} 
}
//文本框接收Ctrl+回车、提交指定按钮
function submitCtrlKeyClick(button) 
{    
	if(event.ctrlKey && event.keyCode == 13)
	{        
		event.keyCode=9; 
		event.returnValue = false; 
		document.all[button].click(); 
	} 
}

//文本框限制输入140个字符
function textLimitedCheck(textarea) 
{    
	if (textarea.value.length > 140){
       alert(140 + ' 个字符限制. \r超出的将自动去除.');
       textarea.value = textarea.value.substring(0, 140);
       textarea.focus();
     }
     /*回写span的值，当前填写文字的数量*/
     messageCount.innerText = 140 - textarea.value.length;
}

//预览联盟代码
function previewCode()
{
    var args=previewCode.arguments;
    if(ns4){
    }
    else if(ie4){
        for(i=0;i<6;i++){
            if(args[0].checked){
                document.getElementById("ctl00_ContentPlaceHolder1_CheckBoxListS1_"+i).checked = false;
                document.getElementById("ctl00_ContentPlaceHolder1_CheckBoxListS1_"+i).disabled = true;
            }
            else{
                document.getElementById("ctl00_ContentPlaceHolder1_CheckBoxListS1_"+i).disabled = false;
            }
        }
    }
}

//加入到收藏夹
function favorite(title)
{
	if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))//Gecko
	{
		window.sidebar.addPanel(title,location.href,'');
	}else if (window.MessageEvent && !document.getBoxObjectFor){
		alert("请使用ctrl+d快捷键收藏本页！");
	 	
	}else{
		window.external.AddFavorite(location.href,title);
	}		
}