// JavaScript Document
d = window.document;

/*
  vars for bindings page
*/
var bType = 0;
var bColor = 0;

//////////////////////////////////////
//  GENERIC RETURN ELEMENT FUNCTION //
//////////////////////////////////////

function getE( v ) {
  // e is for element!
	d = window.document;  
  if ( d.getElementById ) {
    e = d.getElementById( v );
  }
  else if ( d.all ) {
    e = d.all[ v ];
  }

  return e;
}


function largeImage() {
	bigImage = getE( "bigImage");
	bigImage.style.visibility = "visible";
}

function closeImage () {
	bigImage = getE( "bigImage");
	bigImage.style.visibility = "hidden";
}

function largeImage2() {
	bigImage2 = getE( "bigImage2");
	bigImage2.style.visibility = "visible";
}

function closeImage2 () {
	bigImage2 = getE( "bigImage2");
	bigImage2.style.visibility = "hidden";
}

function commercial() {
	commercialImage = getE( "commercialImage" );
	commercialImage.style.visibility = "visible";
}

function closeCommercial () {
	commercialImage = getE( "commercialImage" );
	commercialImage.style.visibility = "hidden";
}




//////////////////////////////////////
//  FLIP DROPDOWN FOR NEW BINDING   //
//  TYPE.                           //
//////////////////////////////////////

function changeColors( thisType ) {
  bType = thisType;
  e = getE( "bindings" );
  opts = e.colors;
  for ( i=0; i<opts.options.length; i++ ) {
    opts.options[i] = null;
  }
  for ( i=0; i<bTypes[bType].length; i++ ) {
    opts.options[i] = d.createElement( "option" );
    opts.options[i].value = i;
    opts.options[i].text = bTypes[bType][i][0];
  }
  changeBinding( 0 );
}

//////////////////////////////////////
//  FLIP DROPDOWN FOR NEW BINDING   //
//  TYPE.                           //
//////////////////////////////////////

function changeColors2( thisType, thisIndex ) {
  bType = thisType;
  e = getE( "bindings" + thisIndex );
  opts = e.colors;
  for ( i=0; i<opts.options.length; i++ ) {
    opts.options[i] = null;
  }
  for ( i=0; i<bTypes[bType].length; i++ ) {
    opts.options[i] = d.createElement( "option" );
    opts.options[i].value = i;
    opts.options[i].text = bTypes[bType][i][0];
  }
//   changeBinding( 0 );
}

var bTypes = new Array();
var bColor = 0;

//////////////////////////////////////
//  INSERT AN IMAGE INTO THE        //
//  BINDING DIV                     //
//////////////////////////////////////

function changeBinding( thisColor ) {
  bColor = thisColor;
  e = getE( "binding" );
  e.innerHTML = bTypes[bType][bColor][1];
  e = getE( "bindings" );
  e.colors.value = thisColor;
}

//////////////////////////////////////
//  INSERT AN IMAGE INTO THE        //
//  BINDING DIV                     //
//////////////////////////////////////

function changeBinding2( thisType, thisColor, thisIndex ) {
  bColor = thisColor;
  e = getE( "binding" + thisIndex );
  e.innerHTML = bTypes[thisType][bColor][1];
//   e = getE( "bindings" );
//   e.colors.value = thisColor;
}

