﻿/*

        Filename:          script.js
        Description:       Javascript functions
        Client:            Red Cross - Reno County Kansas
        Author:            Steven Dahlman, DCM Software
        Start date:        07-16-07
        Last modification: 12-23-09

*/

//
// Function:    date_options
//
// Description: Display date options in SELECT element
//
// Input:
// part = 1 to display months, January to December
//      = 2 to display dates, 1 to 31
//
// Return code:
//  0 = Success
// -1 = Invalid argument
//
function date_options (part) {

	var counter;

	if ( part == 1 ) {

		// Display month (January-December)

		document.write('<OPTION value="January">January</OPTION>');
		document.write('<OPTION value="February">February</OPTION>');
		document.write('<OPTION value="March">March</OPTION>');
		document.write('<OPTION value="April">April</OPTION>');
		document.write('<OPTION value="May">May</OPTION>');
		document.write('<OPTION value="June">June</OPTION>');
		document.write('<OPTION value="July">July</OPTION>');
		document.write('<OPTION value="August">August</OPTION>');
		document.write('<OPTION value="September">Septmber</OPTION>');
		document.write('<OPTION value="October">October</OPTION>');
		document.write('<OPTION value="November">November</OPTION>');
		document.write('<OPTION value="December">December</OPTION>');

	} else if ( part == 2 ) {

		// Display date (1-31)

		for ( counter = 1; counter <= 31; counter ++ ) {

			document.write('<OPTION value="' + counter + '">' + counter + '</OPTION>');

		}

	} else {

		// Invalid argument

		return(-1);

	}

	return(0);

}

//
// Function:    left_column()
//
// Description: Display left column
//
// Return code:
//  0 = Success
//
function left_column () {

	document.write('<TD width=180 bgcolor="#b5b5b5" align="center" valign="top">');

	//
	// Main menu
	//
	document.write('<TABLE border=0 cellpadding=4 cellspacing=4>');

	// Donate
	document.write('<TR><TD width=164 bgcolor="#363636" align="center"><A href="donate.htm" class="mmenu1">');
	document.write('DONATE');
	document.write('</A></TD></TR>');

	// Give Blood
	document.write('<TR><TD width=164 bgcolor="#363636" align="center"><A href="blood.htm" class="mmenu1">');
	document.write('GIVE BLOOD');
	document.write('</A></TD></TR>');

	// Get Ready
	document.write('<TR><TD width=164 bgcolor="#363636" align="center"><A href="prepare.htm" class="mmenu1">');
	document.write('GET READY');
	document.write('</A></TD></TR>');

	// Volunteer
	document.write('<TR><TD width=164 bgcolor="#363636" align="center"><A href="volunteer.htm" class="mmenu1">');
	document.write('VOLUNTEER');
	document.write('</A></TD></TR>');

	//
	// Programs & Services
	//
	document.write('<TR><TD width=164 bgcolor="#363636" align="center" class="mheader">Programs &amp; Services</TD></TR>');
	document.write('<TR><TD width=164 align="center">');

	//document.write('<A href="disaster.htm" class="mmenu2">Disaster Education</A><BR />');
	document.write('<A href="health.htm" class="mmenu2">Health &amp; Safety</A><BR />');
	document.write('<A href="health.htm" class="mmenu2">Aquatics</A><BR />');
	document.write('<A href="community.htm" class="mmenu2">Community Outreach</A><BR />');
	document.write('<A href="rent.htm" class="mmenu2">Rent Assistance</A><BR />');
	document.write('<A href="http://www.westarenergy.com/corp_com/contentmgt.nsf/publishedpages/community%20services%20project%20deserve" target="new" class="mmenu2">Utility Assistance</A><BR />');
	document.write('<A href="military.htm" class="mmenu2">Military Communications</A><BR />');

	document.write('</TD></TR>');

	// Register
	document.write('<TR><TD width=164 bgcolor="#363636" align="center"><A href="register.htm" class="mmenu1">');
	document.write('COURSE REGISTRATION');
	document.write('</A></TD></TR>');

	// Contact
	document.write('<TR><TD width=164 bgcolor="#363636" align="center"><A href="contact.htm" class="mmenu1">');
	document.write('CONTACT');
	document.write('</A></TD></TR>');

	document.write('</TABLE>');

	// "Red Cross Ready" graphic
	document.write('<IMG src="image/redcross_ready.gif" width=172 height=172></IMG>');

	document.write('</TD>');

	return(0);

}

//
// Function:    masthead()
//
// Description: Display masthead and address
//
// Return code:
//  0 = Success
//
function masthead () {

	// Masthead

	document.write('<A href="index.html"><IMG src="image/masthead.jpg" width=800 height=100 border=0></IMG></A>');

	// Address (gray background)

	document.write('<TABLE width="100%" border=0 cellpadding=4 cellspacing=0><TR><TD bgcolor="#b5b5b5" align="right" class="title">');
	document.write('111 North Walnut, Suite B &#149; Hutchinson, KS 67501 &#149; 620-662-3336');
	document.write('</TD></TR></TABLE>');

	return(0);

}

