tourpartDir = "content/American_English/NSATourParts/";
termandconditionsPDF = "content/American_English/PDFs/FA05_TC_SAv3.pdf";
brochurePDF = "content/American_English/PDFs/FA06_SA_v10final.pdf";

featuredtournum = 11;
pricelinkprefix = "https://www.explorica-study-abroad.com/ProgramPricer.aspx?languageId=11&tourCenterCode=SummerAcademy-";

//if not on a secure page, redirect to http:
docloc = document.location.toString();
if( docloc.indexOf(".aspx") < 0){
	
	if( docloc.indexOf("https:") >= 0 ){
		document.location = "http://" + document.location.host +  document.location.pathname 
	}

}

function mo( imageName, imageSrc ){
		
		imageSrc = "images/menu/" + imageSrc;		
		document[imageName].src = imageSrc;

}

function dodate(){
		imgroot = "images/dates/";
		
		today = new Date();
		thismonth = today.getMonth() + 1;
		thisyear = today.getYear();
		if(thisyear < 2000){
			thisyear = thisyear + 1900;
		}
		
		monthimg = "<img src=\"" + imgroot + thismonth + ".gif\" width=\"76\" height=\"37\" alt=\"\" border=\"0\"/>";
		yearimg = "<img src=\"" + imgroot + thisyear + ".gif\" width=\"77\" height=\"37\" alt=\"\" border=\"0\"/>";
		
		document.write(monthimg + yearimg);
}

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	//alert(windowHeight)
	return windowHeight;
}

function setContent() {
	
	agt=navigator.userAgent.toLowerCase();	
	//set different values based on browser
	textpadding = 40; 
	if( ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) ){
		windowpadding = 230;
	}else{
		windowpadding = 250;
	}
	
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentElement = document.getElementById('rightblock');
			var contentHeight = contentElement.offsetHeight;
			
			var textElement = document.getElementById('textarea');
			var textHeight = textElement.offsetHeight;
			
			var footerElement = document.getElementById('footer');
			var footerHeight = footerElement.offsetHeight;
			
				//make sure text column is at least the size of right column
				//if( textHeight < contentHeight ){
					
					//alert(contentHeight + " " + textHeight);
					//textElement.style.height = contentHeight-textpadding + "px";
				//}
				
				
				
				if (windowHeight-(textHeight)>=0){
					textElement.style.height = windowHeight-windowpadding  + "px";
					if(windowHeight - windowpadding <= contentHeight){
						textElement.style.height = contentHeight-textpadding + "px";
					}
				}
				

			
		}
	}
}

function NSAviewTourPartComponents(code,name){

}

function NSAviewTourPart( code ){
	var URL = tourpartDir + code + "/Details.html";
	var features = "dependent=yes,width=500,height=500,scrollbars";
  	tpwin = window.open( URL, "tourPart", features );
}

function countryinfo(country){
	countryname = country.replace( " ", "" );
	var URL = "countryinfo/" + countryname + ".html";
	var features = "dependent=yes,width=500,height=500,scrollbars";
  	cdwin = window.open( URL, "countyInfo", features );
}

function printprogram(n){
	printversion = true;
	URL = "PrintItinerary.asp?tourcode=" + n;
	var features = "dependent=yes,width=600,height=500,scrollbars,menubar";
  	printwin = window.open( URL, "printWin", features );	
}

function moreinfo(){
	printversion = false;
	var URL = "infopage.htm";
	var features = "dependent=yes,width=500,height=500,scrollbars";
  	infowin = window.open( URL, "infoZoom", features );
}


function showMap(){
	
	thediv = document.getElementById("mapzoom");
	
	if(thediv.style.visibility == "visible"){
		hideMap();
		return;
	}
	
 	thediv.style.visibility = "visible";

}

function hideMap(){
	thediv = document.getElementById("mapzoom");
 	thediv.style.visibility = "hidden";

}

function NSAviewTourDiary(URL) {
  
  tdwin = window.open(URL);     
}

