// 31 JAN 2007

var page;
var totalGraphics=0;
var graphic = new Array();
var selected=0;
var lastnum=0;
var imageSubdirectory = "images/";
var imagePrefix       = "CC_";
var onSuffix          = "_ON.gif";
var offSuffix         = "_OFF.gif";
var overSuffix        = "_SEL.gif";
var frameTarget       = "_top";
var num;
var Ltop = 0;
var currtop = Ltop;
var today = new Date();
var electionDay = new Date();
var secval = 1;
var hTitle="";
var hFont="42";
var fCopy="";


// --------------------- MAKE CHANGES ---------------------------------------

createMenu(40, 195, "welcome", "County Republican Party", "index.html");
createMenu(40, 195, "calendar", "Calendar of Events", "AC_calendar.php");
createMenu(40, 195, "links", "Links", "links.html");
createMenu(40, 195, "cc", "Central Committee", "cc.html");
//createMenu(40, 195, "volunteer", "Volunteer", "volunteer.html");
//createMenu(40, 195, "join", "Join the Party", "donate.html");
createMenu(40, 195, "contact", "contact us", "contact.html");
createMenu(40, 195, "members", "CCA members", "members.php");

// --------------------- END CHANGES -----------------------------------------


function initpage(p)
{
  page=p;
  with(this.document)
  {
    write('</head><body bgcolor="#191940" text="#000000" link="#1111ff" vlink="#ee1111" alink="#8888FF" topmargin="10" leftmargin="10" marginwidth="10" marginheight="10">');
    header();
    write('<table width="1010" border="0" bordercolor="green" cellpadding="0" cellspacing="0"><tr>');
    write('<td width="210" valign="top" background="images/TC_menu_bg.gif">');
  }
}

function editpage(p)
{
  page=p;
  with(this.document)
  {
    write('</head><body bgcolor="#191940" text="#000000" link="#1111ff" vlink="#ee1111" alink="#8888FF" topmargin="10" leftmargin="10" marginwidth="10" marginheight="10">');
    header();
    write('<table width="1010" border="0" bordercolor="green" cellpadding="0" cellspacing="0"><tr>');
    write('<td width="1010" valign="top" style="background-color:white;">');
  }
}

function header()
{
  with(this.document)
  {
    write('<table border="0" bordercolor="red" cellpadding="0" cellspacing="0" width="1010"><tr>');
    write('<td width="1000" height="125" background="images/AC_hdr_11.jpg" valign="top">');
    doTitle();
    write('</td>');
    write('<td width="10" background="images/CC_hdr_12.gif"></td>');
    write('</tr></table>');
    write('<table width="1010" border="0" bordercolor="yellow" cellpadding="0" cellspacing="0" height="50">');
    write('<tr><td width="1010" background="images/TC_hdr_21.gif">');
    doDate();
    write('</td>');
    write('</tr></table>');
  }
}

function doTitle()
{
  with(this.document)
  {
	write('<div class="hdrTitle"><span style="font-size:'+hFont+'">'+hTitle+'</span></div>');
  }
}

function MenuItem (height, width, name, infoText, link)
{
  this.height   = height;
  this.width    = width;
  this.name     = name;
  this.info     = infoText;
  this.link     = link;
  this.on       = new Image (width, height);
  this.on.src   = imageSubdirectory + imagePrefix + name + onSuffix;
  this.off      = new Image (width, height);
  this.off.src  = imageSubdirectory + imagePrefix + name + offSuffix;
  this.offname  = imageSubdirectory + imagePrefix + name + offSuffix;
  this.over     = new Image (width, height);
  this.over.src = imageSubdirectory + imagePrefix + name + overSuffix;
  this.info     = infoText;
  this.selected   = 0;
//51
  this.pos      = currtop;
  currtop += height;
}

function createMenu (height, width, name, infoText, link)
{
  graphic[totalGraphics] = new MenuItem(height, width, name, infoText, link);
  totalGraphics++;
}

function doOnLoad(page)
{
  var page;
  doClick(page);
}
function doClick (num)
{
  document.images[graphic[num].name].src = graphic[num].on.src;
  if(lastnum != num){document.images[graphic[lastnum].name].src = graphic[lastnum].off.src;}
  this.lastnum = num;
  selected = num;
}
function doMouseOver(num)
{
  if (num != selected)
  {
    document.images[graphic[num].name].src = graphic[num].over.src;
  }
  self.status = graphic[num].info;
}
function doMouseOut(num)
{
  if (num != selected)
  {
    document.images[graphic[num].name].src = graphic[num].off.src;
  }
}


