		//定义window.showModalDialog如果它不存在  
		if(window.showModalDialog == undefined){  
		    window.showModalDialog = function(url){ 
		        if(window.hasOpenWindow){  
		            alert("您已经打开了一个窗口！请先处理它");//避免多次点击会弹出多个窗口  
		            window.myNewWindow.focus();  
		        }  
		        window.hasOpenWindow = true;  
		        window.myNewWindow = window.open(url);  
		    }  
		}
	
	function select_img( type_val , id_val )
	{
	   //alert("./index.php?load=image_list&act=select_img&type="+type_val+"&get_id="+id_val,"","dialogWidth=500px;dialogHeight=500px;status=no;help=no;scrollbars=no");
	   var someValue=window.showModalDialog("./index.php?load=image_list&act=select_img&type="+type_val+"&get_id="+id_val,"","dialogWidth=500px;dialogHeight=500px;status=no;help=no;scrollbars=no");
	   document.getElementById(id_val).value=some_value;
	}

	function divshow(tag)
	{
		 var light=document.getElementById(tag);
		 light.style.display='block';
	 }
	 
	function divhide(tag)
	{
		 var light=document.getElementById(tag);
		 light.style.display='none';
	}
	
	function loginshow()
	{
		 var light=document.getElementById('dlg');
		 var fade=document.getElementById('overall');
		 light.style.display='block';
		 fade.style.display='block';
	 }
	 
	function loginhide()
	{
		 var light=document.getElementById('dlg');
		 var fade=document.getElementById('overall');
		 light.style.display='none';
		 fade.style.display='none';
	}
	


	//验证码刷新
	function changeImg(webroot_url)
	{
		///var idwebroot_url	=   document.getElementById('webroot_url');
		var idimgCode 	= 	document.getElementById('imgcode');
		idimgCode.src	=	'./application/imgCode.php?time='+Math.random();
 
	}
	
	//字母转换小写
	function tosm( obj )
	{   
		obj.value = obj.value.toLowerCase();   
	}
	//字母转换大写
	function tobg( obj )
	{   
		obj.value = obj.value.toUpperCase();   
	}
	
	//验证邮箱地址是否正确
	function check_email( obj , alert_lan )
	{
		alert_lan = "提示：\n\nE-mail格式不正确，请输入正确的帐号名称！"
		patn = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
		if(!patn.test(obj.value))
		{
			alert (alert_lan);
			obj.focus (); 
			return false; 
		}else{
			return true;	
		}
	}
	
	//所填项不能为空！
	function notempty( obj , nameval)
	{
		if(obj.value=='')
		{
			alert ("提示：\n\n"+nameval+"不能为空，请输入！");
			obj.focus (); 
			return false; 
		}else{
			return true;	
		}
	}
	



	//全选操作
	function select_all(chk,id)
	{
		//var chks = document.getElementsByName(id+'[]');
		//alert(id);
		var chks = document.getElementsByName(id+'[]');
		for(var i=0; i<chks.length; i++)
		{
		   if(chks[i].type=="checkbox")
		   chks[i].checked=chk.checked;
		}
	}
	
	
	 var isSnum = 0;
	function is_select(id)
	{
      
	  var chks 	 = document.getElementsByName(id+'[]');
	  var isS 	 = false;
	  var delstr = '';
	 
			for(var i=0; i<chks.length; i++)
			{
			  if(chks[i].type=="checkbox")
			  {
					if(chks[i].checked == true )
					{  
						isS = true ;
						isSnum = isSnum + 1;
						if(isSnum===1){
							delstr = delstr+chks[i].value ; 
						}else{
							delstr = delstr+','+ chks[i].value ; 
						}

					}
				  }
			}
			
			if(isS == false){ alert( select_prompt ); return false;}
			return delstr;
	}
	
	function arr_opeate(id,act_val,this_lang)
	{
		var delstr = is_select(id);
		if(delstr){
			if(confirm(this_lang)) 
			{
			   window.location ='./index.php?load='+this_obj+'&act='+act_val+'&id='+delstr; 
			}
		}
	}

		
	function arr_delete(id,actstr,this_lang)
	{
		var idwebroot_url=document.getElementById('webroot_url');
		var delstr = is_select(id);
		if(delstr){
			if(confirm(this_lang)) 
			{
			   window.location ='./index.php?load='+actstr+'&act=del&id='+delstr;  
			}
		}
	}
	
	function arr_recycle(id,actstr,this_lang)
	{
		var delstr = is_select(id);
		if(delstr){
			if(confirm(this_lang)) 
			{
			   window.location ='./index.php?load='+actstr+'&act=recycle&id='+delstr;  
			}
		}
	}
	
	function arr_restore(id,actstr,this_lang)
	{
		var delstr = is_select(id);
		if(delstr){
			if(confirm(this_lang)) 
			{
			   window.location ='./index.php?load='+actstr+'&act=restore&id='+delstr;  
			}
		}
	}
	
	function arr_show(id,actstr,this_lang)
	{
		var delstr = is_select(id);
		if(delstr){
			if(confirm(this_lang)) 
			{
			   window.location = './index.php?load='+actstr+'&act=show&id='+delstr;  
			}
		}
	}


	function arr_hide(id,actstr,this_lang)
	{

		var delstr = is_select(id);
		if(delstr){
			if(confirm(this_lang)) 
			{
			   window.location ='./index.php?load='+actstr+'&act=hide&id='+delstr;  
			}
		}
	}

	//跳转页面
	function go_to_page(page_num, act)
	{
	   if(act==''){act='info_list'}
	   var page_num = page_num;
	   url_value  = location.pathname;
	   url_value += "?load="+this_obj+"&act="+act+"&page_num="+page_num;
	   if(typeof(search_form)!="undefined")
	   {  
		  url_value = url_value+'&'+$(search_form).serialize();
	   }
	   window.location = url_value;
	}
	//分页排序跳转
	function list_search( list_val , list_type , act)
	{
	   if(act==''){	act='info_list';}
	   url_value  = location.pathname ;
	   url_value += "?load="+this_obj+"&act="+act+"&page_num=1";
	   
	   document.getElementById('list_val').value 	= list_val;
	   document.getElementById('list_type').value 	= list_type;
	   if(typeof(search_form)!="undefined")
	   {  
		  url_value = url_value+'&'+$(search_form).serialize();
	   }
	   //alert(url_value);
	   window.location = url_value;
	}



	// JavaScript Document
	lastScrollY=0;
	function heartBeat()
	{ 
		var diffY;
		if (document.documentElement && document.documentElement.scrollTop)
			diffY = document.documentElement.scrollTop;
		else if (document.body)
			diffY = document.body.scrollTop
		else
		{/*Netscape stuff*/}

		percent=.1*(diffY-lastScrollY); 
		if(percent>0)percent=Math.ceil(percent); 
		else percent=Math.floor(percent);
		
		if(document.getElementById("lovexin12"))
		document.getElementById("lovexin12").style.top=parseInt(document.getElementById("lovexin12").style.top)+percent+"px";
		
		if(document.getElementById("lovexin14"))
		document.getElementById("lovexin14").style.top=parseInt(document.getElementById("lovexin14").style.top)+percent+"px";
		
		lastScrollY=lastScrollY+percent;
	}
	
	heartleftcode="";
	heartrightcode="";

	//字体大小设置
	function contentZoom(fontval)
	{
		var fontval = fontval; 
		document.getElementById("articlecontentdiv").className = fontval;
	}

