﻿function regImg(e,src){
    if(!window.imgHash) window.imgHash = new Object();
    var a = imgHash[src];
    e.onerror=null;
    if(a==null) {
        e.style.display="none";
        a=imgHash[src]=[];
        a[0]=new Image();
        a[1]=e;
        a[0].onload=function(){setImges(a)};
        a[0].src=src;
    }else{
        if(a[0].readyState=="complete")
            e.src=src;
        else{
            e.style.display="none";
            a[a.length]=e;
        }
    }
}

function setImges(a){
    for(var i=1;i<a.length;i++){
        a[i].src=a[0].src;
        a[i].style.display="";
    }
    a.length=1;
    a[0].onload=null;
}

function loaded(myimg,mywidth,myheight){
var tmp_img = new Image();
tmp_img.src=myimg.src;
image_x=tmp_img.width;
image_y=tmp_img.height;
	if(image_x > mywidth){
	tmp_img.height=image_y * mywidth / image_x;
	tmp_img.width=mywidth;
		if(tmp_img.height>myheight){
			tmp_img.width=tmp_img.width * myheight / tmp_img.height;
			tmp_img.height=myheight;
			}
	}else if(image_y > myheight)
	{
	tmp_img.width=image_x * myheight / image_y;
	tmp_img.height=myheight;
		if(tmp_img.width>mywidth){
			tmp_img.height=tmp_img.height * mywidth / tmp_img.width;
			tmp_img.width=mywidth;
			}
	}
	myimg.width=tmp_img.width;
	myimg.height=tmp_img.height;

}

var greyscale = false;

function toggleGreyScale( vAction ){
	greyscale = !greyscale;
	document.all("imageview").style.filter = vAction ; // // "" ; //"";  左右 flipv 上下
	document.all("imageview").filters[ vAction ].enabled = greyscale;
}

var nStrength = 0;
function onblurPic( ){
	if ( nStrength == 0 ){ 
		document.all("imageview").style.filter = "blur(Strength=10)" ; 
		nStrength = 10 ;
		}
	else{
		document.all("imageview").style.filter = "blur(Strength=0)" ; 
		nStrength = 0 ;
	}	


}

function stop(){
alert('宜宾摄影人 图片作者 版权所有 敬请理解！   ');
return false;
}
document.oncontextmenu=stop;