﻿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 #09569c";

}


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 getHeight() {
    var minHeight = 500;
    var theHeight = document.getElementById('ApplicationIFrame').contentWindow.document.body.scrollHeight;


    if (minHeight > theHeight) {
        document.getElementById('ApplicationIFrame').height = minHeight;
    }
    else {
        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();

//---------------------------resizing functions
var myWidth = window.innerWidth;
var myHeight = window.innerHeight;
function resizeWindowD() { top.resizeTo(500, 300); }
function resizeWindowU() { top.resizeTo(myWidth, myHeight); }
    var min = 8;
    var max = 24;
    var div = document.getElementsByTagName('div'); //divs
    var span = document.getElementsByTagName('span'); //span
    var p = document.getElementsByTagName('p'); //p
    var a = document.getElementsByTagName('a'); //a

//-------------------------------------------------------
function increaseFontSize() {

 
    //p
    for (i = 0; i < p.length; i++) {
        if (p[i].style.fontSize) {
            var s = parseInt(p[i].style.fontSize.replace("px", "")); 
        }
        else {
           s = 14; 
        }
        if (s != max) {
            s += 1;
        }
        p[i].style.fontSize = s + "px";
        //-------------
        var f = p[i].getElementsByTagName("font");
        for (j = 0; j < f.length; j++) {
            if (f[j].style.fontSize)
            { var s1 = parseInt(f[j].style.fontSize.replace("pt", "")); }
            else { s1 = 12; }
            if (s1 != max)
            { s1 += 1; }
            f[j].style.fontSize = s1 + "pt"
        }
    }

    //divs
    for (i = 0; i < div.length; i++) {
        if (div[i].style.fontSize)
        {  s = parseInt(div[i].style.fontSize.replace("px", "")); }
        else { s = 14; }
        if (s != max) { s += 1; } div[i].style.fontSize = s + "px";
         f = div[i].getElementsByTagName("font");
       for (j = 0; j < f.length; j++) {
            if (f[j].style.fontSize)
           {  s1 = parseInt(f[j].style.fontSize.replace("pt", "")); }
           else { s1 = 11; }
           if (s1 != max)
           { s1 += 1; }
           f[j].style.fontSize = s1 + "pt"
       }
    }

//span

    for (i = 0; i < span.length; i++) {
        if (span[i].style.fontSize)
        {  s = parseInt(span[i].style.fontSize.replace("px", "")); }
        else { s = 14; }
        if (s != max) { s += 1; } span[i].style.fontSize = s + "px";
         f = span[i].getElementsByTagName("font");
        for (j = 0; j < f.length; j++) {
            if (f[j].style.fontSize)
            {  s1 = parseInt(f[j].style.fontSize.replace("pt", "")); }
            else {s1 = 12; }
            if (s1 != max)
            { s1 += 1; }
            f[j].style.fontSize = s1 + "pt"
        }
    }
    //a

    for (i = 0; i < a.length; i++) {
        if (a[i].style.fontSize)
        {  s = parseInt(a[i].style.fontSize.replace("px", "")); }
        else {s = 14; }
        if (s != max) { s += 1; } a[i].style.fontSize = s + "px";
//        var f = a[i].getElementsByTagName("font");
//        for (j = 0; j < f.length; j++) {
//            if (f[j].style.fontSize)
//            { var s1 = parseInt(f[j].style.fontSize.replace("pt", "")); }
//            else { var s1 = 12; }
//            if (s1 != max)
//            { s1 += 1; }
//            f[j].style.fontSize = s1 + "pt"
//        }
    }
    
}
//------------------------------------------------------
function decreaseFontSize() {


//p
    for (i = 0; i < p.length; i++) {
        if (p[i].style.fontSize) { var s = parseInt(p[i].style.fontSize.replace("px", "")); } else {  s = 12; } if (s != min) { s -= 1; } p[i].style.fontSize = s + "px"; var f = p[i].getElementsByTagName("font"); for (j = 0; j < f.length; j++) {
            if (f[j].style.fontSize) { var s1 = parseInt(f[j].style.fontSize.replace("pt", "")); } else {  s1 = 10; } if (s1 != min) { s1 -= 1; } f[j].style.fontSize = s1 + "pt"

        }
    }
//divs
    for (i = 0; i < div.length; i++) {
        if (div[i].style.fontSize) {  s = parseInt(div[i].style.fontSize.replace("px", "")); } else { var s = 12; } if (s != min) { s -= 1; } div[i].style.fontSize = s + "px"; var f = div[i].getElementsByTagName("font"); for (j = 0; j < f.length; j++) {
            if (f[j].style.fontSize) {  s1 = parseInt(f[j].style.fontSize.replace("pt", "")); } else { var s1 = 10; } if (s1 != min) { s1 -= 1; } f[j].style.fontSize = s1 + "pt"

        }
    }
//span
    for (i = 0; i < span.length; i++) {
        if (span[i].style.fontSize) {  s = parseInt(span[i].style.fontSize.replace("px", "")); } else {  s = 12; } if (s != min) { s -= 1; } span[i].style.fontSize = s + "px"; var f = span[i].getElementsByTagName("font"); for (j = 0; j < f.length; j++) {
            if (f[j].style.fontSize) {  s1 = parseInt(f[j].style.fontSize.replace("pt", "")); } else {  s1 = 10; } if (s1 != min) { s1 -= 1; } f[j].style.fontSize = s1 + "pt"

        }
    }

    //a
    for (i = 0; i < a.length; i++) {
        if (a[i].style.fontSize) { var s = parseInt(a[i].style.fontSize.replace("px", "")); } else { var s = 12; } if (s != min) { s -= 1; } a[i].style.fontSize = s + "px";

//        var f = a[i].getElementsByTagName("font"); 
//        for (j = 0; j < f.length; j++) {
//            if (f[j].style.fontSize) {
//                var s1 = parseInt(f[j].style.fontSize.replace("pt", ""));
//            } 
//            else { var s1 = 10; } if (s1 != min) { s1 -= 1; } f[j].style.fontSize = s1 + "pt"

//        }
    } 
}




