var popbackground="#FFFFE0" //specify backcolor or background image for pop window
var windowtitle="Singapore Cheshire Home"  //pop window title

function detectexist(obj){
return (typeof obj !="undefined")
}

function NewWindow(imgpath, popwidth, popheight, textdescription){

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
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}

getpos()
var winattributes='width='+popwidth+',height='+popheight+',scrollbars=no,resizable=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{
//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><head><title>' +windowtitle +'</title></head>')
jkpopwin.document.write('<body '+bodyattribute +'><center>')

dummywidth = popwidth-5
dummyheight = popheight-77
// style="border-bottom:1px solid red"
// jkpopwin.document.write('<div style="position:absolute; top:0; left:0; z-index:2"><img src="images/picture.gif" border="0" width="' +dummywidth + '" height="' +dummyheight +'" ></div>')

jkpopwin.document.write('<div style="position:relative; z-index:1">')

//this replaces the character % with '
//necessary when ' needs to be displayed yet calling function uses ' as a parameter delimiter
//word1 = "Spore";
//word2 = "S'pore";
//word2 = word1.replace(rExp,"'");
 
rExp = /%/gi
textdescription = textdescription.replace(rExp,"'")

jkpopwin.document.write('<img src="' +imgpath +'"></div><br>' +textdescription)
jkpopwin.document.write('<p><a href="#"><img border="0" src="images/close-window.jpg" width="87" height="32" onclick="javascript:window.close()"></a>')
jkpopwin.document.write('</center></body></html>')
jkpopwin.document.close()
jkpopwin.focus()
}


