var theme;

function setTheme(maintheme){

theme=maintheme;

}

function getTheme(){

return window.top.theme;

}


function newImage(arg) {

	if (document.images) {

		rslt = new Image();

		rslt.src = arg;

		return rslt;

	}

}



var preloadFlag = false;

function preloadImages(theme) {



var dir;

	if (theme=="winter")

	{

		dir="images/winter/";		

	}

	else {dir="images/";}

	



	if (document.images) {	

		home_00_over = newImage(dir+ "home_00-over.gif");

		home_02_over = newImage(dir+ "home_02-over.gif");

		home_04_over = newImage(dir+ "home_04-over.gif");

		home_06_over = newImage(dir+ "home_06-over.gif");

		home_08_over = newImage(dir+ "home_08-over.gif");

		home_10_over = newImage(dir+ "home_10-over.gif");

		home_12_over = newImage(dir+ "home_12-over.gif");

		home_14_over = newImage(dir+ "home_14-over.gif");

		home_16_over = newImage(dir+ "home_16-over.gif");

		home_18_over = newImage(dir+ "home_18-over.gif");

		home_20_over = newImage(dir+ "home_20-over.gif");

		home_22_over = newImage(dir+ "home_22-over.gif");

		img1 = newImage(dir+ "contentbg.jpg");

		img2 = newImage(dir+ "rborder1.gif");

		img3 = newImage(dir+ "lborder1.gif");

		

		preloadFlag = true;

	}

}



var button_clicked;



function flipOver(img,dir)

{

	fname=document[img].src;	

	if (fname.indexOf("-over")!=-1 && button_clicked!=img)

	{

	document[img].src = dir+ "/" + img+ ".gif";

	}

	else

	{

	document[img].src = dir+ "/" + img+ "-over.gif";

	}

	

	

}





function flipPrevious(imgclk,dir)

{

	for (i=2;i<=22;i+=2)

	{

		if (i<10){ prefix="home_0";}

		else { prefix="home_";}

		img= new String(prefix+ i);	

		if (document[img])

		{

		document[img].src = dir+ "/" +img+ ".gif";		

		}

	}		

	if (document[img])

	{

	document[imgclk].src = dir+ "/" +imgclk + "-over.gif";	

	}

	button_clicked=imgclk;

	

}





function refreshPage(nodename,cont,quote) {

			



	if (nodename=="")

	{

		nodename="about";

	}

	//checking if the theme has changed

	var text = location.search.substring(1); 

	if (text.indexOf("theme=")!=-1)

	{

		theme = text.substring(text.indexOf("theme="));

		if (theme!="")

		{

		nodename= nodename + "&" + theme;

		}

	}

	//alert(nodename);

	

	if (cont=='true')

	{		

		parent.contentframe.location.replace("content.xml?nodename=" + nodename + "&special=true");

	}

	if (quote=='true')

	{

		window.top.frames.quoteframe.location.replace("quote.xml?nodename=" + nodename);

	}

	if ((cont!="true" && quote!="true") || (cont==null && quote==null))

	{

		

		parent.linksframe.location.replace("links.xml?nodename=" + nodename);

		

		parent.quoteframe.location.replace("quote.xml?nodename=" + nodename);



		parent.contentframe.location.replace("content.xml?nodename=" + nodename + "&special=true");	

	}

	

}





function loadFrames()

{



var newurl = ".xml?nodename=home";

var text = location.search.substring(1); 

	if (text.indexOf("theme=")!=-1)

	{

	theme = text.substring(text.indexOf("theme="));

	if (theme!="")

	{

	newurl= newurl + "&" + theme;

	}

	}



parent.quoteframe.location.replace("quote" + newurl);



parent.linksframe.location.replace("links" + newurl);



parent.contentframe.location.replace("content" + newurl);

}



/*

function openPopup(dest,title)

{

var width=400;

var height=300;

var left = screen.width / 2 - (width / 2);

var top = screen.height / 2 - (height / 2);



popWin=window.open(dest,title,"width=" + width +",height=" + height + ",menubar=no,status=no,scrollbars=1,resizable=no,toolbar=no,location=no,directories=no,left =" + left + ",top =" + top);

popWin.focus();

}

*/



function openPopup(dest,title,pwidth,pheight)

{

var width=pwidth;

var height=pheight;



if (width==null) width=400;

if (height==null) height=300;



var left = screen.width / 2 - (width / 2);

var top = screen.height / 2 - (height / 2);



popWin=window.open(dest,title,"width=" + width +",height=" + height + ",menubar=no,status=no,scrollbars=1,resizable=no,toolbar=no,location=no,directories=no,left =" + left + ",top =" + top);

popWin.focus();

}



function goToPage(url){

parent.contentframe.location.replace(url);

}

var to;



function divHide(divname)

{

  	//eval("document.all." + divname + ".style.visibility='hidden'") ;

	if(document.layers){

            //thisbrowser="NN4";

            eval("document." + divname + ".visibility='hidden'");

        }

        if(document.all){

            //thisbrowser="ie"

            eval("document.all." + divname + ".style.visibility='hidden'") ;

        }

        if(!document.all && document.getElementById){

            //thisbrowser="NN6";

            eval("document.getElementById('" + divname + "').style.visibility='hidden'");



        }

}





function divShow(divname)