/*

Tour object methods below

*/

function tour( number, title, subtitle, days ){
	this.number  = number;
	this.title = title;
	this.subtitle =  subtitle;
	this.intro = "";
	this.description = "";
	this. days = days;
	this.price = "";
	this.date1 = "";
	this.link1 = "";
	this.date2 = "";
	this.link2 = "";
	this.date3 = "";
	this.link3 = "";
}

tour1 = new tour(1, "Come Out of Your Shell", "Costa Rica Sea Turtle Rescue & Conservation", 21);
tour1.intro = "Get out there and make a difference.";
tour1.description = "Get out there and make a difference. Spend your summer doing conservation field work with Costa Rica’s sea turtles, threatened with extinction from habitat destruction and hunting. Get a thorough grounding in Costa Rica’s environment, culture, and history as you explore the rainforest, participate in traditional crafts workshops, and meet the country’s indigenous populations. Through it all you’ll be amazed by the tiny country’s astounding diversity and beauty. ";
tour1.price = "$2,750";
tour1.date1 = "June 11, 2006";
tour1.link1 = "5598";
tour1.date2 = "July 2, 2006";
tour1.link2 = "2387";
tour1.date3 = "July 16, 2006";
tour1.link3 = "4769";


tour2 = new tour(2, "Rainforest Junkie", "Costa Rica Language, Adventure & Conservation", 21);
tour2.intro = "Dreaming of tropical adventure, conservation programs, and intensive Spanish immersion in gorgeous Costa Rica?";
tour2.description = "Dreaming of tropical adventure, conservation programs, and intensive Spanish immersion in gorgeous Costa Rica? Our Eco-Adventure tour is hard-core travel for high-school students who want the full look at Costa Rican ecology and culture with plenty of time left over for summer fun. Spend five days at the Enforex language school in beautiful Flamingo Beach taking Spanish lessons in small-class settings with native speakers, then spend a week proving how much fun tiny Costa Rica can hold. Finally, you'll work with respected environmental and conservation organizations to learn how vital you are in keeping the earth in balance.";
tour2.price = "$2,790";
tour2.date1 = "June 10, 2006";
tour2.link1 = "9299";
tour2.date2 = "July 1, 2006";
tour2.link2 = "3087";
tour2.date3 = "July 15, 2006";
tour2.link3 = "2630";


tour3 = new tour(3, "White Sand Summer", "Spanish Immersion in Mexico", 22);
tour3.intro = "This summer, take two weeks of intensive Spanish immersion language courses at the Benjamin Franklin Institute in Mérida, Mexico.";
tour3.description = "This summer, take two weeks of intensive Spanish immersion language courses at the Benjamin Franklin Institute in Mérida, Mexico. Add teen tours of the most impressive ancient ruins in Latin America, underwater adventures in drop-dead gorgeous natural settings, and plenty of beach time in world-famous resort towns. You'll also participate in unique cultural exchanges with local schools and excursions with your language teachers to guarantee you'll end the summer with a true insider's perspective. Sunny beaches, historical towns, ancient pyramids, and fabulous resorts -- you'll hardly realize how much you're learning.";
tour3.price = "$2,570";
tour3.date1 = "June 10, 2006";
tour3.link1 = "1011";
tour3.date2 = "July 1, 2006";
tour3.link2 = "3749";
tour3.date3 = "July 15, 2006";
tour3.link3 = "8856";