//if(confirm(\''.$lang_arr['is_delete'].'\')){ return  true; }else{ return  false; }

	function is_delete()
	{
		if(confirm( lang_delete )){ return  true; }else{ return  false; }	
	}
	function is_recycle()
	{
		if(confirm( lang_recycle )){ return  true; }else{ return  false; }
	}
	
//图片按比例缩放
function show_image(ImgD,iwidth,iheight)
{

	var flag=false;
	var image=new Image();
	if(!iwidth)
		iwidth = 100;
	if(!iheight)
		iheight = 80;

	image.src=ImgD.src;
	if(image.width>0 && image.height>0)
	{

		flag=true;
		if(image.width/image.height>= iwidth/iheight)
		{

			if(image.width>iwidth)
			{
				ImgD.style.width=iwidth + "px";
				ImgD.style.height=Math.floor((image.height*iwidth)/image.width) + "px";

			}else{

				ImgD.style.width=image.width + "px"; 
				ImgD.style.height=image.height + "px";

			}

		}else{

			if(image.height>iheight)
			{ 

				ImgD.style.height=iheight + "px";
				ImgD.style.width=Math.floor((image.width*iheight)/image.height) + "px"; 

			}else{

				ImgD.style.width=image.width + "px"; 
				ImgD.style.height=image.height + "px";

			}

		}

	}

}

