//Get Browser Version
var NS4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var IE4 = (document.all && !document.getElementById)? true : false;
var IE5 = (document.getElementById && document.all)? true : false;
var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var W3C = (document.getElementById)? true : false;

var vertlimit=(NS6)?512:480;

function getVert(){
	try{
		var vert=document.body.parentNode.clientHeight;
	}
	catch(err){	
		try{
			var vert=window.innerHeight;
		}catch(err){
			var vert=screen.availHeight;
		}
	}
	if(vert==0){
		try{
			var vert=window.innerHeight;
		}catch(err){
			var vert=screen.availHeight;
		}
	}
	return vert;
}

/////////////////
//var docpath=location.href;
//docpath=docpath.substring(0,docpath.indexOf("hwm-site"));

var xmlhttp;

function loadXMLDoc(url){
	xmlhttp=null;
	if (window.XMLHttpRequest){  // code for Firefox, Opera, IE7, etc.
		xmlhttp=new XMLHttpRequest();
	}else if (window.ActiveXObject){  // code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xmlhttp!=null){
		xmlhttp.onreadystatechange=state_Change;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}else{
		alert("Your browser does not support XMLHTTP.");
	}
}

function state_Change(){
	if (xmlhttp.readyState==4){// 4 = "loaded"
		if (xmlhttp.status==200){// 200 = "OK"
			if(W3C){
				document.getElementById('content').innerHTML=xmlhttp.responseText;
			}else if (IE4||IE5){
				document.all.content.innerHTML=xmlhttp.responseText;
			}
		}else{
			alert("Problem retrieving data:" + xmlhttp.statusText);
		}
	}
}

function showFile(fnum,pad){
	var fname=(files[fnum]);
	if (IE4||IE5){
		document.all.picture.className="picboxfade";
		document.all.content.className="conscr";
		document.all.content.style.paddingTop=pad + "px";
		loadXMLDoc(fname);
	}else if(NS6){
		document.getElementById("picture").className="picboxfade";
		document.getElementById("content").className="conscr";
		document.getElementById("content").style.paddingTop=pad + "px";
		loadXMLDoc(fname);
	}
}

///////////////////


//create divs array for content
var divs = new Array(9);
divs[0]=9;

//bio
divs[1]="Helen grew up in a <a target='_new' href='http://www.quakerfinder.org/'>Philadelphia Quaker</a> family, and she now lives with her family just outside the city."

divs[1] += "<p> She received her MFA degree in Fiction Writing from <a target='_new' href='http://www.vermontcollege.edu/mfaw/index.asp'>Vermont College of Fine Arts</a> in 2005 and is completing a novel, working title: <a href='#' onClick='showFile(3,8); return false;'>Quaker Playboy Leaves Legacy of Confusion</a></p>"

//author
divs[2]= "Helen's essay <a target='_new' href='http://www.philadelphiastories.org/my-charlie-manson'>My Charlie Manson</a> won the First Person Essay contest from Philadelphia Stories Magazine and is included in <a target='_new' href='http://www.philadelphiastories.org/philadelphia-stories-anthology-volume-2-features-award-winning-local-authors'>Philadelphia Stories Anthology Volume 2</a>."

divs[2]+= "<p>&quot;Biology&quot; won the Editor's Choice award in <br><a target='_new' href='http://www.reliefjournal.com/'>Relief: A Quarterly Christian Expression</a> and it was nominated for a <a target='_new' href='http://www.pushcartprize.com'>Pushcart Prize</a>.</p>"

divs[2]+= "<p>&quot;Astral Projection&quot; is included in the Best of <a target='_new' href='http://www.philadelphiastories.org/'>Philadelphia Stories</a> Anthology 2007.</p>";