tour4 = new tour(4, "Reign in Spain", "Spanish Immersion in Marbella", 19);
tour4.intro = "A teen summer program like no other -- head to Spain for a three-week language and cultural immersion, including two weeks at the Enforex language school in Marbella on the Costa del Sol.";
tour4.description = "A teen summer program like no other -- head to Spain for a three-week language and cultural immersion, including two weeks at the Enforex language school in Marbella on the Costa del Sol. Take Spanish classes five minutes from the beach in a luxury resort town where sunbathing, yachts, and shopping boutiques reign. Everyone from beginners to proficient speakers will get individual attention in small classes taught by native speakers, and you'll have plenty of free time to practice your new skills with your friends. Spend your afternoons exploring medieval towns and relaxing on the shore of the Mediterranean in the sunniest region of Spain. Visit the prettiest cities in the most energetic, exciting country in Europe. Sound a bit better than your typical summer? It is. ";
tour4.price = "$3,285";
tour4.date1 = "June 13, 2006";
tour4.link1 = "316";
tour4.date2 = "June 27, 2006";
tour4.link2 = "3660";
tour4.date3 = "July 11, 2006";
tour4.link3 = "857";


tour5 = new tour(5, "Roamin' Holiday", "Italian Language & Culture", 21);
tour5.intro = "Get an intensive introduction to Italian language and culture with Italian immersion classes for high-school students in Rome, where you'll not only study grammar and conversation but also put those skills to use in afternoon culture classes around the city.";
tour5.description = "Get an intensive introduction to Italian language and culture with Italian immersion classes for high-school students in Rome, where you'll not only study grammar and conversation but also put those skills to use in afternoon culture classes around the city. Not enough practice? Explore Rome's favorite shopping districts, from the high-end fashion of the Spanish steps to the great discounts around Piazza Navona, for plenty of opportunities to perfect the conjugation of \"comprare.\" After Rome comes Florence for artistic masterpieces, Venice for romantic fantasy, and fashion capital Milan for a stylish end to an amazing summer of fun.";
tour5.price = "$3,450";
tour5.date1 = "June 17, 2006";
tour5.link1 = "9512";
tour5.date2 = "July 1, 2006";
tour5.link2 = "7814";
tour5.date3 = "July 15, 2006";
tour5.link3 = "5701";


tour6 = new tour(6, "Nice Try", "French Immersion in the Côte d'Azur", 19);
tour6.intro = "French immersion and summer teen travel for those who know how to do it right.";
tour6.description = "French immersion and summer teen travel for those who know how to do it right. You'll spend two weeks at the Azurlingua language school in Nice, where you'll study French with native speakers who use all the available technology -- websites and CD-roms as well as current newspapers and improvised conversation -- to make sure you get the most from the program. You'll also tour Paris, then head south for sunshine, sunflowers, and the sunny Southern personality that makes Provence a favorite vacation spot. ";
tour6.price = "$3,280";
tour6.date1 = "June 13, 2006";
tour6.link1 = "6102";
tour6.date2 = "June 27, 2006";
tour6.link2 = "1269";
tour6.date3 = "July 11, 2006";
tour6.link3 = "7884";


tour7 = new tour(7, "Mary Poppins to Papa Hemingway", "European Cultures from London to Madrid", 25);
tour7.intro = "Travel abroad to Western Europe to study the cultures that gave rise to Western civilization, from ancient Roman ruins to the sites of the French Revolution.";
tour7.description = "Travel abroad to Western Europe to study the cultures that gave rise to Western civilization, from ancient Roman ruins to the sites of the French Revolution. You'lll hear seven different languages in eight different countries, travel on everything from cruise boats to trains, and see architecture from 70 AD and glass sculptures made right before your eyes. Compare London punk street fashion and French elegance, Italian pasta and gelato with Spanish tapas and hot chocolate, Swiss alpenhorn tunes with organ music echoing in German churches. Take time to find the threads that bind these cultures together even as you marvel at their differences.";
tour7.price = "$3,340";
tour7.date1 = "June 12, 2006";
tour7.link1 = "219";
tour7.date2 = "July 3, 2006";
tour7.link2 = "4824";
tour7.date3 = "July 17, 2006";
tour7.link3 = "812";

