function swapDisplay(name) {
	if(window.opera) return;
	if(document.getElementById)
				element=document.getElementById(name);
	else if(document.all)
				element=document.all[name];
	element.style.display = (element.style.display == "none") ? "" : "none";
}

function showDisplay(name) {
	if(window.opera) return;
	if(document.getElementById)
				element=document.getElementById(name);
	else if(document.all)
				element=document.all[name];
	element.style.display = "";	
}

function hideDisplay(name) {
	if(window.opera) return;
	if(document.getElementById)
				element=document.getElementById(name);
	else if(document.all)
				element=document.all[name];
	element.style.display = "none";	
}

function swapExpandArrow(name) 
{
	if(window.opera) return;
	if(document.getElementById)
				element=document.getElementById(name);
	else if(document.all)
				element=document.all[name];
	element.className = (element.className == "expand_arrow_up") ? "expand_arrow_down" : "expand_arrow_up";

}

function hideVisible(name) {
	if(window.opera) return;
	if(document.getElementById)
				element=document.getElementById(name);
	else if(document.all)
				element=document.all[name];
	element.style.visibility = "hidden";
}

function showVisible(name) {
	if(window.opera) return;
	if(document.getElementById)
				element=document.getElementById(name);
	else if(document.all)
				element=document.all[name];
	element.style.visibility  = "visible";
}

function genpwd() {
  var str = new String();
  str = "";
  ch = new Array();

  for( i = 0; i < 33; i++ )
    ch[ ch.length ] = 0;
  for( ; i < 48; i++ )
    ch[ ch.length ] = ( false ) ? 1 : 0;
  for( ; i < 58; i++ )
    ch[ ch.length ] = ( true ) ? 1 : 0;
  for( ; i < 65; i++ )
    ch[ ch.length ] = ( false ) ? 1 : 0;
  for( ; i < 91; i++ )
    ch[ ch.length ] = ( true ) ? 1 : 0;
  for( ; i < 97; i++ )
    ch[ ch.length ] = ( false ) ? 1 : 0;
  for( ; i < 123; i++ )
    ch[ ch.length ] = ( true ) ? 1 : 0;
  for( ; i < 127; i++ )
    ch[ ch.length ] = ( false ) ? 1 : 0;
  ch[ ch.length ] = 0;

	value = 8;

  count = 0;
  do
  {
    x = Math.floor( Math.random() * 128 );
    if( ch[ x ] == 1 )
      str += String.fromCharCode( x );
    count++;
  } while ( str.length < value && count < 1024 );
  if( count == 1024 )
    alert( "Random selections exceeded safety limit.\n Try again or use larger selection set." );
  document.forms.user.password.value = str;
}

function setSortDir(dir){
	document.forms.filter.sort_dir.value = dir;
	document.forms.filter.submit();
}

function clearSearch(){
	document.forms.filter.search.value = '';
	hideVisible('clear_search');
	document.forms.filter.submit();
}

function doAction(action,id){
	document.forms.applicants.action.value = action;
	document.forms.applicants.id.value = id;
	document.forms.applicants.submit();
}

function doRating(rating,id){
	document.forms.applicants.action.value = 'rating';
	document.forms.applicants.rating.value = rating;
	document.forms.applicants.id.value = id;
	document.forms.applicants.submit();
}

function submitExam(){
	document.forms.exam.timeout.value = 'finish';
	document.forms.exam.submit();
}

function clearSearchShow() {
	if(document.forms.filter.search.value != '') 
		showVisible('clear_search');
	else
		hideVisible('clear_search');
}
