﻿document.onkeydown=function() { 
if (event.keyCode==13){
if(document.getElementById("ctl00_c_txtACGSearch") != null)
{
if(document.getElementById("ctl00_c_txtACGSearch").value != "")
{
document.getElementById("ctl00_c_imgACGSearch").click();
event.returnValue=false;
}
}
if(document.getElementById("ctl00_txtUserName") != null)
{
if(document.getElementById("ctl00_txtUserName").value != "" || document.getElementById("ctl00_txtpassword").value != "")
{
document.getElementById("ctl00_ImageButton1").click();
event.returnValue=false;
}
}
if(document.getElementById("ctl00_c_txtImgSearch") != null)
{
if(document.getElementById("ctl00_c_txtImgSearch").value != "")
{
document.getElementById("ctl00$c$btnSearch").click();
event.returnValue=false;
}
}
}} 


function checkacg(){
if(document.getElementById("ctl00_c_txtACGSearch").value == "")
{alert('请先输入您要搜索的内容哦！');
event.returnValue=false;
}
}


function checklogin(){
if(document.getElementById("ctl00_txtUserName").value == "" || document.getElementById("ctl00_txtpassword").value == "")
{alert('用户名或密码不可为空！');
event.returnValue=false;
}
}


function newscheckname()
{
var content = document.getElementById("ctl00_c_txtContent").value;
if(content.length <4 )
{
alert("您发表的文字内容太短啦.不要恶意灌水或纯表情哦>_<");
window.event.returnValue=false;  
}else{
if(content.length > 2000)
{
alert("请勿提交过长评论影响他人访问页面的速度.谢谢");
window.event.returnValue=false;  
}else{
var kan_keys="法轮功|色情|http|www|com|cn|net|bbs|操你妈|sb|奥运|script|草|html|/>|<IMG src";
var kan_sp=kan_keys.split("|")
var pin=0;
for (i=0;i<kan_sp.length;i++){
if(content.indexOf(kan_sp[i])>=0){ 
pin=1;
break;
}
}
if(pin == 1){
window.alert("对不起!您所提交的内容中带有非法内容.请修改后再提交!谢谢!");
document.getElementById("ctl00_c_txtContent").value = "";
window.event.returnValue=false;  
}else{
document.getElementById("ctl00_c_btnSubmit").className  = "disable"; 
document.getElementById("ctl00_c_lblSubMessage").innerHTML = "正在发布评论.请勿重复提交";
document.getElementById("ctl00_c_btnSubmit").onclick=Function("return false;"); 
return true;
}}}}


var control={}
control.left=function(index){
	var box=$('.cartoon-Box:eq('+index+')');
	var	e=box.find('.list-switch a').index(box.find('.list-selected'))-1;
	if(e<0){
		return;
	}
	control.setList(index,e);
}
control.right=function(index){
	var box=$('.cartoon-Box:eq('+index+')');
	var	e=box.find('.list-switch a').index(box.find('.list-selected'))+1;
	if(e>2){
		return;
	}
	control.setList(index,e);
}
control.setList=function(index,e){
	var box=$('.cartoon-Box:eq('+index+')');
	var _switch=box.find(".list-switch a");
	var _selected=box.find(".list-selected");
	if(_switch.index(_selected)==e){
		return;
	}
	_selected.removeClass();
	_switch.eq(e).addClass("list-selected");
	var movePos = (box.find('.list-ul li').width())*(-3*e);	
	box.find(".list-ul").animate({left:movePos-1},300);
}
