function pageWidth() {
 return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

function pageHeight() {
 return window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}

function pageleftlocation() {
 thepagewidth = pageWidth();
 leftlocationplace = (thepagewidth / 2) - (400 / 2);
 leftlocationplace = leftlocationplace < 0 ? 0 : leftlocationplace;
 return leftlocationplace;
}

function pagetoplocation() {
 thepageheight = pageHeight();
 toplocationplace = (thepageheight / 2) - (400 / 2);
 toplocationplace = toplocationplace < 0 ? 0 : toplocationplace;
 return toplocationplace;
}

function imagevoodooon(imagefile) {
 document.getElementById('popupimagefile').src = imagefile;
 document.getElementById('popupimage').style.display = 'inline';
 imagevoodoorelocate();
}

function imagevoodoorelocate() {
 document.getElementById('popupimage').style.left = pageleftlocation();
 document.getElementById('popupimage').style.top = pagetoplocation();
}

function imagevoodoooff() {
 document.getElementById('popupimage').style.display = 'none';
}
