

// Memorial 2005 Javascript File

function GetDateInfo() {
	dArray     = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
	mArray     = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	today      = new Date();
	Year       = today.getFullYear();
	MonthNum   = today.getMonth();
	Month      = mArray[ MonthNum ];
	DayNum     = today.getDate();	
	WkDay      = dArray[ today.getDay() ];
	Hours      = today.getHours();
	Minutes    = today.getMinutes();
	Seconds    = today.getSeconds();
	Offset     = today.getTimezoneOffset();
	OSTime     = today.getTime();
	if (Year < 1000)     { Year += 1900 }
	if ( MonthNum < 10 ) { MonthNum = "0" + MonthNum } 		
	if ( DayNum < 10 )   { DayNum = "0" + DayNum } 	
	if ( Hours >= 12 )   {  Hours -= 12; AmPm = "PM"; } else { AmPm = "AM" }
	if ( Hours == 0 )    { Hours = 12 }
	if ( Minutes < 10 )  { Minutes = "0" + Minutes }
	if ( Seconds < 10 )  { Seconds = "0" + Seconds }					
}
    
function MakeDate(dateType) {
   GetDateInfo();
	Month = MonthNum + 1;
	if ( DayNum < 10 )   { DayNum = "0" + DayNum }
	if ( MonthNum < 10 ) { MonthNum = "0" + MonthNum }
	if ( Hours < 10 )    { Hours = "0" + Hours }
	if ( Minutes < 10 )  { Minutes = "0" + Minutes }
	if ( Seconds < 10 )  { Seconds = "0" + Seconds }
    
	var theDate   = ( Month + "/" + DayNum + "/" + Year );
	var theTime   = ( Hours + ":" + Minutes + ":" + Seconds );
	var dateStamp = ( theDate + " \@ " + theTime );
    
	if ( dateType == "dateOnly" ) { return theDate }
	if ( dateType == "timeOnly" ) { return theTime }
	if ( dateType == "dateTime" ) { return dateStamp }
}

function MakeClock( clockID ) {
	GetDateInfo();	
   var clock = WkDay + " " + DayNum +" " + Month + " " + Year + " | " + Hours + ":" + Minutes + " " + AmPm;
	document.getElementById( clockID ).innerHTML = clock;
}

function MakeTimer( yr,mn,dy,timerID,timerMsg ) {
	GetDateInfo();
   var timerdone  = "Have Fun! Play Well!";
   var todaydate  = Month + " " + DayNum + ", " + Year + " " + Hours + ":" + Minutes + ":" + Seconds;
   var futuredate = mArray[mn-1] + " " + dy + ", " + yr;
   var dd         = Date.parse(futuredate) - Date.parse(todaydate);
   var dday       = Math.floor(dd/(60*60*1000*24)*1);
   var dhour      = Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);
   var dmin       = Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
   var dsec       = Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);
   if ( dday<=0 && dhour<=0 && dmin<=0 && dsec<=1 ) { 
   	var timercount = timerMsg;
   } else {
      if ( dday < 10 )  { dday = "00" + dday } else if ( dday < 100 ) { dday = "0" + dday }
      if ( dhour < 10 ) { dhour = "0" + dhour }
      if ( dmin < 10 )  { dmin = "0" + dmin }
      if ( dsec < 10 )  { dsec = "0" + dsec }
      var timercount  = dday + "D : " + dhour + "H : " +  dmin + "M : " +  dsec + "S";
   }
   document.getElementById( timerID ).innerHTML = timercount;
}

function DocStamp( FB ) {
    document.write( "<DIV><P CLASS=\"m3\">" );
    document.write( "Last Update:   " + document.lastModified + "&nbsp;&nbsp;&nbsp;" );
    document.write("&copy; 2010/2011 ");
    if ( FB ) {
        document.write( "<A HREF=\"javascript:PopUpWindow(\'http://disqman.com/" + 
        "feedback.html\',\'feedback\',\'610\',\'535\')\">DISQMAN.COM</A> All " +
        "Rights Reverved.");
    } else {
        document.write( "DISQMAN.COM - All Rights Reverved.");
    }
    document.write( "</P></DIV>" );
}

function PopUpWindow( winURL, winName, winWidth, winHeight ) {
    var hzPos      = ( (screen.availWidth / 2) - (winWidth / 2) );
    var vtPos      = ( (screen.availHeight / 2) - (winHeight / 2) );
    var winProps   = "width=" + winWidth + "," + 
                     "height=" + winHeight + "," +
                     "screenX=" + hzPos + "," +
                     "screenY=" + vtPos + "," +
                     "left=" + hzPos + "," + 
                     "top=" + vtPos + "," +
                     "scrollbars" + "," +
                     "resizable";
    window.open( winURL,winName,winProps );
}

function HomeAlert() {
	var msgAlert = "As of January, 26, 2009, Registration is closed. The player field is full.\n\n"+
    "If you would like to be placed on the wait list, complete a Mail-in Registration Form\n"+
    "and send it in, with your registration fees included, as soon as possible. Names will\n"+
    "be placed on the list on a first-come-first-serve basis.\n\n"+
    "Your entry fees will not be processed unless you are added to the player field. If you\n"+
    "you do not make it into the tournament, your check or money order will be destroyed\n"+
    "or returned to you upon request.";
	alert( msgAlert )
}

function LoadSponsorData() {
	//<![CDATA[
	  window.addEvent('domready', function(){
	    var data = {	
	      'sb-dgu.jpg': { href: 'http://spinnersdiscgolf.com' }, 
	      'sb-pdga.jpg': { href: 'http://pdga.com' },
	      'sb-rsaa.png': { href: 'http://rsautoarts.com' },
	      'sb-fhtown.jpg': { href: 'http://www.fh.az.gov/' },
		  'sb-disqman.jpg': { href: 'http://disqman.com/' },
		  'sb-fallputt.png': { href: 'http://fallingputt.com/' },
		  'sb-skyline.png': { href: 'http://www.skylinediscgolf.com/' }
	    };
	    var myShow = new Slideshow('sponsors', data, {controller: false, height: 145, width: 145, hu: 'images/sidebar/', thumbnails: false, random: true, delay: 2750 });
	  });
	//]]>
}

function LoadDynamicInfo() {
	LoadSponsorData();
}
