//
/*  System Variables                      
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
	var day   = new Array("Sun","Mon","Tues","Wednes","Thurs","Fri","Satur");
	var month = new Array("January","February","March","April","May","June",
                "July","August","September","October","November","December");
	var today = new Date();
	var oneDay = 0;
	oneDay = 1000*60*60*24;


/*  Display Date Modified
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
function printLastMod() 
{
	var x = new Date (document.lastModified);
	var modDate = new Date(x.toGMTString());
	var modYear = takeYear(modDate);
	var modMonth = modDate.getMonth();
	modMonth += 1;
	document.write( modMonth + "/" + modDate.getDate() + "/" + modYear );
}

function takeYear(theDate) 
{
	var x = theDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}

function copyRight() 
{
	today = new Date();
	document.write( "&copy;" + today.getFullYear() + " Wheaten Treasures ~ Allison Iwamoto. All right reserved." );
}

function printToday(bold) 
{
	var printIt = new String(day[today.getDay()] + "day" + " &nbsp; &#149; &nbsp; " + 
					month[today.getMonth()] + " " + 
                    today.getDate() + "&nbsp;");
	if ( bold == "bold" )
	{
		document.write( "<strong>" + printIt + "</strong>" );
	} 
	else 
	{
		document.write( printIt );
	}
	
}


function popup(url, name, height, width)
{
	var popwin;
	var opts = "toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes";
	opts += ",height=" + height + ",width=" + width;
	
	popwin = window.open("", name, opts);
	popwin.focus();
	popwin.location = url;
}




//
//  Display Date Modified
//
function lastMod() {
	var x = new Date (document.lastModified);
	Modif = new Date(x.toGMTString());
	Year = takeYear(Modif);
	Month = Modif.getMonth();
	Month += 1;
	Day = Modif.getDate();
/*	var towrite = 'updated ' + Month + '-' + Day + '-' + Year; */
	var towrite = Month + '-' + Day + '-' + Year;
	return towrite;
}
function takeYear(theDate) {
	x = theDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}


// =======================================================
//   Email Spider Stumper v3.1
//    last modified 13 Oct 2005
//    Developed by Scott Clark & Kevin Duhe
//    The Source is available at http://www.clarksco.com/blog/
//    Copyright 2005 Clark Consulting
// =======================================================
//   MODIFIED for flexible domains
//      Robyn Alexander  2007-06-10
// ======================================================= 

// There are three arguments being passed into this array.
//   "theName"    =  username (or the portion of the email address prior to the @.
//   "theDomain"  =  domain   (not including .com,.net, etc)
//   "theCom"     =  com,net, edu    (defauts to com if left blank)
//   "theSubject" =  subjec for email.   Can be blank if you don't want to use this feature.
//   "theLink"    = text for the link such as "Jane Doe"  (defaultsto email address if blank)

function stumpIt(theName,theDomain,theCom,theSubject,theLink) {
	if	( theCom == "" )
	{	
		theCom = "com";
	}
	if ( theSubject == "" ) 
	{
		theSubject = document.title;
	}
	var theEmail = theName+"@"+theDomain+"."+theCom;
	var theEmailSubj = theName+"@"+theDomain+"."+theCom+"?subject="+theSubject;
	if	( theName == "" || theDomain == "" )
	{
		theName = "ERROR";
		theLink = "ERROR";
		myEmail = theName;
		myLink = theLink;
	}
	else
	{
		if (theLink == "" && theSubject == "")
		{
			myLink = theEmail;
			myEmail = theEmail;
		}
		else if  ( theLink == "" && theSubject != "")
		{
			myLink = theEmail;
			myEmail = theEmailSubj;
		}
		else if  ( theLink != ""  &&  theSubject != "" )
		{
			myLink = theLink;
			myEmail = theEmailSubj;
		}
		else if  ( theLink != ""  &&  theSubject == "" )
		{
			myLink = theLink;
			myEmail = theEmail;
		}
	}
	document.write('<a href="mailto:' + myEmail + '">' + myLink + '</a>');
}
function stumpWeb(theName,theDomain,theCom,theSubject,theLink) {
	if	( theCom == "" )
	{	
		theCom = "com";
	}
	if ( theSubject == "" ) 
	{
		theSubject = document.title;
	}
	var theEmail = theName+"@"+theDomain+"."+theCom;
	var theEmailSubj = theName+"@"+theDomain+"."+theCom+"?subject="+theSubject;
	if	( theName == "" || theDomain == "" )
	{
		theName = "ERROR";
		theLink = "ERROR";
		myEmail = theName;
		myLink = theLink;
	}
	else
	{
		if (theLink == "" && theSubject == "")
		{
			myLink = theEmail;
			myEmail = theEmail;
		}
		else if  ( theLink == "" && theSubject != "")
		{
			myLink = theEmail;
			myEmail = theEmailSubj;
		}
		else if  ( theLink != ""  &&  theSubject != "" )
		{
			myLink = theLink;
			myEmail = theEmailSubj;
		}
		else if  ( theLink != ""  &&  theSubject == "" )
		{
			myLink = theLink;
			myEmail = theEmail;
		}
	}
	document.write('<a href="mailto:' + myEmail + '" style="border-right:0px; padding-left:0px; padding-right:0px;">' + myLink + '</a>');
}




