﻿/*function playVid(vidId) {
    if (vidPaneID.style.display == 'block') {
        vidPaneID.style.display = 'none';
        vidPaneID.innerHTML = '';
    } else {
        vidPaneID.style.display = 'block';
        vidPaneID.innerHTML = '<A HREF="javascript:playVid()">CLOSE</A>';
        var vidstring = '<center><embed enableJavascript="false" allowScriptAccess="never"';
        vidstring += ' allownetworking="internal" type="application/x-shockwave-flash"';
        vidstring += '  src="http://www.youtube.com/v/' + vidId + '&autoplay=1" ';
        vidstring += ' wmode="transparent" height="350" width=425"></center>';
        vidPaneID.innerHTML += vidstring;
    }
}
*/
function showDiv(divID) {

    var orgCursor = null;   // The original Cursor (mouse) Style so we can restore it
    var dragOK = false;     // True if we're allowed to move the element under mouse
    var dragXoffset = 0;    // How much we've moved the element on the horozontal
    var dragYoffset = 0;    // How much we've moved the element on the verticle

    vidPaneID = document.getElementById(divID); // Our movable layer    
    vidPaneID.style.top =  ((window.screen.height / 4)) + "px";        // Starting location horizontal
    vidPaneID.style.left = ((window.screen.width / 2) - 250) + "px";  // Starting location verticle
    
    if (vidPaneID.style.visibility == 'visible') {
        vidPaneID.style.visibility = 'hidden';
    } else {
        vidPaneID.style.visibility = 'visible';
    }
    
    document.onmousedown = dragHandler;
}

function moveHandler(e) {
    if (e == null) { e = window.event }
    if (e.button <= 1 && dragOK) {
        savedTarget.style.left = e.clientX - dragXoffset + 'px';
        savedTarget.style.top = e.clientY - dragYoffset + 'px';
        return false;
    }
}

function cleanup(e) {
    document.onmousemove = null;
    document.onmouseup = null;
    savedTarget.style.cursor = orgCursor;
    dragOK = false;
}

function dragHandler(e) {
    var htype = '-moz-grabbing';
    if (e == null) { e = window.event; htype = 'move'; }
    var target = e.target != null ? e.target : e.srcElement;
    orgCursor = target.style.cursor;
    if (target.className == "PopUpForm") {
        savedTarget = target;
        target.style.cursor = htype;
        dragOK = true;
        dragXoffset = e.clientX - parseInt(vidPaneID.style.left);
        dragYoffset = e.clientY - parseInt(vidPaneID.style.top);
        document.onmousemove = moveHandler;
        document.onmouseup = cleanup;
        return false;
    }
}


