﻿// JScript File

function initRollovers() 
{
    if (!document.getElementById) return
    var aPreLoad = new Array();
    var sTempSrc;
    var aImages = document.getElementsByTagName('img');
    for (var i = 0; i < aImages.length; i++) 
    {
        if (aImages[i].className == 'imgover') 
        {
            var src = aImages[i].getAttribute('src');
            if (src.indexOf('Off.')>0)
            {
                var ftype = src.substring(src.lastIndexOf('Off.'), src.length);

                var hsrc = src.replace(ftype, 'On'+ftype);
                hsrc = hsrc.replace("Off", '');
                aImages[i].setAttribute('hsrc', hsrc);

                aPreLoad[i] = new Image();
                aPreLoad[i].src = hsrc;

                aImages[i].onmouseover = function() 
                {
                    sTempSrc = this.getAttribute('src');
                    this.setAttribute('src', this.getAttribute('hsrc'));
                }
            }
            if (src.indexOf('Off.')>0)
            {
                aImages[i].onmouseout = function() 
                {
                    if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('On'+ftype, ftype);
                    this.setAttribute('src', sTempSrc);
                }
            }
        }
    }
}

function fnEditPage(iPageId)
{
    showPopWin('PageEdit.aspx?PageId=' + iPageId, 750, 600);
    return false;
}

function closeMe()
{
	if(confirm('Are you sure you want to close?  Any unsaved data will be lost.'))
	{
	    window.opener.location.reload();
		window.close();
	}
}

function openWin(url)
{
    window.open(url,'','');
}

function openDemo(FileName, FileWidth, FileHeight)
{
    window.open('ShowDemo.aspx?FileName=' + FileName + '&FileWidth=' + FileWidth + '&FileHeight=' +FileHeight, 'DemoPage', 'Height=' + FileHeight + 'px, Width=' + FileWidth + 'px, resizable=no, status=no,scrollbars=no,menubar=no');
}

function GetLink(dd, link)
{
    var sID;
    var sLink;
    sID = dd.options[dd.selectedIndex].value;
    //alert(sID);
    sLink = link + "/DownloadFile.aspx?FileId=" + sID;
    document.getElementById("txtCopy").value = sLink;
    document.getElementById("txtCopy").focus();
    document.getElementById("txtCopy").select();
}
