

function init_popup(){
    var thebody=document.getElementsByTagName("body");
    var popupwindow = document.createElement('div');
    popupwindow.setAttribute('id', 'popuplayer');
    popupwindow.setAttribute('style', 'display: none;');
    thediv=thebody[0].appendChild(popupwindow);
    thediv.innerHTML="<a href=\"javascript: popup_hide()\">[close]</a><img src=\"http://www.armourhe.co.uk/images/nothing.gif\" id=\"popupimage\" alt=\"\"></img>";
    thediv.style.display='none';
    links=document.getElementsByTagName("a");
    for(var n=0; n<links.length; n++){
        if (links[n].className=="popuplink"){
            links[n].href="javascript: popup_image('"+links[n].href+"')";
        }
    }
}

function popup_hide(){
    document.getElementById('popuplayer').style.display='none';
    
    document.getElementById('popupimage').src="http://www.armourhe.co.uk/images/nothing.gif";
}

function fitPic(mywindow) {
    if (mywindow.innerWidth){
        iWidth = mywindow.innerWidth;
        iHeight = mywindow.innerHeight;
    }else{
        iWidth = mywindow.document.body.clientWidth;
        iHeight =mywindow.document.body.clientHeight;
    }
        iWidth = mywindow.document.images[0].width - iWidth;
        iHeight = mywindow.document.images[0].height - iHeight;
    mywindow.resizeBy(iWidth, iHeight);
};

function popup_image(newimage){
    if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Mac")!=-1){
        var load = window.open('about:blank','','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no');
        load.document.write('<html><head><title>Cinemax Image</title>');
        load.document.write('<script language="javascript" src="/themes/cinemax/scripts/popup_image.js" type="text/javascript"></script>');
        load.document.write('</head><body style="margin: 0px; padding: 0px;">');
        load.document.write('<img onload="fitPic(window)" src="'+newimage+'" alt=""></img>');
        load.document.write('</body></html>');
        load.document.close();
    }
    else
    {
        document.getElementById('popupimage').src=newimage;
        document.getElementById('popuplayer').style.display='';
    }
}


