// JavaScript Document
function MM_jumpMenu(targ,selObj,restore){

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function showCats( parent_id ) {
	
	
	el = document.getElementById(parent_id);
	
	if(! el ) {
		return false;	
	}
	
	if (! el.childNodes )
		return false;
		
	for(var i=0; i<el.childNodes.length; i++) {
		if ( el.childNodes[i].tagName == "UL" ) {
			
			el.childNodes[i].style.display = "block"
		}
	}
	
	return true;
	
}


function hideCats( parent_id ) {
	el = document.getElementById(parent_id);
	
	
	if(! el ) {
		return false;	
	}
	
	if (! el.childNodes )
		return false;
		
	for(var i=0; i<el.childNodes.length; i++) {
		if ( el.childNodes[i].tagName == "UL" ) {
			el.childNodes[i].style.display = "none"
		}
	}
	
	return true;
	
}


// **** **** **** **** *** **** **** 
// Stuff taken from dave's ajax scrip.js file
// Applies to AJAX pages accross the board
// **** **** **** **** *** **** **** 

function show ( id ) {
	var el = document.getElementById(id);
	if (! el ) {
		return;	
	}
	el.style.display = 'block';
}


function fadeout( id, speed, slide ) {
	
	if (! speed ) {
		speed = 3000;	
	}
	
	
	var el = document.getElementById(id);
	if (! el ) {
		return;	
	}
	
	if ( el.timeouts ) {
		if ( el.timeouts['fadeouts'] && el.timeouts['fadeouts'].length > 0 ) {
			var numTimeouts = el.timeouts['fadeouts'].length;

			for ( var i=0; i < numTimeouts; i++ ) {
				var timeout = el.timeouts['fadeouts'][i];
			}			
		}
		
	}
	
	opacity(id, 100, 0, speed, slide);
}


function opacity(id, opacStart, opacEnd, millisec, slide) { 


    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
	
	
	el = document.getElementById(id);
	if(! el ) {
		return;	
	}
	
	el.style.display = 'block';

	el.timeouts = new Array();
	el.timeouts['fadeouts'] = new Array();

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            el.timeouts['fadeouts'][i] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) { 
            el.timeouts['fadeouts'][i] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    }
	i = el.timeouts['fadeouts'].length;
	
	if ( slide ) {
		el.timeouts['fadeouts'][i] = setTimeout("slide('" + id + "',1000)",(timer * speed)); 
	}
	
	
} 


//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

