var popbackground="#F0F5FE" //specify backcolor or background image for pop window
var windowtitle="Phuket.Net Photo Gallery"  //pop window title

function detectexist(obj){
return (typeof obj !="undefined")
}

function jkpop(imgpath, popwidth, popheight, textdescription, imgX, imgY){

function getpos(){
leftpos=(detectexist(window.left))? left+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.top))? top+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}

getpos()
var winattributes='width='+popwidth+',height='+popheight+',resizable=yes,scrollbars=no,left='+leftpos+',top='+toppos
var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'
if (typeof jkpopwin=="undefined" || jkpopwin.closed)
jkpopwin=window.open("","",winattributes)
else{

jkpopwin.resizeTo(popwidth, popheight+30)
}
jkpopwin.document.open()
jkpopwin.document.write('<html><head><title>'+windowtitle+'</title><style type="text/css">body { padding: 0; margin; 0; overflow: hidden; } p { position: relative; top: -10px; left: -5px; font: bold 1em verdana, lucida, sans-serif; color: #888; margin: 0 0 3px; padding-left: 5px;  } a img { border:0; position: relative; left: -10px; top: -15px; } span.instr { font: normal 0.6em verdana, lucida, sans-serif; color: #999; }</style></head><body '+bodyattribute+'><a href="javascript:window.close()"><img src="'+imgpath+'" width="'+imgX+'px" height="'+imgY+'px"><\/a><p>'+textdescription+'<span class="instr">&nbsp;-&nbsp;click image to close window.</p></body></html>')
jkpopwin.document.close()
jkpopwin.focus()
}