{

  	//eval("document.all." + divname + ".style.visibility='visible'") ;

	if(document.layers){

            //thisbrowser="NN4";

            eval("document." + divname + ".visibility='visible'");

        }

        if(document.all){

            //thisbrowser="ie"

            eval("document.all." + divname + ".style.visibility='visible'") ;

        }

        if(!document.all && document.getElementById){

            //thisbrowser="NN6";

            eval("document.getElementById('" + divname + "').style.visibility='visible'");



        }

}



function divHideDisp(divname)

{

	//eval("document.all." + divname + ".style.display='none'") ;

	if(document.layers){

            //thisbrowser="NN4";

            eval("document." + divname + ".display='none'");

        }

        if(document.all){

            //thisbrowser="ie"

            eval("document.all." + divname + ".style.display='none'") ;

        }

        if(!document.all && document.getElementById){

            //thisbrowser="NN6";

            eval("document.getElementById('" + divname + "').style.display='none'");

        }

}



function divDisplay(divname)

{

	//eval("document.all." + divname + ".style.display='inline'") ;

	if(document.layers){

            //thisbrowser="NN4";

            eval("document." + divname + ".display='inline'");

        }

        if(document.all){

            //thisbrowser="ie"

            eval("document.all." + divname + ".style.display='inline'") ;

        }

        if(!document.all && document.getElementById){

            //thisbrowser="NN6";

            eval("document.getElementById('" + divname + "').style.display='inline'");

        }

}



var nodenum=1;



function loadPhoto(direction,theme){





if (direction==0) nodenum--;

if (direction==1) nodenum++;

if (nodenum==0) nodenum=1;

var text = window.photoframe.location.search.substring(1); 

//alert("text : " + text);





if (text.indexOf("seas")!=-1){

	if (text.indexOf("nodenum")==-1){

	endindex="";}

	else {endindex=text.indexOf("&nodenum");}	

	if (endindex==""){	

	season = text.substring(text.indexOf("seas"));

	}

	else{

	season = text.substring(text.indexOf("seas"),endindex);

	}

}



window.photoframe.location.replace("galleryframe.xml?" + season + "&theme=" + theme + "&nodenum=" + nodenum);





//alert("num is " + nodenum);

}





function loadPhotoSeas(season,theme){

nodenum=1;

window.photoframe.location.replace("galleryframe.xml?seas="+ season + "&theme=" + theme + "&nodenum=1");

}



function resetNode(node,count){

//alert("node & cnt " + node +'&' + count);

if (node == count){ parent.nodenum=0;}

}



function refreshNode(bool)

{

if (bool=='true')

{parent.nodenum=1;}



}



function openPopupProgram(dest,title)

{

var width=425;

var height=440;

var left = screen.width / 2 - (width / 2);

var top = screen.height / 2 - (height / 2);

popWin=window.open(dest,title,"width=" + width +",height=" + height + ",menubar=no,status=no,scrollbars=1,resizable=no,toolbar=no,location=no,directories=no,left =" + left + ",top =" + top);

popWin.focus();

}





function openEventPopup(dest,title)

{

var width=400;

var height=300;

var left = screen.width / 2 - (width / 2);

var top = screen.height / 2 - (height / 2);

popWin=window.open(dest,title,"width=" + width +",height=" + height + ",menubar=no,status=no,scrollbars=yes,resizable=no,toolbar=no,location=no,directories=no,left =" + left + ",top =" + top);

popWin.focus();

}



function getMonth(){

if(months==1){ months="January "; }

else if(months==2){ months="February "; }

else if(months==3){ months="March "; }

else if(months==4){ months="April "; }

else if(months==5){ months="May "; }

else if(months==6){ months="June "; }

else if(months==7){ months="July "; }

else if(months==8){ months="August "; }

else if(months==9){ months="September "; }

else if(months==10){ months="October "; }

else if(months==11){ months="November "; }

else if(months==12){ months="December "; }

return months;

}



function getWeek(week){



if(week=="Sunday"){ d=0; }

else if(week=="Monday"){ d=1; }

else if(week=="Tuesday"){ d=2; }

else if(week=="Wednesday"){ d=3; }

else if(week=="Thursday"){ d=4; }

else if(week=="Friday"){ d=5; }

else if(week=="Saturday"){ d=6; }

return d;

}



//old site compatible

 function changeimg(orig,dest) 

 {

 	orig.src = "images/" +dest+".gif";

 }

 

 function loadUrl(url,frame) { 

	eval("window.top.frames."+ frame + ".location.replace('" + url + "')");			



}





function validateContact(){

var count = 0;

	for (i=0;i < arguments.length;i++)

	{

	str= eval("document.main." + arguments[i] + ".value.replace (/\s/g, '')");

		if ((str=="") || (str==" "))

		{

		eval("document.main." + arguments[i] + ".focus()");

		window.alert("Please enter your first and last names and a valid email address");

		return false;

		}

	}

return true;

}

var fieldstocheck = new Array();
    fieldnames = new Array();

function checkform() {
  for (i=0;i<fieldstocheck.length;i++) {
    if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
      alert("Please enter your "+fieldnames[i]);
      eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
      return false;
    }
  }
  return true;
}
function addFieldToCheck(value,name) {
  fieldstocheck[fieldstocheck.length] = value;
  fieldnames[fieldnames.length] = name;
}


