// JavaScript Document


// Swap Image functions

function newImage(arg) {
	if (document.images) {
  	rslt = new Image();
  	rslt.src = arg;
  	return rslt;
  }
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

// Swap image functionality for main nav, requires Swap image functions
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		home_on = newImage("/images/main_nav_home_on.gif");
		products_on = newImage("/images/main_nav_products_on.gif");
		gallery_on = newImage("/images/main_nav_gallery_on.gif");
		about_us_on = newImage("/images/main_nav_about_us_on.gif");
		press_on = newImage("/images/main_nav_press_on.gif");
		contact_us_on = newImage("/images/main_nav_contact_us_on.gif");
		tool_box_on = newImage("/images/main_nav_tool_box_on.gif");
		preloadFlag = true;
	}
}


// Incomplete functions for showing current location in the main navigation
//function setCurrentLocation() {
	//changeImages(location, '/images/main_nav_' + location + '_on.gif'); 
	//return true;
	//alert(location);
//}

// SubNav Show & Hide
function parseSubNav() {
				if ( thisPage == "products_custom" ) {
				//alert(thisPage);
				document.getElementById('custom_node').style.display = "block";
				}
				if ( thisPage == 'products_custom_systems' || thisPage == 'products_custom_frames' ) {
					document.getElementById('custom_node').style.display = "block";
				}
				if ( thisPage == 'products_custom_cores' ||
							thisPage == 'products_custom_cores_clear_frosted' || 
							thisPage == 'products_custom_cores_opal_frosted' || 
							thisPage == 'products_custom_cores_beach_grass' || 
							thisPage == 'products_custom_cores_oyster_linen' ||
							thisPage == 'products_custom_cores_search_light' || 
							thisPage == 'products_custom_cores_clear_transparent' ) {
				document.getElementById('custom_node').style.display = "block";
				document.getElementById('custom_systems_cores_node').style.display = "block";
				}
				if ( thisPage == "products_custom_lattices"  ||
							thisPage == 'products_custom_lattices_type_1' || 
							thisPage == 'products_custom_lattices_type_2' || 
							thisPage == 'products_custom_lattices_type_3' || 
							thisPage == 'products_custom_lattices_type_4' ||
							thisPage == 'products_custom_lattices_custom' ) {
				document.getElementById('custom_node').style.display = "block";
				document.getElementById('custom_systems_lattices_node').style.display = "block";
				}
				if ( thisPage == "products_custom_hardware" ||
							thisPage == 'products_custom_hardware_flush_pull_rp_60' || 
							thisPage == 'products_custom_hardware_flush_pull_op_150' || 
							thisPage == 'products_custom_hardware_invisible_hinges' || 
							thisPage == 'products_custom_hardware_ring_pull_edge_mounted' || 
							thisPage == 'products_custom_hardware_ring_pull_face_mounted' || 
							thisPage == 'products_custom_hardware_privacy_lock_ka' || 
							thisPage == 'products_custom_hardware_privacy_lock_agb' || 
							thisPage == 'products_custom_hardware_privacy_lock_rcl180' || 
							thisPage == 'products_custom_hardware_flush_bolt_38' || 
							thisPage == 'products_custom_hardware_dust_proof_strikes' || 
							thisPage == 'products_custom_hardware_door_connectors') {
				document.getElementById('custom_node').style.display = "block";
				document.getElementById('custom_systems_hardware_node').style.display = "block";
				}
				if ( thisPage == "products_custom_tracks"  ||
							thisPage == 'products_custom_tracks_he_track' || 
							thisPage == 'products_custom_tracks_he_bi_track' ||
							thisPage == 'products_custom_tracks_floor_track_guide' ||
							thisPage == 'products_custom_tracks_folding_track' ||
							thisPage == 'products_custom_tracks_40b_track' ) {
				document.getElementById('custom_node').style.display = "block";
				document.getElementById('custom_systems_tracks_node').style.display = "block";
				}
			}
// Sets the current section in the subnav			
function setCurrentLocation() {
	document.getElementById(thisPage).style.backgroundColor = "white" ;
	document.getElementById(thisPage).style.borderStyle = "solid" ;
	document.getElementById(thisPage).style.borderWidth = "1px" ;
	document.getElementById(thisPage).style.borderTopColor = "#ccc" ;
	document.getElementById(thisPage).style.borderRightColor = "#fff" ;
	document.getElementById(thisPage).style.borderBottomColor = "#ccc" ;
	document.getElementById(thisPage).style.borderLeftColor = "#ccc" ;
	document.getElementById(thisPage).style.paddingTop = "4px" ;
	document.getElementById(thisPage).style.paddingRight = "4px" ;
	document.getElementById(thisPage).style.paddingBottom = "4px" ;
	if (thisPage == 'products_custom' || thisPage == 'products_standard' || thisPage == 'products_closet') {
	document.getElementById(thisPage).style.paddingLeft = "4px" ;
	} else if (thisPage == 'products_custom_systems' || thisPage == 'products_custom_frames' || thisPage == 'products_custom_cores' || thisPage == 'products_custom_lattices' || thisPage == 'products_custom_hardware' || thisPage == 'products_custom_tracks') {
	document.getElementById(thisPage).style.paddingLeft = "14px" ;
	} else if (thisPage == 'products_custom_cores_clear_frosted' || thisPage == 'products_custom_cores_opal_frosted' || thisPage == 'products_custom_cores_beach_grass' || thisPage == 'products_custom_cores_oyster_linen' || thisPage == 'products_custom_cores_search_light' || thisPage == 'products_custom_cores_clear_transparent'
		|| thisPage == 'products_custom_lattices_type_1' || thisPage == 'products_custom_lattices_type_2' || thisPage == 'products_custom_lattices_type_3' || thisPage == 'products_custom_lattices_type_4' || thisPage == 'products_custom_lattices_custom'
		|| thisPage == 'products_custom_hardware_flush_pull_rp_60' || thisPage == 'products_custom_hardware_flush_pull_op_150' || thisPage == 'products_custom_hardware_invisible_hinges' || thisPage == 'products_custom_hardware_flush_bolt_38' || thisPage == 'products_custom_hardware_dust_proof_strikes'
		|| thisPage == 'products_custom_hardware_ring_pull_edge_mounted' || thisPage == 'products_custom_hardware_ring_pull_face_mounted' || thisPage == 'products_custom_hardware_privacy_lock_ka' || thisPage == 'products_custom_hardware_privacy_lock_agb' || thisPage == 'products_custom_hardware_privacy_lock_rcl180' || thisPage == 'products_custom_hardware_door_connectors' 
		|| thisPage == 'products_custom_tracks_he_track' || thisPage == 'products_custom_tracks_he_bi_track' || thisPage == 'products_custom_tracks_floor_track_guide' || thisPage == 'products_custom_tracks_folding_track' || thisPage == 'products_custom_tracks_40b_track'
	) { document.getElementById(thisPage).style.paddingLeft = "24px" ;
	}
}
