﻿
function OnClientdropDownOpenedHandler(sender, eventArgs) {
    var tree = sender.get_items().getItem(0).findControl("radTimeTree");
    var selectedNode = tree.get_selectedNode();
    if (selectedNode) {
        selectedNode.scrollIntoView();
    }
}

function GeoOnClientSelectedIndexChanged(sender, eventArgs) {
    var item = eventArgs.get_item();
    sender.set_text(item.get_text());
}

function slideConfig(uniqudId, dir) {
    var divstyle = new String();
    divstyle = document.getElementById("toggle").style.visibility;
    if (divstyle.toLowerCase() == "visible" || divstyle == "")
     {
        document.getElementById("toggle").style.visibility = "hidden";
        document.getElementById("imgspan").className = "toggledown";
        document.getElementById("mymod").className = "bigModuleBottomS";
        document.getElementById("Title").style.visibility = "visible";
        document.getElementById("Title").innerText = "Show Data Filters";
    }
    else {
        document.getElementById("toggle").style.visibility = "visible";
        document.getElementById("mymod").className = "bigModuleBottomL";
        document.getElementById("imgspan").className = "toggleUp";
        document.getElementById("Title").style.visibility = "hidden";
    }
}
function setClass(BtnId)
    {
        for(var i=1; i<=4; i++)
        {
            var BtnFH = document.getElementById('ctl00_ContentPlaceHolder1_btnfy' + i);
            if(BtnFH != null)
            {
                BtnFH.style.fontWeight = 'normal';
                BtnFH = null;
            }
        }
        
        BtnFH = document.getElementById(BtnId);
        if(BtnFH != null)
        {
           BtnFH.style.fontWeight = 'bold';
        }
    }


// ================================================================================
//  
//  Author  :   Youngsuk Yu
//  Date    :   3/11/2009
//  Contact :   n2name@hotmail.com
//  Homepage:   http://www.netimate.com
//
//  Desc    :   Whole screen popup div, all right reseerved by Youngsuk Yu.
//
// ================================================================================

var divPopupID = "divPopupImage";
var divMenuID = "divSideMenu";
var imgID = "divPopupPDF";

var _isDown = false;
var _mX = 0;
var _mY = 0;
var _dX = 0;
var _dY = 0;

// Set a global Key press event. It closes popup if user press any key.
function keyPress(e) {
    ClosePopup();
}
document.onkeypress = keyPress;


function PopupArea() {
    var divPopup = document.getElementById(divPopupID);
    if (divPopup == null)
        return;
    var divMenu = document.getElementById(divMenuID);
    if (divMenu == null)
        return;
    var divImage = document.getElementById(imgID);
    if (divImage == null)
        return;

    divPopup.style.position = "fixed";
    divPopup.style.display = "block";

    divMenu.style.display = "block";

    divImage.style.position = "fixed";
    divImage.style.display = "block";

    divImage.style.left = "55px";
    divImage.style.top = "5px";
    divImage.style.right = "55px";
    divImage.style.bottom = "5px";

    try {
        // if user's web browser is not IE, do below
        if (navigator.userAgent.indexOf("MSIE") < 0)
            divImage.onmousedown = function(event) {
                ImageMouseDown(event);
                if (event && event.preventDefault)
                    event.preventDefault();
            };
    } 
    catch (e)
    { }

}
function IFRAME_size_to_content(iframe_ref) { 
    var oIframe = document.getElementById(iframe_ref);
    if (typeof oIframe != null) {
        var winheight = getOnlyHeight();
        if (winheight) oIframe.style.height = winheight.toString() + 'px';
    }
}

function getOnlyHeight() {
    var myHeight = 0;
    try {
        if (typeof (window.innerWidth) == 'number') {
            //Non-IE
            myHeight = window.innerHeight;
        } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
            //IE 6+ in 'standards compliant mode'
            myHeight = document.documentElement.clientHeight;
        } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
            //IE 4 compatible
            myHeight = document.body.clientHeight;
        }
    }
    catch (e) { }
    return myHeight - 10;
}

function LeftMenu(isHover) {
    var menu = document.getElementById(divMenuID);
    if (menu == null)
        return;

    if (isHover) {
        menu.style.backgroundColor = "#22c";
        menu.style.cursor = "pointer";
        return;
    }
    menu.style.backgroundColor = "#22a";
    menu.style.cursor = "default";
}

function ClosePopup() {
    var divPopup = document.getElementById(divPopupID);
    if (divPopup == null)
        return;
    var divMenu = document.getElementById(divMenuID);
    if (divMenu == null)
        return;
    var divImage = document.getElementById(imgID);
    if (divImage == null)
        return;

    divPopup.style.display = 'none';
    divMenu.style.display = 'none';

    divImage.style.display = 'none';
    divImage.style.left = "55px";
    divImage.style.top = "5px";
}

function isNumeric(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode != 46 && charCode > 31 && ((charCode >= 48 && charCode <= 57) || charCode == 46))
        return true;
    else {
        alert('Please Enter Numeric values.');
        return false;
    }
}

function isValidChar(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode == 60 || charCode == 62) {
        return false;
    }
    else {
        return true;
    }
}
function dropDownClosed(sender, args) {
    var input = sender.get_inputDomElement();
    var range = input.createTextRange();
    range.move('character', 0);
    range.select();
}
