photo









var _sticks=new Array,_cStk=-1,_sX,_sY,_z=2000

function stickSty(id,color,x,y,w,h)
{
var p="z-index:2000;position:absolute;left:"+x+"px;top:"+y+"px;width:"+w+"px;height:"+h+"px;"
var p2="z-index:2000;position:absolute;left:"+x+"px;top:"+y+"px;width:"+Math.max(0,w-4)+"px;height:"+h+"px;"
var alpha=(!_ns4)?"filter:alpha(opacity=85);":"",clip="clip:rect(0px,"+w+"px,"+h+"px,0px);"
var bg=(_ns4?"layer-background-color":"background-color")+":"+color+";"
var border=(_macIE&&_ie4)?"":"border-width:1px;border-color:black;border-style:solid;"
return "#keestickbg"+id+"{"+p+alpha+bg+border+"}#keesticktxt"+id+"{"+p2+clip+"padding:5px;font-family:'Verdana','Arial';font-size:13px;font-weight:bold;}#keestickfrm"+id+"{"+p+"cursor:move}"
}

function getStick(nx,ny)
{
for (var i=_sticks.length-1;i>=0;i--) with (_sticks[i]) if ((nx>=x)&&(nx=y)&&(ny=0)
{
var last=_sticks.length-1,old=_sticks[_cStk]
_sticks[_cStk]=_sticks[last];_sticks[last]=old,_cStk=last
var id=_sticks[_cStk].id
if (!_ns4) layerCSS("keestickbg"+id).filter=''
_z++;layerCSS("keestickbg"+id).zIndex=_z;layerCSS("keesticktxt"+id).zIndex=_z;layerCSS("keestickfrm"+id).zIndex=_z
return false
}
}
return true
}

function upCB(ev)
{
if (_cStk>=0)
{
var stick=_sticks[_cStk];stick.x=stick.x+eventGetX(ev)-_sX;stick.y=stick.y+eventGetY(ev)-_sY
_cStk=-1
if (!_ns4) layerCSS("keestickbg"+stick.id).filter='alpha(opacity=85)'
return false
}
else return true
}

function mvCB(ev)
{
if (_cStk>=0)
{
var s=_sticks[_cStk],x=s.x+eventGetX(ev)-_sX,y=s.y+eventGetY(ev)-_sY
moveLayer("keestickbg"+s.id,x,y);moveLayer("keesticktxt"+s.id,x,y);moveLayer("keestickfrm"+s.id,x,y)
return false
}
}

function initStickers()
{
document.onmousedown=downCB;document.onmouseup=upCB;document.onmousemove=mvCB
if (_ns4) document.captureEvents(Event.MOUSEDOWN|Event.MOUSEMOVE|Event.MOUSEUP)
}

function stickerFrame(id,w,h)
{
if (_ns) return ""+box(w,h)+""
else return ""+box(w,h)+""
}

function KeeBooSticker(id,str,x,y,w,h)
{
var s=stickerFrame("keestickbg"+id,w,h,"")
s+=""+str+""
s+=stickerFrame("keestickfrm"+id,w,h)
document.write(s);document.close()
var a=new Array
a["id"]=id;a["x"]=x;a["y"]=y;a["w"]=w;a["h"]=h
_sticks[_sticks.length]=a
}

var _w,_h,_url,_pg,_loaded=false
if (_page!=_NULL)
{
var _pg=_ktop.book.pages[_page]
if (_pg&&(_pg.internal=="pict"))
{
if (_pg.fileName) _url=_ktop._contents+_pg.fileName
else _url=_pg.url
document.write(""+_ktop.book.title+" - "+_pg.title+"")
}
}

var sty=""
if (_pg) if (_pg.sticker) for (var i in _pg.sticker) with(_pg.sticker[i]) sty+=stickSty(i,color,x,y,w,h)
writeStyle(sty)


function writeElem()
{
if (!_url) return
calcSize()
var s=""
+""
document.write(s)
document.close()
}

function initCheck()
{
_img=document.images[0];_loaded=true
if (_moz) setInterval("resizeCB()",100)
if (_ie) resizeCB()
if (_w==_NULL) setTimeout("getSize()",150)
if (_ns4) setTimeout('_handleResize=true',400)
}

function getSize()
{
if (_img)
{
if (_ie&&!_img.complete)
{
setTimeout("getSize()",100);return
}
_pg.w=_w=_img.width;_pg.h=_h=_img.height;resize()
}
}

function calcSize()
{
if (_pg)
{
if (_pg.w==_NULL) return
var sizeW,sizeH,marg=30

if ((_side!="undefined")&&!_loaded)
{
var vfr=_ktop.getFrame('f_binder'),hfr=_ktop.getPageFrame(_side,"top")
if (vfr.winHeight) sizeH=vfr.winHeight()+23
if (hfr.winWidth) sizeW=hfr.winWidth()
}

if (((sizeW==_NULL)&&_loaded)||_ns) sizeW=_ns?window.innerWidth:document.body.clientWidth
if (((sizeH==_NULL)&&_loaded)||_ns) sizeH=_ns?window.innerHeight:document.body.clientHeight
if (sizeW==_NULL) sizeW=_pg.w+marg
if (sizeH==_NULL) sizeH=_pg.h+marg
sizeW=Math.max(0,sizeW-marg);sizeH=Math.max(0,sizeH-marg);_w=_pg.w;_h=_pg.h

if (_pg.w>sizeW)
{
_w=sizeW;_h=Math.round(_pg.h*sizeW/_pg.w)
}

if (_h>sizeH)
{
var oldH=_h
_h=sizeH;_w=Math.round(_w*sizeH/oldH)
}
}
}

var _handleResize=false
function resizeCB()
{
if (_ns4) if (!_handleResize) return
resize()
}

function resize()
{
if (_side=='undefined') return

if (_url&&_loaded&&(_w!=_NULL))
{
calcSize()
if ((_img.width!=_w)||(_img.height!=_h))
{
if (_ns4) document.location.replace(document.location.href)
else
{
_img.width=_w;_img.height=_h
}
}
}
}

if (!_moz) window.onresize=resizeCB
if (_ns4) window.captureEvents(Event.RESIZE)




writeElem()
if (_pg) if (_pg.sticker) for (var i in _pg.sticker) with(_pg.sticker[i]) KeeBooSticker(i,text,x,y,w,h)
initStickers()





Wyszukiwarka

Podobne podstrony:
Photo 0008
Photo 0016
Photo 0021
photo 2
Photo 0043
Photo 0013
Photo 0028
photo 3

więcej podobnych podstron