function displayNav (section,page) {
	if (flashinstalled == 2 && flashversion >= 7) {

		var swfdir = '/images/';
		var theUrl = swfdir+'anywhere.swf?v=1.3&section='+section+'&page='+page+'&swfdir='+swfdir;
		var theWidth = '780';
		var theHeight = '580';
		var sAlign = 't';		
	
		theHtml  = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
		theHtml += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ';
		theHtml += 'width="'+theWidth+'" height="'+theHeight+'" id="video-object">';
		theHtml += '	<param name="allowScriptAccess" value="sameDomain" />';
		theHtml += '	<param name="movie" value="'+theUrl+'" />';
		theHtml += '	<param name="loop" value="false" />';
		theHtml += '	<param name="menu" value="false" />';
		theHtml += '	<param name="quality" value="autohigh" />';
		theHtml += '	<param name="scale" value="noscale" />';
		theHtml += '	<param name="salign" value="'+sAlign+'" />';
		theHtml += '	<param name="wmode" value="transparent" />';
		theHtml += '	<embed src="'+theUrl+'" loop="false" menu="false" quality="autohigh" ';
		theHtml += 'scale="noscale" salign="'+sAlign+'" wmode="transparent" width="'+theWidth+'" height="'+theHeight+'" ';
		theHtml += 'id="video-embed" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" ';
		theHtml += 'pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		theHtml += '</object>';
	
	} else {
	
		theHtml  = '<h1><a href="/">Anywhere Road</a></h1>';
		theHtml += '<div id="nav"><ul>';
		theHtml += '	<li><span class="films">Films</span></li>';
		theHtml += '	<li><a href="/company/" class="company">Company</a></li>';
		theHtml += '	<li><a href="/press/" class="press">Press</a></li>';
		theHtml += '	<li><a href="/sales/" class="sales">Sales</a></li>';
		theHtml += '	<li><a href="/contact/" class="contact">Contact</a></li>';
		theHtml += '</ul></div>';
	
	}
	document.getElementById('flash').innerHTML = theHtml;
}

function setSize (thissize) {
	document.getElementById('header').className = thissize;
}

function openPage (thisurl) {

	var thisroot = 'http://anywhereroad.com/';
	var loadhref = false;

	if (thisurl.substr(0,thisroot.length) != thisroot) {
		if (thisurl == '/') {
			thisurl = thisroot;
		} else if (thisurl.search(/^([a-z]+:)/) == -1) {
			thisurl = thisroot + thisurl;
		} else loadhref = true;
	}
	if (loadhref == false) {

		var ajaxurl = thisurl;
		if (ajaxurl.search(/\/\?/) == -1) {
			ajaxurl += '?getajax=content';
		} else ajaxurl += '&getajax=content';

		xmlrequest = new Request({
			url: ajaxurl,
			autoCancel: true,
			onSuccess: function(responseText) { $('content').innerHTML = responseText },
			onFailure: function() { requestBusy = false }
			});
		if (xmlrequest) {
			$('permalink').innerHTML = '<a href="'+thisurl+'">Click here to link to this page</a>';
			$('content').innerHTML = '';
			xmlrequest.send();
		} else loadhref = true;

	}
	if (loadhref) document.location = thisurl;
	return false;

}

function ajaxForm (theForm) {

	var theUrl = theForm.action;
	var theData  = 'cmd=send&join=true&getajax=content&name='+$('name').value+'&email='+$('email').value;
	theRequest = new Request({
		url: theUrl,
		autoCancel: true,
		onSuccess: function(responseText) { $('content').innerHTML = responseText },
		onFailure: function(){ $('ajaxerror').innerHTML = '<p><b>An error occurred. Please try again.</b></p>' }
		});
	if (theRequest) {
		theRequest.setHeader('Content-Type','application/x-www-form-urlencoded');
		theRequest.send(theData);
	}
	return false;

}

window.addEvent('domready',function() {

	displayNav(navSection,navPage);
	
});