﻿// image rollover functions
function IndexPicture_OnMouseOver(sender, onImgPath) {
    var obj = $(sender);
    obj.addClassName('mouseOver');
    if (onImgPath.length > 0) obj.getElementsBySelector('img')[0].src = onImgPath;    
}
function IndexPicture_OnMouseOut(sender, outImgPath) {
    var obj = $(sender);
    obj.removeClassName('mouseOver');
    if (outImgPath.length > 0) obj.getElementsBySelector('img')[0].src = outImgPath;    
}

function ChangePicture_OnEvent(sender, imgPath) {
    if (sender) sender.src = imgPath;
}

//media pop up
function openMediaPopup(url, width, height)
{
    if(url.length > 0)
    {
        // shows a pop up window
        var left = (screen.width) ? (screen.width-width)/2 : 0;
        var top = (screen.height) ? (screen.height-height)/3 : 0;
        var name = '_blank';
        // create the popup settings now
        var settings = 'height='+ height + ',width=' + width + ',top=' + top + ',left=' + left + ',status=no,menubar=no,directories=no,scrollbars=no,resizable=no';
        // open the new window
        win = window.open('/media-viewer.aspx?media=' + url, name, settings);
        win.focus();
    }
}


function resizeWinTo( idOfDiv ) {
     var oH = getRef(idOfDiv); if( !oH ) { return false; }
     var oW = oH.clip ? oH.clip.width : oH.offsetWidth;
     var oH = oH.clip ? oH.clip.height : oH.offsetHeight; if( !oH ) { return false; }
     var x = window; x.resizeTo( oW + 200, oH + 200 );
     var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;
     if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }
     else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }
     else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }
     if( window.opera && !document.childNodes ) { myW += 16; }
     x.resizeTo( oW + ( ( oW + 200 ) - myW ), oH + ( (oH + 200 ) - myH ) );
}

function getRef(id) {
return $(id);
// if (isDOM) return document.getElementById(id);
// if (isIE4) return document.all[id];
// if (isNS4) return document.layers[id];
}