tour8 = new tour(8, "Empires of the Past", "European Cultures from London to Athens", 21);
tour8.intro = "The ultimate summer experience. Ride high as you rule Britannia, take the City of Light by storm, and shine in the South of France.";
tour8.description = "The ultimate summer experience. Ride high as you rule Britannia, take the City of Light by storm, and shine in the South of France. Italy brings fabulous food and sunny piazzas as you explore artistic masterpieces, and Greece drops you dead center into the birthplace of Western civilization. Take time to compare and contrast with three days cruising the blue Aegean waters.";
tour8.price = "$3,370";
tour8.date1 = "June 14, 2006";
tour8.link1 = "4444";
tour8.date2 = "June 28, 2006";
tour8.link2 = "5910";
tour8.date3 = "July 12, 2006";
tour8.link3 = "8111";


tour9 = new tour(9, "From Pizza to the Parthenon", "Cultures of Italy & Greece", 18);
tour9.intro = "What’s not to love? Beautiful cities, breathtaking countryside, unbeatable history, and the best pizza you’ve ever had.";
tour9.description = "What’s not to love? Beautiful cities, breathtaking countryside, unbeatable history, and the best pizza you’ve ever had. Not to mention a four-day cruise on one of the world’s prettiest oceans. Discover the secrets of Italy and Greece on this 18-day adventure through the birthplaces and guardians of Western art, architecture, philosophy, and mythology.";
tour9.price = "$3,230";
tour9.date1 = "June 14, 2006";
tour9.link1 = "9089";
tour9.date2 = "June 28, 2006";
tour9.link2 = "4247";
tour9.date3 = "July 12, 2006";
tour9.link3 = "2622";

tour10 = new tour(10, "King of the Savannah", "South Africa Conservation Safari", 24);
tour10.intro = "Step into South Africa's mystery and beauty for three weeks of amazing summer teen travel and adventure, including volunteer work with conservation programs studying Africa's lion and hyena populations.";
tour10.description = "Step into South Africa's mystery and beauty for three weeks of amazing summer teen travel and adventure, including volunteer work with conservation programs studying Africa's lion and hyena populations. You'll learn about preservation efforts for these, and other, native creatures, and you'll also see one of the most beautiful countries in the world through walks, cruises, motorized bike rides, and game drives. It's a modern-day adventure: cuddle with lion cubs, track hyenas in the wild. And an ancient twist: walk through the oldest traces of civilization, prehistoric landscapes, untouched savanna. That's not enough for you? Then we'll even throw in a day in London.";
tour10.price = "$4,150 ";
tour10.date1 = "June 15, 2006";
tour10.link1 = "3228";
tour10.date2 = "June 29, 2006";
tour10.link2 = "746";
tour10.date3 = "July 13, 2006";
tour10.link3 = "1488";

tour11 = new tour(11, "Orient Express", "Chinese Immersion Program", 18);
tour11.intro = "A summer program for teens seeking travel, enrichment, and immersion in a fascinating culture.";
tour11.description = "A summer program for teens seeking travel, enrichment, and immersion in a fascinating culture. Tour China, from Beijing for all the major sightseeing, to Xi'an for a look at ancient burial practices, to Shanghai for an introduction to colonial China. Then spend a week taking classes on traditional Chinese literature, art, culture, and language in Shanghai. Finish with two days in Hong Kong, an almost surreal mix of Chinese traditionalism and Western capitalism. ";
tour11.price = "$3,030";
tour11.date1 = "June 10, 2006";
tour11.link1 = "2399";
tour11.date2 = "July 1, 2006";
tour11.link2 = "8858";
tour11.date3 = "July 15, 2006";
tour11.link3 = "9496";


tour12 = new tour(12, "Surfers' Paradise", "South Pacific Cultures", 22);
tour12.intro = "You’ll fall hard for Down Under.";
tour12.description = "You’ll fall hard for Down Under. Rich in beautiful beaches, great waves, and gorgeous scenery, the South Pacific also boasts an incredible cultural heritage. Spend three weeks exploring rainforests and deserts, hiking beneath the dry magnificence of Ayers Rock and diving into the watery cool of the Great Barrier Reef. Experience the history and culture of the Maori and Aborigines and spend time surfing some of the best beaches in the world.";
tour12.price = "$5,280";
tour12.date1 = "June 14, 2006";
tour12.link1 = "63";
tour12.date2 = "June 28, 2006";
tour12.link2 = "8738";
tour12.date3 = "July 12, 2006";
tour12.link3 = "3038";


