function change_class(id, newClass) 
	{
	identity=document.getElementById(id);
	identity.className=newClass;
	}

function swap_class(id, Class1, Class2) 
	{
	identity=document.getElementById(id);
	
	if ( identity.className==Class1 ) 
		{
		identity.className=Class2;
		}
	else 
		{
		identity.className=Class1;
		}
	}

function empty_contents(id)
	{
	identity = document.getElementById(id);
	
	identity.innerHTML= "";
	}

function update_contents(id, contents)
	{
	identity = document.getElementById(id);
	
	identity.innerHTML= contents;
	}

function do_loading(id)
	{
	identity = document.getElementById(id);
	
	identity.innerHTML= "<img src='/images/loading.gif' align='absmiddle'> Loading...";
	}

function swap_contents(id, Contents1, Contents2) 
	{
	identity=document.getElementById(id);
	
	if ( identity.innerHTML==Contents1 ) 
		{
		identity.innerHTML=Contents2;
		}
	else 
		{
		identity.innerHTML=Contents1;
		}
	}

function toggle_disabled(id) 
	{
	identity=document.getElementById(id);

	if ( identity.disabled == true ) 
		{
		identity.disabled = false;
		}
	else 
		{
		identity.disabled = true;
		}
	}

function getHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
//  window.alert( 'Width = ' + myWidth );
//  window.alert( 'Height = ' + myHeight );

  return myHeight - 130;	
}

	
function jahs(target,url) {
    // native XMLHttpRequest object
//    document.getElementById(target).innerHTML = 'sending...';
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = function() {jahsDone(target);};
        req.open("GET", url, true);
        req.send(null);
    // IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = function() {jahsDone(target);};
            req.open("GET", url, true);
            req.send();
        }
    }
}    

function jahsDone(target) {
    // only if req is "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            results = req.responseText;
            document.getElementById(target).innerHTML = results;
        } else {
            document.getElementById(target).innerHTML="jah error:\n" +
                req.statusText;
        }
    }
}
