
var currURL = location.pathname;
var rootImgURL = "img_/tmr/";

function opt(str) {document.write(str);}
function vSpace(howHigh) {opt('<div><img src="' + rootImgURL + 'sp.gif" width=1 height='+ howHigh +' border=0 alt=""></div>');}
function hSpace(howWide) {opt('<img src="' + rootImgURL + 'sp.gif" width='+ howWide +' height=1 border=0 alt=""><br>');}

function closeWin(winRef) {
  if (winRef)
    if (!winRef.closed) winRef.close();
  return null;
}

/* Swap image with another */
function swapImg(imgName, imgSrc) {
  if (typeof document[imgName] != 'undefined') document[imgName].src = imgSrc;
}


var agt = navigator.userAgent.toLowerCase();
/* SuQ: HACK! check for something after ) in navigator.agent string; real IE has nothing after ) */
is_major = parseInt(navigator.appVersion);
is_minor = parseFloat(navigator.appVersion);
is_ie  = ((agt.indexOf("msie") != -1) && (agt.lastIndexOf(")") == agt.length-1) || ((typeof window.opera != "undefined") && window.opera ));
is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
/* is_major borken in IE versions > 4 */
is_ie5up = (is_ie && (is_major == 4) && (agt.indexOf("msie 4.0")==-1) );
/* is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1)); */
is_nav = (navigator.appName.indexOf("Netscape") != -1);

/*** PLATFORM ***/
is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
is_mac = (agt.indexOf("mac")!=-1);
is_nav4 = (is_nav && is_major == 4);
is_nav6 = (is_nav && (is_major > 4));
is_safari = agt.indexOf("safari") != -1;

function handleResize() { document.location.reload(false); }

if (is_nav4 && (is_minor > 4.08 )) {
  window.captureEvents(Event.RESIZE);
  window.onResize = handleResize;
}

/* function that opens a popup window */
var popup=null;
function openPopup(url) {
  closeWin(popup);
  popup = window.open(url,"pop_win","height=400,width=550,location=no,menubars=no,scrollbars=yes,toolbars=no,resizable=yes");
}

function openPopupToSize(url, width, height) {
  closeWin(popup);
  popup = window.open(url,"pop_win","height="+height+",width="+width+",location=no,menubars=no,scrollbars=yes,toolbars=no,resizable=yes");
}


/* Keyboard Short Cut Event handeler */
function showKey(evt) {
  var theKey
  if (is_nav4) {
    theKey = evt.which;
  }
  else if (is_ie) { // not for nav6
    theKey = window.event.keyCode;
    keyStroke(theKey);
  }
  return false;
}

function nn4KP() {
  if (is_nav4) {
    document.captureEvents(Event.KEYPRESS);
    document.onKeyPress = showKey;
  }
}