//
// Function:    playflash()
//
// Description: Play Flash animation
//
// Input:
// file = 1 to play "Gulf Coast Storms"
//      = 2 to play "Help hurricane victims now"
//
// Return code:
//  0 = Success
// -1 = Invalid argument
//
function playflash (file) {

	//
	// Shockwave Flash values
	//

	// "classid"
	var sFlashClassId ="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";

	// "codebase"
	var sFlashCodeBase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0";

	// "pluginspage"
	var sFlashPlugInsPage = "http://www.macromedia.com/go/getflashplayer";

	// "type"
	var sFlashType = "application/x-shockwave-flash";

	//
	// Other Flash values
	//
	var sFlashFile;
	var nWidth;
	var nHeight;

	if ( file == 1 ) {

		// Gulf Coast Storms
		sFlashFile = "http://midwaykansas.redcross.org/images/uploads/gulf_coast_storms.swf";
		nWidth = 250;
		nHeight = 204;

	} else if ( file == 2 ) {

		// Help hurricane victims now
		sFlashFile = "http://www.redcross.org/images/psabanners/all/300x250/RedCross_300x250_CNN.swf";
		nWidth = 300;
		nHeight = 250;

	} else {

		// Invalid argument
		return(-1);

	}

	document.write('<OBJECT classid="' + sFlashClassId + '" codebase="' + sFlashCodeBase + '" ');
	document.write('width="' + nWidth + '" height="' + nHeight + '">');

	document.write('<PARAM name="movie" value="' + sFlashFile + '"></PARAM>');
	document.write('<PARAM name="quality" value="high"></PARAM>');

	document.write('<EMBED src="' + sFlashFile + '" ');
	document.write('pluginspage="' + sFlashPlugInsPage + '" play="true" loop="true" ');
	document.write('menu="false" quality="high" scale="noborder" ');
	document.write('width="' + nWidth + '" height="' + nHeight + '" type="' + sFlashType + '"></EMBED>');

	document.write('</OBJECT>');

	return(0);

}

//
// Function:    slideshow()
//
// Description: Display images as slideshow
//
// Input:
// imgno = Image number (1-20) to display
//       = 0 to initialize images
//
// -Display in "slide" SPAN id on home page
// -To call, place in BODY tag: onload="slideshow(1);"
//
// Return code:
//  0 = Success
//
function slideshow (imgno) {

	var basename;

	if ( imgno == 0 ) {

		//
		// Preload images
		//
		img1 = new Image(529,400);
		img2 = new Image(545,400);
		img3 = new Image(533,400);
		img4 = new Image(589,400);
		img5 = new Image(600,400);
		img6 = new Image(600,400);
		img7 = new Image(516,400);
		img8 = new Image(557,400);
		img9 = new Image(526,400);
		img10 = new Image(546,400);
		img11 = new Image(560,400);
		img12 = new Image(600,400);
		img13 = new Image(600,400);
		img14 = new Image(510,400);
		img15 = new Image(539,400);
		img16 = new Image(560,400);
		img17 = new Image(469,400);
		img18 = new Image(533,400);
		img19 = new Image(533,400);
		img20 = new Image(533,400);

		img1.src = "image/rcrc01.jpg";
		img2.src = "image/rcrc02.jpg";
		img3.src = "image/rcrc03.jpg";
		img4.src = "image/rcrc04.jpg";
		img5.src = "image/rcrc05.jpg";
		img6.src = "image/rcrc06.jpg";
		img7.src = "image/rcrc07.jpg";
		img8.src = "image/rcrc08.jpg";
		img9.src = "image/rcrc09.jpg";
		img10.src = "image/rcrc10.jpg";
		img11.src = "image/rcrc11.jpg";
		img12.src = "image/rcrc12.jpg";
		img13.src = "image/rcrc13.jpg";
		img14.src = "image/rcrc14.jpg";
		img15.src = "image/rcrc15.jpg";
		img16.src = "image/rcrc16.jpg";

		img17.src = "image/rcrc17.jpg";
		img18.src = "image/rcrc18.jpg";
		img19.src = "image/rcrc19.jpg";
		img20.src = "image/rcrc20.jpg";

		imgno = 1;

	}

	if ( imgno < 10 ) {
		basename = 'rcrc0' + imgno;
	} else {
		basename = 'rcrc' + imgno;
	}

	document.getElementById('slide').innerHTML = '<IMG src="image/' + basename + '.jpg"></IMG>';

	if ( imgno == 20 ) {
		imgno = 1;
	} else {
		imgno = imgno + 1;
	}

	// After duration, call this function again and display next image
	setTimeout('slideshow(' + imgno + ')', 2500);

	return(0);

}