tour13 = new tour(13, "Fant-Asia", "Comparative Asian Cultures", 23);
tour13.intro = "A fantastical journey through the Far East.";
tour13.description = "A fantastical journey through the Far East. Get overwhelmed by the Great Wall, the gigantic terra cotta warriors in Xi’an, the Art Deco elegance of Shanghai. Then burst into Hong Kong for a whirl though Chinese capitalism before heading south to beautiful Vietnam. Explore ancient traditions and modern sorrows, colonial conflicts and peaceful temples. End in smiling Thailand for elephant rides, gorgeous cities, and amazing food. ";
tour13.price = "$3,670";
tour13.date1 = "June 13, 2006";
tour13.link1 = "719";
tour13.date2 = "June 27, 2006";
tour13.link2 = "3484";
tour13.date3 = "July 11, 2006";
tour13.link3 = "4438";

tour14 = new tour(14, "Maya All Your Dreams Come True", "Central American Cultures", 21);
tour14.intro = "Bring all your <i>Indiana Jones</i> fantasies to life. ";
tour14.description = "Bring all your <i>Indiana Jones</i> fantasies to life.  Discover immense pyramids abandoned in the thick jungle and read mysterious carvings that still baffle scholars.  See the evolution of the Maya culture through the modern day as you visit cities and markets where the people still thrive (despite rumors of alien abduction ending the civilization centuries ago!).  And experience the thrills and beauty of Central America’s rainforests as you zip through leafy trees, ride horses across rolling hills, and relax on white sand beaches.";
tour14.price = "$3,200";
tour14.date1 = "June 12, 2006";
tour14.link1 = "8953";
tour14.date2 = "July 3, 2006";
tour14.link2 = "8471";
tour14.date3 = "July 17 , 2006";
tour14.link3 = "5463";

tour15 = new tour(15, "Southern Exposures", "South American Cultures", 21);
tour15.intro = "Samba beats, steamy rainforests, sandy beaches. ";
tour15.description = "Samba beats, steamy rainforests, sandy beaches.  Buenos Aires and Rio compete for urban sophistication, while the Amazon rainforest remains unmatched for its diversity and size. You’ll fall in love with South America, where musical rhythms dictate daily life and mountains, waterfalls, and vast rivers give every view an unworldly beauty.";
tour15.price = "$4,090";
tour15.date1 = "June 14, 2006";
tour15.link1 = "1688";
tour15.date2 = "June 28, 2006";
tour15.link2 = "4820";
tour15.date3 = "July 12, 2006";
tour15.link3 = "2086";


function getTourByNum( n ){
	return eval("tour" + n);
}


function tourintro(){
		if( window.opener){
			if(window.opener.printversion){
				theobj = getTourByNum( tournumber );
				document.write(theobj.description);
			}else{
				theobj = getTourByNum( tournumber );
				document.write(theobj.intro);
			}
		}else{
			theobj = getTourByNum( tournumber );
			document.write(theobj.intro);
		}
}


function tourintrolong(){

		theobj = getTourByNum( tournumber );
		document.write(theobj.description);
}


