

/**
 * Print Icon Code Below
 */

function rollover(e, newsrc){
	//show the rollover
	this.src = newsrc;
}

SIDJA.util.Event.addListener("print_specs", "mouseover", rollover, "images/icon_print_specs_roll.gif");
SIDJA.util.Event.addListener("print_specs", "mouseout", rollover, "images/icon_print_specs.gif");






/**
 * Menu Code Below
 */

var wasselected;
var selectednum = 0;
var isshown = false;
//var ids = ''; // this will be the id of the setTimeout




// prototype
function menu(){
	this.ids = []
}
mymenu = new menu();


// each item in the submenu adds 20px to the height (would be 10px for firefox only...ie requires 20px)
// height should not be set in the code like it is below

function showmenu(parentmenuid, submenuid){

	//alert (mymenu.ids[parentmenuid]);
	window.clearTimeout(mymenu.ids[parentmenuid]);
	
	if (isshown == true){
		//leave it shown
		SIDJA.util.Dom.setStyle(submenuid, 'visibility', 'visible');
	}
	else{
		// need to figure out if the parent was selected only the first time we look at it 
		// (otherwise, when we change it, it won't reflect it's original state 
		if (selectednum < 1){
			
			if (SIDJA.util.Dom.hasClass(parentmenuid, 'menutextselected')){
				wasselected = true;
			}
			else {
				wasselected = false;
			}
			
		}
		selectednum++;
		
		// animate it out here
		SIDJA.util.Dom.setStyle(submenuid, 'height', '0');
		SIDJA.util.Dom.setStyle(submenuid, 'top', '18'); // initial top
		SIDJA.util.Dom.setStyle(submenuid, 'opacity', '0.0'); 
		SIDJA.util.Dom.setStyle(submenuid, 'visibility', 'visible');
		AnimatedMenu = new SIDJA.util.Anim(submenuid, {
			top:{to: 39},
			opacity:{to: .95},
			height:{to: 95}
			}, .3, SIDJA.util.Easing.easeOut);
					
		AnimatedMenu.animate();
		
		SIDJA.util.Dom.replaceClass(parentmenuid, 'menutext', 'menutextselected');
		
		// set isshown
		isshown = true;
	}
}




// setup the delay with a new hideaction object
function hidemenu(parentmenuid, submenuid){
	// instantiate the hide object, and assign some properties
	hider = new hideaction();
	hider.parent = parentmenuid;
	hider.sub = submenuid;
	
	window.clearTimeout(mymenu.ids[parentmenuid]); //no browsers but IE need this...why?
	mymenu.ids[parentmenuid] = window.setTimeout( "hider.hide()", 250 );
	
}




// actually does the hiding
function hideaction(parentmenuid, submenuid){

	this.parent = parentmenuid;
	this.sub = submenuid;
	this.hide = function(){
		
			
			AnimatedMenuHide = new SIDJA.util.Anim(this.sub, {
				top:{to: 35},
				opacity:{to: 0.0},
				height:{to: 0}
				}, .3, SIDJA.util.Easing.easeOut);
					
				AnimatedMenuHide.animate();
			
			
			// The following has to be done for firefox as well as for IE6, 
			// else when you roll over where the menu was, it will reappear
			//
			// the onComplete as well as onSlideEnd methods weren't working here, so we'll 
			// add a setTimeout that lasts just a bit longer than the ani
			SIDJA.util.Dom.setStyle(this.sub, 'visibility', 'hidden');
			
			 
			
				
			if (wasselected == true){
				// do nothing
			}
			else{
				SIDJA.util.Dom.replaceClass(this.parent, 'menutextselected', 'menutext');
			}
			
			
			//reset isshown
			isshown = false;
			
		}
}



