﻿function imgzoom(o) {
	if(event.ctrlKey) {
		var zoom = parseInt(o.style.zoom, 10) || 100;
		zoom -= event.wheelDelta / 12;
		if(zoom > 0) {
			o.style.zoom = zoom + '%';
		}
		return false;
	} else {
		return true;
	}
}


function loadImg(obj)
{
    if(obj.width>screen.width*0.7) 
    {
        obj.resized=true; 
        obj.width=screen.width*0.7; 
        obj.style.cursor="hand"; 
        obj.alt="点击打开新窗口\nCTRL+鼠标滑轮进行缩";
    }
}


function imgOver(obj)
{
    if(this.width>screen.width*0.7) 
    {
        obj.resized=true; 
        obj.width=screen.width*0.7; 
        obj.style.cursor="hand"; 
        obj.alt="点击打开新窗口\nCTRL+鼠标滑轮进行缩放";
    }
}

function imgClick(obj)
{
    if(!obj.resized) 
    {
        return true;
    } 
    else 
    {
        window.open(obj.src);
    } 
}

function referUrl(obj)
{
    var editor=document.getElementById("eWebEditor");
    
    if(editor!=null)
    {
        var str="<div  style='margin:5px 20px; padding: 5px;border: 1px solid #CCCCCC;background-color:#F3F3F3;line-height: normal;'><b>以下是引用:</b><br>";
        str+="<IMG onmousewheel='return imgzoom(this);' onmouseover=imgOver(this) onclick=imgClick(this) src='" + obj.href + "' onload=loadImg(this) border=0>"
        str+="</div><br><br>";
        eWebEditor.PutContents(str);
    }
}


function picLoad(obj,width,height)
{
	if(obj.width>width)
	{
		obj.width=width;
	}
	if(height==null)
		return;
	if(obj.height>height)
	{
		obj.height=height;
	}
}