// JavaScript Document
// Navigation Rollover

  // PRT 07-Jan-04
  // checkDomain() is my code to redirect to pwriting.org
function checkDomain() {
		var topLocation = top.location.host;
		if ( topLocation.indexOf("proprioceptivewriting") > -1 ) {
			location.replace("http://www.pwriting.org");
		} else if ( topLocation.indexOf("pwriting.com") > -1 ) {
			location.replace("http://www.pwriting.org");
		}
}
/*
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
*/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function showMenu(selected) {

	// HOME
	var htm = '<TD>&nbsp;&nbsp;';
	if ( selected == 'home' ) {
		htm += '<SPAN class="menuNon">&nbsp;home&nbsp;';
	} else {
		htm += '<A HREF="index.htm" class="menu">&nbsp;home&nbsp;</A>';
	}
	htm += '&nbsp;</TD>';

	// WHAT
	htm += '<TD>';
	if ( selected == 'what' ) {
		htm += '<A HREF="what_is_pw.htm" class="menuSel">&nbsp;what is pw&nbsp;</A>';
	} else {
		htm += '<A HREF="what_is_pw.htm" class="menu">&nbsp;what is pw&nbsp;</A>';
	}
	htm += '&nbsp;</TD>';
	
	// WHO
	htm += '<TD>';
	if ( selected == 'who' ) {
		htm += '<SPAN class="menuSel">&nbsp;who we are&nbsp;</SPAN>';
	} else {
		htm += '<A HREF="who_we_are.htm" class="menu">&nbsp;who we are&nbsp;</A>';
	}
	htm += '&nbsp;</TD>';

	// PODCAST
/*	htm += '<TD>';
	if ( selected == 'podcast' ) {
		htm += '<SPAN class="menuSel">&nbsp;podcasting&nbsp;</SPAN>';
	} else {
		htm += '<A HREF="podcasting.htm" class="menu">&nbsp;podcasting&nbsp;</A>';
	}
	htm += '&nbsp;</TD>';
*/
	// CALENDAR
	htm += '<TD>';
	if ( selected == 'calendar' ) {
		htm += '<A HREF="course_calendar.htm" class="menuSel">&nbsp;course calendar&nbsp;</A>';
	} else {
		htm += '<A HREF="course_calendar.htm" class="menu">&nbsp;course calendar&nbsp;</A>';
	}
	htm += '&nbsp;</TD>';
	
	// DESCS
	htm += '<TD>';
	if ( selected == 'descs' ) {
		htm += '<A HREF="course_descriptions.htm" class="menuSel">&nbsp;course descriptions&nbsp;</A>';
	} else {
		htm += '<A HREF="course_descriptions.htm" class="menu">&nbsp;course descriptions&nbsp;</A>';
	}
	htm += '&nbsp;</TD>';
	
	// FAQS
	htm += '<TD>';
	if ( selected == 'faqs' ) {
		htm += '<A HREF="faqs.htm" class="menuSel">&nbsp;faqs&nbsp;</A>';
	} else {
		htm += '<A HREF="faqs.htm" class="menu">&nbsp;faqs&nbsp;</A>';
	}
	htm += '&nbsp;</TD>';
	
	// FORUMS
	htm += '<TD>';
	htm += '<A HREF="dc/dcboard.php" class="menu">&nbsp;forums&nbsp;</A>';
	htm += '&nbsp;</TD>';
	
	// LINKS
/*	htm += '<TD>';
	if ( selected == 'links' ) {
		htm += '<SPAN class="menuSel">&nbsp;links&nbsp;</SPAN>';
	} else {
		htm += '<A HREF="links.htm" class="menu">&nbsp;links&nbsp;</A>';
	}
	htm += '&nbsp;</TD>';
*/
	// STORE
	htm += '<TD>';
	if ( selected == 'store' ) {
		htm += '<SPAN class="menuSel">&nbsp;pw store&nbsp;</SPAN>';
	} else {
		htm += '<A HREF="store.htm" class="menu">&nbsp;pw store&nbsp;</A>';
	}
	htm += '&nbsp;</TD>';
	
//	alert("htm = " + htm);

	return htm;
}

function showSubMenu(selected) {

	var htm = '<TABLE><TR><TD>&nbsp;&nbsp;</TD><TD>';
	
	// quarter
	if ( selected == 'quarter' ) {
		htm += '<A HREF="quarter_century.htm" class="submenuSel">&nbsp;29 years of PW&nbsp;</A>';
	} else {
		htm += '<A HREF="quarter_century.htm" class="submenu">&nbsp;29 years of PW&nbsp;</A>';
	}
	htm += '</TD><TD>&nbsp;&nbsp;</TD>';
	
	// people
	htm += '<TD>';
	if ( selected == 'people' ) {
		htm += '<A HREF="what_people_said.htm" class="submenuSel">&nbsp;what people have said&nbsp;</A>';
	} else {
		htm += '<A HREF="what_people_said.htm" class="submenu">&nbsp;what people have said&nbsp;</A>';
	}
	htm += '</TD><TD>&nbsp;&nbsp;</TD>';
	
	// topics
	/*
	htm += '<TD>';
	if ( selected == 'topics' ) {
		htm += '<A HREF="what_is_pw_topics.htm" class="submenuSel">&nbsp;applying PW to your life&nbsp;</A>';
	} else {
		htm += '<A HREF="what_is_pw_topics.htm" class="submenu">&nbsp;applying PW to your life&nbsp;</A>';
	}
	htm += '</TD>';
	*/
	htm += '</TR></TABLE>';
	
	return htm;
}
