﻿function initPopups() {

    
    //Detect IE5.5+
    version=0
    if (navigator.appVersion.indexOf("MSIE")!=-1){
    temp=navigator.appVersion.split("MSIE")
    version=parseFloat(temp[1])
    }

    if (version<5.0 && version !=0) //NON IE browser will return 0
    window.location="badbrowser/upgradebrowser.htm";
    
    
        
        
        
        var els = document.getElementsByTagName("a");
        for(var i = 0; i < els.length; i++) {
            if (els[i].className.indexOf("popup") !=- 1) {
            els[i].onclick=popup;
            }
        }
    }

    function popup() {
        var img=new Image;
        img.src=this.href;
        var rnd_num = Math.random()*100000;  
         var s = "" + Math.round(rnd_num * 100000)/100000;  
         var i = s.indexOf('.');  
         var t = s.substring(0, i) ;  
         var win=window.open("about:blank", t,"width="+(img.width)+",height="+(img.height));  
         with (win.document){
         writeln('<html><head><title>AdiColor Colour Image</title></head>');
         writeln('<style>body {margin:0px;}</style>');
         writeln('</head>');
         writeln('<body >');
         writeln('<image alt="" src="'+img.src+'" style="display:block" />');
         writeln('</body>');
         writeln('</html>');
         }
         
        return false; 
    }
    
function ColourSwatchpopup(divToPop){
var popimage = document.getElementById(divToPop);
var mousex = 0;
var mousey = 0;
if (window.event)
{
        //fires in IE
        e = window.event;
        mousex = e.x;
        mousey = e.y;
}
else
{       
        //fires in FireFox
        mousex = 500;
        mousey = 100;
}
popimage.style.position = 'absolute';
popimage.style.left = mousex + 10;
popimage.style.top = mousey - 10;
popimage.style.visibility = 'visible';
}

function ColourSwatchpopdown(divToPop){
var popimage = document.getElementById(divToPop);
popimage.style.visibility = 'hidden';
}
  
  

