﻿
function hideme() {

    var ctl = document.getElementById("ctl00_ContentPlaceHolder1_tdback");
    ctl.style.visibility = 'hidden'

    var cts = document.getElementById("LoadingGif");
    cts.style.visibility = 'visible'


}
function ShowPic(path, description,pdfPath) {

    
    var td = document.getElementById("ctl00_ContentPlaceHolder1_tdback");
    newImage = "url(" + path + ")";
    //newImage.id = "img11122"
    //newImage.onload = fadeIn('ctl00_ContentPlaceHolder1_tdback', 0);
    // newImage.id = "lblaa";

    if (null == td.onload) {
        td.onload = hideme();
        td.onunload = ShowMe();
        //td.onload = fadeIn('ctl00_ContentPlaceHolder1_tdback', 70);
    }
    // td.load = fadeIn('ctl00_ContentPlaceHolder1_tdback', 70);
    td.style.backgroundImage = newImage;
    document.getElementById("ctl00_ContentPlaceHolder1_lblgalleryText").innerHTML = description;
    td.onclick = function() { window.open(pdfPath, "mywindow", "status=1"); };
    document.getElementById("ctl00_ContentPlaceHolder1_lblClick").href = pdfPath;
    
    //"OpenPdf(" + pdfPath + ");";

}
function test() {
    alert('test');
 }
function OpenPdf(path) {
    window.open(path, "mywindow", "status=1");
}
function ShowMe() {
    var img = document.getElementById("ctl00_ContentPlaceHolder1_tdback");
    img.style.visibility = 'visible';
    setOpacity('ctl00_ContentPlaceHolder1_tdback', 0);
    fadeIn('ctl00_ContentPlaceHolder1_tdback', 50);
}
function setOpacity(obj, opacity) {
    try {
        opacity = (opacity == 100) ? 99.999 : opacity;

        // IE/Win
        obj.style.filter = "alpha(opacity:" + opacity + ")";

        // Safari<1.2, Konqueror
        obj.style.KHTMLOpacity = opacity / 100;

        // Older Mozilla and Firefox
        obj.style.MozOpacity = opacity / 100;

        // Safari 1.2, newer Firefox and Mozilla, CSS3
        obj.style.opacity = opacity / 100;
    }
    catch (Error) {

    }
}
function fadeIn(objId, opacity) {

    try {
        if (document.getElementById) {
            obj = document.getElementById(objId);
            if (opacity <= 100) {
                setOpacity(obj, opacity);
                opacity += 10;
                window.setTimeout("fadeIn('" + objId + "'," + opacity + ")", 100);
            }
            if (opacity == 100) {
                var cts = document.getElementById("LoadingGif");
                cts.style.visibility = 'hidden'
            }
        }
    }
    catch (Error) {

    }

}