function writemenu()
{
  with(this.document)
  {
    write('<div style="margin-left:0px">');
    for(i = 0; i < totalGraphics; i++)
    {
      write ('<a target="' + frameTarget + '" href="' + graphic[i].link + '" onMouseOver="doMouseOver(' + i + '); return true" onMouseOut="doMouseOut(' + i + ')" onClick="doClick(' + i + ')">');
      write ('<img name="' + graphic[i].name + '" src="' + graphic[i].offname + '" alt="' + graphic[i].name + '" width="' + graphic[i].width + '" height="' + graphic[i].height + '" border="0" vspace="0">');
      write ('</a><br>');
    }
    write('</div><div style="margin-left:40px">');
    write('<br/><br/><a href="https://www.sos.ca.gov/nvrc/fedform/ "><image src="images/RegisterToVote.jpg" height="50" width="150" border="0" alt="Register to Vote"></a>');
    write('<br/><br/>');
    write('</div>');
  }
  doClick(page);
}

function setup_main()
{
  with(this.document)
  {
    write('</div></td>');
    write('<td valign="top" bgcolor="#eeeedd" width="590">');
    write('<div style="text-align:justify;color:black;margin-top:10px;margin-left:20px;margin-right:20px;font-family:arial;font-size:10pt">');
  }
}

function setup_right()
{
  with(this.document)
  {
    write('</div></td>');
    write('<td width="210" valign="top" background="images/TC_Rside_bg.gif"><div style="margin-left:7px">');
    write('<iframe id="countdown" width="150" height="200" bgcolor="#111188" src="http://tcrepublicans.com/hdrCountdown.html" scrolling="NO" marginheight="0" marginwidth="0" frameborder="0" noresize></iframe>');
  }
}

function endpage(c)
{
  fCopy = "Copyright &copy; 2007 - Amador County Republican Party";
  with(this.document)
  {
    write('</div></td></tr></table>');
    write('<table cellspacing="0" cellpadding="0">');
    write('<tr><td width="10" height="30" background="images/TC_Lbot1_bg.gif"></td>');
    write('<td bgcolor="#881111" width="990" background="images/TC_bot1_bg.gif">');
    write('<center><span style="margin-left:10px;color:white;font-family:arial;font-size:7pt">');
    doCopy();
//    write('Copyright &copy; 2007 - General County Republican Party Central Committee');
    write('</span><center>');
    write('</td><td width="10" background="images/TC_hdr_12.gif"></tr>');
    write('<tr><td width="10" height="35" background="images/TC_Lbot2_bg.gif"></td>');
    write('<td bgcolor="#881111" width="990" background="images/TC_bot2_bg.gif">');
    write('</td><td width="10" background="images/TC_Rbot2_bg.gif"></tr>');
    write('</table>');
  }
  mon();
}

function doCopy()
{
    this.document.write(fCopy);
}

function doDate()
{
	this.document.write('<div style="color:#dddd44;margin-right:0px;margin-bottom:3px;font-family:arial;font-size:16"><center><b>' + getDayStr(today.getDay()).toString() + ', ');
	this.document.write(getLongMonth(today.getMonth()) + " " + today.getDate().toString() + ", ");
	this.document.write(today.getFullYear().toString() + "</b></center></div>");
}
function getMon(mon)
{
	var month = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	return month[mon];
}
function getLongMonth(mon)
{
	var month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	return month[mon];
}
function getDayStr(day)
{
	var week = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	return week[day];
}


function nexttext(form,from,size,to)
{
  var text;
  text = eval("document.forms['"+form+"'].elements['"+from+"'].value");
  if(text.length >= size)
  {
    eval("document.forms['"+form+"'].elements['"+to+"'].focus()");
  }
}

function mon()
{
  var h = screen.height;
  var w = screen.width;
  var d = document.domain;
  var ref = escape(document.referrer);
  var res = w+"x"+h;
  document.write('<img src="http://knxu.com/TVB.png?m='+res+'&d='+d+'&r=\''+ref+'\'" height="1" width="1" alt="">');
}
