// JavaScript Document
// UPDATED 11/2/07 Thor Ringler

/******* SHOW or HIDE CONTENT contained in a DIV ********/
// TOGGLE a DIV (from CLOSED to OPEN or OPEN to CLOSED)
function toggle_content() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.display = ($(arguments[i]).style.display != 'none' ? 'none' : '' );
	}
}
// OPEN a DIV
function open_content() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.display = '' ;
	}
}
// CLOSE a DIV
function close_content() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.display = 'none';
	}
}

/******* EXPANDO MENUS in Product Pages ********/
// TOGGLE an EXPANDO MENU (from CLOSED to OPEN or OPEN to CLOSED)
function toggle_header() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.borderBottomStyle = ($(arguments[i]).style.borderBottomStyle != 'solid' ? 'solid' : '' );
		$(arguments[i]).style.fontWeight = ($(arguments[i]).style.fontWeight != 'normal' ? 'normal' : '' );
		$(arguments[i]).style.backgroundImage = ($(arguments[i]).style.backgroundImage != 'url('+ http_path +'/images/buttons/plus_8w8h.gif)' ? 'url('+ http_path +'/images/buttons/plus_8w8h.gif)' : 'url('+ http_path +'/images/buttons/minus_8w8h.gif)' );
// Goofy thing here. Mozilla browsers return the backgroundColor in rgb format with a SPACE after the commas. The replace function here strips out the spaces.
		$(arguments[i]).style.backgroundColor = (($(arguments[i]).style.backgroundColor).replace(/ /g,"") != 'rgb(255,255,255)' ? 'rgb(255,255,255)' : '' );
		$(arguments[i]).style.color = (($(arguments[i]).style.color).replace(/ /g,"") != 'rgb(35,60,136)' ? 'rgb(35,60,136)' : '' );
		$(arguments[i]).title = ($(arguments[i]).title != 'Show' ? 'Show' : 'Hide' );
	}
}
// OPEN an EXPANDO MENU
function open_header() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.borderBottomStyle = '';
		$(arguments[i]).style.fontWeight = '';
		$(arguments[i]).style.backgroundImage = 'url('+ http_path +'/images/buttons/minus_8w8h.gif)';
		$(arguments[i]).style.backgroundColor = '';
		$(arguments[i]).style.color = '';
		$(arguments[i]).title = 'Hide';
	}
}
// CLOSE an EXPANDO MENU
function close_header() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.borderBottomStyle = 'solid';
		$(arguments[i]).style.fontWeight = 'normal';
		$(arguments[i]).style.backgroundImage = 'url('+ http_path +'/images/buttons/plus_8w8h.gif)';
		$(arguments[i]).style.backgroundColor = 'rgb(255,255,255)';
		$(arguments[i]).style.color = 'rgb(35,60,136)';
		$(arguments[i]).title = 'Show' ;
		// we activate the HEADER div cursors here.
		// the TRY block will fail for IE5 because it doesn't recognize "pointer" as a cursor value it does recognize "hand"
		try {
			$(arguments[i]).style.cursor = 'pointer';
		} catch (oldIEException) {
			$(arguments[i]).style.cursor = 'hand';
		}
	}
}

/******* EXPANDO SUB-MENUS in Product Pages ********/
// TOGGLE an EXPANDO SUB-MENU (from CLOSED to OPEN or OPEN to CLOSED)
function toggle_table_header() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.fontWeight = ($(arguments[i]).style.fontWeight != 'normal' ? 'normal' : '' );
		$(arguments[i]).style.backgroundImage = ($(arguments[i]).style.backgroundImage != 'url('+ http_path +'/images/buttons/plus_8w8h.gif)' ? 'url('+ http_path +'/images/buttons/plus_8w8h.gif)' : 'url('+ http_path +'/images/buttons/minus_8w8h.gif)' );
		// Goofy thing here. Mozilla browsers return the backgroundColor in rgb format with a SPACE after the commas. The replace function here strips out the spaces.
		$(arguments[i]).style.backgroundColor = (($(arguments[i]).style.backgroundColor).replace(/ /g,"") != 'rgb(255,255,255)' ? 'rgb(255,255,255)' : '' );
		$(arguments[i]).style.color = (($(arguments[i]).style.color).replace(/ /g,"") != 'rgb(126,168,208)' ? 'rgb(126,168,208)' : '' );
		$(arguments[i]).title = ($(arguments[i]).title != 'Show' ? 'Show' : 'Hide' );
		// activate the table HEADER cursors here
		// the TRY block will fail for IE5 because it doesn't recognize "pointer" as a cursor value it does recognize "hand"
		try {
			$(arguments[i]).style.cursor = 'pointer';
		} catch (oldIEException) {
			$(arguments[i]).style.cursor = 'hand';
		}
	}
}
// OPEN an EXPANDO SUB-MENU
function open_table_header() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.fontWeight = '';
		$(arguments[i]).style.backgroundImage = 'url('+ http_path +'/images/buttons/minus_8w8h.gif)';
		$(arguments[i]).style.backgroundColor = '';
		$(arguments[i]).style.color = '';
		$(arguments[i]).title = 'Hide';
	}
}
// CLOSE an EXPANDO SUB-MENU
function close_table_header() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.fontWeight = 'normal';
		$(arguments[i]).style.backgroundImage = 'url('+ http_path +'/images/buttons/plus_8w8h.gif)';
		$(arguments[i]).style.backgroundColor = 'rgb(255,255,255)';
		$(arguments[i]).style.color = 'rgb(126,168,208)';
		$(arguments[i]).title = 'Show' ;
		// we activate the HEADER div cursors here.
		// the TRY block will fail for IE5 because it doesn't recognize "pointer" as a cursor value it does recognize "hand"
		try {
			$(arguments[i]).style.cursor = 'pointer';
		} catch (oldIEException) {
			$(arguments[i]).style.cursor = 'hand';
		}
	}
}