divs[2]+= "<p><img src='images/bonechinacover-138.gif' alt='bone china' style='float:left; margin-right:12px;'>Her poetry chapbook, from <a target='_new' href='http://www.finishinglinepress.com'>Finishing Line Press</a>, is titled<br><a target='_new' href='http://www.amazon.com/exec/obidos/ASIN/0972613617/192-9085728-7304412'>Bone China.</a></p>"

divs[2]+= "<p style='font-size:17px;'>Op-Ed pieces:</p>"

//divs[2]+= "<p><a target='_new' href='OpEdGates.htm'>A Post-racial Society? Not Hardly.</a><br>Commentary on the arrest of Henry Louis Gates Jr.</p>";

divs[2]+= "<p><a target='_new' href='http://www.helenwmallon.com/NotAboutRace.pdf'>It should not be about race</a><br>Philadelphia Inquirer</p>";

divs[2]+= "<p><a target='_new' href='http://www.helenwmallon.com/WorkOfDying.pdf'>The hard, personal work of dying</a><br>Philadelphia Inquirer</p>";

divs[2]+= "<p>&nbsp;</p>";

//book reviews
divs[3]="Helen's reviews have appeared in the <a target='_new' href='Inq-Review-RedConvertible.htm'>Philadelphia Inquirer</a> and <a target='_new' href='http://fictionwritersreview.com/reviews/unsung-story-collection-friend-of-mankind-by-julian-mazor'>other venues</a>.";

divs[3]+="<p>&quot;(Helen is) a wonderful writer, someone who not only can craft an appeal to millions of adult readers in their own language, with impact, but also can write at the highest standards of the contemporary essay. She's something most of the people I read (and edit) just aren't. I look forward to the privilege of running her work as soon as the next piece appears.&quot;<br>- John Timpane of the Philadelphia Inquirer</p>";

//editor
divs[4]="&quot;Helen perfectly combines engagement with distance in her editing. She throws herself into the project, cares deeply, learns more about what she needs to learn more about, but at the same time gives the writer just the objectivity and fresh perspective necessary.&quot;<br>- <a target='_new' href='http://www.linkedin.com/pub/dir/adrienne/redd'>Adrienne Redd, PhD</a>";

//teacher/writing coach
//divs[5]="Helen teaches <i>Writing Short Stories that Sing</i>, a workshop at <a target='_new' href='http://www.cheltenhamadultschool.org'>Cheltenham Township Adult School</a>.<br><br>Students <a href='' onClick='SwapContent(1,8); return false;'>have this to say</a>:";

divs[5]="Helen teaches <i>Writing Short Stories that Sing</i>, a workshop at <a target='_new' href='http://www.cheltenhamadultschool.org'>Cheltenham Township Adult School</a>.<br><br>Students have this to say:";

divs[5]+="<p>&quot;Over the past few months, I have worked with Helen four times. Each review offered invaluable insight re. the strength, direction and flow of the piece.  Through suggestions that both excited and challenged my writing skills, Helen deepened not only my understanding of the creative process itself, but also my belief in the  personal space that I, a new writer, am attempting to create. It was a joy to work with Helen, and I highly recommend her for your editorial needs.&quot;<br>- Helene, working on memoir</p>";

divs[5]+="<p>&quot;Helen is super fun, but don't underestimate how serious she is when it comes to writing great short stories. Her classes were very instrumental in helping me take my technique to the next level.&quot;<br>- Rodney, Pharmaceutical Marketing Manager</p>";

divs[5]+="<p>&nbsp;</p>"

//contact
divs[6]="Email: <a href='mailto:hmallon@navpoint.com'>hmallon@navpoint.com</a><br><br>Facebook: <a target='_new' href='http://www.facebook.com/home.php#/profile.php?id=756799615&ref=profile'>Facebook Profile</a>";

//links
divs[7]="BuildLinkTable(8);";

//looking on the bright side
divs[8]="CycleSlips(8);"

var divactive=0;

