function DrawImage(ImgD,iwidth,iheight)
{ 
	var flag=false; 
	var image=new Image(); 
	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.width=iwidth; 
				ImgD.height=(image.height*iwidth)/image.width; 
			}
			else
			{ 
				ImgD.width=image.width;   
				ImgD.height=image.height; 
			} 
		} 
		else
		{ 
			if(image.height>iheight)
			{   
				ImgD.height=iheight; 
				ImgD.width=(image.width*iheight)/image.height;   
			}
			else
			{ 
				ImgD.width=image.width;   
				ImgD.height=image.height; 
			} 
		} 
	} 
} 


function ChgClassName(strName)
{
   switch (strName)
   {
   case "芜湖要闻" :
       strName="芜湖";
       break;
   case "芜湖民生" :
       strName="民生";
       break;
   case "社会新闻" :
       strName="社会";
       break;
   case "视频新闻" :
       strName="视频";
       break;
   case "特别报道" :
       strName="特报";
       break;
   case "芜湖政务" :
       strName="政务";
       break;
   case "民政信息" :
       strName="民政";
       break;     
   case "安徽" :
   case "国内" :
   case "财经" :
   case "揭秘" :
   case "社会" :
   case "文体" :
   case "趣闻" :
   case "军事" :
   case "国际" :
   case "房产" :
   case "汽车" :
   case "要闻" :         
       strName="综合";
       break;
   case "外媒看芜湖" :
       strName="外媒";
       break;
   case "2008北京奥运" :
       strName="奥运";
       break;       
   default :
       break;
   }
   
   return strName;
}

function CutStr(strContent,nLen,strTail)
{
   if (strContent.length>nLen)
	   strContent=strContent.substr(0,nLen)+strTail;
	 strContent=strContent.replace(/&amp;/g, "&");
	 strContent=strContent.replace(/&nbsp;/g, "");
   return strContent;
}

//function CutStr(str, len, strTail) 
//{ 
//  var newLength = 0; 
//  var newStr = ""; 
//  var chineseRegex = /[^\x00-\xff]/g; 
//  var singleChar = ""; 
//  var strLength = str.replace(chineseRegex,"**").length; 
//  for(var i = 0;i < strLength;i++) 
//  { 
//    singleChar = str.charAt(i).toString(); 
//    if(singleChar.match(chineseRegex) != null) 
//    { 
//      newLength += 2; 
//    } 
//    else 
//    { 
//      newLength++; 
//    } 
//    if(newLength > len) 
//    { 
//      break; 
//    } 
//    newStr += singleChar; 
//  } 
//
//  newStr += strTail;
//  return newStr; 
//}

