var lastmenuclicked
var numofmenuitems

function newLocation(myurl)
{
window.location=myurl
}




function goBack()
  {
  window.history.back()
  }


function loadcontents(myid)
{
	var myobject = top.rightFrame.document.getElementById('text' + (myid))
	top.rightFrame.animatemenu(myid)
	top.mainFrame.document.location.href = myobject.href
}

function showanswer(myid)
{
	var myobject = document.getElementById('myanswer' + myid)
	if(myobject.style.display == 'block'){myobject.style.display = 'none'}else{myobject.style.display = 'block'};
}

function clickmenu(myid, myrefmain, myrefmenu, myrefplayer)
{
	animatemenu(myid)
	if(myrefmain!=''){top.mainFrame.document.location.href = myrefmain}
	if(myrefmenu!=''){top.rightFrame.document.location.href = myrefmenu}
	if(myrefplayer!=''){top.mainFrame.document.location.href = myrefplayer}
	//if(myrefplayer!=''){window.open = myrefplayer}
}

function animatemenu(myid)
{
	if(lastmenuclicked!=myid){
	lastmenuclicked = 0
	for(var a =1;a<=numofmenuitems;a++){
		if(a!=myid){
			animateimages(a, '')
			animatetextcol(a, '')
		}else{
			animateimages(a, '-sel')
			animatetextcol(a, '-sel')
		}
	}
	lastmenuclicked = String(myid)
	displayparents(myid)
	}
}

function displayparents(myid)
{
	myobject = document.getElementById('text' + String(myid))
	while(myobject.parentNode)
		{
			myobject = myobject.parentNode
			if(myobject.className == 'submenu'){myobject.style.display='block'}
		}
}

function clickbutton(myhref)
{
	//window.open( myhref)
	
	//animateimages(myid, '-dwn')
	//animatetextcol(myid, '-dwn')
	window.location.assign(myhref)

	
}


function animatetextcol(myid, mystate)
{
	var myobject
	var myclassname 
	
	myobject = document.getElementById('text' + String(myid))
	myclassname = myobject.className
	myclassname = myclassname.replace("-dwn","")
	myclassname = myclassname.replace("-ovr","")
	myclassname = myclassname.replace("-sel","")
	myobject.className = myclassname + mystate
}

function animateimages(myid, mystate)
{
	var myobject
	var mycollection
	if(lastmenuclicked!=myid){
		myobject = document.getElementById('table' + String(myid))
		mycollection = myobject.getElementsByTagName('TD')
		var myteststr = String(mycollection[0].style.backgroundImage)

		if(myteststr==myteststr.replace("-sel","")){
		changebackgroundimage (mycollection[0], mystate)
		changebackgroundimage (mycollection[1], mystate)
		changebackgroundimage (mycollection[2], mystate)
		animatetextcol(myid, mystate)
		}
	}
}

function animateme(e, mystate)
{
	var targ
	if (!e) var e = window.event
	if (e.target) targ = e.target
	else if (e.srcElement) targ = e.srcElement
	if (targ.nodeType == 3) // defeat Safari bug
   targ = targ.parentNode
   changebackgroundimage (targ, mystate)
}

function changebackgroundimage(myobject, mystate)
{
	var myimgsrc
	myimgsrc = String(myobject.style.backgroundImage)
	
	myimgsrc = myimgsrc.replace("-dwn","")
	myimgsrc = myimgsrc.replace("-ovr","")
	myimgsrc = myimgsrc.replace("-sel","")
	
	myimgsrc = myimgsrc.replace(".gif", mystate + ".gif")
	myimgsrc = myimgsrc.replace(".png", mystate + ".png")
	myobject.style.backgroundImage = myimgsrc
	
}


function checkfaq(e)
{
	var targ
	if (!e) var e = window.event
	if (e.target) targ = e.target
	else if (e.srcElement) targ = e.srcElement
	if (targ.nodeType == 2) // defeat Safari bug
   	targ = targ.parentNode
   switch(targ.value)
   {
   case "Nord Stage 88":
	myfaqref = ""
	mymanref = "../manuals/index.asp#ns"
   break
   case "Nord Stage 76":
   myfaqref = ""
	mymanref = "../manuals/index.asp#ns"
   break
   case "Nord Stage Compact":
   myfaqref = ""
	mymanref = "../manuals/index.asp#ns"
   break
   case "Nord Lead":
   myfaqref = "../faq/nordlead.asp"
	mymanref = "../manuals/index.asp#nl"
   break
   case "Nord Rack":
   myfaqref = "../faq/nordlead.asp"
	mymanref = "../manuals/index.asp#nl"
   break
   case "Nord Lead 2":
   myfaqref = "../faq/nordlead.asp"
	mymanref = "../manuals/index.asp#nl2"
   break
   case "Nord Rack 2":
   myfaqref = "../faq/nordlead.asp"
	mymanref = "../manuals/index.asp#nl2"
   break
   case "Nord Lead 2X":
   myfaqref = "../faq/nordlead.asp"
	mymanref = "../manuals/index.asp#nl2x"
   break
   case "Nord Rack 2X":
   myfaqref = "../faq/nordlead.asp"
	mymanref = "../manuals/index.asp#nl2x"
   break
   case "Nord Lead 3":
   myfaqref = "../faq/nordlead3.asp"
	mymanref = "../manuals/index.asp#nl3"
   break
   case "Nord Rack 3":
   myfaqref = "../faq/nordlead3.asp"
	mymanref = "../manuals/index.asp#nl3"
   break
   case "Nord Modular Key":
   myfaqref = "../faq/micro.asp"
	mymanref = "../manuals/index.asp#nm"
   break
   case "Nord Modular Rack":
   myfaqref = "../faq/micro.asp"
	mymanref = "../manuals/index.asp#nm"
   break
   case "Nord Micro Modular":
   myfaqref = "../faq/micro.asp"
	mymanref = "../manuals/index.asp#nm"
   break
   case "Nord Modular G2X":
   myfaqref = "../faq/modular.asp"
	mymanref = "../manuals/index.asp#nmg2"
   break
   case "Nord Modular G2":
   myfaqref = "../faq/modular.asp"
	mymanref = "../manuals/index.asp#nmg2"
   break
   case "Nord Modular G2 Engine":
   myfaqref = "../faq/modular.asp"
	mymanref = "../manuals/index.asp#nmg2"
   break
   case "Nord Electro/Nord Electro 2":
	mymanref = "../manuals/index.asp#ne"
	myfaqref = "../faq/electro.asp"
   break
   case "Nord Electro Rack 2":
   myfaqref = "../faq/electro.asp"
   mymanref = "../manuals/index.asp#ne"
   break
 default:
	myfaqref = "_blank"
	mymanref == "_blank"
   }
   //alert(myfaqref)
  if(myfaqref!=''){ faqframe.document.location.href = myfaqref};
  // if(mymanref!=''){ manframe.document.location.href = mymanref};
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}