/*This code belogs are the java script functions for zilda-massage.com*/
/*author: Brian Freeman*/
/*Last Updated: 8/15/08*/


//Date Selector functions and variable. 
var today=new Date();
today.setDate(today.getDate());

var ThisMonth=today.getMonth();
var ThisDay=today.getDate();
var ThisYear=today.getFullYear();
var ThisHour=today.getHours();
var ThisMinutes=today.getMinutes();
var Month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var SetMonth;
var SetDay;
var SetYear;


function Selector(val, name, def)
{
document.write("<option value=" +val+ " " +def+ ">" +name+ "</option>");
}


function MonthSelect()
{

	document.write("<select>");

	for(i=0;i<=11;i++)
	{
		if(i==ThisMonth)
		{
		Selector(ThisMonth,Month[i],'selected')
		}
		else
		{
		Selector(i,Month[i]);
		}

	}
	document.write("</select>");

SetMonth=document.getElementsByTagName("value");

}

function DaySelect()
{
document.write("<select>");
for(i=1;i<=31;i++)
{
	if(i==ThisDay)
	{Selector(ThisDay,ThisDay,'selected');
	document.write("Today is "+ThisDay);
	}
	else
	{
	Selector(i,i);
	}
}
document.write("</select>");
}

function YearSelect()
{
	document.write("<select>");
	for(i=ThisYear;i<=ThisYear+5;i++)
	{Selector(i,i);}
	document.write("</select>");
}

function DateSelect()
{
MonthSelect();
DaySelect();
YearSelect();

document.write(SetMonth[1]);

}


//End Date Selector



//make links
function link(name,location, target)
{document.write("<a href="+location+" target="+target+">"+name+"</a>");}


//make tags
function tag(tag)
{
document.write("<"+tag+">");
}

function string(string)
{document.write(string);}


//Begin Tabbed Menu Functions
//I used this in one version of the site and did not take these functions out

var tp = [];
var tpl = [];

function tpSet(i, c) {
if (document.createElement) {
	var e = document.getElementById(i);
	var l = document.createElement('ul');
	var p = document.createElement('div');
	e.className = l.className = p.className = c;

	var a, j, t;
	for (j = 2; j < arguments.length; j++) {
		c = document.getElementById(t = arguments[j]);
		tp[t] = c.parentNode.removeChild(c);

		a = l.appendChild(document.createElement('li'));
		a.className = c.className;
		tpl[t] = a = a.appendChild(document.createElement('a'));
		a.setAttribute('href', 'javascript:tpShow(\''+i+'\', \''+t+'\');');
		a.appendChild(document.createTextNode(c.getAttribute('title')));
	}

	p.appendChild(tp[arguments[2]]);
	tpl[arguments[2]].className = 'active';

	while (e.firstChild) e.removeChild(e.firstChild);
	e.appendChild(l);
	e.appendChild(p);
}}


function tpShow(e, p) {
	e = document.getElementById(e).lastChild;
	tpl[e.replaceChild(tp[p], e.firstChild).getAttribute('id')].className = null;
	tpl[p].className = 'active';
}



//Changing Background onload.
//This is something else I was playing around with that is not used in the current site
/*function ChangingBackground(){

var randnum = Math.floor(Math.random()*11);

background=new Array();

background[0] = "background: transparent url(Zilda_files/Bamboo.GIF) no-repeat center center fixed;";
background[1] = "background: transparent url(Zilda_files/WaterFall_1.GIF) no-repeat center center fixed;";
background[2] = "background: transparent url(Zilda_files/Palms_1.GIF) no-repeat center center fixed;";
background[3] = "background: transparent url(Zilda_files/Palm_2.GIF) no-repeat center center fixed;";
background[4] = "background: transparent url(Zilda_files/bamboo_forest_1.GIF) no-repeat center center fixed;";
background[5] = "background: transparent url(Zilda_files/bamboo_forest_2.GIF) no-repeat center center fixed;";
background[6] = "background: transparent url(Zilda_files/WaterFall_2.GIF) no-repeat center center fixed;";
background[7] = "background: transparent url(Zilda_files/bamboo_road.GIF) no-repeat center center fixed;";
background[8] = "background: transparent url(Zilda_files/Brazil.GIF) no-repeat center center fixed;";
background[9] = "background: transparent url(Zilda_files/brazil_1.GIF) no-repeat center center fixed;";
background[10] = "background: transparent url(Zilda_files/Brazil_2.GIF) no-repeat center center fixed;";


document.write("<style type='text/css'>");
document.write("body{"+background[randnum]+"}");
document.write("</style>");
}*/



//Menubar Function
//These are the images for the main menu bar
function menu(){
string(' <td class="sections">');
string(' <a href="index.htm"><img src="Zilda_files/zilda_bamb_grad4_home.gif"></a>  ');  
string(' <a href="aboutus.htm"><img src="Zilda_files/zilda_bamb_grad4_aboutus.gif"></a>  ');  
string(' <a href="contact.htm"><img src="Zilda_files/zilda_bamb_grad4_contact.gif"></a>  ');  
string(' <a href="services.htm"><img src="Zilda_files/zilda_bamb_grad4_services.gif"></a>  ');
string(' <a href="policies.htm"><img src="Zilda_files/zilda_bamb_grad4_policies.gif"></a>  ');
string(' </td>');

}

//Begin Endpage Function
//This is the end of the page footer
function endpage()
{
string('<br>');
tag('dl');
string('<table  style=" text-align: center; margin-left: auto; margin-right: auto;">');
tag('tbody');
tag('tr');
tag('td id="end"');
string('<a href="index.htm">Home</a> | ');
string('<a href="aboutus.htm">About Us</a> | ');
string('<a href="contact.htm">Contact</a> | ');
string('<a href="services.htm">Services</a> | ');
string('<a href="MassageandBody.htm">Massage and Body</a> | ');
string('<a href="SkinandWax.htm">Skin Care and Waxing</a> | ');
string('<a href="SpaPackages.htm">Spa Packages</a> | ');
string('<a href="NailCare.htm">Natural Nail Care</a> | ');
string('<a href="ServiceExtras.htm">Additional Services</a> | ');
string('<a href="policies.htm">Policies</a>');
//Change the below email address
string('<br>This page is maintained by : <a href="mailto:bfreeman91080@hotmail.com">Zilda Webmaster</a>  | Design by: Brian Freeman');
string('-last updated on : '+ document.lastModified+'');
tag('/td');
tag('/tr');
string('<tr id="EndZilda">');
string('<td>');
string('<strong>Zilda Brazilian Spa</strong>, 5215 George Washington Memorial Highway, Yorktown, VA 23692 <strong>(757)-234-4099</strong>');
tag('/td');
tag('/tr');
tag('/tbody');
tag('/table');
tag('/dl');
string('<br>');
}

function favicon()
{
string('<link rel="icon" href="Zilda_files/zilda_favicon_16x16.gif">');
}
