// Google Analytics
// Depends on http://www.google-analytics.com/urchin.js
//
function googleAnalytics() {
  _uacct = "UA-453858-3";
  urchinTracker();  
}
////////////////////////////
///// TAKEN FROM ORIG //////
//
// Popop window functions
//
function popup(url, windowname, properties) {
  if (!window.focus) {
    return true;
  }
  var href;
  if (typeof(url) == 'string') {
    href = url;
  }
  else {
    href = url.href;
  }
  window.open(href, windowname, properties).focus();
  return false;
}

//
// Pops up the sign up dialog in a new window
//
function signUp() {
  var x = 0;
  var y = 0;
  if (window.screenTop) {
    x = window.screenLeft;
    y = window.screenTop;
  }
  else if (window.screenX) {
    x = window.screenX;
    y = window.screenY;
  }
  x += 125;
  y += 50;
  return popup('/signup.php', 'signup', 'width=800,height=680,left='+x+',screenX='+x+',top='+y+',screenY='+y+',location=0,menubar=0,toolbar=0,resizable=0');
}

// Popup for Demo
var newwindow;
function popup2(url)
{
	newwindow=window.open(url,'name','height=444,width=620');
	if (window.focus) {newwindow.focus()}
}
/// EOF TAKEN FROM ORIG ////
////////////////////////////

/////////////////////
 /// ROLLOVER CODE ///
/////////////////////

function isDefined(property) {
  return (typeof property != 'undefined');
}
if (!activeLink){
	var activeLink = '';
}
var rolloverInitialized = false;
function rolloverInit() {

   if (!rolloverInitialized && isDefined(document.images)) {
	// get all images (not including <input type="image">s)
      var images = new Array();
      if (isDefined(document.getElementsByTagName)) {
         images = document.getElementsByTagName('img');
         /*var inputs = document.getElementsByTagName('input');
         for (var i = 0; i < inputs.length; i++) {
            if (inputs[i].type == 'image') {
               images[images.length] = inputs[i];
            }
         }*/
      } else { //ie4, opera4,5
         images = document.images;
         /*inputs = new Array();
         for (var formIndex = 0; formIndex < document.forms.length; formIndex++) {
            for (var elementIndex = 0; elementIndex < document.forms.elements.length; elementIndex++) {
               if (isDefined(document.forms.elements[i].src)) {
                  inputs[inputs.length] = document.forms.elements[i];
               }
            }
         }*/
      }
      
      // get all images with '_off.' in src value excepting the one that is for the BODY
	
      for (var i = 0; i < images.length; i++) {
         if (images[i].src.indexOf('_off.') != -1) {

            //check for active link
		   if (images[i].id == activeLink)
               images[i].src = images[i].src.replace(/_off\./, '_over.');
            else {

            var image = images[i];
            
            // store the off state filename in a property of the image object
            image.offImage = new Image();
            image.offImage.src = image.src;
            
            // store the on state filename in a property of the image object
            // (also preloads the on state image)
            image.onImage = new Image();
            image.onImage.imageElement = image;
            
            // add onmouseover and onmouseout event handlers once the on state image has loaded
            // Safari's onload is quirky for off-screen images; temporary fix
            if (navigator.userAgent.toLowerCase().indexOf('safari') != - 1) {
               image.onmouseover = function() {
                  this.src = this.onImage.src;
               };
               image.onmouseout = function() {
                  this.src = this.offImage.src;
               };
            }
            else {
               image.onImage.onload = function() {
                  this.imageElement.onmouseover = function() {
                     this.src = this.onImage.src;
                  };
                  this.imageElement.onmouseout = function() {
                     this.src = this.offImage.src;
                  };
               };
            }
            
            // set src of on state image after defining onload event handler
            // so cached images (that load instantly in IE) will trigger onload
            image.onImage.src = image.src.replace(/_off\./, '_over.');

           }
         }
      }
   }
   rolloverInitialized = true;
}

  //////////////////////////////////////////////////////
 /// INITIALIZE LAYER AND ROLLOVER FUNCTIONS ONLOAD ///
//////////////////////////////////////////////////////
function globalOnLoad() {
  // googleAnalytics();
  rolloverInit();
}

/*window.onload = function() {
	rolloverInit();
 }*/
