function stopError() {
	
  return true;
}
window.onerror = stopError;

function rollOver(imgName,state) {

	switch(state) {
	
		case "over":
			if(document.images) {
			// get the image type
				suffixType = imgName.src.substring(imgName.src.lastIndexOf("."),imgName.src.length);
				// swap to new image
				if (imgName.src.indexOf("_over") == -1) {
					imgName.src = imgName.src.substring(0,(imgName.src.indexOf(suffixType))) + "_over" + suffixType;
				}
			}

		break;
		
		case "out":
			if(document.images) {
				// get the image type
				suffixType = imgName.src.substring(imgName.src.lastIndexOf("."),imgName.src.length);
				
				// swap image back to original
				if (imgName.src.indexOf("_over") != -1) {
					imgName.src = imgName.src.substring(0,(imgName.src.indexOf("_over"))) + suffixType;
				}
			}

		break;	
	} 

}


function buildPreloader(section) {
	
	var myImages = new Array()
	
	myImages[0] = '/images/topnav_home_over.gif'
	myImages[1] = '/images/topnav_prod_over.gif'
	myImages[2] = '/images/topnav_faq_over.gif'
	myImages[3] = '/images/topnav_locate_over.gif'
	myImages[4] = '/images/topnav_order_over.gif'
	myImages[5] = '/images/topnav_about_over.gif'
	myImages[6] = '/images/topnav_contact_over.gif'

	preLoader(myImages);
}


function preLoader(imgArray) {

	for (i=0; i < imgArray.length; i ++) {
		//alert(imgArray[i])
		imgArray[i] = new Image()
	}
	return true;
}


/* I'm going to skip nn4 */

var comments = new Array();
//&#8220;&#8221;
comments[0] = "&#8220;My son is left-handed and has had a lot of trouble writing his alphabet. He received one of your capital Manuscript templates as a gift from his grandmother. After practicing, he was able to write so much better. I could not believe what I was seeing! Thank you for your help.&#8221; – Nicole, Texas";
comments[1] = "&#8220;I purchased your products for my daughter. Wow! These are great. Every child should have them!&#8221; – Cindy, Florida";
comments[2] = "&#8220;I purchased one of your writing aids on a visit to DISNEY WORLD last Easter  and have had much success with it.&#8221; –Paula, Nottingham, England.";
comments[3] = "&#8220; I wanted to let you know that my son has shown a great deal of improvement in his writing after using your manuscript stencil. You have made a fine product and should be proud.&#8221;  –Sandy, Louisiana. ";


function loadComments() {

	var currVal = document.mainForm.commentId.value;
	var str  = '<img src="images/home_cmnhdr.gif" alt="Parent Comments" width="167" height="23" id="hdr"/>';
	str = str +  '<p> '+comments[currVal]+'</p>';
		
	if (document.getElementById) {
		document.getElementById("comments").innerHTML = str;
	} else if (document.all && !document.getElementById) {
		document.all["comments"].innerHTML = str;
	}
		
}	

function writeCommentLink() {
	
	if ((document.getElementById || document.all) && comments.length > 1) {
	document.write("<a href='javascript:nextComment()'>Next Comment >></a>");
	}
}

function nextComment() {
	
	var currVal = document.mainForm.commentId.value;
	var numComments = comments.length -1;
	

	if (currVal < numComments) {
		currVal++;
		document.mainForm.commentId.value = currVal;
		loadComments();	
	} else {
		document.mainForm.commentId.value = 0;
		loadComments();
	}
}

function openVideoWindow(clip)
{
  var string = "width=320,height=240,resizable=yes,toolbar=no,status=no,location=no,scrollbars=no,left=100,top=100";
  var video = window.open(clip, 'video', string) ;
  if (window.focus) {video.focus()}
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
		if (oldonload) {
			oldonload();
		}
			func();
		}
	}
}

function openWin(url,id,height,width) {
	var x = (640 - width)/2;
	var y = (480 - height)/2;
	if (screen) {
		y = (screen.availHeight - height)/2;
		x = (screen.availWidth - width)/2;
	}
	remote = window.open(url,id,"toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+width+",height="+height+",screenX="+x+",screenY="+y+",top="+y+",left="+x)
	remote.focus();
}