//Aurigma Graphics Mill for .NET
//Copyright 2004-2006 Aurigma Inc.
//Version 3.5.0.0
var __remoteScriptingTimeOut=60000;
function _View(i,l,t,w,h,z){
this.i=i;
this.l=l;
this.t=t;
this.w=w;
this.h=h;
this.z=z;
}
function Bitmap(bitmapWidth,bitmapHeight,bitmapPixelFormat){
this._bitmapWidth=bitmapWidth;
this._bitmapHeight=bitmapHeight;
this._bitmapPixelFormat=bitmapPixelFormat;
this.getBitsPerPixel=function(){
return (this.getPixelFormat()&0x0000FF00)>>8;
}
this.getColorSpace=function(){
if(this.getIsRgb()){
return "Rgb";
}
else if(this.getIsCmyk()){
return "Cmyk";
}
else if(this.getIsGrayScale()){
return "GrayScale"
}
else{
return "Unknown";
}
}
this.getHasAlpha=function(){
return ((this.getPixelFormat()&0x40000)==0x40000)||((this.getPixelFormat()&0x80000)==0x80000);
}
this.getHeight=function(){
return this._bitmapHeight.value*1;
}
this.getIsCmyk=function(){
return (this.getPixelFormat()&0x14000000)==0x14000000;
}
this.getIsEmpty=function(){
return (this._bitmapWidth.value==-1&&this._bitmapHeight.value==-1);
}
this.getIsExtended=function(){
return (this.getPixelFormat()&0x100000)==0x100000;
}
this.getIsGrayScale=function(){
return (this.getPixelFormat()&0x12000000)==0x12000000;
}
this.getIsIndexed=function(){
return (this.getPixelFormat()&0x10000)==0x10000;
}
this.getIsRgb=function(){
return (this.getPixelFormat()&0x1000000)==0x1000000;
}
this.getPixelFormat=function(){
return this._bitmapPixelFormat.value*1;
}
this.getWidth=function(){
return this._bitmapWidth.value*1;
}
}
function BitmapViewerClientSideOptions(bv){
this._postBackOnBitmapChanged=bv._getHidden("PostBackOnBitmapChanged");
this._postBackOnClick=bv._getHidden("PostBackOnClick");
this._postBackOnScrolled=bv._getHidden("PostBackOnScrolled");
this._postBackOnZoomed=bv._getHidden("PostBackOnZoomed");
this.setPostBackOnBitmapChanged=function(v){
this._postBackOnBitmapChanged.value=v;
}
this.getPostBackOnBitmapChanged=function(){
return this._postBackOnBitmapChanged.value=="true";
}
this.setPostBackOnClick=function(v){
this._postBackOnClick.value=v;
}
this.getPostBackOnClick=function(){
return this._postBackOnClick.value=="true";
}
this.setPostBackOnScrolled=function(v){
this._postBackOnScrolled.value=v;
}
this.getPostBackOnScrolled=function(){
return this._postBackOnScrolled.value=="true";
}
this.setPostBackOnZoomed=function(v){
this._postBackOnZoomed.value=v;
}
this.getPostBackOnZoomed=function(){
return this._postBackOnZoomed.value=="true";
}
}
function BitmapViewer(doCallback,addCallback,releaseCallback,bitmapChangedPostBack,clickPostBack,scrolledPostBack,zoomedPostBack,viewWidth,viewHeight){
this._getSubId=function(name){
return this.id+"_"+name;
}
this._getHidden=function(name){
return document.getElementsByName("__"+this._getSubId(name))[0];
}
this._doCallback=doCallback;
this._addCallback=addCallback;
this._releaseCallback=releaseCallback;
this.__callbackId=0;
this._bitmapChangedPostBack=bitmapChangedPostBack;
this._bitmapChanged=this._getHidden("BitmapChanged");
this._clickPostBack=clickPostBack;
this._click=this._getHidden("Click");
this._clickArgs=this._getHidden("ClickArgs");
this._scrolledPostBack=scrolledPostBack;
this._scrolled=this._getHidden("Scrolled");
this._zoomedPostBack=zoomedPostBack;
this._zoomed=this._getHidden("Zoomed");
var sa=document.getElementById(this._getSubId("ScrollableArea"));
this.__scrollableArea=sa;
this._background=document.getElementById(this._getSubId("Background"));
this._background.galleryImg="no";
if (!__browser.isSafari){
this.onmousedown=function(){return false};
}
this.ondrag=function(){return false};
this.__scrollableArea.ondrag=function(){return false};
this._background.ondrag=function(){return false};
var sv=document.getElementById(this._getSubId("ScrolledView"));
if (sv){
sv.ondrag=function(e){return false};
sv.unselectable="on"
sv.galleryImg="no";
}
this.unselectable=this.__scrollableArea.unselectable=this._background.unselectable="on";
this._bitmapFileName=this._getHidden("FileName");
this._bitmapWidth=this._getHidden("Width");
this._bitmapHeight=this._getHidden("Height");
this._bitmapPixelFormat=this._getHidden("PixelFormat");
this._callbackTimer=null;
this._needToRefresh=false;
this._events=new Events(this);
sa._bv=this;
sa.onclick=function(e){
e=e?e:window.event;
this._bv._events.raiseEvent("Click",e);
var p=this._bv.getOffsetPoint(e);
var z=this._bv.getZoom();
this._bv._clickArgs.value=(p.x/z)+";"+(p.y/z);
if (this._bv.getAutoPostBack()||this._bv.clientSideOptions.getPostBackOnClick()){
this._bv._clickPostBack();
}
else{
this._bv._click.value="true";
}
return false;
}
sa.onmousedown=function(e){
e=e?e:window.event;
this._bv._events.raiseEvent("MouseDown",e);
return false;
}
sa.onmousemove=function(e){
e=e?e:window.event;
this._bv._events.raiseEvent("MouseMove",e);
return false;
}
sa.onmouseup=function(e){
e=e?e:window.event;
this._bv._events.raiseEvent("MouseUp",e);
return false;
}
if(!sa.setCapture){
sa.setCapture=function(){};
sa.releaseCapture=function(){};
}
this.__setReturnValue=function(releaseCallback,returnValue,exceptionName,exceptionDescription){
this.__callbackId++;
if (this._callbackTimer!=null){
window.clearTimeout(this._callbackTimer);
}
this._callbackTimer=null;
this._returnValue=returnValue;
this._exceptionName=exceptionName;
this._exceptionDescription=exceptionDescription;
if (releaseCallback){
this._releaseCallback();
}
this._status="Ready";
this._events.raiseEvent("StatusChanged");
if(this._needToRefresh){
this._needToRefresh=false;
this.refresh();
}
}
this._clearScrolledViews=function(){
while(this._views.length>0){
var e=this._views.pop();
var i=e.i;
i.parentNode.removeChild(i);
}
}
this._needToClearViews=function(){
var bz=this.getZoom();
var c=false;
for(var i=0;i<this._views.length;i++){
c=c||(Math.abs(bz-this._views[i].z)>0.001);
}
return c;
}
this.__synchronizeState=function(fileName,width,height,pixelFormat,backgroundFileName){
this._bitmapFileName.value=fileName;
this._bitmapWidth.value=width;
this._bitmapHeight.value=height;
this._bitmapPixelFormat.value=pixelFormat;
var a=this.__scrollableArea;
var b=this._background;
if (width>0&&height>0){
var w=Math.floor(width*this.getZoom()),h=Math.floor(height*this.getZoom());
a.style.width=w+"px";
a.style.height=h+"px";
if (backgroundFileName!=""){
b.width=w;
b.height=h;
b.src=backgroundFileName;
b.style.display="block";
}
else{
b.style.display="none";
}
a.style.display="block";
}
else{
a.style.display="none";
b.style.display="none";
}
this._clearScrolledViews();
this._events.raiseEvent("BitmapChanged");
if (this.getAutoPostBack()||this.clientSideOptions.getPostBackOnBitmapChanged()){
this._bitmapChangedPostBack();
}
else{
this._bitmapChanged.value="true";
}
}
this.__addView=function(s,l,t,w,h,z){
if(Math.abs(this.getZoom()-z)<0.001){
if(this._needToClearViews()){
this._clearScrolledViews();
}
}
var v=document.createElement("img");
v.galleryImg="no";
v.width=Math.round(w*z);
v.height=Math.round(h*z);
v.style.position="absolute";
v.style.left=Math.round(l*z)+"px";
v.style.top=Math.round(t*z)+"px";
v.style.zIndex=51+this.__scrollableArea.childNodes.length;
v.src=s;
v.ondrag=function(){return false};
this.__scrollableArea.appendChild(v);
var z = this.getZoom();
this._views.push(new _View(v,l,t,w,h,z));
};
this._getViewsCoverage=function(){
function compare(a,b){
if(a>b) return 1;
if(a<b) return -1;
return 0;
}
function removeDuplicates(a){
var b=new Array();
b.push(a.shift());
while(a.length>0){
var v=a.shift();
if(v!=b[b.length-1]){
b.push(v);
}
}
return b;
}
function Area(x1,y1,x2,y2){
this.x1=x1;
this.y1=y1;
this.x2=x2;
this.y2=y2;
}
var vs=this._views;
var xc=new Array(),yc=new Array();
var bw=this.bitmap.getWidth();
var bh=this.bitmap.getHeight();
var z=this.getZoom();
var winw=__parseInt(this.style.width),winh=__parseInt(this.style.height);
winw=Math.min(winw,bw*z-this.scrollLeft);
winh=Math.min(winh,bh*z-this.scrollTop);
if (this._needToClearViews()){
return new Array(new _View(null,this.scrollLeft/z,this.scrollTop/z,winw/z,winh/z,z));
}
var win=new _View(null,this.scrollLeft,this.scrollTop,winw,winh);
xc.push(win.l);
xc.push(win.l+win.w);
yc.push(win.t);
yc.push(win.t+win.h);
for(var i=0;i<vs.length;i++){
var v=vs[i];
var l=Math.round(v.l*z),t=Math.round(v.t*z);
var w=Math.round(v.w*z),h=Math.round(v.h*z);
if(l>win.l&&l<win.l+win.w){
xc.push(l)
};
if(l+w>win.l&&l+w<win.l+win.w){
xc.push(l+w)
};
if(t>win.t&&t<win.t+win.h){
yc.push(t)
};
if(t+h>win.t&&t+h<win.t+win.h){
yc.push(t+h)
};
}
xc=removeDuplicates(xc.sort(compare));
yc=removeDuplicates(yc.sort(compare));
var m=new Array();
for(var i=0;i<yc.length-1;i++){
m[i]=new Array();
for(var j=0;j<xc.length-1;j++){
m[i][j]=0;
}
}
for(var k=0;k<vs.length;k++){
var v=vs[k],x1=-1,x2=-1,y1=-1,y2=-1;
var l=Math.round(v.l*z),t=Math.round(v.t*z);
var w=Math.round(v.w*z),h=Math.round(v.h*z);
for(var j=0;j<=xc.length-2;j++){
if(l<=xc[j]){
x1=j;
break;
}
}
for(var j=xc.length-1;j>=1;j--){
if(l+w>=xc[j]){
x2=j-1;
break;
}
}
for(var j=0;j<=yc.length-2;j++){
if(t<=yc[j]){
y1=j;break;
}
}
for(var j=yc.length-1;j>=1;j--){
if(t+h>=yc[j]){
y2=j-1;
break;
}
}
if(x1!=-1&&x2!=-1&&y1!=-1){
for(var i=y1;i<=y2;i++){
for(var j=x1;j<=x2;j++){
m[i][j]=1;
}
}
}
}
var minX=0,maxX=xc.length-2,minY=0,maxY=yc.length-2;
while(minX<=maxX){
var s=0;
for(var i=minY;i<=maxY;i++){
s+=m[i][minX];
}
if(s==maxY-minY+1){
minX++;
}
else{
break;
}
}
while(minX<=maxX){
var s=0;
for(var i=minY;i<=maxY;i++){
s+=m[i][maxX];
}
if(s==maxY-minY+1){
maxX--;
}
else{
break;
}
}
while(minY<=maxY){
var s=0;
for(var i=minX;i<=maxX;i++){
s+=m[minY][i];
}
if(s==maxX-minX+1){
minY++;
}
else{
break;
}
}
while(minY<=maxY){
var s=0;
for(var i=minX;i<=maxX;i++){
s+=m[maxY][i];
}
if(s==maxX-minX+1){
maxY--;
}
else{
break;
}
}
if(minX>maxX||minY>maxY){
return null;
}
var f=0;
for(var i=minY;i<=maxY;i++){
for(var j=minX;j<=maxX;j++){
f+=m[i][j];
}
}
var maxAreas=3;
var areas=new Array();
var maxF=(maxX-minX+1)*(maxY-minY+1);
while(f<maxF&&areas.length<maxAreas){
var sX=-1,sY=-1;
if(m[minY][minX]==0){
sX=minX;
sY=minY;
}
else if(m[maxY][minX]==0){
sX=minX;
sY=maxY;
}
else if(m[minY][maxX]==0){
sX=maxX;
sY=minY;}
else if(m[maxY][maxX]==0){
sX=maxX;
sY=maxY;
}
else{
for(var i=minX;i<=maxX;i++){
if(m[minY][i]==0){
sX=i;
sY=minY;
break;
}
}
if(sX==-1)
{
for(var i=minX;i<=maxX;i++){
if(m[maxY][i]==0){
sX=i;
sY=maxY;
break;
}
}
if(sX==-1)
{
for(var i=minY;i<=maxY;i++){
if(m[i][minX]==0){
sX=minX;
sY=i;
break;
}
}
if(sX==-1)
{
for(var i=minY;i<=maxY;i++){
if(m[i][maxX]==0){
sX=maxX;
sY=i;
break;
}
}
if(sX==-1)
{
for(var i=minY+1;i<=maxY-1;i++){
for(var j=minX+1;j<=maxY-1;j++){
if(m[i][j]==0){
sX=j;
sY=i;
break;
}
}
if(sX!=-1){break;}
}
}
}
}
}
}
var a=new Area(sX,sY,sX,sY);
m[sY][sX]=1;
f++;
while(a.y1>minY){
var s=0;
for(var i=a.x1;i<=a.x2;i++){
s+=m[a.y1-1][i];
}
if(s==0){
a.y1--;
f+=a.x2-a.x1+1;
for(var i=a.x1;i<=a.x2;i++){
m[a.y1][i]=1;
}
}
else{
break;
}
}
while(a.x1>minX){
var s=0;
for(var i=a.y1;i<=a.y2;i++){
s+=m[i][a.x1-1];
}
if(s==0){
a.x1--;
f+=a.y2-a.y1+1;
for(var i=a.y1;i<=a.y2;i++){
m[i][a.x1]=1;
}
}
else{
break;
}
}
while(a.y2<maxY){
var s=0;
for(var i=a.x1;i<=a.x2;i++){
s+=m[a.y2+1][i];
}
if(s==0){
a.y2++;
f+=a.x2-a.x1+1;
for(var i=a.x1;i<=a.x2;i++){
m[a.y2][i]=1;
}
}
else{
break;
}
}
while(a.x2<maxX){
var s=0;
for(var i=a.y1;i<=a.y2;i++){
s+=m[i][a.x2+1];
}
if(s==0){
a.x2++;
f+=a.y2-a.y1+1;
for(var i=a.y1;i<=a.y2;i++){
m[i][a.x2]=1;
}
}
else{
break;
}
}
areas.push(a);
}
if(f!=maxF){
return new Array(new _View(null,xc[minX]/z,yc[minY]/z,(xc[maxX+1]-xc[minX])/z,(yc[maxY+1]-yc[minY])/z,z));
}
var result=new Array();
for(var j=0;j<areas.length;j++){
var a=areas[j];
if (xc[a.x2+1]-xc[a.x1]>0.5&&yc[a.y2+1]-yc[a.y1]>0.5){
result.push(new _View(null,xc[a.x1]/z,yc[a.y1]/z,(xc[a.x2+1]-xc[a.x1])/z,(yc[a.y2+1]-yc[a.y1])/z,z));
}
}
return result;
}
this._updateBitmap=function(){
var mode=this.getZoomMode();
var bw=this.bitmap.getWidth();
var bh=this.bitmap.getHeight();
var b=this.style.borderLeftWidth=="none"?0:__parseInt(this.style.borderLeftWidth);
var winw=__parseInt(this.style.width)-b*2,winh=__parseInt(this.style.height)-b*2;
if (mode=="ZoomControl"){
var z=this.getZoom();
this.style.overflow="visible";
this.style.width=Math.round(z*bw+b*2)+"px";
this.style.height=Math.round(z*bh+b*2)+"px";
}
else
{
if (mode!="None")
{
var s=this.getScrollBarWidth();
var hzsb=winw/bw;
var vzsb=winh/bh;
var hz=(winw-s)/bw;
var vz=(winh-s)/bh;
var z=this.getZoom();
var minz=this.getMinZoom();
var maxz=this.getMaxZoom();
switch(mode){
case "BestFit":
z=Math.min(hzsb,vzsb);
break;
case "BestFitShrinkOnly":
z=Math.min(1,Math.min(hzsb,vzsb));
break;
case "FitToHeight":
if(vzsb*bw>winw){
if(vz*bw<winw)
z=hzsb;
else
z=vz;
}
else{
z=vzsb;
}
break;
case "FitToHeightShrinkOnly":
if(vzsb*bw>winw){
if(vz*bw<winw)
z=hzsb;
else
z=vz;
}
else{
z=vzsb;
}
z=Math.min(1,z);
break;
case "FitToWidth":
if(hzsb*bh>winh){
if(hz*bh<winh)
z=vzsb;
else
z=hz;
}
else{
z=hzsb;
}
break;
case "FitToWidthShrinkOnly":
if(hzsb*bh>winh){
if(hz*bh<winh)
z=vzsb;
else
z=hz;
}
else{
z= hzsb;
}
z=Math.min(1,z);
break;
}
this._zoom.value=Math.max(Math.min(z,maxz),minz);
}
this.style.overflow=this.getScrollBarsStyle()=="Scroll"?"scroll":"auto";
}
var z=this.getZoom();
var aw=Math.round(bw*z),ah=Math.round(bh*z);
var a=this.__scrollableArea;
var b=this._background;
this.scrollLeft=Math.max(Math.min(this.scrollLeft, aw-winw), 0);
this.scrollTop=Math.max(Math.min(this.scrollTop, ah-winh), 0);
for(var i=0;i<this._views.length;i++){
var s=this._views[i];
s.i.style.left=Math.round(s.l*z)+"px";
s.i.style.top=Math.round(s.t*z)+"px";
s.i.width=Math.round(s.w*z);
s.i.height=Math.round(s.h*z);
}
this._events.raiseEvent("Zoomed");
if (this.getAutoPostBack()||this.clientSideOptions.getPostBackOnZoomed()){
this._autoPostBackEvent="Zoomed";
}
else{
this._zoomed.value="true";
}
b.width=aw;b.height=ah;
a.style.width=aw+"px";a.style.height=ah+"px";
this.delayedRefresh();
}
this._autoPostBack=this._getHidden("AutoPostBack");
this.setAutoPostBack=function(v){
this._autoPostBack.value=v;
}
this.getAutoPostBack=function(){
return this._autoPostBack.value=="true";
}
this.bitmap=new Bitmap(this._bitmapWidth,this._bitmapHeight,this._bitmapPixelFormat);
this.clientSideOptions=new BitmapViewerClientSideOptions(this);
this._maxZoom=this._getHidden("MaxZoom");
this.getMaxZoom=function(){
return this._maxZoom.value*1;
}
this._minZoom=this._getHidden("MinZoom");
this.getMinZoom=function(){
return this._minZoom.value*1;
}
this._navigator=this._getHidden("Navigator");
this.setNavigator=function(v){
var nid=this._navigator.value;
var n=nid?document.getElementById(nid):null;
if(n){
n.disconnect();
}
this._navigator.value=v;
if (v){
n=document.getElementById(v);
if(n){
n.connect(this.id);
}
}
var rid=this.getRubberband();
if (rid){
r=document.getElementById(rid);
if(r){
r.update();
}
}
}
this.getNavigator=function(){
return this._navigator.value;
}
this._rubberband=this._getHidden("Rubberband");
this.setRubberband=function(v){
var rid=this._rubberband.value;
var r=rid?document.getElementById(rid):null;
if(r){
r.disconnect();
}
this._rubberband.value=v;
if (v){
r=document.getElementById(v);
if(r){
r.connect(this.id);
}
}
}
this.getRubberband=function(){
return this._rubberband.value;
}
this._scrollBarsStyle=this._getHidden("ScrollBarsStyle");
this.getScrollBarsStyle=function(){
return this._scrollBarsStyle.value*1;
}
this._scrollBarWidth=this._getHidden("ScrollBarWidth");
this.getScrollBarWidth=function(){
return this._scrollBarWidth.value*1;
}
this._scrollingPosition=this._getHidden("ScrollingPosition");
this.setScrollingPosition=function(value){
this.scrollLeft=value.x;this.scrollTop=value.y;
this._scrollingPosition.value=this.scrollLeft+";"+this.scrollTop;
this._events.raiseEvent("Scrolled");
}
this.getScrollingPosition=function(){
var p=this._scrollingPosition.value.split(";");
return new Point(p[0]*1,p[1]*1);
}
this._zoom=this._getHidden("Zoom");
this.setZoom=function(v){
v=Math.min(Math.max(v,this.getMinZoom()),this.getMaxZoom());
this._zoom.value=v;
this._zoomMode.value="None";
this._updateBitmap();
}
this.getZoom=function(){return this._zoom.value*1;}
this._zoomMode=this._getHidden("ZoomMode");
this.setZoomMode=function(value){
this._zoomMode.value=value;
this._updateBitmap();
}
this.getZoomMode=function(){
return this._zoomMode.value;
}
this._zoomQuality=this._getHidden("ZoomQuality");
this.setZoomQuality=function(value){
this._zoomQuality.value=value;
}
this.getZoomQuality=function(){
return this._zoomQuality.value*1;
}
this._status="Ready";
this.getStatus=function(){return this._status;}
this._exceptionName="";
this.getExceptionName=function(){
return this._exceptionName
};
this._exceptionDescription="";
this.getExceptionDescription=function(){
return this._exceptionDescription
};
this._returnValue="";
this.getReturnValue=function(){
return this._returnValue
};
this.bitmapToControlPoint=function(point){
var _zoom=this.getZoom();
return new Point(Math.round(point.x*_zoom),Math.round(point.y*_zoom));
}
this.controlToBitmapPoint=function(point){
var _zoom=this.getZoom();
return new Point(Math.round(point.x/_zoom),Math.round(point.y/_zoom));
}
this._encodeString=function(v){
var r="";
for (var i=0;i<v.length;i++){
if (i>0){
r+=";"
}
r+=v.charCodeAt(i);
}
return r;
}
this.invokeRemoteMethod=function(name,args){
if(this._status=="Busy"){
return false;
}
this._status="Busy";
this._events.raiseEvent("StatusChanged");
this.__callbackId++;
var sArgs=name+" "+this.__callbackId;
if(args!=null){
for(var i=0;i<args.length;i++){
var arg=args[i];
var v="0";
if(typeof(arg)=="number"||typeof(arg)=="boolean"){
v=arg;
}
else if (typeof(arg)=="string"){
v=this._encodeString(arg);
}
else if(typeof(arg)=="object"){
if(Array.prototype.isPrototypeOf(arg)){
v="{";
for(var j=0;j<arg.length;j++){
if(j>0){
v+=",";
}
if(typeof(arg[j])=="number"||typeof(arg[j])=="boolean"){
v+=arg[j];
}
else if (typeof(arg[j])=="string"){
v+=this._encodeString(arg[j]);
}
}
v+="}";
}
else if(arg.constructor==RgbColor){
v="RgbColor("+arg.a+","+arg.r+","+arg.g+","+arg.b+")";
}
else if(arg.constructor==CmykColor){
v="CmykColor("+arg.a+","+arg.c+","+arg.m+","+arg.y+","+arg.k+")";
}
else if(arg.constructor==GrayScaleColor){
v="GrayScaleColor("+arg.a+","+arg.gray+")";
}
}
sArgs+=" "+v;
}
}
var code="document.getElementById('"+this.id+"').__setReturnValue("+this.__callbackId+",'','Timeout','');";
this._callbackTimer=window.setTimeout(code, __remoteScriptingTimeOut);
this._addCallback();
this._doCallback(sArgs);
return true;
}
this.refresh=function(){
if(this._status=="Busy"){
this._needToRefresh=true;
}
else{
this._needToRefresh=false;
var views=this._getViewsCoverage();
if(views){
var coords="";
for(i=0;i<views.length;i++){
var v=views[i];
coords+=" "+__round3(v.l)+" "+__round3(v.t)+" "+__round3(v.w)+" "+__round3(v.h);
}
this._status="Refresh";
this._doCallback("__Refresh"+coords);
}
}
};
this.abort=function(){
if(this._status=="Busy"){
this.__setReturnValue(this.__callbackId,'','Abort','');
}
}
this.__refreshTimer=null;
this.delayedRefresh=function(){
if (this.__refreshTimer!=null){
window.clearTimeout(this.__refreshTimer);
}
var code="var bv=document.getElementById('"+this.id+"');if(!bv.__processAutoPostBack()){bv.__refreshTimer=null;bv.refresh();}";
this.__refreshTimer=window.setTimeout(code,1000);
}
this.__processAutoPostBack=function(){
if ((this.getAutoPostBack()||this.clientSideOptions.getPostBackOnScrolled()) && this._autoPostBackEvent=="Scrolled"){
this._scrolledPostBack();
return true;
}
else if ((this.getAutoPostBack()||this.clientSideOptions.getPostBackOnZoomed()) && this._autoPostBackEvent=="Zoomed"){
this._zoomedPostBack();
return true;
}
return false;
}
this.getOffsetPoint=function(e){
var el=this.__scrollableArea;
var x=0;var y=0;
while(el.offsetParent){
x+=el.offsetLeft;
y+=el.offsetTop;
el=el.offsetParent;
}
if(__browser.isIE){
var p=new Point(event.clientX-x+this.scrollLeft+document.body.scrollLeft,event.clientY-y+this.scrollTop+document.body.scrollTop);
if (!__browser.isCSS1Compat){
var bw=__parseInt(this.style.borderTopWidth);
p.x=p.x-bw-2;
p.y=p.y-bw-2;
}
return p;
}
else{
var p=new Point(e.pageX-x+this.scrollLeft,e.pageY-y+this.scrollTop);
if (__browser.isSafari){
var bw=__parseInt(this.style.borderTopWidth);
p.x=p.x-bw;
p.y=p.y-bw;
}
return p;
}
}
this.setCursor=function(value){
var sCursor;
switch (value){
case "zoomin":sCursor="url('"+__gmResources.getUrl("ZoomIn.cur")+"'),-moz-zoom-in";break;
case "zoomout": sCursor="url('"+__gmResources.getUrl("ZoomOut.cur")+"'),-moz-zoom-out";break;
case "pan": sCursor="url('"+__gmResources.getUrl("Pan.cur")+"'),move";break;
default:sCursor=value;}
this.__scrollableArea.style.cursor=sCursor;
}
this.addBitmapChanged=function(h,d){
this._events.addHandler("BitmapChanged",h,d);
}
this.removeBitmapChanged=function(h,d){
this._events.removeHandler("BitmapChanged",h,d);
}
this.addScrolled=function(h,d){
this._events.addHandler("Scrolled",h,d);
}
this.removeScrolled=function(h,d){
this._events.removeHandler("Scrolled",h,d);
}
this.addStatusChanged=function(h,d){
this._events.addHandler("StatusChanged",h,d);
}
this.removeStatusChanged=function(h,d){
this._events.removeHandler("StatusChanged",h,d);
}
this.addZoomed=function(h,d){
this._events.addHandler("Zoomed",h,d);
}
this.removeZoomed=function(h,d){
this._events.removeHandler("Zoomed",h,d);
}
this.addClick=function(h,d){
this._events.addHandler("Click",h,d);
}
this.removeClick=function(h,d){
this._events.removeHandler("Click",h,d);
}
this.addMouseDown=function(h,d){
this._events.addHandler("MouseDown",h,d);
}
this.removeMouseDown=function(h,d){
this._events.removeHandler("MouseDown",h,d);
}
this.addMouseMove=function(h,d){
this._events.addHandler("MouseMove",h,d);
}
this.removeMouseMove=function(h,d){
this._events.removeHandler("MouseMove",h,d);
}
this.addMouseUp=function(h,d){
this._events.addHandler("MouseUp",h,d);
}
this.removeMouseUp=function(h,d){
this._events.removeHandler("MouseUp",h,d);
}
var sp=this.getScrollingPosition();
if(sp.x!=0||sp.y!=0){
if (__browser.isIE||__browser.isKhtml){
this._initScroll=true;
var initSP=new Function("var bv=document.getElementById('"+this.id+"');bv.scrollLeft="+sp.x+";bv.scrollTop="+sp.y+";");
if (__browser.isIE){
document.attachEvent("onreadystatechange",initSP);
}
else
{
window.addEventListener("load",initSP,false);
}
}
else{
this._initScroll=false;
this.scrollLeft=sp.x;
this.scrollTop=sp.y;
}
}
else{
this._initScroll=false;
}
this._views=new Array();
if (viewWidth>0&&viewHeight>0){
var z=this.getZoom();
this._views.push(new _View(document.getElementById(this._getSubId("ScrolledView")), sp.x/z, sp.y/z, viewWidth, viewHeight, z));
}
this._autoPostBackEvent="";
this._onscrollHandler=function(e){
if (this._initScroll){
this._initScroll=false;
return;
}
this.setScrollingPosition(new Point(this.scrollLeft,this.scrollTop));
this._events.raiseEvent("Scrolled");
if (this.getAutoPostBack()||this.clientSideOptions.getPostBackOnScrolled()){
this._autoPostBackEvent="Scrolled";
}
else{
this._scrolled.value="true";
}
this.delayedRefresh();
}
this.__listenScroll=function(){
if(this._prevScrollLeft!=this.scrollLeft||this._prevScrollTop!=this.scrollTop){
this._onscrollHandler();
}
this._prevScrollLeft=this.scrollLeft;this._prevScrollTop=this.scrollTop;
var code="document.getElementById('"+this.id+"').__listenScroll();";
window.setTimeout(code, 500);
}
this._prevScrollLeft=this.scrollLeft;
this._prevScrollTop=this.scrollTop;
this.__listenScroll();
if (__browser.isKonq)
{
var code="var bv=document.getElementById('"+this.id+"');var p=bv.scrollLeft;bv.scrollLeft=p+1;bv.scrollLeft=p;";
window.setInterval(code, 500);
}
if (__browser.isIE&&__browser.isCSS1Compat){
alert("Graphics Mill BitmapViewer does not completely support CSS1 compatible mode in Internet Explorer. It is caused by improper implementation of HTML standard by Internet Explorer.\n"+
"Therefore you CANNOT use the following document type declarations in the top of your HTML document:\n\n"+
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n"+
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n"+
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"+
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"+
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n\n"+
"However you CAN (and should) use the HTML 4.0 Transitional declaration with omitted system identifiers (URI references), i.e.:\n\n"+
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" >\n\n"+
"Note, this problem affects Internet Explorer only. Alternative browsers like Firefox, Mozilla, Safari, Konqueror, and Opera can work with BitmapViewer with any DTD declaration.\n"+
"You can get more information about this problem here:\n\n"+
"http://www.aurigma.com/go/?id=50\n");
}
}
function initBitmapViewer(id,doCallback,addCallback,releaseCallback,bitmapChangedPostBack,clickPostBack,scrolledPostBack,zoomedPostBack,viewWidth,viewHeight){
document.getElementById(id)._ctor=BitmapViewer;
document.getElementById(id)._ctor(doCallback,addCallback,releaseCallback,bitmapChangedPostBack,clickPostBack,scrolledPostBack,zoomedPostBack,viewWidth,viewHeight);
}