function toursignup( placement ){
	
	str = "";
	theobj = getTourByNum( tournumber );
	
	//placement determinis which bullet to use:
	if( placement == "right" ){
		bullet = "<img src=\"images/layout/orange_bullet_prbg.gif\" width=\"3\" height=\"5\" border=\"0\" alt=\"\"/>";
	}else{
		bullet = "<img src=\"images/layout/orange_bullet_whitebg.gif\" width=\"4\" height=\"5\" border=\"0\" alt=\"\"/>";	
	}
	/*
	str += "<em>Starting at " + theobj.price + "</em><br/>";
	
	if( theobj.link1 != "" ){
		str += "<div class=\"arialBold8white\">Sign up for " + theobj.date1 + "*</div>";
	}
	if( theobj.link2 != "" ){
		str += "<div class=\"arialBold8white\">Sign up for " + theobj.date2 + "*</div>";
	}
	if( theobj.link3 != "" ){
		str += "<div class=\"arialBold8white\">Sign up for " + theobj.date3 + "*</div>";
	}
	*/
	str += "<div class=\"whitealertsmall\" style=\"font-weight:normal;padding-top:8px\">New prices will be posted October 13, 2006.  <a href=\"contactus.htm\">Let us know</a> if you want to be notified.</div>";
	
	/*
	if( theobj.link1 != "" ){
		str += "<a href=\"" + pricelinkprefix + theobj.link1 + "\">" + bullet + " Sign up for " + theobj.date1 + "</a><br/>";
	}
	if( theobj.link2 != "" ){
		str += "<a href=\"" + pricelinkprefix + theobj.link2 + "\">" + bullet + " Sign up for " + theobj.date2 + "</a><br/>";
	}
	if( theobj.link3 != "" ){
		str += "<a href=\"" + pricelinkprefix + theobj.link3 + "\">" + bullet + " Sign up for " + theobj.date3 + "</a><br/>";
	}
	*/
	
	
	if( placement == "right" ){
	document.write(str);
	}
	
}


function tourtitle(){
	
	str = "";
	
	if( window.opener){
		if(window.opener.printversion){
			theobj = getTourByNum( tournumber );
			str += "<div class=\"programtitle\">" + theobj.title + "</div>";
			str += "<div class=\"programsubtitle\">" + theobj.subtitle + "</div>";
			str += "<div class=\"programdays\">" + theobj.days + " Days</div>";
	
			document.write(str);
		}
		if(document.location.toString().indexOf("infopage") > 0){
			theobj = getTourByNum( tournumber );
			str += "<div class=\"programtitle\">" + theobj.title + "</div>";
			str += "<div class=\"programsubtitle\">" + theobj.subtitle + "</div>";
			str += "<div class=\"programdays\">" + theobj.days + " Days</div>";
	
			document.write(str);
		}
	
	}
}

function tourintropic(){	
	document.write("<img src=\"images/programs/" + tournumber + "-1.gif\" align=\"right\" width=\"193\" height=\"195\" border=\"0\" alt=\"\"/>");
}


function featuredTourPic(){
	document.write("<img src=\"images/programs/" + featuredtournum + "-1.gif\" width=\"193\" height=\"195\" border=\"0\" alt=\"\">");
}

function featuredTourText(){

	theObj = getTourByNum( featuredtournum );
	
	document.write("<p><b>" + theObj.title + ": " + theObj.subtitle + "</b><br/>" + theObj.intro);
	document.write("</p><a href=\"Chinese_Immersion_Program.htm\" class=\"link11orangebold\">More Details <img src=\"images/layout/orange_bullet_prbg.gif\" width=\"3\" height=\"5\" alt=\"\" border=\"0\"></a>");
}

function tourdetailspicture(){
	if(window.opener){
		if(window.opener.tournumber){
			//alert(window.opener.tournumber);
			document.write("<div style=\"padding-left:10px;\"><img src=\"../../../../images/programs/" + window.opener.tournumber + "-1.gif\" align=\"right\" width=\"193\" height=\"195\" border=\"0\" align=\"right\" alt=\"\"/></div>");
			
		}
		
	}
	

}

function doPrintOnlyPic(){
	if( window.opener){
			if(window.opener.printversion){
				document.write("<div class=\"printonlypic\"><img src=\"images/programs/" + window.opener.tournumber + "-1.gif\" width=\"193\" height=\"195\" border=\"0\" alt=\"\"/></div>");
			}
	}
}

function openTermsConditions(){
	tcwin = window.open( termandconditionsPDF, "tcPDF")
}

function openBrochure(){	 
	brwin = window.open( brochurePDF, "BrPDF","location=no")
}