//define menu line object
function menuline (display,xoff,yoff,padtop,typ,wide,high,imagegroup,altext) {
	this.length = 9;
	this.disp = display;
	this.xoffset = xoff;
	this.yoffset = yoff;
	this.padding = padtop;
	this.type = typ;
	this.width = wide;
	this.height = high;
	this.img = imagegroup;
	this.alt = altext;
}

//array of links
var menu = new Array(9);
menu[0]=9;
menu[1]=new menuline(true,2,-14,8,"txt",234,45,"hwy25-HWM","about Helen W. Mallon");
menu[2]=new menuline(true,2,-12,0,"txt",98,39,"hwy25-Author","Author");
menu[3]=new menuline(true,2,-10,0,"txt",180,40,"hwy25-BookReviews","Book Reviews");
menu[4]=new menuline(true,2,-12,0,"txt",85,41,"hwy25-Editor","Editor");
menu[5]=new menuline(true,0,-12,0,"txt",304,61,"hwy25-Teacher","Teacher/Writing Coach");
menu[6]=new menuline(true,2,-14,0,"txt",94,38,"hwy25-Contact","Contact");
menu[7]=new menuline(true,4,-12,8,"fun",72,40,"hwy25-Links","Links");
menu[8]=new menuline(true,4,-10,8,"fun",338,50,"hwy25-Looking","Looking on the bright side");

function BuildMenu(){
	var vert=getVert();
	var linespace=(vert<vertlimit) ? 42 : 63;
	var lineoffset=(vert<vertlimit) ? -1 : -21;
	var posleft=0;
	var postop=0;
	var padtop=0;
	var pagestr="";
	for(i=1;i<menu[0];i++){
		posleft=530+menu[i]["xoffset"];
		postop=(linespace*i)+menu[i]["yoffset"]+lineoffset;
		padtop=(menu[i]["padding"]==0) ? postop-32 : menu[i]["padding"];
		pagestr += '<div id="menu' + i + '" style="position:absolute; left:' + posleft + 'px; top:' + postop + 'px;">';
		pagestr += '<a href="#" ';
		if(menu[i]["type"]=="fil"){
			pagestr += 'onClick="showFile(\'' + divs[i] + '\',' + padtop + '); return false;">';
		}else if(menu[i]["type"]=="pic"){
			pagestr += 'onClick="ShowPic(' + i + ',' + padtop + '); return false;">';
		}else if(menu[i]["type"]=="fun"){
			pagestr += 'onClick="ResetPic(); hideface(); ' + divs[i] + ' return false;">';
		}else{
			pagestr += 'onClick="ShowText(' + i + ',' + padtop + '); return false;">';
		}
		pagestr += '<img src="images/' + menu[i]["img"] + '-blue.gif" border="0" ';
		pagestr += 'alt="' + menu[i]["alt"] + '" ';
		pagestr += 'onMouseOver="src=\'images/' + menu[i]["img"] + '-gold.gif\';" ';
		pagestr += 'onMouseOut="src=\'images/' + menu[i]["img"] + '-blue.gif\';"></a>';
		pagestr += '</div>';
	}
	document.write(pagestr);
}

//external files
var files=new Array(4);
files[0]=4;
files[1]="ST-QPLL.txt";
files[2]="StudentComments.txt";
files[3]="http://www.helenwmallon.com/ST-QPLL.txt";

//alternate content
var swap = new Array(3);
swap[0]=3;

swap[1]="<p>&quot;Over the past few months, I have worked with Helen four times. Each review offered invaluable insight re. the strength, direction and flow of the piece.  Through suggestions that both excited and challenged my writing skills, Helen deepened not only my understanding of the creative process itself, but also my belief in the  personal space that I, a new writer, am attempting to create. It was a joy to work with Helen, and I highly recommend her for your editorial needs.&quot;<br>- Helene, working on memoir<p></p>&quot;Helen is super fun, but don't underestimate how serious she is when it comes to writing great short stories. Her classes were very instrumental in helping me take my technique to the next level.&quot;<br>- Rodney, Pharmaceutical Marketing Manager</p>";

