function viewImage(_imgSrc, _gallery) {
    size = checkDocumentSize();
    leftPos = size[0]/2-355;
    topPos = 20;
    window.open('pages/viewimage.php?image='+_imgSrc+'&gallery='+_gallery, "imageViewer", "width=710,height=700,top="+topPos+",left="+leftPos+",location=no,resizable=no,menubar=0,status=0");
}

function checkDocumentSize() {
    var browser = checkBrowser();
    switch(browser) {
        case 'ie':
                windowHeight = truebody().offsetHeight;
                windowWidth = truebody().offsetWidth;
                documentHeight = truebody().scrollHeight;
                documentWidth = truebody().scrollWidth;
            break;
        case 'ns':
                windowHeight = window.innerHeight;
                windowWidth = window.innerWidth;
                documentHeight = window.innerHeight + window.scrollMaxY;
                documentWidth = window.body.scrollWidth;
            break;
        case 'w3':
                windowHeight = self.innerHeight;
		windowWidth = self.innerWidth;
		documentHeight = truebody().offsetHeight;
		documentWidth = truebody().offsetWidth;
	    break;
    }
    var size = new Array(windowWidth, windowHeight, documentWidth, documentHeight);
    return size;
}

function checkBrowser() {
    var ns=(document.layers);
    var ie=(document.all);
    var w3=(document.getElementById && !ie);
    if (ie) {
        return 'ie';
    } else if (ns) {
        return 'ns';
    } else if (w3) {
        return 'w3';
    }
}

function truebody(){
    return (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body;
}