/******* PRODUCT COMPONENT TABS in Kit and Instrument Pages ********/
// TOGGLE a PRODUCT COMPONENT TAB (from CLOSED to OPEN or OPEN to CLOSED)
function toggle_component_tab() {
	for ( var i=0; i < arguments.length; i++ ) {
		if ($(arguments[i]).style.borderBottomStyle == 'solid') {
			// the Folder Tab is CLOSED so open it
			$(arguments[i]).style.borderRightStyle = 'solid';
			$(arguments[i]).style.borderBottomStyle = 'none';
			$(arguments[i]).style.borderLeftStyle = 'solid';
			$(arguments[i]).innerHTML = 'hide list <img src="../../images/buttons/minus_8w8h_gray.gif" width="8" height="8" hspace="3" vspace="0" border="0">';
			$(arguments[i]).style.backgroundColor = '';
			$(arguments[i]).title = 'Hide List';
		} else {
			// the Folder Tab is OPEN so close it
			$(arguments[i]).style.borderRightStyle = 'none';
			$(arguments[i]).style.borderBottomStyle = 'solid';
			$(arguments[i]).style.borderLeftStyle = 'none';
			$(arguments[i]).innerHTML = 'show list <img src="../../images/buttons/plus_8w8h_gray.gif" width="8" height="8" hspace="3" vspace="0" border="0">';
			$(arguments[i]).style.backgroundColor = 'rgb(255,255,255)';
			$(arguments[i]).title = 'Show List';
		}			
	}
}

// CLOSE a PRODUCT COMPONENT TAB
function close_component_tab() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.borderRightStyle = 'none';
		$(arguments[i]).style.borderBottomStyle = 'solid';
		$(arguments[i]).style.borderLeftStyle = 'none';
		$(arguments[i]).innerHTML = 'show list <img src="../../images/buttons/plus_8w8h_gray.gif" width="8" height="8" hspace="3" vspace="0" border="0">';
		$(arguments[i]).style.backgroundColor = 'rgb(255,255,255)';
		$(arguments[i]).title = 'Show List';
		try {
			$(arguments[i]).style.cursor = 'pointer';
		} catch (oldIEException) {
			$(arguments[i]).style.cursor = 'hand';
		}
	}
}

/******* STANDARD FOLDER TABS ********/
// OPEN a FOLDER TAB
function open_folder_tab() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.borderBottomStyle = 'none';
		$(arguments[i]).style.color = '';
		$(arguments[i]).style.backgroundColor = '';
		$(arguments[i] + "_top").style.backgroundColor = '';
		$(arguments[i]).title = '';
		$(arguments[i]).style.cursor = '';
	}
}
// HIGHLIGHT a FOLDER TAB
function highlight_folder_tab() {
	for ( var i=0; i < arguments.length; i++ ) {
		if ($(arguments[i]).style.borderBottomStyle == 'none') {
			$(arguments[i]).style.backgroundColor = '';
			$(arguments[i] + "_top").style.backgroundColor = '';
		} else if (($(arguments[i]).style.backgroundColor).replace(/ /g,"") == 'rgb(126,168,208)') {
			$(arguments[i]).style.color = 'rgb(0,107,167)';
			$(arguments[i]).style.backgroundColor = 'rgb(241,246,249)';
			$(arguments[i] + "_top").style.backgroundColor = 'rgb(241,246,249)';
		} else {
			$(arguments[i]).style.color = 'rgb(241,246,249)';
			$(arguments[i]).style.backgroundColor = 'rgb(126,168,208)';
			$(arguments[i] + "_top").style.backgroundColor = 'rgb(126,168,208)';
		}			
	}
}
// CLOSE a FOLDER TAB
function close_folder_tab() {
	for ( var i=0; i < arguments.length; i++ ) {
		$(arguments[i]).style.borderBottomStyle = 'solid';
		$(arguments[i]).style.color = 'rgb(0,107,167)';
		$(arguments[i]).style.backgroundColor = 'rgb(241,246,249)';
		$(arguments[i] + "_top").style.backgroundColor = 'rgb(241,246,249)';
		$(arguments[i]).title = $(arguments[i]).innerHTML;
		try {
			$(arguments[i]).style.cursor = 'pointer';
		} catch (oldIEException) {
			$(arguments[i]).style.cursor = 'hand';
		}
	}
}
