function pausecomp(millis){//sets delay for the button up sound to play --- found at www.sean.co.uk
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < millis);
} 

function div(id){
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( id );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[id];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[id];
	
	return elem;
}

function resizeDiv(div,other){
  if( document.getElementById ) // this is the way the standards work
    resize = document.getElementById( div );
  else if( document.all ) // this is the way old msie versions work
      resize = document.all[div];
  else if( document.layers ) // this is the way nn4 works
    resize = document.layers[div];

  if( document.getElementById ) // this is the way the standards work
    change = document.getElementById( other );
  else if( document.all ) // this is the way old msie versions work
      change = document.all[other];
  else if( document.layers ) // this is the way nn4 works
    change = document.layers[other];
	
	resize.style.height=change.style.height;
}

function toggleLayer( whichLayer ){
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function toggleVisibility( whichLayer ){
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.visibility==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.visibility = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'visible':'hidden';
  vis.visibility = (vis.visibility==''||vis.visibility=='visible')?'hidden':'visible';
}

function hideVisibility( whichLayer ){
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  vis.visibility='hidden';
}

function showVisibility( whichLayer ){
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  vis.visibility='visible';
}

function hideLayer(layer) {
   if (document.getElementById) { // DOM3 = IE5, NS6
      document.getElementById(layer).style.display = 'none';
   }
   else if (document.layers) { // Netscape 4
      document.layer.display = 'none';
   }
   else { // IE 4
      document.all.layer.style.display = 'none';
   }
}

function showLayer(layer) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(layer).style.display = 'block';
	}
	else if (document.layers) { // Netscape 4
		document.layer.display = 'block';
	}
	else { // IE 4
		document.all.layer.style.display = 'block';
	}
} 

function toggleWidth(theID,returnWidth){
	if(document.getElementById) // this is the way the standards work
	elem = document.getElementById(theID);
	else if(document.all) // this is the way old msie versions work
	  elem = document.all[theID];
	else if(document.layers) // this is the way nn4 works
	elem = document.layers[theID];
	object = elem.style;
	if(object==0){
		object.width=returnWidth;
	}
	else{
		object.width='0px';
	}
}

function changeHeight(theID,returnHeight){
	if(document.getElementById) // this is the way the standards work
	elem = document.getElementById(theID);
	else if(document.all) // this is the way old msie versions work
	  elem = document.all[theID];
	else if(document.layers) // this is the way nn4 works
	elem = document.layers[theID];
	elem.height=returnHeight;
}

function adjustIFrameSize (iframeWindow) {
    var iframeElement = document.getElementById(iframeWindow);
    iframeElement.style.height = iframeWindow.document.height + 'px';
  //  iframeElement.style.width = iframeWindow.document.width + 'px';
}
function changeClass(wrap,change){
	if( document.getElementById ){ // this is the way the standards work
		wrapper = document.getElementById( wrap );
	}
	else if( document.all ){ // this is the way old msie versions work
		wrapper = document.all[wrap];
	}
	else if( document.layers ){ // this is the way nn4 works
		wrapper = document.layers[wrap];
	}
	wrapper.className=change;

}
function resizeWindow(id,div){
	if( document.getElementById ){ // this is the way the standards work
		frame = document.getElementById( id );
		container = document.getElementById( div );
	}
	else if( document.all ){ // this is the way old msie versions work
		frame = document.all[id];
		container = document.all[div];
	}
	else if( document.layers ){ // this is the way nn4 works
		frame = document.layers[id];
		container = document.layers[div];
	}
	
	
	w=frame.width;
	h=frame.height;
	container.style.marginLeft= "-" + parseInt(w / 2) + "px";
	container.style.marginTop= "-" + parseInt(h / 2) + "px";
}


function LaunchWindow(url, id, w, h,scrolling){
  if( document.getElementById ) // this is the way the standards work
    frame = document.getElementById( id );
  else if( document.all ) // this is the way old msie versions work
      frame = document.all[id];
  else if( document.layers ) // this is the way nn4 works
    frame = document.layers[id];

	if(!scrolling){
		scrolling=0;
	}
	frame.src=url;
	frame.width=w;
	frame.height=h;

}



/*function LaunchWindow(url, name, w, h,scrolling){
	if(!scrolling){
		scrolling=0;
	}
	remotewin = window.open(url, name, 'width='+ w +',height='+ h +',resizable=1,scrollbars='+ scrolling +',top=200,left=200');
	if (remotewin != null){
		if (remotewin.opener == null) {
			remotewin.opener = self;
		}
	}
}
*/
