// JavaScript Document
// Data and functions for list of classes and banner display of classes on front page
function ClassList() {
	this.fp_data = '';			// Data for front page banner, also title of entry on list of classes
	this.class_data = '';		// Data for entry on list of classes
};
var g_classList = new Array();
// ====================================================================================== //
function populate_classList(glist) {
var new_el = new ClassList();
var index = 0;
// ---------------------------------------------------
new_el.fp_data = "Chair Yoga";
new_el.class_data = "Instructor: Janet Abel<br/>Five Sessions: $50<br/>Thursdays: January 19th - February 16th<br/>4:30 - 5:30 pm<br/><div class='vspace_10px'></div><a href='chair-yoga.html' target = '_self'>More Information</a>";
glist[index] = new_el;
index += 1;
// ---------------------------------------------------
new_el = new ClassList();
new_el.fp_data = "Acrylic Painting";
new_el.class_data = "This class is full.<br/>Instructor: Tisha Rose<br/>Four Sessions: $40<br/>Thursdays January 5th through the 26th<br/>11:00 am - 1:00 pm<br/><div class='vspace_10px'></div><a href='tisha-rose-art-class.html' target = '_self'>More Information</a>";
glist[index] = new_el;
index += 1;
// ---------------------------------------------------
new_el = new ClassList();
new_el.fp_data = "Eco Mixed-media Workshop";
new_el.class_data = "Instructor: Juliette Marshall<br/>Two Sessions: $35<br/>Tuesdays January 10th &amp; 17th<br/>1:00 - 2:00 pm<br/><div class='vspace_10px'></div><a href='j-marshall-art-class.html' target = '_self'>More Information</a>";
glist[index] = new_el;
index += 1;
// ---------------------------------------------------
new_el = new ClassList();
new_el.fp_data = "Watercolor Painting";
new_el.class_data = "Instructor: Bill Hobler<br/>10 Sessions: $120<br/>Thursdays: January 5th-March 8th<br/> 3:30-6:30 pm<br/><div class='vspace_10px'></div><a href='hobler-watercolor-101.html' target = '_self'>More Information</a>";
glist[index] = new_el;
index += 1;
// ---------------------------------------------------
new_el = new ClassList();
new_el.fp_data = "Private/Semi-Private Lessons";
new_el.class_data = "Instructor: Laura Tovar Dietrick<br/>Advanced Drawing<br/>Basic and Advanced Drawing<br/>Figure Drawing<br/>Oil Painting with Water Soluble Paints<br/><div class='vspace_10px'></div><a href='dietrick-art-class.html' target = '_self'>More Information</a>";
glist[index] = new_el;
index += 1;
// ---------------------------------------------------
new_el = new ClassList();
new_el.fp_data = "Polymer Clay";
new_el.class_data = "Instructor: Deb Ross<br/>4 Sessions: $140<br/>Saturdays: February 4th - 25th<br/>2:00-4:30pm<br/><div class='vspace_10px'></div><a href='deb-ross-art-class.html' target = '_self'>More Information</a>";
glist[index] = new_el;
index += 1;
// ---------------------------------------------------
new_el = new ClassList();
new_el.fp_data = "Drawing";
new_el.class_data = "Instructor: Joyce Timberlake<br/>4 Sessions: $60<br/>Wednesdays: January 4th - 25th<br/>11:00 am-2:00 pm<br/><div class='vspace_10px'></div><a href='timberlake-art-class.html' target = '_self'>More Information</a>";
glist[index] = new_el;
index += 1;
// ---------------------------------------------------
new_el = new ClassList();
new_el.fp_data = "Portrait II";
new_el.class_data = "Instructor: Bill Hobler<br/>4 Sessions: Tuesdays 3:30 -5:30 pm<br/>January 3rd - 24th<br/>Cost: $120<br/><div class='vspace_10px'></div><a href='hobler-portrait.html' target = '_self'>More Information</a>";
glist[index] = new_el;
index += 1;
// ---------------------------------------------------
new_el = new ClassList();
new_el.fp_data = "Stained Glass";
new_el.class_data = "Instructor: Susan Welteroth<br/>One Session $25<br/>Two Separate Dates: <div style='position:relative;left:25px;'> Thursday February 23 or<br/>Tuesday February 28</div> 10:30-12:00<div class='vspace_10px'></div><a href='welteroth-art-class.html' target = '_self'>More Information</a>";
glist[index] = new_el;
index += 1;
// ---------------------------------------------------
new_el = new ClassList();
new_el.fp_data = "Basic Photography";
new_el.class_data = "Instructor: John Butler<br/>Three Sessions $30<br/>Saturdays February 4th, 11th, and 18th<br/>12 - 2pm<div class='vspace_10px'></div><a href='butler-art-class.html' target = '_self'>More Information</a>";
glist[index] = new_el;
index += 1;

};
// ====================================================================================== //
function draw_classList(glist,list_div_ID,source_ID) {
	var template = $('#'+source_ID);
	var destination = $('#'+list_div_ID);
	var idval = '';
	var t1;
	for(var i=0;i<glist.length;i++) {
		idval = source_ID + i;
		t1 = template.clone().css('display','block').attr('id',idval);
		t1.find('h1').html(glist[i].fp_data);
		t1.find('.class_text_box').html(glist[i].class_data);
		if(i==glist.length-1) t1.find('hr').css('display','none');			
		destination.append(t1);
	}
};
// ====================================================================================== //
function init_classList_banner(settings){
		this.banner_divID = settings.banner_divID
		this.bannerID = settings.bannerID
		this.interval = settings.interval
		this.trans_interval = settings.trans_interval
		this.classList = settings.classList
		this.list_index = settings.list_index
		if(this.list_index < 0) 
			this.list_index = this.get_random();
		else if (this.list_index >= this.classList.length) this.list_index = this.classList.length - 1;
		
		$('div#'+this.banner_divID + ' #'+this.bannerID).html(this.classList[this.list_index].fp_data);
		var banner = this;
		setInterval(function(){banner.run_banner()},this.interval);
};
init_classList_banner.prototype.run_banner = function(){
		var old_list_index = this.list_index;
		this.list_index += 1;	
		if(this.list_index == this.classList.length) this.list_index = 0;
		if(this.classList[this.list_index].fp_data != this.classList[old_list_index].fp_data){
			var runbanner = this;
			$('div#'+this.banner_divID + ' #'+this.bannerID).fadeOut(this.trans_interval,function() {runbanner.show_new()});
		};
};
init_classList_banner.prototype.show_new = function() {
		$('div#'+this.banner_divID + ' #'+this.bannerID).html(this.classList[this.list_index].fp_data).fadeIn(this.trans_interval);
};
init_classList_banner.prototype.get_random = function() {
	return Math.floor(Math.random()*this.classList.length);
};







