function checkstr(e){
     var str="";
	 var i=0;
     if(e[i].checked) str=e[i].value
	 return str;
}

function DrawImage(ImgD,w,h){
   xwidth=w;
   xheight=h;
   var image=new Image();
   image.src=ImgD.src;
   if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= xwidth/xheight){
     if(image.width>xwidth){  
     ImgD.width=xwidth;
     ImgD.height=(image.height*xwidth)/image.width;
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }

     }
    else{
     if(image.height>xheight){  
     ImgD.height=xheight;
     ImgD.width=(image.width*xheight)/image.height;     
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }

     }
    }
}


function fEvent(sType,oInput){
		switch (sType){
			case "focus" :
				oInput.isfocus = true;
				oInput.className += ' input_login_o';
				break;
			case "mouseover" :
				//oInput.className += ' ipt-t-focus';
				break;
			case "blur" :
				oInput.isfocus = false;
			case "mouseout" :
				if(!oInput.isfocus){
					oInput.className = 'input_login';
				}
				break;
		}
}
	
function guanggao(width,height,name,pic,links){
    var textheight=0
	var focus_width=width
	var focus_height=height
	var swf_height = focus_height
	var names=name
	var pics=pic
document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='"+ focus_width +"' height='"+ (swf_height+textheight) +"'>");
	document.write("<param name='allowScriptAccess' value='sameDomain'><param name='movie' value='./image/playswf.swf'><param name=wmode value=transparent><param name='quality' value='high'>");
	document.write("<param name='menu' value='false'><param name='wmode' value='opaque'>");
	document.write("<param name='FlashVars' value='texts="+names+"&pics="+pics+"&links="+links+"&borderwidth="+focus_width+"&borderheight="+focus_height+"&textheight="+textheight+"'>");
	document.write("<embed src='./image/playswf.swf' wmode='opaque' FlashVars='texts="+names+"&pics="+pics+"&links="+links+"&borderwidth="+focus_width+"&borderheight="+focus_height+"&textheight="+textheight+"' menu='false' bgcolor='#DADADA' quality='high' width='"+ focus_width +"' height='"+ (swf_height+textheight) +"' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");	
}


/*评论*/
function doEmot(e){
	document.all.pingluncontent.value+='[EM='+String(100+e).substr(1,2)+']';
}

function checkpinglun(obj){
   if (obj.pingluncontent.value==""){
	  alert("请输入评论内容！");
	  obj.pingluncontent.focus();
   }
   else{
	   return true;
   }
   return false;
}


function checkbbswrite(obj){
   if (obj.content1.value==""){
	  alert("请输入内容！");
	  //obj.content1.focus();
   }
   else{
	   return true;
   }
   return false;
}

/*注册必用*/
function isNumberOrLetter(s){//判断是否是数字或字母
   var regu = "^[0-9a-zA-Z]+$"; 
   var re = new RegExp(regu); 
   if (re.test(s)) { 
      return true; 
   }
   else
   { 
      return false; 
   }
} 

function isChinaOrNumbOrLett(s){//判断是否是汉字、字母、数字组成
   var regu = "^[0-9a-zA-Z\u4e00-\u9fa5]+$"; 
   var re = new RegExp(regu); 
   if (re.test(s)) { 
      return true; 
   }
   else
   { 
      return false; 
   } 
}

function checkEmail(strEmail) { //检查输入的Email信箱格式是否正确
   var emailReg = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/; 
   if( emailReg.test(strEmail) ){ 
      return true; 
   }
   else
   { 
      return false; 
   } 
}


//得到字节长度 
function getByteLen(str){ 
   var l = str.length; 
   var n = l; 
   for ( var i=0; i<l; i++ ) 
   if ( str.charCodeAt(i) <0 || str.charCodeAt(i) >255 ) 
   n=n+1; 
   return n 
}

function kindeditor(idname,formname,bodyheight){
	KE.show({
			id : idname,
			width : '100%',
			height: bodyheight,
			resizeMode : 1,
			imageUploadJson : '../../asp/upload_json.asp',
			//fileManagerJson : '../../asp/file_manager_json.asp',
			//allowFileManager : true,
			afterCreate : function(id) {
				/*
				KE.event.ctrl(document, 13, function() {
					KE.util.setData(id);
					document.forms[formname].submit();
				});
				KE.event.ctrl(KE.g[id].iframeDoc, 13, function() {
					KE.util.setData(id);
					document.forms[formname].submit();
				});*/
			}
	});	
}