swap[2]="file://ST-QPLL.txt"

//rejection slips
var slip=new Array(8);
slip[0]=8;
slip[1]="<img src='images/Rejection-MissouriZapped.jpg' style='opacity:0.75;filter:alpha(opacity=75);'>"
slip[2]="<img src='images/Rejection-TheSun.jpg' style='opacity:0.75;filter:alpha(opacity=75);'>"
slip[3]="<img src='images/Rejection-OneStory.jpg' style='opacity:0.75;filter:alpha(opacity=75);'>"
slip[4]="<img src='images/Rejection-HaydensFerry.jpg' style='opacity:0.75;filter:alpha(opacity=75);'>"
slip[5]="<img src='images/Rejection-CrazyHorse.jpg' style='opacity:0.75;filter:alpha(opacity=75);'>"
slip[6]="<img src='images/Rejection-AQR.jpg' style='opacity:0.75;filter:alpha(opacity=75);'>"
slip[7]="<img src='images/Rejection-YaleReview.jpg' style='opacity:0.75;filter:alpha(opacity=75);'>"

function CycleSlips(num){
	divactive=num;
	SlipContent(slip[0]-1,num);
	for(i=1;i<slip[0];i++){
		SlipTimer=setTimeout("SlipContent(" + i + "," + num + ");",5000*i);
	}
}

function ShowText(num,pad){
	divactive=num;
	var divcontent=(pad<8) ? "" : "<div style='height:" + (pad - 8) + "px;'></div>";
	divcontent += divs[num];
	if (IE4||IE5){
		document.all.picture.className="picboxfade";
		document.all.content.className="contxt";
		document.all.content.innerHTML=divcontent;
	}else if(NS6){
		document.getElementById("picture").className="picboxfade";
		document.getElementById("content").className="contxt";
		document.getElementById("content").innerHTML=divcontent;
	}
}

function ShowPic(num,pad){
	divactive=num;
	if (IE4||IE5){
		document.all.content.className="conpic";
		document.all.content.style.paddingTop=pad + "px";
		document.all.content.innerHTML=divs[num];
	}else if(NS6){
		document.getElementById("content").className="conpic";
		document.getElementById("content").style.paddingTop=pad + "px";
		document.getElementById("content").innerHTML=divs[num];
	}
}

function ResetPic(){
	if (IE4||IE5){
		document.all.picture.className="picbox";
		document.all.content.className="contxt";
		document.all.content.innerHTML="";
	}else if(NS6){
		document.getElementById("picture").className="picbox";
		document.getElementById("content").className="contxt";
		document.getElementById("content").innerHTML="";
	}
}

function SwapContent(num,pad){
	if (IE4||IE5){
		document.all.content.className="contxt";
		document.all.content.style.paddingTop=pad + "px";
		document.all.content.innerHTML=swap[num];
	}else if(NS6){
		document.getElementById("content").className="contxt";
		document.getElementById("content").style.paddingTop=pad + "px";
		document.getElementById("content").innerHTML=swap[num];
	}
}

function SlipContent(pic,num){
	if(divactive==num){
		if (IE4||IE5){
			document.all.content.style.paddingTop="8px";
			document.all.content.innerHTML=slip[pic];
		}else if(NS6){
			document.getElementById("content").style.paddingTop="8px";
			document.getElementById("content").innerHTML=slip[pic];
		}
	}
}

function SizeBox(){
	var vert=getVert();
	var vertcontent=(NS6) ? vert-94 : vert-92;
	var vertpicture=(NS6) ? vert-82 : vert-80;
	var topcredits=(NS6) ? vert-42 : vert-40;
	if((W3C)&&(vert<vertlimit)){
		document.getElementById("content").style.height=vertcontent + 'px';
		document.getElementById("picture").style.height=vertpicture + 'px';
		document.getElementById("credits").style.top=topcredits + 'px';
	}
}
