function detectexist(obj){
return (typeof obj !="undefined")
}
// recieving and naming the variables send by the link 
function jkpopimage(imgpath, popwidth, popheight, textdescription, windowtitle, popbackground){
// centering the pop-up window 
function getpos(){
leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
// opera work around
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}
// processing variables and opening pop-up window
getpos()
var winattributes='width='+popwidth+',height='+popheight+',left='+leftpos+',top='+toppos+',"fullscreen=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1"'
var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'
if (typeof jkpopwin=="undefined" || jkpopwin.closed)
jkpopwin=window.open("","",winattributes)
else{
//getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too
//jkpopwin.moveTo(leftpos, toppos)
jkpopwin.resizeTo(popwidth, popheight+30)
}
jkpopwin.document.open()
jkpopwin.document.write('<html><title>'+windowtitle+'</title><link href="../css/main-styles.css" rel="stylesheet" type="text/css" /><body '+bodyattribute+' onBlur="self.close()" MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BOTTOMMARGIN="0" style="border: 0px; overflow: hidden; margin: 0pt;"><a href="javascript:self.close()"><img src="'+imgpath+'"></a><br>'+textdescription+'</body></html>')
jkpopwin.document.close()
jkpopwin.focus()
}
