﻿// JScript File

//Function that returns the swf file to play
function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}


Array.prototype.moveElement = function(index, delta) {

  // This method moves an element within the array
  // index = the array item you want to move
  // delta = the direction and number of spaces to move the item.
  //
  // For example:
  // move_element(myarray, 5, -1); // move up one space
  // move_element(myarray, 2, 1); // move down one space
  //
  // Returns true for success, false for error.

  var index2, temp_item;

  // Make sure the index is within the array bounds
  if (index < 0 || index >= this.length) {
    return false;
  }

  // Make sure the target index is within the array bounds
  index2 = index + delta;
  if (index2 < 0 || index2 >= this.length || index2 == index) {
    return false;
  }

  // Move the elements in the array
  temp_item = this[index2];
  this[index2] = this[index];
  this[index] = temp_item;

  return true;
}

/*
*******************************************************************************
	ContextMenu
	Initialize Context Menu
	
	el =>					id of element to be used as the menu.
				
	triggerEl =>  String / Element / Array representing the trigger
								elements(s) for the menu.
								
*******************************************************************************
*/
PersistentToolTip = function(el, triggerEl) {

	this.element = el;
	this.menu = null;
	this.triggers = triggerEl;
	
	this.show = function(e) {
		var trigger = YAHOO.util.Event.getTarget(e);
		var triggerRegion = YAHOO.util.Dom.getRegion(trigger);
		// NOTE: Here, "this" refers to the yahoo Menu object
		this.menu.cfg.setProperty("xy", [triggerRegion.right - 20, triggerRegion.top + 3]);
		this.menu.show();
	}
	
	YAHOO.util.Event.onContentReady(el, function () {
		this.menu = new YAHOO.widget.Menu(this.element, { position: "dynamic", constraintoviewport: false, hidedelay:1000 });
		this.menu.render();
		YAHOO.util.Event.addListener(this.triggers, "mouseover", this.show, this, true);
	}, this, true);

}

function ToggleContact()
{
    var ctl = document.getElementById('contactLayer');
    
    if(ctl.style.display == 'none')
        ctl.style.display = 'block';
    else
        ctl.style.display = 'none';
}

