

// Cookies
var ajCX = new HTTP.Cookies;

var arrow_switch = null;
var arrow_current = null;

function onload_events( ref ) {
	subnav_current( ref );
}

function subnav_current( ref ) {
	( $('nav_secondary') && $('subnav_' + ref) ) 
		
		&& ( $('nav_secondary').innerHTML = $('subnav_' + ref).innerHTML );
	
	subnav_arrow( ref );
}

function subnav_arrow( ref ){
	
	( arrow_current && ( $('nav_hlight_' + arrow_current) ) )
	
		&& ( $('nav_hlight_' + arrow_current).innerHTML = '<IMG SRC="/resources/pix.gif"/>' );
	
	( $('nav_hlight_' + ref) )
		
		&& ( $('nav_hlight_' + ref).innerHTML = '<IMG SRC="/images/sjc_nav_1_solid_bg.gif"/>' );
	
	arrow_current = ref;
	
}

function subnav_swap( ref, current ) {
	clearTimeout( arrow_switch );
	( $('nav_secondary') && $('subnav_' + ref) ) 
	
		 && ( $('nav_secondary').innerHTML = $('subnav_' + ref).innerHTML );
		 
	if (ref != current) {
		( $('nav_hlight_' + ref) )
			&& ( $('nav_hlight_' + ref).innerHTML = '<IMG SRC="/images/sjc_nav_1_bg.gif"/>' );
	}
}


function subnav_lolight ( ref, current ) {
	clearTimeout( arrow_switch );
	if (ref != current) {
		( $('nav_hlight_' + ref) ) 
			&& ( $('nav_hlight_' + ref).innerHTML = '<IMG SRC="/resources/pix.gif"/>' );
	}
	arrow_switch = setTimeout("subnav_arrow('"+ref+"')",100);
}

function jb_hiLite(oRow){
	oRow.cells[0].style.backgroundColor = '#59588A';
	oRow.cells[1].style.backgroundColor = '#59588A';
	oRow.cells[2].style.backgroundColor = '#59588A';
}
function jb_loLite(oRow){
	oRow.cells[0].style.backgroundColor = '#353A76';
	oRow.cells[1].style.backgroundColor = '#1E2564';
	oRow.cells[2].style.backgroundColor = '#191F5B';
}
function jbQS_hiLite(oRow,hex){
	jbQS_hiliteCache[oRow.id] = oRow.style.backgroundColor
	oRow.style.backgroundColor = '#FCCBAC'; //FCCBAC
}
function jbQS_loLite(oRow,hex){
	oRow.style.backgroundColor = jbQS_hiliteCache[oRow.id]; //'#'+hex; //FEECE0
}
var jbQS_hiliteCache = Object();





function toggleRHP(){
	hideRHP(toolboxes[cToolbox-1]);
	cToolbox = 3-cToolbox;
	showRHP(toolboxes[cToolbox-1]);
	ajCX.write('tb',(cToolbox-1),'+1M','/');
}

function showRHP(n){	
	oBody = $('toolbox_body_'+n);
	oMin  = $('toolbox_min_'+n);
	Element.show(oBody);
	Element.hide(oMin);
}
function hideRHP(n){	
	oBody = $('toolbox_body_'+n);
	oMin  = $('toolbox_min_'+n);
	Element.hide(oBody);
	Element.show(oMin);
}





function tool_search ( sAction ){
	if ( typeof search_query == 'string' ) {
		if ( search_query || ( sAction == 'modify' ) ) {
			var sStem = '';
			switch ( sAction ){
				case "modify" 	: sStem = '/ajax/search?'; break;
				case "save"		: sStem = '/ajax/my/alerts?type=basic&'; break;
				case "email"	: sStem = '/ajax/my/alerts?type=email&'; break;
				case "rss"		: sStem = '/ajax/my/alerts?type=rss&'; break;
			}
			if ( sStem ) {
				sUri = sStem + search_query;
				//saf.navigate( sUri );
				window.open( sUri );
				return true;
			}
		} else {
			alert("You can't save a search for 'everything'.\nPlease be a little more specific");
			return true;
		}
	}
	alert("Sorry, something strange happened and I can't complete your requested action.\nIf symptoms persist please consult support.");
}