﻿String.prototype.after = function(delimiter, defaultValue) {
  var i = this.indexOf(delimiter);
  if (i == -1) return typeof defaultValue == "undefined" ? this : defaultValue;
  return this.substring(i + delimiter.length);
};
String.prototype.before = function(delimiter,defaultValue) {
  var i = this.indexOf(delimiter);
  if (i == -1) return typeof defaultValue == "undefined" ? this : defaultValue;
  return this.substring(0,i);
};

/*
var CTX = location.href.after("//").after("/").before("/") == "morweb4e" ? "/morweb4e" : "";
function morMenu() {
stm_bm(["menu4503",840,"","blank.gif",0,"","",0,0,250,0,1000,1,0,0,"","",0,0,1,2,"default","hand",""],this);
stm_bp("p0",[0,4,0,0,10,10,0,0,100,"",-2,"",-2,50,0,0,"#999999","transparent","",3,0,0,"#000000"]);
stm_ai("p0i0",[0,"HOME","","",-1,-1,0,CTX+"/index.html","_self","","MoreMotion Home Page","","",0,0,0,"","",0,0,0,0,1,"white",1,"gray",0,"","",3,3,0,0,"white","#000000","#FFFFFF","#FFFFFF","8pt 'Tahoma','Arial','Verdana'","8pt 'Tahoma','Arial','Verdana'",0,0]);
stm_aix("p0i1","p0i0",[0,"PRODUCTS","","",-1,-1,0,"","_self","",""]);
stm_bp("p1",[1,4,0,0,0,8,0,0,100,"",-2,"",-2,50,0,0,"#999999","gray","",3,0,0,"#FFFFFF black black"]);
stm_aix("p1i0","p0i0",[0,"Application Studio","","",-1,-1,0,CTX+"/mmas/index.html","_self","","MoreMotion Application Studio","","",0,0,0,"","",0,0,0,0,1,"#000000",1,"#424242",0,"","",3,3,0,0,"black","#000000"],170,0);
stm_aix("p1i1","p1i0",[0,"Downloads","","",-1,-1,0,CTX+"/resources/downloads.html","_self","","Downloads"],170,0);
stm_ep();
stm_aix("p0i2","p0i1",[0,"RESOURCES"]);
stm_bpx("p2","p1",[]);
stm_aix("p2i0","p1i0",[0,"FAQ","","",-1,-1,0,CTX+"/resources/faq.html","_self","","FAQ"],170,0);
stm_aix("p2i1","p1i0",[0,"Screencasts","","",-1,-1,0,CTX+"/resources/videos.html","_self","","Screencasts"],170,0);
stm_aix("p2i2","p1i0",[0,"Online Help Files","","",-1,-1,0,CTX+"/mmas/onlinehelp.html","_self","","Online Help Files"],170,0);
stm_aix("p2i3","p1i0",[0,"Forum","","",-1,-1,0,CTX+"/display.doms?pg=forum/index","_self","","Forum"],170,0);
stm_ep();
stm_aix("p0i3","p0i1",[0,"SUPPORT AND SERVICES"]);
stm_bpx("p3","p1",[]);
stm_aix("p3i0","p1i0",[0,"Technical Support","","",-1,-1,0,CTX+"/support/","_self","","Technical Support"],170,0);
stm_aix("p3i1","p1i0",[0,"Consultancy","","",-1,-1,0,CTX+"/services/consulting.html","_self","","Consultancy"],170,0);
stm_aix("p3i2","p1i0",[0,"Training","","",-1,-1,0,CTX+"/services/training.html","_self","","Training"],170,0);
stm_ep();
stm_aix("p0i4","p0i1",[0,"BUY","","",-1,-1,0,CTX+"/order/index.html"]);
stm_aix("p0i5","p0i1",[0,"COMPANY"]);
stm_bpx("p4","p1",[]);
stm_aix("p4i0","p1i0",[0,"About Us","","",-1,-1,0,CTX+"/company/about.html","_self","","About Us"],170,0);
stm_aix("p4i1","p1i0",[0,"Contact","","",-1,-1,0,CTX+"/company/contact.html","_self","","Contact"],170,0);
stm_ep();
stm_em();
};

*/

function Download() {
  document.location.href = CTX + '/resources/downloads.html';
}

function _attachEvent(node,name,func) {
  if (window.addEventListener) {
    node.addEventListener(name, func, false);
  } else {
    node.attachEvent('on'+name, func);
  }
}

function initButton(id) {
  var node = document.getElementById(id);
  node.style.cursor = 'pointer';
  node.nimg_src = node.src;
  node.himg = new Image();
  var s = node.src.before("_n.jpg",null);
  node.himg.src = s == null ? node.src : s + "_h.jpg";
  _attachEvent(node,'mouseover',function(){node.src = node.himg.src});
  _attachEvent(node,'mouseout',function(){node.src = node.nimg_src});
}

function OnLoad() {
  initButton('home');
  initButton('pinfo');
  initButton('videos');
  initButton('download');
  initButton('support');
  initButton('order');
  initButton('company');
}




