﻿//-----------------------------------------------------------------------------
// Author   : Sudipta Das
// Date     : 18-Nov-2008
// Purpose  : This script is to show a pop-up image.
//-----------------------------------------------------------------------------
function Large(obj)
{
    var imgbox=document.getElementById("imgbox");
    imgbox.style.visibility='visible';
    var img = document.createElement("img");    
    img.src=obj.src;
    img.style.width='575px';
    img.style.height='132px';
    
    if(img.addEventListener){
        img.addEventListener('mouseout',Out,false);
        img.addEventListener('click', Redirect, false);
    } else {
        img.attachEvent('onmouseout',Out);
            img.attachEvent('onclick', Redirect);  

    }             
    imgbox.innerHTML='';    
    imgbox.appendChild(img);    
    imgbox.style.left=(getElementLeft(obj)) +'px';
    imgbox.style.top=(getElementTop(obj)) + 'px';   
}  
function LargeMap(obj)
{
    var imgbox=document.getElementById("imgboxMap");
    imgbox.style.visibility='visible';
    var img = document.createElement("img");    
    img.src=obj.src;
    img.style.width='487px';
    img.style.height='291px';
    
    if(img.addEventListener){
        img.addEventListener('mouseout',OutMap,false);
        img.addEventListener('click', RedirectMap, false);
    } else {
        img.attachEvent('onmouseout',OutMap);
            img.attachEvent('onclick', RedirectMap);  

    }             
    imgbox.innerHTML='';    
    imgbox.appendChild(img);    
    imgbox.style.left=(getElementLeft(obj)) +'px';
    imgbox.style.top=(getElementTop(obj)) + 'px';   
}  
function LargeGroup(obj)
{
    var imgbox=document.getElementById("imgboxGroup");
    imgbox.style.visibility='visible';
    var img = document.createElement("img");    
    img.src=obj.src;
    img.style.width='432px';
    img.style.height='176px';
    
    if(img.addEventListener){
        img.addEventListener('mouseout',OutGroup,false);
        img.addEventListener('click', RedirectGroup, false);
    } else {
        img.attachEvent('onmouseout',OutGroup);
            img.attachEvent('onclick', RedirectGroup);  

    }             
    imgbox.innerHTML='';    
    imgbox.appendChild(img);    
    imgbox.style.left='300px';
    imgbox.style.top=(getElementTop(obj)) + 'px';   
}  
function Redirect()
{
    window.location = "http://stampiton.co/Accred.aspx";
}
function RedirectMap()
{
    window.location = "http://maps.google.co.uk/maps?q=stampiton&hl=en&ll=53.332513,-1.980286&spn=0.851242,2.469177&hq=stampiton&radius=15000&t=m&z=9&vpsrc=6";
}
function RedirectGroup()
{
    window.location = "http://www.klimax-group.com/";
}

function Out()
{
    document.getElementById("imgbox").style.visibility='hidden';
}
function OutMap()
{
    document.getElementById("imgboxMap").style.visibility='hidden';
}
function OutGroup()
{
    document.getElementById("imgboxGroup").style.visibility='hidden';
}

function getElementLeft(elm) 
{
    var x = 0;

    //set x to elm’s offsetLeft
    x = elm.offsetLeft;

    //set elm to its offsetParent
    elm = elm.offsetParent;

    //use while loop to check if elm is null
    // if not then add current elm’s offsetLeft to x
    //offsetTop to y and set elm to its offsetParent

    while(elm != null)
     {
        x = parseInt(x) + parseInt(elm.offsetLeft);
        elm = elm.offsetParent;
     }
     
     return x - 20;
}
function getElementLeftGroup(elm) 
{
    var x = 0;

    //set x to elm’s offsetLeft
    x = elm.offsetLeft;

    //set elm to its offsetParent
    elm = elm.offsetParent;

    //use while loop to check if elm is null
    // if not then add current elm’s offsetLeft to x
    //offsetTop to y and set elm to its offsetParent

    while(elm != null)
     {
        x = parseInt(x) + parseInt(elm.offsetLeft);
        elm = elm.offsetParent;
     }
     
     return x - 50;
}

function getElementTop(elm) 
{
    var y = 0;

    //set x to elm’s offsetLeft
    y = elm.offsetTop;

    //set elm to its offsetParent
    elm = elm.offsetParent;

    //use while loop to check if elm is null
    // if not then add current elm’s offsetLeft to x
    //offsetTop to y and set elm to its offsetParent

    while(elm != null)
     {
        y = parseInt(y) + parseInt(elm.offsetTop);
        elm = elm.offsetParent;
     }
     
     return y;
}

/* -- Capture date from calendar popup window -- */
