// Just let this be
var flash1 = '<object type="application/x-shockwave-flash" data="/images/flash.swf" width="936" height="328" wmode="transparent" /><param name="movie" value="/images/flash.swf"><param name="wmode" value="transparent" /></object>';

// Create the site subnav menus here.
var subnavigation = '\
	<ul id="submenu2" class="submenu">\
		<li><a href="http://www.rack911.com/Linux-Server-Management/">Management Overview</a></li>\
		<li><a href="http://www.rack911.com/Linux-Server-Management/Server-Management.php">Linux Server Management</a></li>\
		<li><a href="http://www.rack911.com/Linux-Server-Management/Server-Optimization.php">Server Optimization</a></li>\
		<li><a href="http://www.rack911.com/Linux-Server-Management/Managed-Infrastructure.php">Managed Infrastructure</a></li>\
		<li><a href="http://www.rack911.com/Linux-Server-Management/Ecommerce-Management.php">Ecommerce Management</a></li>\
	</ul>\
	<ul id="submenu3" class="submenu">\
		<li><a href="http://www.rack911.com/Linux-Server-Security/">Security Overview</a></li>\
		<li><a href="http://www.rack911.com/Linux-Server-Security/DDoS-Proxy-Services.php">DDoS Proxy Services</a></li>\
		<li><a href="http://www.rack911.com/Linux-Server-Security/PCI-DSS-Compliance.php">PCI DSS Compliance</a></li>\
	</ul>\
	<ul id="submenu5" class="submenu">\
		<li><a href="http://www.rack911.com/About-Rack911/">Company Overview</a></li>\
		<li><a href="http://blog.rack911.com/">Our Blog</a></li>\
		<li><a href="http://www.rack911.com/About-Rack911/Testimonials.php">Customer Feedback</a></li>\
		<li><a href="http://www.rack911.com/Support/Contact-Us.php">Contact Rack911</a></li>\
	</ul>\
	<ul id="submenu6" class="submenu">\
		<li><a href="https://support.rack911.com/">Submit a Ticket</a></li>\
		<li><a href="http://www.providesupport.com?messenger=rack911" onclick="popup(\'http://www.providesupport.com?messenger=rack911\',\'500\',\'460\'); return false;">Online real time chat</a></li>\
		<li><a href="http://www.rack911.com/Support/Contact-Us.php">Contact Us</a></li>\
		<li><a href="http://www.rack911.com/Support/Request-a-Quote.php">Request a Quote</a></li>\
	</ul>\
';

// Show/hide one of the submenus
function toggleNav(foo) {
	menus = new Array();
	menus = document.getElementsByTagName('ul');
	
	for (i=0 ; i<menus.length ; i++) {
		if (menus[i].className === 'submenu') {
			menus[i].style.visibility = 'hidden';
		}
	}
	if (foo !== '') document.getElementById('submenu'+foo).style.visibility = 'visible';
}

function setup() {
	// OUTBOUND LINKS OPEN IN A NEW WINDOW UNLESS EXPLICITLY TOLD OTHERWISE
	// FORCE SAME WINDOW: rel="self" in anchor
	// FORCE EXTERNAL WINDOW: rel="external" in anchor
	var domain = window.location+'';
	domain = domain.replace('//','');
	domain = domain.substring(domain.indexOf(':')+1,domain.indexOf('/'));
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var URL = anchors[i].href;
		if ((URL.search(domain)===-1 && URL.search('http')!==-1 && anchors[i].rel !== 'self') || anchors[i].rel === 'external') anchors[i].target = "_blank";
	}

	// Sets up navigation menus
	document.getElementById('subnav1').innerHTML = subnavigation;
	
	// Compares the height of the main content area and sidebar and adjusts the height of the sidebar accordingly.
	if (document.getElementById('right1').offsetHeight <= (document.getElementById('contentCols').offsetHeight-14)) document.getElementById('right1').style.height = (document.getElementById('contentCols').offsetHeight-14) + 'px';
}

// Activates contact scripts
function activate(brillig) {
	document.getElementById('config').name = "config";
	document.getElementById('config').value = brillig;
}

// Pops open a new window
function popup(file,wide,high) {
	window.open(file,'popup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=yes,copyhistory=no,width='+wide+',height='+high)
	}


window.onload = setup;
