// Javascript Include file copyright.js
// (c) copyright 1998 by The Othersiders Country Western Dance Club

//Fri Feb 02 21:25:59 2001
//var LastUpdate = 'Thursday, October 02, 2003';
//var DateEstablished = 'July 11, 1997'; //a Friday

var ShowUpdate = false; // (location.href.indexOf('.shtml')>0) ? 0 : 1;

var now = new Date(); 
var day = now.getDay(); 
var dayname; 
if (day==0) dayname = "Sunday";
if (day==1) dayname = "Monday";
if (day==2) dayname = "Tuesday";
if (day==3) dayname = "Wednesday";
if (day==4) dayname = "Thursday";
if (day==5) dayname = "Friday";
if (day==6) dayname = "Saturday";
var month = now.getMonth(); 

function monthname(n)
{
var mname = "unknown month";
if (n==0) mname = "January";
if (n==1) mname = "February";
if (n==2) mname = "March";
if (n==3) mname = "April";
if (n==4) mname = "May";
if (n==5) mname = "June";
if (n==6) mname = "July";
if (n==7) mname = "August";
if (n==8) mname = "September";
if (n==9) mname = "October";
if (n==10) mname = "November";
if (n==11) mname = "December";
return mname;
}
 
function WriteDate() 
{ 
	var dom = now.getDate(); 
	var year = now.getYear(); 
	if (year<2000) {year = year + 1900}; 
	document.write("<b>On " + dayname + ", " + monthname(month) + " "); 
	document.write(dom + ", " + year + "</b><br>"); 
	return true; 
} 

function WriteUntilWeHoedown(size,lastdate) 
{ 
	var lastday = new Date(lastdate); 
	var left = lastday.getTime() - now.getTime();  //milliseconds 
	left = Math.floor(left/(1000*60*60*24)); 
	left++;
	var daysinhoedown = 5
	if (left > 0) 
	{ 
		document.write("<font size=+",size,">Only " + left + " more day"); 
		if (left!=1) 
		{  
			document.write("s"); 
		} 
		document.write(" until we hoedown!</font>"); 
	} 
	else if (left>=0 && left<daysinhoedown) 
	{ 
		document.write('<font size=+',size+1,'>TODAY WE HOEDOWN!</font>'); 
	} 
	return true; 
} 

function WriteDaysAgo() 
{ 
	var firstday = new Date('July 11, 1997');  
	var left = now.getTime() - firstday.getTime();  //milliseconds 
	daysago = Math.floor(left/(1000*60*60*24)); 
	yearsago = Math.floor(daysago / 365);
	daysago  = daysago % 365;

	if (yearsago>0)
	{
		document.write(yearsago + " year"); 
		if (yearsago!=1) 
		{  
			document.write("s"); 
		} 
		document.write(" "); 
	}
	if (daysago!=0)
	{
		document.write(daysago + " day"); 
		if (daysago!=1) 
		{  
			document.write("s"); 
		} 
	}
	document.write(" ago"); 
	if (daysago==0)
	{
		document.write(', HAPPY ANNIVERSARY!!!');
	}
	return true; 
} 

function LastModDate()
{
  var lastmoddate = new Date(document.lastModified);
  var yy = lastmoddate.getYear();
  if (yy <= 1000)
	yy+=1900;
  return monthname(lastmoddate.getMonth()) + ' ' + lastmoddate.getDate() + ', ' + yy;
}


function ToUnicode(st)
{
	var u,i,n;
	u = '';
	for (i=0; i<st.length; i++)
	{
		n = "&#"+st.charCodeAt(i).toString(10)+";";
		u += n;
	}
	return u;
}


function Contact(firstname)
{
	Contact(firstname,0);
}

function Contact(firstname,dirdepth)
{
	Contact(firstname,dirdepth,"");
}

// NOTE:  set abspath to "localhost" or "server", if blank, path is calculated using dirdepth
function Contact(firstname,dirdepth,abspath)
{
	// FOR OTHERSIDERS.COM -- CHANGE HERE AND IN Email FUNCTION BELOW
	abspath = "server";

	var path;
	if (abspath=="localhost")
		path = "http://localhost/othersiders/";
	else if (abspath!="")
		path = "http://othersiders.com/";
	else
	{
		path = "";
		for (var i=0; i<dirdepth; i++)
			path += '../';
	}

	var w = window.open(path+'phpapps/contact_by_email/contact_by_email.php?key='+firstname,'msg','width=600,height=650,resizable=yes,scrollbars=yes,menubar=yes');
	w.focus();
}

