function imgzoom(img,maxsize){
	var a=new Image();
	a.src=img.src
	if(a.width > maxsize * 4)
	{
		img.style.width=maxsize;
	}
	else if(a.width >= maxsize)
	{
		img.style.width=Math.round(a.width * Math.floor(4 * maxsize / a.width) / 4);
	}
	return false;
}

//图片缩放<img name="" src="" onload="javascript:resizeimg(this,100,200)">
function resizeimg(ImgD,iwidth,iheight) {
     var image=new Image();
     image.src=ImgD.src;
     if(image.width>0 && image.height>0){
        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;
                }
				ImgD.alt="点击查看大图";
               //ImgD.title=image.width+" X "+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;
                     }
				ImgD.alt="点击查看大图";
                //ImgD.alt= image.width+" X"+image.height;
            }
　　　　　//ImgD.style.cursor= "pointer"; //改变鼠标指针
　　　　　ImgD.onclick = function() { window.open(this.src);} //点击打开大图片
　　　/*if (navigator.userAgent.toLowerCase().indexOf("ie") > -1) { //判断浏览器，如果是IE
　　　　　　ImgD.title = "请使用鼠标滚轮缩放图片，点击图片可在新窗口打开";
　　　　　　ImgD.onmousewheel = function img_zoom() //滚轮缩放
　　　　　 {
　　　　　　var zoom = parseInt(this.style.zoom, 10) || 100;
　　　　　　zoom += event.wheelDelta / 12;
　　　　　　if (zoom> 0)　this.style.zoom = zoom + "%";
　　　　　　return false;
　　　　　 }
　　　  } else { //如果不是IE
　　　　　　　     ImgD.title = "点击图片可在新窗口打开";
　　　}*/
    }
}


var Obj='' 
document.onmouseup=MUp 
document.onmousemove=MMove 

function MDown(Object){ 
Obj=Object.id 
document.all(Obj).setCapture() 
pX=event.x-document.all(Obj).style.pixelLeft; 
pY=event.y-document.all(Obj).style.pixelTop; 
} 

function MMove(){ 
if(Obj!=''){ 
document.all(Obj).style.left=event.x-pX; 
document.all(Obj).style.top=event.y-pY; 
} 
} 

function MUp(){ 
if(Obj!=''){ 
document.all(Obj).releaseCapture(); 
Obj=''; 
} 
} 
function openWithIframe(tit,url,w,h){ 
var sWidth,sHeight; 
sWidth=document.body.clientWidth; 
sHeight=document.body.scrollHeight; 
var bgObj=document.createElement("div"); 
bgObj.setAttribute('id','bgDiv'); 
bgObj.style.position="absolute"; 
bgObj.style.top="0"; 
bgObj.style.background="#000000"; 
bgObj.style.filter="Alpha(Opacity=30);"; 
bgObj.style.left="0"; 
bgObj.style.width=sWidth + "px"; 
bgObj.style.height=sHeight + "px"; 
bgObj.style.zIndex = "10000"; 
document.body.appendChild(bgObj); 
massage_box.style.left = event.x; 
massage_box.style.top = event.y; 
//massage_box.style.left = (document.body.clientWidth - w) / 2; 
//massage_box.style.top = (document.body.clientHeight - h) -80; 
//massage_box.style.top = (screen.height - h) / 2-80; 
massage_box.style.screenx = (document.body.clientWidth - w) / 2;//仅适用于Netscape 
massage_box.style.screeny = (screen.height - h) / 2-80;//仅适用于Netscape 
massage_box.style.width = w+"px"; 
massage_box.style.height = h+"px"; 
pop_title.innerHTML=tit; 
massage_box.style.display='' 
var popiframe='<img src="'+url+'" alt="场景-01" width="400" height="325" />'; 
pop_iframe.innerHTML=popiframe; 
} 
function closeWithIframe(){ 
massage_box.style.display="none"; 
document.body.removeChild(document.getElementById("bgDiv")); 
} 
document.write('<div id="massage_box" style="position:absolute;z-index:10001;display:none">'); 
document.write('<div style="border-width:1 1 3 1; width:100%; height:100%; background:#fff; color:#57A01B; font-size:12px; line-height:150%">'); 
document.write('<div onmousedown=MDown(massage_box) style="background:#57A01B; height:20px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;color:#fff;cursor:move;padding:0 0 4px 0">'); 
document.write('<div style="display:inline; width:200px; position:absolute;padding:3px 0 0 5px" id=pop_title></div>'); 
document.write('<span onClick="closeWithIframe()" style="float:right; display:inline; cursor:hand;padding:3px 5px 0 0;font-size:12px">关闭</span>'); 
document.write('</div>'); 
document.write('<div style="padding:5px" id=pop_iframe></div>'); 
document.write('</div>'); 
document.write('</div>');


function   statusreport()   {   
      var   tempx   =   event.clientX   +   document.body.scrollLeft;   
      var   tempy   =   event.clientY   +   document.body.scrollTop;   
      status='在整个页面中的X,   Y坐标   :   ('+tempx+',   '+tempy+')   ;   在当前窗口中的X,   Y坐标   :   (   '+event.clientX+',   '+event.clientY   +')';   
  }   
function showAd(ImageUrl, ImageName, iWidth, iHeight)
{
	var str, pos;
	var strScript ;
	
	var strUrl ;
	strUrl = ImageName ;
	if(! ImageName)  strUrl = ImageUrl ;

	str = /.swf/;
	pos = strUrl.search(str);
	if (pos==-1)
	{
		/*document.write("<img src=\'", strUrl, "\' border=0>");*/
		strScript = '<img src="' + strUrl +  '" height=' + iHeight + ' width=' + iWidth + ' border=0>' ;
	}
	else
	{

		strScript  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width=' + iWidth + ' height=' +  iHeight +  '>\n\n';
        strScript  = '<param name="movie" value="' + strUrl + '" />\n\n';
       strScript  = '<param name="quality" value="high" />\n\n';
        strScript  = '<param name="wmode" value="transparent" />\n\n';
       strScript  = '<embed src="' + strUrl + '" width="' + iWidth + '" height="' +  iHeight +  '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>\n\n';	
		strScript += '</object>' ;
	}
	
	document.write(strScript);
}
