﻿var IE = document.all;

if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;

function getMouseXY(e) {
    if (IE) {
        tempX = event.clientX + document.documentElement.scrollLeft;
        tempY = event.clientY + document.documentElement.scrollTop;
    }
    else {
        tempX = e.pageX;
        tempY = e.pageY;
    }

    if (tempX < 0) { tempX = 0; }
    if (tempY < 0) { tempY = 0; }

    return;
}

   

function displayPopupDiv(e,cls) {

    var posx = tempX;
    var posy = tempY;  
    
    var div = document.getElementById('popup');
    
    if (!div) {
        var div = document.createElement('div');
        div.setAttribute('id', 'popup');
        div.className = cls;
    }
    
    /* Calendar Popup for Event Calendar Page */
    if (e == 'calendar') {
        div.appendChild(document.createTextNode('Calendar Legend'));

        var ww = div.appendChild(document.createElement('div'));
        ww.appendChild(document.createTextNode('Whistling Wing Events are in this color'));
        ww.style.color = 'coral';
        var ukc = div.appendChild(document.createElement('div'));
        ukc.appendChild(document.createTextNode('UKC Events are in this color'));
        ukc.style.color = 'DarkKhaki';
        var akc = div.appendChild(document.createElement('div'));
        akc.appendChild(document.createTextNode('AKC events are in this color'));
        akc.style.color = 'Beige';
        var multi = div.appendChild(document.createElement('div'));
        multi.appendChild(document.createTextNode('Multiple events are in this color'));
        multi.style.color = 'LightGreen';
        var selected = div.appendChild(document.createElement('div'));
        selected.appendChild(document.createTextNode('Selected event in red text'));
        selected.style.color = 'Red';
        var currentday = div.appendChild(document.createElement('div'));
        currentday.appendChild(document.createTextNode("Today's text is in blue"));
        currentday.style.color = 'Blue';
    }
    else if (e == 'pinterest') {


        div.appendChild(document.createTextNode('Explanation of Terms'));

        var t1 = div.appendChild(document.createElement('h2'));

        t1.appendChild(document.createTextNode('Hunting Retriever Training - You are interesting in teaching your dog to be a good hunting companion.'));

        var t2 = div.appendChild(document.createElement('h2'));
        t2.appendChild(document.createTextNode('Hunt Test - You are intereted in teaching your dog to perform in hunt tests to earn titles / awards for their achievement.'));
    }

    else if (e == 'willhelp') {
        div.appendChild(document.createTextNode('Explanation of Terms'));

        var tx1 = "Throwing Bumpers / Birds - We use wingers (really big sling shots) to launch birds for the dogs to pick up during hunts and practice days. We can help you learn how to use them they are really easy to operate";
        var tx2 = "Gunning - Sometimes during hunt tests we use live flyers and need volunteers to shoot the birds. (You must have a hunters safety course to volunteer)";
        var tx3 = "Marshaling - Very fun and easy way to get involved. This role during hunts is responsible for keeping track of the running order and making sure handlers (dog owners) are ready to test their dog";
        var tx4 = "Raffle Donations - We are always in need of donation items for the club to raise money. If you have connections or not afraid to ask people for support this is a great way to get involved";
        var tx5 = "Club Demonstration - Great opportunity to help draw more interests and members to the club we have some ideas and need to know who might be interested in helping.";
        var tx6 = "Promotional Events - Are you willing to help man a booth and talk to people about HRC and joining the club check this box. Again we are looking for people with an interest to call upon in the future.";
        var tx7 = "Cook / Passing Out Food - Have a special dish, like to cook for people or want to help with passing out food at events.";
        var tx8 = "General Worker Bee - Can range from helping with set up / tear down during hunts or practice, as a runner or greeter at hunts, coordinating the raffle, or any other opportunities that might be needed.";


        var t = [1, 2, 3, 4, 5, 6, 7, 8];
        var tx = [tx1, tx2, tx3, tx4, tx5, tx6, tx7, tx8];


        for (i = 0; i < 8; i++) {

            t[i] = div.appendChild(document.createElement('h2'));
            t[i].appendChild(document.createTextNode(tx[i]));


        }



    }

    else if (e == 'involve') {
        div.appendChild(document.createTextNode('Explanation of Terms'));

        var tx1 = "Club Officer - Help shape the direction and future of the club. Positions include President, VP, Secretary, Treasurer";
        var tx2 = "Board Member - At larger members are anothe way to help shape the direction of the club.";
        var tx3 = "Hunt Test Committee - These individual help to ensure the Hunts are being run in accordance with HRC rules and help the judges when needed.";
        var tx4 = "Other Committees - There are a variety of committees where we need help.";
        var tx5 = "Hunt Test Judge - We are always in need of more Judges if you're interested in getting involved check the box.";

        var t = [1, 2, 3, 4, 5];
        var tx = [tx1, tx2, tx3, tx4, tx5];


        for (i = 0; i < 5; i++) {

            t[i] = div.appendChild(document.createElement('h2'));
            t[i].appendChild(document.createTextNode(tx[i]));


        }


    }

    else if (e == 'dogs') {
    div.appendChild(document.createTextNode('UKC number is not required'));
    posy += 100;
    }
 
   document.getElementById('main').appendChild(div);

     
    div.style.top=posy-100+'px';
    div.style.left = posx + 15 + 'px';
  

  }


function hidePopupDiv(){
var div=document.getElementById('popup');
if(!div){return};
div.parentNode.removeChild(div);


}



window.onload = function() {
    if (document.getElementById && document.createElement && document.createAttribute.TextNode) {
        var div = document.getElementById('container');
        if (!div) { return };
        div.onmousemove = displayPopupDiv;
        div.onmouseout = hidePopupDiv;
    }
}