/************************************************************

	This file has all the JS bells and whistles
			   for
		richard esmonde web design
	      http://www.richardesmonde.com

	If you are stealing stuff, go ahead
	but do something nice for some stranger.

	Sloppyright: richard esmonde 2003.

*************************************************************/

var days = new Array(7);
	days[0] = "Sunday";
	days[1] = "Monday";
	days[2] = "Tuesday";
	days[3] = "Wednesday";
	days[4] = "Thursday";
	days[5] = "Friday";
	days[6] = "Saturday";



var months = new Array(12);
	months[0] = "January";
	months[1] = "February";
	months[2] = "March";
	months[3] = "April";
	months[4] = "May";
	months[5] = "June";
	months[6] = "July";
	months[7] = "August";
	months[8] = "September";
	months[9] = "October";
	months[10] = "November";
	months[11] = "December";

var now = new Date();
var todaysday = now.getDay();
var todaysdate = now.getDate();
var presentmonth = now.getMonth();
var presentyear = now.getFullYear();
var currentyear = presentyear.toString();


function todaysDate() {
	document.write(days[todaysday] + ", " + months[presentmonth] + " " + todaysdate + ", " + currentyear);
}

/* And as a function for call within HTML: yields Copyright Year */
function perAnnum() {
 document.write(currentyear);
 }


//  2 Image PreLoads for arrow navigation buttons

var arrowpics = new Array();
    arrowpics[0] = new Image(14,15);
    arrowpics[0].src = "images/whiteforwardIcon.gif";
    arrowpics[1] = new Image(14,15);
    arrowpics[1].src = "images/greenforwardIcon.gif";


function flick(pic, n) {

switch(pic) {

case 'services':
	document.services.src = arrowpics[n-1].src;
	break;

case 'guesstimate':
	document.guesstimate.src = arrowpics[n-1].src;
	break;

case 'contact':
	document.contact.src = arrowpics[n-1].src;
	break;

case 'resume':
	document.resume.src = arrowpics[n-1].src;
	break;
	
case 'livesite':
	document.livesite.src = arrowpics[n-1].src;
	break;	

	}
}




function ChgTD(element, bkgndclr, txtcolor, pic_index)
{
	element.style.backgroundColor = bkgndclr;	// for the background
	element.style.color = txtcolor;			// for the text, works in IE, Netscape and Opera browsers
}




// Home Page random images
var photos = new Array();

        photos[0] = new Image(322,416);
        photos[0].src = "photos/richard.jpg";
        photos[1] = new Image(322,462);
        photos[1].src = "photos/celtic.jpg";
        photos[2] = new Image(322,354);
        photos[2].src = "photos/nyc3.jpg";
        photos[3] = new Image(322,330);
        photos[3].src = "photos/nyc4.jpg";
        photos[4] = new Image(322,448);
        photos[4].src = "photos/nyc5.jpg";
        photos[5] = new Image(322,457);
        photos[5].src = "photos/joshua1.jpg";
        photos[6] = new Image(322,441);
        photos[6].src = "photos/joshua2.jpg";
        photos[7] = new Image(322,390);
        photos[7].src = "photos/joshua3.jpg";
        photos[8] = new Image(322,324);
        photos[8].src = "photos/thai1.jpg";
        photos[9] = new Image(322,431);
        photos[9].src = "photos/mydoor.jpg";
        photos[10] = new Image(322,387);
        photos[10].src = "photos/sf1.jpg";


// Random Number Generator
var now = new Date();
var seed = now.getTime()%0xffffffff;

function rand(n) {
        seed = (0x015a4e35*seed)%0x7fffffff;
        return(seed >>16)%n;
        }

function activate()
 {

 	var m = photos.length;
        document.photograph.src = photos[rand(m)].src;
   //     setTimeout("activate()", 12500);
 }


 function teigh()
 {
 	type_text();
 	activate();
 }

/*
 * Next two functions used on resume page
 * for printing resume' in various formats
 */

function selectFormat(theFormatChoice)
{
 document.location.href = theFormatChoice;
}

// resets the menu selectionS (top n' bottom of page) upon loading resume' page
function resetPrintSelection() {
 document.resumeformats.clientschoiceTop.selectedIndex = 0;
 document.resumeformats.clientschoiceBtm.selectedIndex = 0;
}

/*
function openFenetre(uri)
{
	var newWin = window.open("uri", "Portfolio Sample", "status, scrollbar=yes, resizeable=yes, 640, 480");
}
*/

function pwin(winurl, wd, ht) {
var featureset = "width="+wd+",height="+ht+",scrollbars=yes,resizable=yes,menubar=no";
var popupwindow = window.open(winurl,"", featureset);
popupwindow.focus();
}


