/*--------------------------------------------------------------------------
 * Gallery
 * (c) 2009 Evgueni Naverniouk
 * evgueni@globexdesigns.com
 *
 * Designed for www.naverniouk.com
 *
 *--------------------------------------------------------------------------*/

function getPageHeight(){if(window.innerHeight&&window.scrollMaxY){yWithScroll=window.innerHeight+window.scrollMaxY}else if(document.body.scrollHeight>document.body.offsetHeight){yWithScroll=document.body.scrollHeight}else{yWithScroll=document.body.offsetHeight}return yWithScroll}function createCurtain(){var curtain=document.createElement('div');curtain.setAttribute('id','Curtain');curtain.setAttribute('onclick','hideGallery()');curtain.style.height=getPageHeight()+'px';document.body.appendChild(curtain)}function createFrame(picture){var frame=document.createElement('div');frame.setAttribute('id','Frame');frame.setAttribute('onclick','hideGallery()');frame.style.top=((getPageHeight()-620)/2)+'px';frame.style.left=((document.body.scrollWidth-820)/2)+'px';document.body.appendChild(frame);var pic=document.createElement('img');pic.setAttribute('src','img/design-'+picture+'.jpg');pic.setAttribute('id','FramePic');pic.setAttribute('alt','Design Showcase');pic.setAttribute('onclick','hideGallery()');pic.setAttribute('onmouseover','document.getElementById(\'CloseButton\').style.display = \'block\';');pic.setAttribute('onmouseout','document.getElementById(\'CloseButton\').style.display = \'none\';');document.getElementById('Frame').appendChild(pic);var closebutton=document.createElement('img');closebutton.setAttribute('src','img/design-close.png');closebutton.setAttribute('id','CloseButton');closebutton.setAttribute('alt','Close Image');closebutton.setAttribute('onclick','hideGallery()');closebutton.setAttribute('onmouseover','document.getElementById(\'CloseButton\').style.display = \'block\';');closebutton.setAttribute('onmouseout','document.getElementById(\'CloseButton\').style.display = \'none\';');document.getElementById('Frame').appendChild(closebutton)}function hideGallery(){document.body.removeChild(document.getElementById('Curtain'));document.body.removeChild(document.getElementById('Frame'))}function openGallery(pic){createCurtain();createFrame(pic)}