function check_search(sele_id,empty_value){
	if(document.getElementById(sele_id).value == empty_value){
		alert("请选择您要查询的项目！");
		return false;
	}
	return true;
}


function is_dele(str,url){
	if(window.confirm(str)){
		location.href=url;
		return true;
	}
	return false;
}
function o_m_over(action,marquee_id){
	var obj;
	obj=document.getElementById(marquee_id);
	if(action=="left"){
		obj.direction	=	"left";
	}else{
		obj.direction	=	"right";
	}
}

function move_content(id_name,action,height){
	if(action=="down"){
		document.getElementById(id_name).scrollTop+=	height-20;
	}else{
		document.getElementById(id_name).scrollTop-=	height-20;
	}

}

//JS复制字符串
function copyToClipBoard(copy_content,cue_str){ 
	var clipBoardContent=''; 
	clipBoardContent+=	 copy_content; 
	window.clipboardData.setData("Text",clipBoardContent); 
	if(cue_str!=""){
		alert(cue_str);
	}
}




//弹出框  用iframe加载内容
var maskDiv;
var winlistDiv;
function showPage(url,width,height,left,top){
	if(!width) width="440";
	if(!height) height="280";
	if(!left) left	=	(document.documentElement.clientWidth-450)/2;
	if(!top) top	 =	 document.documentElement.clientHeight-200;

	maskDiv=document.createElement("DIV");

	maskDiv.style.cssText="position:absolute;top:0px;left:0px;background-color:#ffffff;filter:alpha(opacity=10);";
	maskDiv.style.height=getscrollHeight();//页面最大高度
	maskDiv.style.width=document.body.clientWidth;//页面最宽   其实是 想要把这个DIV覆盖整个页面  然后搞点透明度 能看到下面的内容
	document.body.appendChild(maskDiv);


	winlistDiv=document.createElement("DIV");//这里的DIV就是你要显示的内容   可以在这进行一些操作！innerHTML 其实也可以用 AJAX搞
	winlistDiv.style.cssText="width:"+width+"px;height:"+height+"px;position:absolute;left:"+left+"px;top:"+top+"px;background:#EFEFEF;";
	winlistDiv.innerHTML="<iframe src='"+url+"' width='"+width+"' height='"+height+"' marginwidth='0'  marginheight='0' scrolling='no' frameborder='0'></iframe>";
	document.body.appendChild(winlistDiv);
}
function getscrollHeight(){
         if(document.body.scrollHeight>document.documentElement.clientHeight){
            return document.body.scrollHeight
         }else{
            return document.documentElement.clientHeight
         }
}
function closePage(){
	maskDiv.removeNode(true);
	winlistDiv.removeNode(true);
}



//---------------------------------------------------------------------------------------------------------- 字符处理 BEGIN -------------------------------------------------------------- 
function get_substring(str, start, count) 
{ 
	var i, j; 
	var result = ""; 
	j = 0; 
	
	for (i = start; i < str.length; i++) 
	{ 
		j++; 
		
		if (str.charCodeAt(i) > 255) j++; 
		
		if (j > count) break; 
		
		result = result + str.charAt(i); 
	} 
	
	return result; 
} 
function get_stringlen(str)
{
	var i;
	var length = 0;
	
	if ((str == null) || (str == "")) return length;
	
	for (i = 0; i < str.length; i++) 
	{ 
		length++; 
		
		if (str.charCodeAt(i) > 255) length++; 
	}
	
	return length;
} 

//汉字
function countCHKeys(obj, total,alertmsg)
{
	var text = obj.value;
	var left = total - get_stringlen(text); 
	if (left < 0) 
	{ 
		var word_len = 0;
		word_len = total / 2;
		
		obj.value = get_substring(text, 0, total); 
		//monitor.value = total - get_stringlen(obj.value); 
		dialog.showPage('/templates/show_js_message.html?'+alertmsg, 400,300);		
		//return false; 
	} 
	
	//return true; 
}

function countCHKeys2(obj, total,alertmsg)
{
	var text = obj.value;
	var left = total - get_stringlen(text); 
	if (left < 0) 
	{ 
		var word_len = 0;
		word_len = total / 2;
		
		obj.value = get_substring(text, 0, total); 
 
		var alertmsg = "很抱歉，该项不能超过" + word_len + "个汉字！";
		
		alert(alertmsg); 
		//dialog.showPage('/templates/show_js_message.html?'+alertmsg, 400,300);		
		return false; 
	} 
	
	//return true; 
}
//字母

function countCKeys(obj, total)
{
	var text = obj.value;
	var left = total - get_stringlen(text); 
	if (left < 0) 
	{ 
		var word_len = 0;
		word_len = total ;
		var alertmsg = "很抱歉，该项不能超过" + word_len + "个字母！";
		
		alert(alertmsg); 
		obj.value = get_substring(text, 0, total); 
		//monitor.value = total - get_stringlen(obj.value); 
		return false; 
	} 
	
	return true; 
} 
//数字

function countKeys(obj, total)
{
	var text = obj.value;
	var left = total - get_stringlen(text); 
	if (left < 0) 
	{ 
		var word_len = 0;
		word_len = total ;
		var alertmsg = "很抱歉，该项不能超过" + word_len + "个数字！";
		
		alert(alertmsg); 
		obj.value = get_substring(text, 0, total); 
		//monitor.value = total - get_stringlen(obj.value); 
		return false; 
	} 
	
	return true; 
} 

function check_Num(obj)
{
	var text = obj.value;
	
	//alert(text);
	
	var len = get_stringlen(text);
	
	if(isNaN(text))
	{
		alert("只能输入半角数字，请关闭全角或中文输入法！");
		
		var i = 0;

		for (i = 0; i < text.length; i++)
		{

			if ((text.charCodeAt(i) < 48 || text.charCodeAt(i) > 57))
			{ 
				break;
			}
		}

		obj.value = get_substring(text, 0, i);
		return false;
		
	}
}
	
function isFloat(theFloat)
{
//判断是否为浮点数
 len=theFloat.length;

 for(var i=0;i<len;i++){
	  oneNum=theFloat.substring(i,i+1);
	  if (oneNum==".")
	   return true;
   }

 return false;
}

function checkMail(obj,str)
{
        s=obj.value
        var regu = "^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|NET|com|COM|gov|GOV|mil|MIL|org|ORG|edu|EDU|int|INT)$"
         var re = new RegExp(regu);
         if (s.search(re) != -1) {
               return true;
         } else {
               window.alert (str)
               return false;
         }	
}
//---------------------------------------------------------------------------------------------------------- 字符处理 END -------------------------------------------------------------- 

