﻿
function createRightNavigation() {
	var rl = document.getElementById("RightQuickLinks");
	var contentDiv = document.getElementById("Content");
	var contentDivs = contentDiv.getElementsByTagName("div");

			alert ("create right navigation");

	contentDiv.style.borderWidth = "0px 0px 0px 0px";
	rl.style.borderWidth="0px 0px 0px 0px";

	rl.style.position="absolute";
	rl.style.float="right";
	rl.style.width="15em";

	contentDivs[0].style.marginRight = "16em";
	contentDivs[1].style.marginRight = "16em";
}

/* Find all of the new window references.  */
function changeonclicks() {
	var index = 0;
	var tags=new Array;

	tags = document.getElementsByName("newwindow");
	for (index=0; index<tags.length; index++) {
			tags[index].onclick =  newwindow;
	}

	tags = document.getElementsByName("skipnavigation");
	for (index=0; index<tags.length; index++) {
			//tags[index].onclick =  changenavigation;
			tags[index].onclick =  togglefloat1;
	}

	tags = document.getElementsByName("togglefloat");
	for (index=0; index<tags.length; index++) {
			tags[index].onclick =  togglefloat1; 
	}

}

/* Add a target attribute to them so they will open in a new window. */
function newwindow() {
	var id = this.id;
	var URL = this.href;

	var newtarget = window.open(URL,"_blank","");
	newtarget.focus();

	return false;
}

function togglefloat() {
	alert("togglefloat");
}
function togglefloat1() {
	var RightLinks = document.getElementById("RightQuickLinks");
	var ContentDiv = document.getElementById("Content");

	ContentDiv.style.borderWidth = "0px";
	RightLinks.style.borderWidth="0px";

/*
Make it so this function knows how to toggle upon the first run without setting some attribute already in navigation.css
	alert(RightLinks.style.position);
*/

	var a1 = document.getElementById("FirstContentElement");
	var a2 = document.getElementById("Hardware");

	if (RightLinks.style.position == "absolute") {
		RightLinks.style.position="relative";
		RightLinks.style.float="none";
		RightLinks.style.width="auto";

		a1.style.marginRight = "auto";
		a2.style.marginRight = "auto";
	} else {
		RightLinks.style.position="absolute";
		RightLinks.style.float="right";
		RightLinks.style.width="15em";

		a1.style.marginRight = "16em";
		a2.style.marginRight = "16em";
	}
}

function changenavigation() {
	//alert("skip");
}

function hideFavIcons() {
	var quickLinksDiv = document.getElementById("RightQuickLinks");
	var imgTags = quickLinksDiv.getElementsByTagName("img");
	var index=0;
	for (index=0; index<imgTags.length; index++) {
		imgTags[index].style.visibility=  visible; 
	}
}

function initializePage() {
	changeonclicks();
	togglefloat1(); 
	/* createRightNavigation();  */
	hideFavIcons();
}

/* If I was really cool I would turn the borders on my different content areas dynamically. */

window.onload = initializePage;

