
//******************************************************************************
function $G(){
var Url=top.window.location.href;
var u,g,StrBack='';
if(arguments[arguments.length-1]=="#")
   u=Url.split("#");
else
   u=Url.split("?");
if (u.length==1) g='';
else g=u[1];

if(g!=''){
   gg=g.split("&");
   var MaxI=gg.length;
   str = arguments[0]+"=";
   for(i=0;i<MaxI;i++){
      if(gg[i].indexOf(str)==0) {
        StrBack=gg[i].replace(str,"");
        break;
      }
   }
}
return StrBack;
}



//******************************************************************************2008-4-14更新 by:blog.51ait.cn
//图片按比例缩放
//var flag=false;
//参数(图片,允许的宽度,允许的高度)
//调用方式<img src='"+url+"' onload='javascript:DrawImage(this,300,380)'>
function DrawImage(ImgD,iwidth,iheight){
    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;
		alert(ImgD.height);
        }else{
        ImgD.width=iwidth;  
        ImgD.height=(image.height/image.width)*iwidth;
		//alert(ImgD.height);
        }
        ImgD.alt=ImgD.width+"/"+ImgD.height+"="+image.width+"/"+image.height;
        }
    else{
        if(image.height>iheight){  //实际高度大于参数
        ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;  
		alert(ImgD.width);
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
		alert(ImgD.width);
        }
        ImgD.alt=ImgD.width+"/"+ImgD.height+"="+image.width+"/"+image.height;
        }
    }
}
//******************************************************************************