// -------------------------------------------------------------------
// randomImage
//   Used on scwtca.org to display randomimage
// -------------------------------------------------------------------
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

function randomImage ()
{
	// Set up the image files to be used.
	var theImages = new Array() // do not change this
	var theName   = new Array() // do not change this
	var theShow   = new Array() // do not change this
	var theWin    = new Array() // do not change this
	// To add more image files, continue with the
	// pattern below, adding to the array.

	theImages[0] = '20081004 SCWTCA Best Puppy Sweeps.jpg'
	theShow[0]   = '10/ 4/2008 &nbsp;&ndash;&nbsp; SCWTCA National'
	theName[0]   = 'Orion Trebol Hot On The Leader Board'
	theWin[0]    = 'Best in Puppy Sweepstakes'

	theImages[1] = '20081004 SCWTCA Best Vet Sweeps.jpg'
	theShow[1]   = '10/ 4/2008 &nbsp;&ndash;&nbsp; SCWTCA National'
	theName[1]   = 'Ch Gleanngay Keep The Faith VCD2 RN'
	theWin[1]    = 'Best in Veteran Sweepstakes'
	
	theImages[2] = '20081005 MCKC BOB.JPG'
	theShow[2]   = '10/ 5/2008 SCWTCA National ~ Montgomery County KC'
	theName[2]   = 'Ch Doubloon\'s Ultimate Player'
	theWin[2]    = 'Best of Breed'

	theImages[3] = '20081004 SCWTCA BOS Puppy Sweeps.jpg'
	theShow[3]   = '10/ 4/2008 &nbsp;&ndash;&nbsp; SCWTCA National'
	theName[3]   = 'Caraway Strike A Pose'
	theWin[3]    = 'Best Opposite Sex in Puppy Sweepstakes'

	theImages[4] = '20081004 SCWTCA BOS Vet Sweeps.jpg'
	theShow[4]   = '10/ 4/2008 &nbsp;&ndash;&nbsp; SCWTCA National'
	theName[4]   = 'Ch Kaler Kick It Up A Notch'
	theWin[4]    = 'Best Opposite Sex in Veteran Sweepstakes'

	theImages[5] = '20081005 MCKC WD.jpg'
	theShow[5]   = '10/ 5/2008 SCWTCA National ~ Montgomery County KC'
	theName[5]   = 'Greentree Real Quiet'
	theWin[5]    = 'Winners Dog'

	theImages[6] = '20081005 MCKC WB BOW.jpg'
	theShow[6]   = '10/ 5/2008 SCWTCA National ~ Montgomery County KC'
	theName[6]   = 'Keepsake Lastingimage\'s Encore'
	theWin[6]    = 'Winners Bitch ~ Best of Winners'

	theImages[7] = '20081005 MCKC RWD.jpg'
	theShow[7]   = '10/ 5/2008 SCWTCA National ~ Montgomery County KC'
	theName[7]   = 'Cameron Hunnicut'
	theWin[7]    = 'Reserve Winners Dog'

	theImages[8] = '20081005 MCKC RWB.jpg'
	theShow[8]   = '10/ 5/2008 SCWTCA National ~ Montgomery County KC'
	theName[8]   = 'Kennally Hobel\'s Work of Art'
	theWin[8]    = 'Reserve Winners Bitch'

	theImages[9] = '20081005 MCKC AOM D-Vet.JPG'
	theShow[9]   = '10/ 5/2008 SCWTCA National ~ Montgomery County KC'
	theName[9]   = 'Ch Lakkas Ustilago'
	theWin[9]    = 'Award of Merit ~ Veteran Dog ~ Stud Dog'

	theImages[10] = '20081005 MCKC BOS.JPG'
	theShow[10]   = '10/ 5/2008 SCWTCA National ~ Montgomery County KC'
	theName[10]   = 'Ch Lovesong\'s Dance To The Beat'
	theWin[10]    = 'Best of Opposite Sex'

	// theImages[7] = '20080622 SCWTCSC BISw.jpg'
	// theShow[7]   = '6/22/2008 &nbsp;&ndash;&nbsp; SCWTC Southern California'
	// theName[7]   = '---'
	// theWin[7]    = 'Best in Sweeps'

	
	var p = theImages.length;

	// var j = 0
	// var preBuffer = new Array()
	// for (i = 0; i < p; i++){
	//    preBuffer[i] = new Image()
	//    preBuffer[i].src = theImages[i]
	// }
	var whichImage = Math.floor(Math.random()*p);
	
	document.write('<img src="../images/mckc2008/'+theImages[whichImage]+'" alt="'+theName[whichImage]+'" style="width:300px; border: 1px solid #000000;" >');
	document.write('<br /><strong>'+theShow[whichImage]+'</strong><br />'+theName[whichImage]+'<br /><em>'+theWin[whichImage]+'</em>');

}



