//判断非法字符
function textIsNull(str)   
	{   
	var patrnn=/['|*|%]/; 
	if (!patrnn.exec(str)) return false 
	return true
} 

//增大字体
function ChangeSize(size){	var objSize=document.getElementById('container');objSize.style.fontSize=size+"px";}

//添加收藏
function AddFav(){	window.external.AddFavorite(window.document.location.href, document.title)}

//头部输入关键字表单
function toptext(){
	var text1;
	text1=document.topform.keytext.value;
	text1=text1.replace(/\'/g,"")
	text1=text1.replace(/\;/g,"")
	text1=text1.replace(/\"/g,"")
	text1=text1.replace(/\</g,"")
	text1=text1.replace(/\>/g,"")
	text1=text1.replace(/\%/g,"")
	text1=text1.replace(/\&/g,"")
	text1=text1.replace(/\*/g,"")
	text1=text1.replace(/\^/g,"")
	text1=text1.replace(/\#/g,"")
	document.topform.keytext.value=text1;
}

//头部验证搜索
function topcheack(){
	var text=document.topform;				
	if (text.keytext.value.replace(/ /g,"")==""){
		alert("搜索内容不能为空,请输入搜索内容");
		text.keytext.focus();
		return false;
		}
	if (text.keytext.value.replace(/ /g,"").length>40){
		alert("搜索内容有点长了,为了方便准确的搜索出您所想要的信息,请正确输入搜索内容");
		text.keytext.focus();
		return false;
		}	
	if (textIsNull(text.keytext.value)){
		alert("搜索内容有非法字符，请正确输入您要搜索的内容");
		text.keytext.focus();
		return false;
		} 
	if (text.action.value==""){
		alert("搜索栏目不能为空,请选择一个正确搜索栏目，这样方便您快速的查找到您所要找的信息");
		text.action.focus();
		return false;
		}
return true;	
}

//单独信息过滤
function texttext(){
	var text1;
	text1=document.searchform.keytext.value;
	text1=text1.replace(/\'/g,"")
	text1=text1.replace(/\;/g,"")
	text1=text1.replace(/\"/g,"")
	text1=text1.replace(/\</g,"")
	text1=text1.replace(/\>/g,"")
	text1=text1.replace(/\%/g,"")
	text1=text1.replace(/\&/g,"")
	text1=text1.replace(/\*/g,"")
	text1=text1.replace(/\^/g,"")
	text1=text1.replace(/\#/g,"")
	document.searchform.keytext.value=text1;
}

//单独信息搜索
function textcheack(){
	var text=document.searchform;				
	if (text.keytext.value.replace(/ /g,"")==""){
		alert("搜索内容不能为空,请输入搜索内容");
		text.keytext.focus();
		return false;
		}
	if (text.keytext.value.replace(/ /g,"").length>40){
		alert("搜索内容有点长了,为了方便准确的搜索出您所想要的信息,请正确输入搜索内容");
		text.keytext.focus();
		return false;
		}	
	if (textIsNull(text.keytext.value)){
		alert("搜索内容有非法字符，请正确输入您要搜索的内容");
		text.keytext.focus();
		return false;
		} 

	return true;	
}

//用户登陆验证
function lgcheack(){
	var form=document.login

	if (form.usename.value.replace(/ /g,"")==""){
		alert("用户名不能为空");
		form.usename.focus();
		return false;
		}

	if (form.pwd.value.replace(/ /g,"")==""){
		alert("密码不能为空");
		form.pwd.focus();
		return false;
		}
	
	if (form.code.value.replace(/ /g,"")==""){
		alert("验证码不能为空");
		form.code.focus();
		return false;
		}
	if (isNaN(form.code.value.replace(/ /g,""))){
		alert("验证码必须为数字");
		form.code.focus();
		return false;
		}		
return true;
}

function setTab(name,cursel,n){
	for(i=1;i<=n;i++){
		var menu=document.getElementById(name+i);
		var con=document.getElementById("con_"+name+"_"+i);
		menu.className=i==cursel?"hover":"";
		con.style.display=i==cursel?"block":"none";
	}
}

function copyToClipBoard(){
	var clipBoardContent="";
	clipBoardContent+="本篇文章来源于 连云港旅游网 http://www.lyglyw.com 原文出处：";
	clipBoardContent+="\n\n";
	clipBoardContent+=top.location.href;;
	window.clipboardData.setData("Text",clipBoardContent);
	alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友");
}

function fCopyToClicp(id){
	var a = document.getElementById(id);
	window.clipboardData.setData('text',a.value);
	alert("已复制到剪贴板了.");
}