// returns true for the following browsers:  NS7+, IE6, 'gecko' browsers, Opera 7)
function canJSBookmark() {
    if (window.external && ( navigator.platform == 'Win32' || ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
        return true;
    } else {
        return false;
    }
}

function optBookmark(img, label) {
    if (canJSBookmark()) {
        opt('<a href="" onclick="bookmark(');
        opt(')" ');

        if (window.opera && window.print) {
            opt('rel="sidebar" ');
        }

        opt('/>');

        if (typeof label != "undefined" && label != null && (typeof img == "undefined" || img == null)) {
            opt(label);
        } else if (typeof img != "undefined" && img != null) {
            opt('<img src="');
            opt(img);
            opt('"/>');
        } else {
            opt('Bookmark');
        }

        opt('</a>');
    }
}

function bookmark(url, title) {
    if (typeof url == "undefined" || url == null) {
        url = location.href;
    }

    if (typeof title == "undefined" || title == null) {
        if (document.title) {
            title = document.title;
        } else {
            title = "";
        }
    }

    if( window.sidebar && window.sidebar.addPanel ) {
        //Gecko (Netscape 6 etc.) - add to Sidebar
        window.sidebar.addPanel(title, url, "");
    } else if( window.external && ( navigator.platform == 'Win32' ||
          ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
        //IE Win32 or iCab
        window.external.AddFavorite( url, title );
    } else if( window.opera && window.print ) {
        //Opera 6+ - add as sidebar panel to Hotlist.
        return true;
    } else if( document.layers ) {
        //NS4 & Escape - tell them how to add a bookmark quickly (adds current page, not target page)
        //window.alert( 'Please click OK then press Ctrl+D to create a bookmark' );
    } else {
        //other browsers - tell them to add a bookmark (adds current page, not target page)
        //window.alert( 'Please use your browser\'s bookmarking facility to create a bookmark' );
    }
}

/**************************************************
 * dom-drag.js
 * 09.25.2001
 * www.youngpup.net
 **************************************************
 * 10.28.2001 - fixed minor bug where events
 * sometimes fired off the handle, not the root.
 **************************************************/

var Drag = {

  obj : null,

  init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
  {
    o.onmousedown  = Drag.start;

    o.hmode      = bSwapHorzRef ? false : true ;
    o.vmode      = bSwapVertRef ? false : true ;

    o.root = oRoot && oRoot != null ? oRoot : o ;

    if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
    if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
    if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
    if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

    o.minX  = typeof minX != 'undefined' ? minX : null;
    o.minY  = typeof minY != 'undefined' ? minY : null;
    o.maxX  = typeof maxX != 'undefined' ? maxX : null;
    o.maxY  = typeof maxY != 'undefined' ? maxY : null;

    o.xMapper = fXMapper ? fXMapper : null;
    o.yMapper = fYMapper ? fYMapper : null;

    o.root.onDragStart  = new Function();
    o.root.onDragEnd  = new Function();
    o.root.onDrag    = new Function();
  },

  start : function(e)
  {
    var o = Drag.obj = this;
    e = Drag.fixE(e);
    var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
    var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
    o.root.onDragStart(x, y);

    o.lastMouseX  = e.clientX;
    o.lastMouseY  = e.clientY;

    if (o.hmode) {
      if (o.minX != null)  o.minMouseX  = e.clientX - x + o.minX;
      if (o.maxX != null)  o.maxMouseX  = o.minMouseX + o.maxX - o.minX;
    } else {
      if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
      if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
    }

    if (o.vmode) {
      if (o.minY != null)  o.minMouseY  = e.clientY - y + o.minY;
      if (o.maxY != null)  o.maxMouseY  = o.minMouseY + o.maxY - o.minY;
    } else {
      if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
      if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
    }

    document.onmousemove  = Drag.drag;
    document.onmouseup    = Drag.end;

    return false;
  },

  drag : function(e)
  {
    e = Drag.fixE(e);
    var o = Drag.obj;

    var ey  = e.clientY;
    var ex  = e.clientX;
    var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
    var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
    var nx, ny;

    if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
    if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
    if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
    if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

    nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
    ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

    if (o.xMapper)    nx = o.xMapper(y)
    else if (o.yMapper)  ny = o.yMapper(x)

    Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
    Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
    Drag.obj.lastMouseX  = ex;
    Drag.obj.lastMouseY  = ey;

    Drag.obj.root.onDrag(nx, ny);
    return false;
  },

  end : function()
  {
    document.onmousemove = null;
    document.onmouseup   = null;
    Drag.obj.root.onDragEnd(  parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
                  parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
    Drag.obj = null;
  },

  fixE : function(e)
  {
    if (typeof e == 'undefined') e = window.event;
    if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
    if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
    return e;
  }
};

function go(url) { document.location.href = url; }

/* BEGIN Cookie Object */
function Cookie(document, name, hours, path, domain, secure) {
  this.$document = document;
  this.$name = name;
  if (hours)
      this.$expiration = new Date((new Date()).getTime() + hours*3600000);
  else this.$expiration = null;
  if (path) this.$path = path; else this.$path = null;
  if (domain) this.$domain = domain; else this.$domain = null;
  if (secure) this.$secure = true; else this.$secure = false;
}

/* This function is the store() method of the Cookie object */
function _Cookie_store() {
  var cookieval = "";
  for(var prop in this) {
    if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function')) continue;
    if (cookieval != "") cookieval += '&';
    cookieval += prop + ':' + escape(this[prop]);
  }
  var cookie = this.$name + '=' + cookieval;
  if (this.$expiration) cookie += '; expires=' + this.$expiration.toGMTString();
  if (this.$path) cookie += '; path=' + this.$path;
  if (this.$domain) cookie += '; domain=' + this.$domain;
  if (this.$secure) cookie += '; secure';

  /* Now store the cookie by setting the magic Document.cookie property */
  this.$document.cookie = cookie;
}

/* This function is the load() method of the Cookie object */
function _Cookie_load() {
  var allcookies = this.$document.cookie;
  if (allcookies == "") return false;

  var start = allcookies.indexOf(this.$name + '=');
  if (start == -1) return false; /* cookie not defined for this page. */
  start += this.$name.length + 1; /* skip name and equals sign. */
  var end = allcookies.indexOf(';', start);
  if (end == -1) end = allcookies.length;
  var cookieval = allcookies.substring(start, end);

  var a = cookieval.split('&'); /* break it into array of name/value pairs */
  for(var i=0; i < a.length; i++) /* break each pair into an array */
    a[i] = a[i].split(':');

  for(var i = 0; i < a.length; i++) {this[a[i][0]] = unescape(a[i][1])};
  return true;
}

/* This function is the remove() method of the Cookie object. */
function _Cookie_remove() {
  var cookie;
  cookie = this.$name + '=';
  if (this.$path) cookie += '; path=' + this.$path;
  if (this.$domain) cookie += '; domain=' + this.$domain;
  cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT';

  this.$document.cookie = cookie;
}

new Cookie();
Cookie.prototype.store = _Cookie_store;
Cookie.prototype.load = _Cookie_load;
Cookie.prototype.remove = _Cookie_remove;
/* END Cookie Object */


	
function showSurvey() {
	//window.open('survey.aspx', 'Survey','width=550, height=400, menubar=yes, resizable=no')
	location = "survey_page.aspx"
	}