


function showEmailForm(){
	document.getElementById('contentHolder').innerHTML = document.getElementById('articleTools').innerHTML;

	document.getElementById('articleTools').innerHTML = document.getElementById('emailArticleForm').innerHTML
}

function hideEmailForm(){
	document.getElementById('articleTools').innerHTML = document.getElementById('contentHolder').innerHTML;
}



var timer;
function createTimer(timer){
timer = setTimeout('hideAll()',1000);
}


function showArchivesNav(){

	clearTimeout(timer);
	
	hideAll();
	document.getElementById('archivesNav').style.visibility = 'visible';
}


function showSubNav1(){

	clearTimeout(timer);
	
	hideSubNavs();
	document.getElementById('archivesSubNav1').style.visibility = 'visible';
}

function showSubNav2(){

	clearTimeout(timer);
	
	hideSubNavs();
	document.getElementById('archivesSubNav2').style.visibility = 'visible';
}


function showSubNav3(){

	clearTimeout(timer);
	hideSubNavs();
	document.getElementById('archivesSubNav3').style.visibility = 'visible';
}


function showSubNav4(){

	clearTimeout(timer);
	
	hideSubNavs();
	document.getElementById('archivesSubNav4').style.visibility = 'visible';
}







function showAboutNav(){
	clearTimeout(timer);
	hideAll();
	document.getElementById('aboutNav').style.visibility = 'visible';
}

function showMediaCentreNav(){
	clearTimeout(timer);
	hideAll();
	document.getElementById('mediaCentreNav').style.visibility = 'visible';
}

function showCategoryNav(){

	clearTimeout(timer);
	
	hideSubNavs();
	document.getElementById('categoryNav').style.visibility = 'visible';
}


function showCustomerCareNav(){

	clearTimeout(timer);
	
	hideAll();
	document.getElementById('customerCareNav').style.visibility = 'visible';
}

function hideAll(){

	document.getElementById('archivesNav').style.visibility = 'hidden';
	document.getElementById('archivesSubNav1').style.visibility = 'hidden';
	document.getElementById('archivesSubNav2').style.visibility = 'hidden';
	document.getElementById('archivesSubNav3').style.visibility = 'hidden';
	document.getElementById('archivesSubNav4').style.visibility = 'hidden';
	document.getElementById('aboutNav').style.visibility = 'hidden';
	document.getElementById('mediaCentreNav').style.visibility = 'hidden';
	document.getElementById('categoryNav').style.visibility = 'hidden';
	document.getElementById('customerCareNav').style.visibility = 'hidden';
}

function hideSubNavs(){

	document.getElementById('archivesSubNav1').style.visibility = 'hidden';
	document.getElementById('archivesSubNav2').style.visibility = 'hidden';
	document.getElementById('archivesSubNav3').style.visibility = 'hidden';
	document.getElementById('archivesSubNav4').style.visibility = 'hidden';
	document.getElementById('categoryNav').style.visibility = 'hidden';
}



function setTimer(){

	timer = setTimeout('hideAll()',1000);
	
}

var page;
function sidebarPop(page){
window.open(page,'pop','width=300,height=600,scrollbars=auto,bookmarksbar=no,addressbar=no,statusbar=no');
}


function getAdjustment(){
	var adjusted;
	var browswidth;

	if (document.layers){
		browswidth = windows.innerwidth;
	} else {
		browswidth = document.body.offsetWidth;
	}

	adjusted=(browswidth-800)/2;
	return adjusted;
}


function setMenuPosition(){
	var adjusted = getAdjustment();
	var mac = false;
	if (adjusted > 0){
	if (navigator.userAgent.search('Macintosh') != -1){
		mac = true;
	}
	

		if (document.layers){
			eval(layerRef + '["aboutNav"]' + styleSwitch + '.left=' + adjusted+45);
			eval(layerRef + '["archivesNav"]' + styleSwitch + '.left=' + adjusted+180);
			eval(layerRef + '["archivesSubNav1"]' + styleSwitch + '.left=' + adjusted+379);
			eval(layerRef + '["archivesSubNav2"]' + styleSwitch + '.left=' + adjusted+379);
			eval(layerRef + '["archivesSubNav3"]' + styleSwitch + '.left=' + adjusted+379);
			eval(layerRef + '["archivesSubNav4"]' + styleSwitch + '.left=' + adjusted+379);
			eval(layerRef + '["categoryNav"]' + styleSwitch + '.left=' + adjusted+379);
			eval(layerRef + '["mediaCentreNav"]' + styleSwitch + '.left=' + adjusted+663);
			eval(layerRef + '["customerCareNav"]' + styleSwitch + '.left=' + adjusted+333);
	
		}else{
	
			
			document.getElementById('aboutNav').style.left=adjusted+62+ 'px';
			document.getElementById('archivesNav').style.left=adjusted+125+ 'px';
			document.getElementById('archivesSubNav1').style.left=adjusted+323+ 'px';
			document.getElementById('archivesSubNav2').style.left=adjusted+323+ 'px';
			document.getElementById('archivesSubNav3').style.left=adjusted+323+ 'px';
			document.getElementById('archivesSubNav4').style.left=adjusted+323+ 'px';
			document.getElementById('categoryNav').style.left=adjusted+323+ 'px';
			document.getElementById('mediaCentreNav').style.left=adjusted+570+ 'px';
			document.getElementById('customerCareNav').style.left=adjusted+285+ 'px';
		
		}
	} 
	

	
}




function replaceLineBreaks (ta) {
  return ta.replace(/\r\n|\r|\n/g, '<br />');
}

	
function previewComment(){
	document.getElementById('commentPreview').style.display = 'block';
	document.getElementById('commentPreview').innerHTML = '<h3>Comment Preview<\/h3>' + replaceLineBreaks(document.getElementById('commentText').value) + '<p><input type="submit" name="commentSubmit" id="commentSubmit" value="Post" /><\/p>';
	document.getElementById('commentSubmit').disabled = false;
}
	
function disablePost(){
	
	document.getElementById('commentSubmit').disabled = true;
	
}

function init(){
	setMenuPosition();
	createTimer(timer);
}

window.onload=init;

window.onresize= setMenuPosition;