function Email(firstname)
{
	Email(firstname,0);
}

function Email(firstname,dirdepth)
{
	if (dirdepth==undefined) dirdepth = 0;
	document.write('<a href="javascript:Contact(\'', firstname, '\',', dirdepth, ')" title="Click to view this e-mail address in a popup window.">', 
		'<img style="border-bottom-width : 1px;border-bottom-style : inset;border-bottom-color : black;" src="');
	for (var i=0; i<dirdepth; i++)
		document.write('../');
	document.write('phpapps/personemailname.php?key=' +firstname+ '" align=absmiddle border=0>', '</a>');
}

function EmailAddr(firstname,dirdepth)
{
	if (dirdepth==undefined) dirdepth = 0;
	
	document.write('<img src="');
	for (var i=0; i<dirdepth; i++)
		document.write('../');
	document.write('phpapps/personemailaddr.php?key=' +firstname+ '" align=absmiddle border=0>');
}

function WriteMainCopyrightTable()
{
	WriteMainCopyrightTable(0)
}

function WriteMainCopyrightTable(dirdepth)
{
  if (dirdepth==undefined) dirdepth = 0;
  document.write( '<table width=90% border=0 cellpadding=0 cellspacing=0> ');
  document.write( '<tr> ');
  document.write( '<td colspan=2><i>&copy; 1997-2004</i> <b>The Othersiders Country Western Dance Club</b>');
  document.write( ' - Member of <a href=\"http://iaglcwdc.org\" target=\"_top\">IAGLCWDC</a><br> ');
  document.write( 'All Rights Reserved<p> ');
  document.write( '<i>Post Office Box 55162<br> ');
  document.write( 'Norfolk, VA 23505-9141<br> ');
  document.write( 'USA</i><br><tt>&nbsp;</td></tr> ');
  document.write( '<tr valign=top><td>');

  document.write( 'E-mail: </td><td>General Information '); Email('osboard',dirdepth);
  document.write( '<br>Team Manager '); Email('team_manager',dirdepth);
  document.write( '<br>President and Web Site Author/Manager '); Email('charlie',dirdepth);

  document.write( '<br>&nbsp;</td></tr>');
/*
  document.write( '<tr><td></td><td align=center>');
  document.write( 'The author is a member of the following professional organizations:<p>');
  document.write( '<A HREF="http://www.hwg.org/" target="_blank" class=image><IMG SRC="gr/lo-025.gif" WIDTH="64" HEIGHT="90"   ALT="The HTML Writers Guild" TITLE="Link to The HTML Writers Guild" border=0 align=absmiddle></A>');
  document.write( '&nbsp;&nbsp;&nbsp;');
  document.write( '<xa xhref="http://www.iggw.org" target="_blank" class=image><img src="gr/iggwlogo.gif" width="150" height="150" alt="International Guild of Gay Webmasters" border=0 align=absmiddle></a>');
  document.write( '<br>&nbsp;</td></tr>');
*/
  document.write( '<tr><td colspan=2>');
  document.write( 'We have been on the web since Friday, July 11, 1997&nbsp;&nbsp;&nbsp;(');
  WriteDaysAgo();
  document.write( ')' );
  if (ShowUpdate)
    document.write( '<br>This page was last updated on ',LastModDate(),'.');
  document.write( '</tt></td> ');
  document.write( '</tr> ');
  document.write( '</table><br>&nbsp; ');
}

function WriteCopyright()
{
	WriteCopyright(0);
}
function WriteCopyright(dirdepth)
{
  if (dirdepth==undefined) dirdepth = 0;
  document.write( '<i>&copy; 1997-2004</i> <b>The Othersiders Country Western Dance Club</b><br>');
  document.write( 'All Rights Reserved<br>');
  document.write( 'Site Established: July 11, 1997<br>');
  document.write( 'Club E-mail: '); 
	Email('osboard',dirdepth);
  document.write( '<br>Webmaster: '); 
	Email('charlie',dirdepth);
  document.write( '<br>');
  if (ShowUpdate)
    document.write( 'This page was last updated on ',LastModDate(),'.');
  document.write( '<br>&nbsp;');
}

function WriteCopyrightTable()
{
	WriteCopyrightTable(0)
}

function WriteCopyrightTable(dirdepth)
{
  document.write('<table width=90% border=0 cellpadding=0 cellspacing=0><tr><td>');
  WriteCopyright(dirdepth);
  document.write('</td></tr></table>');
}
