
// Pop is a pop-up window function for displaying either images or youTube videos

// Use the followingf in links that invoke script
// To display image use: pop('image.jpg',image_width,image_height)
// To display youTube video use: pop('xxxxxxxxxxx') -the eleven digit video code only

function pop(media,width,height){
var top = '<html><head><title>m u l t i m e d i a g a l l e r y</title></head><body style="margin: 50px;"><center>'
var bottom = '</center><h2 align="center"><a href="javascript:window.close();">close</a></h2></body></html>'

if(media.indexOf(".")!=-1){                           // If there's a period in the code it's an image
media = '<img src="' + media + '" id="pix" />'
width = width + 160
height = height + 160
}else{                                                      // Else it's a youTube code, video
var ytcode = '<object width="296" height="233"><param name="movie" id="vp" value="http://www.youtube.com/v/'
ytcode = ytcode + media + '&autoplay=1&hl=en&fs=1&rel=0"></param>'
ytcode = ytcode + '<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>'
ytcode = ytcode + '<embed id="ve" src="http://www.youtube.com/v/'+ media + '&autoplay=1&hl=en&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="296" height="233"></embed></object>'
width = 400
height = 400
media = ytcode
}
var features = "resizable,scrollbars,menubar=no,toolbar=no,width="+width+",height="+height
mediaWin=window.open("","gallery",features)
mediaWin.document.open()
mediaWin.document.write(top + media + bottom)
mediaWin.document.close()
mediaWin=window.open("","gallery",features)
width=width*.5
height=height*.5
mediaWin.moveTo(screen.width/2-width,200)  // Pop-up window location. Change 200 value to move window vertically.
mediaWin.focus()
}



