﻿function ShowPanel(obj, QId) {
    var divTitle = document.getElementById("divTitle" + QId);
    var divContent = document.getElementById("divContent" + QId);


    if (divContent.style.display = 'none') {
        divContent.style.display = 'block';
        divTitle.style.display = 'none';
    }

}

function HidePanel(obj, QId) {
    var divTitle = document.getElementById("divTitle" + QId);
    var divContent = document.getElementById("divContent" + QId);

    if (divContent.style.display = 'block') {
        divContent.style.display = 'none';
        divTitle.style.display = 'block';
    }
}

//sets border of the selected image in radrotator
function setBorder(obj, ID) {
    var rotateImage = document.getElementById("rotatorImage" + ID);

    //clear the border from all images
    var imgs, i;
    imgs = document.getElementsByTagName('img');
    for (i in imgs) {

        if (/img/.test(imgs[i].className)) {
            imgs[i].style.border = '2px solid #efefef';
        }
    }
    //apply border to the selected image
    document.getElementById("rotatorImage" + ID).style.border = "2px solid #ef4d38";

}


function BigImage(obj, ID) {
    var rotateImage = document.getElementById("rotatorImage" + ID);
    var imagePreview = document.getElementById('<%=imagePreview.ClientID%>');
    var ImgPreview = document.getElementById('ImgPreview');
    ImgPreview.src = rotateImage.src;
 
}



function resize_pic(width,height) {

var divImg = document.getElementById('divImage');
var imgAlbum = document.getElementById('imgAlbum');

  //  var maxWidth = (screen.width - 20); 
  //  var maxHeight = (screen.height - 100);
   
    var maxWidth = (113);
    var maxHeight = (150);
    var w = width;
    var h = height;

 //   if (w == 0 || h == 0) {
     //   window.setTimeout("resize_pic()", 1000);
   //     return;
 //   }

    if (h > maxHeight) {
        w = w * (maxHeight / h);
        }
        else
        {
        h = maxHeight;
        }

        if (w > maxWidth) {
            h = h * (maxWidth / w);
        }
        else {
            w = maxWidth;
        }

    imgAlbum.width = w;
    imgAlbum.height = h;
  //  document.all.img_td.height = h;
}


function resize_pic() {
    var maxWidth = window.screen.width - 200, maxHeight = window.screen.height - 200;
    var w = img1.width;
    var h = img1.height;

    if (h <= maxHeight && w <= maxWidth) {
        w = w;
        h = h;

        if (w > maxWidth) {
            h = h * (maxWidth / w);
            w = maxWidth;
        }

    }

    else {
        if (h > maxHeight) {
            w = w * (maxHeight / h);
            h = maxHeight;
        }

        if (w > maxWidth) {
            h = h * (maxWidth / w);
            w = maxWidth;
        }
    }
    img1.width = w;
    img1.height = h;
}

function calcHeight() {

    var theHeight = document.getElementById('ApplicationIFrame').contentWindow.document.body.scrollHeight;

    document.getElementById('ApplicationIFrame').height = theHeight;
}


function openPopup(url) {
    var LeftPosition = (screen.width) ? (screen.width - 550) / 2 : 0;
    var TopPosition = (screen.height) ? (screen.height - 500) / 2 : 0;
    var settings = 'height=500 ,width=550,top=' + TopPosition + ',left=' + LeftPosition + ',toolbar=no,location=no,directories=no,status=no,titlebar=no,copyhistory=yes,scrollbars=no,resizable=no';
   
window.open(url, "_blank", settings);
//window.open(url, "_blank", "toolbar=no, location=no, directories=no, status=no, titlebar=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=850, height=500,left=200,top=200");


}


function openPopup(url, width, height) {
    var w;
    var h;
    if (width == null)
        w = 850;
    else
        w = width;

    if (height == null)
        h = 600;
    else
        h = height;

    var LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
    var TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
    var settings = 'height=' + h + ',width=' + w + ',top=' + TopPosition + ',left=' + LeftPosition + ',toolbar=no,location=no,directories=no,status=no,titlebar=no,copyhistory=yes,scrollbars=yes,resizable=yes';

    window.open(url, "_blank", settings);


}

function ShowBigImage(obj, ID) {

    var smallImage = document.getElementById('<%=imagePreview.ClientID%>');
    
   
}

function PrintThisPage(css) {
    var sOption = "toolbar=yes,location=no,directories=yes,menubar=yes,";
    sOption += "scrollbars=yes,width=750,height=600,left=100,top=25";

    var sWinHTML = document.getElementById('contentstart').innerHTML;

    var winprint = window.open("", "", sOption);
    winprint.document.open();
    winprint.document.write('<html>'+ css +'<body>');
    winprint.document.write(sWinHTML);
    winprint.document.write('</body></html>');
    winprint.document.close();
    winprint.focus();
}





//////////////////////////////////////


var scrmsg = "    Web Tips and Tricks    Web Tips and Tricks";
var scrspacer = " ";
var scrpos = 0;
function ScrollMessage() {
    window.status = scrmsg.substring(scrpos, scrmsg.length) + scrspacer +
            scrmsg.substring(0, scrpos);
    scrpos++;
    if (scrpos > scrmsg.length) scrpos = 0;
    window.setTimeout("ScrollMessage()", 150);
}

//ScrollMessage(); 