// -------------------------------------------------------------------
// nextEvent
//   Used on scwtcnc.org to display days until next major event
// -------------------------------------------------------------------
function nextEvent ()
{
		var listDate = new Array(	new Date(),
									new Date("Feb 9, 2009"),
									new Date("Feb 10, 2009"),
									new Date("Apr 10, 2009"),
									new Date("May 2, 2009"),
									new Date("May 29, 2009"),
									new Date("Jun 19, 2009"),
									new Date("Jul 24, 2009"),
									new Date("Aug 14, 2009"),
									new Date("Oct 4, 2009"),
									new Date("Dec 12, 2009"),
									new Date("Dec 13, 2009")  );

		var listName = new Array(	"",
									"the Westminster KC Dog Show in New York",
									"the Westminster KC Dog Show in New York",
									"the SCWTCNC Specialty in Sacramento",
									"the Del Val SCWTC Specialty in Philadelphia",
									"the SCWTC of Greater St Louis Specialty",
									"the SCWTCSC Specialty at Great Western in Long Beach",
									"the SCWTC of Greater Milwaukee Specialty",
									"the Greater Denver SCWTC Specialty",
									"Montgomery, the SCWTCA National Specialty in Philadelphia",
								 	"the AKC / Eukanuba Invitational in Long Beach",
									"the AKC / Eukanuba Invitational in Long Beach"  );
		
		var next = 0;
		var diffDate = new Array();
		
		for ( i=0; i<listDate.length; i++ )
		{
			diff = Math.round(.49 + ( (listDate[i].getTime() - today.getTime()) / oneDay ) );
			diffDate[i] = diff;
		}
		for ( i=0; i<listDate.length; i++ )
		{
			if ( diffDate[i] > 0  )  
			{
				next = i;
				
				/*	
				document.write("i = " + i +
							   "&nbsp;&nbsp; diffDate[i] = " + diffDate[i] +
							   "&nbsp;&nbsp; diffDate[i+1] = " + diffDate[i+1] +
							   "NEXT = " + i + "&nbsp;&nbsp;&nbsp;<br/>");                 
				*/
				
				break;

			}		
		}		

		document.write("Just " + diffDate[next] + " days until " + listName[next] + " on " 
                           + month[listDate[next].getMonth()] + " " 
                           + listDate[next].getDate() + ", " 
						   + listDate[next].getFullYear() + "&nbsp;" 
                           ); 
}