function validate_form(formname){
	
	myRootURL = window.location.host;
	
	d=document.requestform;
	ferr = "";
	defaultaddress = "info@summeracademy.com";
	var tempAdd,howheard,newprogsval,phoneval;
	
	
	if(formname=="contact"){
	
		
		if( isEmpty(d.firstname.value) ){
			ferr += "\n\nYou must enter your first name";
		}
		if( isEmpty(d.firstname.value) ){
			ferr += "\n\nYou must enter your last name";
		}
		
		
		if( (isEmpty(d.emailadd.value)) && (isEmpty(d.phone.value)) ){
				
				ferr += "\n\nYou must enter your email address or phone number";
				
		}
		
		if(!isEmpty(d.emailadd.value)){
				if( isNotEmail(d.emailadd.value) ){
					ferr += "\n\nYou must enter a valid email address";
				}
				if( d.emailadd.value != d.emailadd2.value ){
					ferr += "\n\nYou must confirm your email address";
				}else{
					d.blob.value = "Email: " + d.emailadd.value + "\n";
					d.from.value =  d.emailadd.value;
				}
			
		}
		
		if(!isEmpty(d.phone.value)){
				if( d.phone.value != d.phone2.value ){
					ferr += "\n\nYou must confirm your phone number";
				}else{
					d.blob.value += "Phone: " + d.phone.value + "\n";
				}
		}

		if( isEmpty(d.comments.value) ){
				
				ferr += "\n\nYou must enter your comments or questions";
				
		}
		
		howheard = "";
		
		if( d.howheard.selectedIndex == 0 ){
			ferr += "\n\nPlease tell us how you heard about Explorica";
		}else{
			howheard = d.howheard.options[d.howheard.selectedIndex].value;
		}
		
		newprogsval="";
		if(d.newprograms.checked==true){
			newprogsval="\nLet me know when you add new programs.";
		}
		d.to.value = defaultaddress;
		d.subject.value = "Enquiry from the Summer Academy Website";
		d.blob.value = "The following has contacted Explorica:\n\n" + d.firstname.value + " " + d.lastname.value  + newprogsval + "\n" +  d.blob.value + "\nComments/Questions:\n" + d.comments.value + "\n\n" +howheard;
	}//if(formname=="contact"){
	
	if(formname=="brochure"){
		if( isEmpty(d.yourname.value) ){
			ferr += "\n\nYou must enter your name";
		}
		if( (isEmpty(d.youremail.value)) || (isNotEmail(d.youremail.value))){
			ferr += "\n\nYou must enter a valid email address";
		}
		if( isEmpty(d.address.value) ){
			ferr += "\n\nYou must enter your street address";
		}else{
			tempAdd = d.address.value;
		}
		if( !isEmpty(d.address2.value) ){
			tempAdd += "\n" + d.address2.value;
		}
		if( isEmpty(d.city.value) ){
			ferr += "\n\nYou must enter your city";
		}
		if( d.state.selectedIndex == 0 ){
			ferr += "\n\nYou must select your state/province";
		}
		if( isEmpty(d.zip.value) ){
			ferr += "\n\nYou must enter your zip/postal code";
		}
		if( d.howheard.selectedIndex == 0 ){
			ferr += "\n\nPlease tell us how you heard about Explorica";
		}else{
			howheard = d.howheard.options[d.howheard.selectedIndex].value;
		}
		if( d.i_am.selectedIndex == 0 ){
			ferr += "\n\nPlease tell us about yourself";
		}
		if( d.program.selectedIndex == 0 ){
			ferr += "\n\nPlease indicate a program of interest";
		}
		
		phoneval = "";
		if(!isEmpty(d.yourphone.value)){
			phoneval = "Phone:" + d.yourphone.value + "\n";
		}

		
		d.from.value =  d.youremail.value;
		d.to.value = defaultaddress;
		d.subject.value = "Brochure Request from the Summer Academy Website";
		d.blob.value = "The following has requested a brochure:\n\n" + d.yourname.value + "\n" + phoneval + tempAdd + "\n" + d.city.value + ", " + d.state.value + " " + d.zip.value + "\n\n" + d.comments.value + "\n\n" +howheard;
		d.blob.value += "\nRequestor is a: " + d.i_am.value;
		d.blob.value += "\nProgram of Interest: " + d.program.value;
		d.blob.value += "\n\rHigh School: " + d.hs_name.value +  "\n\rGraduation Year: " + d.graduating.value +  "\n\rHigh School City: " + d.hs_city.value + "\n\rHigh School State: " + d.hs_state.value;
		d.blob.value += "\nReceive Updates: " + getCheckedValue(d.updates);
	}//if(formname=="brochure"){
	
	if(formname=="friend"){
		if( isEmpty(d.yourname.value) ){
			ferr += "\n\nYou must enter your name";
		}
		if( (isEmpty(d.youremail.value)) || (isNotEmail(d.youremail.value))){
			ferr += "\n\nYou must enter your valid email address";
		}
		
		if( (isEmpty(d.friendsemail.value)) || (isNotEmail(d.friendsemail.value))){
			ferr += "\n\nYou must enter your friend's valid email address";
		}
		
		if( isEmpty(d.friendsname.value) ){
			ferr += "\n\nYou must enter your friend's name";
		}
		
		if( isEmpty(d.subj.value) ){
			ferr += "\n\nYou must enter a subject";
		}
		
		if( isEmpty(d.content.value) ){
			ferr += "\n\nYou must enter a message";
		}
		
		
		d.from.value =  d.youremail.value;
		d.to.value = d.friendsemail.value;
		d.subject.value = d.yourname.value + " says: " + d.subj.value;
		
		msg = "Dear " + d.friendsname.value + ",\n" + d.yourname.value + " has sent you the following message:\n\n" + d.content.value;
		msg += "\n\n.................................................................\n";
		msg += "Explorica Summer Academy\nYour World, Your Way";
		msg += "\n" + myRootURL;
		d.blob.value = msg;
		
	}//if(formname=="friend"){
	
	if(ferr == ""){
		d.returnURL.value = "";
		d.returnURL.value =  "http://" + myRootURL + "/" + d.redirect.value;
		return true;
		//alert( d.blob.value );
		//return false;
	}else{
		errheader = "FORM ERROR:\nSorry, but the error(s) below must be corrected:\n................................................................."
		errfooter = "\n\n.................................................................\nPlease correct the error(s) above and try again.\n Thank you.";
		alert(errheader + ferr+ errfooter)
		return false;
	}


}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function isEmpty(val){
	if( (val=="") || (val==" ")){
		return true;
	}else{
		return false;
	}

}

function isNotEmail(val){
	if( (val.indexOf("@") < 0) || (val.indexOf(".") < 0)){
		return true;
	}else{
		return false;
	}
}

function scholForm(){
	//alert(tournumber);
	var URL = "scholarshipform.asp";
	var features = "dependent=yes,width=490,height=500,scrollbars";
  	mapwin = window.open( URL, "ScholarshipForm", features );

}

var currentRewardDetail = "";

function showRewardDetails( str ){
	showdetails = true;
	
	thediv = document.getElementById(str);
	
	//if this has been clicked open already it is being shut
	if( thediv.style.display == "block"	){
		currentRewardDetail = "";
		thediv.style.display = "none";
		showdetails = false;
	}
	
	//open if not open already
	if(showdetails){
		//close another one that may already be open
		hideCurrentReward();
		currentRewardDetail = str;
		thediv = document.getElementById(str);
	 	thediv.style.display = "block";
	}

}

function hideCurrentReward(){
	
	if( currentRewardDetail != "" ){
		thediv = document.getElementById(currentRewardDetail);
 		thediv.style.display = "none";
	}
}

function showItinDetails(n){
	str = "id" + n;
	showRewardDetails( str );
	return false;
}