
/* This file contains the data AND functions for displaying conference information. */

/* Format for each array:
Name/title of conference,
Root-relative URL of detail page,
Start Date (mm/dd/yyyy),
End Date (mm/dd/yyyy),
Cost (number || 0),
CEU's (number || 0),
Learning Units (yes || no),
Registration Method (online || print)
*/

/* Conferences WITH dates must appear before conferences WITHOUT dates. */
/* Use  %26   for an ampersand */

conferences=new Array();

//-----------------------------------------------------------------------------
// with dates
//-----------------------------------------------------------------------------

conferences.push(["AF-6 Start-up and Troubleshooting","/na/business_lighting/education_resources/conferences/detail_af6_startup_troubleshooting.htm",
		  "04/13/2010","04/14/2010",
		  "400","0","no","online"]);
conferences.push(["AF-6 Start-up and Troubleshooting","/na/business_lighting/education_resources/conferences/detail_af6_startup_troubleshooting.htm",
		  "07/13/2010","07/14/2010",
		  "400","0","no","online"]);
conferences.push(["AF-6 Start-up and Troubleshooting","/na/business_lighting/education_resources/conferences/detail_af6_startup_troubleshooting.htm",
		  "11/30/2010","12/01/2010",
		  "400","0","no","online"]);

conferences.push(["Fundamentals of Commercial and Industrial Lighting","/na/business_lighting/education_resources/conferences/detail_candifundamnt.htm",
		  "12/08/2009","12/10/2009",
		  "550","1.5","no","online"]);
conferences.push(["Fundamentals of Commercial and Industrial Lighting","/na/business_lighting/education_resources/conferences/detail_candifundamnt.htm",
		  "02/09/2010","02/11/2010",
		  "550","1.5","no","online"]);
conferences.push(["Fundamentals of Commercial and Industrial Lighting","/na/business_lighting/education_resources/conferences/detail_candifundamnt.htm",
		  "05/04/2010","05/06/2010",
		  "550","1.5","no","online"]);
conferences.push(["Fundamentals of Commercial and Industrial Lighting","/na/business_lighting/education_resources/conferences/detail_candifundamnt.htm",
		  "06/16/2010","06/18/2010",
		  "550","1.5","no","online"]);
conferences.push(["Fundamentals of Commercial and Industrial Lighting","/na/business_lighting/education_resources/conferences/detail_candifundamnt.htm",
		  "08/03/2010","08/05/2010",
		  "550","1.5","no","online"]);
conferences.push(["Advanced MCC and Switchboard Takeoffs","/na/business_lighting/education_resources/conferences/detail_advanced_motor_control_centers.htm",
		  "09/28/2010","09/30/2010",
		  "550","0","no","online"]);
conferences.push(["Fundamentals of Commercial and Industrial Lighting","/na/business_lighting/education_resources/conferences/detail_candifundamnt.htm",
		  "12/07/2010","12/09/2010",
		  "550","1.5","no","online"]);

conferences.push(["Lighting for Healthcare Facilities","/na/business_lighting/education_resources/conferences/detail_lighting_health.htm",
		  "06/02/2010","06/03/2010",
		  "400","1.0","no","online"]);
conferences.push(["Lighting for Healthcare Facilities","/na/business_lighting/education_resources/conferences/detail_lighting_health.htm",
		  "10/06/2010","10/07/2010",
		  "400","1.0","no","online"]);

conferences.push(["C%26I Products 101 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_101.htm",
		  "02/16/2010","02/18/2010",
		  "550","0","no","online"]);
conferences.push(["C%26I Products 101 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_101.htm",
		  "04/27/2010","04/29/2010",
		  "550","0","no","online"]);
conferences.push(["C%26I Products 101 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_101.htm",
		  "06/08/2010","06/10/2010",
		  "550","0","no","online"]);
conferences.push(["C%26I Products 101 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_101.htm",
		  "08/17/2010","08/19/2010",
		  "550","0","no","online"]);
conferences.push(["C%26I Products 101 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_101.htm",
		  "11/16/2010","11/18/2010",
		  "550","0","no","online"]);

conferences.push(["C%26I Products 102 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_102.htm",
		  "03/16/2010","03/18/2010",
		  "550","0","no","online"]);
conferences.push(["C%26I Products 102 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_102.htm",
		  "05/18/2010","05/20/2010",
		  "550","0","no","online"]);
conferences.push(["C%26I Products 102 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_102.htm",
		  "06/22/2010","06/24/2010",
		  "550","0","no","online"]);
conferences.push(["C%26I Products 102 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_102.htm",
		  "08/24/2010","08/26/2010",
		  "550","0","no","online"]);
conferences.push(["C%26I Products 102 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_102.htm",
		  "10/12/2010","10/14/2010",
		  "550","0","no","online"]);

conferences.push(["C%26I Products 103 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_103.htm",
		  "03/30/2010","04/01/2010",
		  "550","0","no","online"]);
conferences.push(["C%26I Products 103 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_103.htm",
		  "10/19/2010","10/21/2010",
		  "550","0","no","online"]);

conferences.push(["Advanced AF-6 Drives","/na/business_lighting/education_resources/conferences/detail_advanced_af6_drives.htm",
		  "03/09/2010","03/11/2010",
		  "550","0","no","online"]);
conferences.push(["Advanced AF-6 Drives","/na/business_lighting/education_resources/conferences/detail_advanced_af6_drives.htm",
		  "05/04/2010","05/06/2010",
		  "550","0","no","online"]);
conferences.push(["Advanced AF-6 Drives","/na/business_lighting/education_resources/conferences/detail_advanced_af6_drives.htm",
		  "09/14/2010","09/16/2010",
		  "550","0","no","online"]);

conferences.push(["Lighting Retrofits","/na/business_lighting/education_resources/conferences/detail_lighting_retrofits.htm",
		  "03/10/2010","03/11/2010",
		  "400","0","no","online"]);
conferences.push(["LED and Energy Efficient Lighting Trends for Retail","/na/business_lighting/education_resources/conferences/detail_energy_efficient_trends.htm",
		  "10/13/2010","10/14/2010",
		  "400","1.0","no","online"]);

//-----------------------------------------------------------------------------
// no dates
//-----------------------------------------------------------------------------
conferences.push(["LED and Energy Efficient Lighting Trends for Retail","/na/business_lighting/education_resources/conferences/detail_energy_efficient_trends.htm",
		  "","",
		  "400","1.0","no","online"]);
conferences.push(["Outdoor Lighting","/na/business_lighting/education_resources/conferences/detail_outdoor_lighting.htm",
		  "","",
		  "400","1.0","no","online"]);
conferences.push(["C%26I Products 102 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_102.htm",
		  "","",
		  "550","0","no","online"]);
conferences.push(["Lighting Retrofits","/na/business_lighting/education_resources/conferences/detail_lighting_retrofits.htm",
		  "","",
		  "400","0","no","online"]);
conferences.push(["C%26I Products 103 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_103.htm",
		  "","",
		  "550","0","no","online"]);
conferences.push(["Advanced AF-6 Drives","/na/business_lighting/education_resources/conferences/detail_advanced_af6_drives.htm",
		  "","",
		  "550","0","no","online"]);
conferences.push(["LC Exam Prep Course","/na/business_lighting/education_resources/conferences/detail_lc_exam_prep.htm",
		  "","",
		  "550","1.5","no","online"]);
conferences.push(["C%26I Products 101 (Distributor Training)","/na/business_lighting/education_resources/conferences/detail_ci_101.htm",
		  "","",
		  "550","0","no","online"]);
conferences.push(["Basic Distributor Sales Training (Edison Elite)","/na/business_lighting/education_resources/conferences/detail_basic_distributor_sales.htm",
		  "","",
		  "500","0","no","online"]);
conferences.push(["Museum Lighting","/na/business_lighting/education_resources/conferences/detail_museum.htm",
		  "","",
		  "400","0","no","online"]);
conferences.push(["Workshop for Architects","/na/business_lighting/education_resources/conferences/detail_workshop_for_architects.htm",
		  "","",
		  "550","0","no","online"]);
conferences.push(["Switchgear Basics","/na/business_lighting/education_resources/conferences/detail_switchgear_basics.htm",
		  "","",
		  "550","0","no","online"]);
conferences.push(["Advanced Lighting Update","/na/business_lighting/education_resources/conferences/detail_advanced.htm",
		  "","",
		  "400","1.0","no","online"]);
conferences.push(["Trends in Electrical Solutions","/na/business_lighting/education_resources/conferences/detail_trends.htm",
		  "","",
		  "400","0.7","no","online"]);
conferences.push(["Environmental Building Strategies","/na/business_lighting/education_resources/conferences/detail_environmental_building_strategies.htm",
		  "","",
		  "400","1.0","no","online"]);
conferences.push(["Retail Lighting","/na/business_lighting/education_resources/conferences/detail_retail.htm",
		  "","",
		  "400","1.0","no","online"]);



//convert any dates from strings to date objects
for(i=0;i<conferences.length;i++){
	for(j=2;j<=3;j++){
		if(conferences[i][j] != ""){
			month=conferences[i][j].substring(0,2);
			month--;
			day=conferences[i][j].substring(3,5);
			year=conferences[i][j].substring(6,conferences[i][j].length);
			conferences[i][j]=new Date(year,month,day);
		}
	}
}
//sort all conferences based on the dates
datedconferences=new Array();
counter=0;
for(i=0;i<conferences.length;i++){
	if(conferences[i][2] != ""){
		datedconferences[counter]=conferences[i];
		counter++;
	}
}
//Use bubble sort to do the sorting
var holder;
for(i=1;i<datedconferences.length;i++){
	if(datedconferences[i][2]<datedconferences[i-1][2]){
		holder=datedconferences[i];
		datedconferences[i]=datedconferences[i-1];
		datedconferences[i-1]=holder;
		i=0;
	}
}
for(i=0;i<datedconferences.length;i++){
	conferences[i]=datedconferences[i];
}
//end of conferences sorting

//Remove conferences which have already passed
expired=0;
while(expired<1){
	today=new Date();
	if (today>conferences[0][2]){
		holderarray=new Array();
		for(i=0;i<(conferences.length-1);i++){
			holderarray[i]=conferences[i+1];
		}
		conferences=new Array();
		for(i=0;i<holderarray.length;i++){
			conferences[i]=holderarray[i];
		}
	}
	else{
		expired++;
	}
}
//Remove conferences from "upcoming conferences" list if there is an entry for the same conference with a date attached.
holderarray=new Array();
removalarray=new Array();
counter=0;
for(i=0;i<conferences.length;i++){
	for(j=i+1;j<conferences.length;j++){
		if(conferences[i][1]==conferences[j][1] && conferences[j][2]==""){
			//alert(conferences[i][1]);
			removalarray[counter]=j;
			//alert(removalarray[counter]);
			counter++;
		}
	}
}
//alert(counter);
//alert(removalarray.length);
counter=0;
for(i=0;i<conferences.length;i++){
	errcount=0;
	for(j=0;j<removalarray.length;j++){
		if(removalarray[j]==i){
			errcount++;
		}
	}
	if(errcount == 0){
		holderarray[counter]=conferences[i];
		counter++;
	}
}
conferences=new Array();
for(i=0;i<holderarray.length;i++){
	conferences[i]=holderarray[i];
}

//Get url of page, which will be used in other parts of the script for matching purposes.
var text = window.location.href;

function delineate(str,start,end){
	//var point = str.lastIndexOf("?");
	//var startlength=start.length;
	var startingpoint=str.indexOf(start);
	if(end!="EndOfLine"){
		return unescape(str.substring(startingpoint,str.indexOf(end)));
	}
	else{
		return unescape(str.substring(startingpoint,str.length));
	}
}
//Find out from the url the relative page location 
var thispageurl=delineate(text,"/na/","EndOfLine");

//The variable, thisconferencelist, holds an array of conferences that match the current page.
thisconferencelist=new Array();
months=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");


function showavaildates(){
	counter=0;
	for(i=0;i<conferences.length;i++){
		if(conferences[i][1]==thispageurl){
			thisconferencelist[counter]=conferences[i];
				if(conferences[i][2] != ""){
					counter++;
				}
		}
	}
	if (counter != 0){
		//thisdate=new Date(thisconferencelist[0][2]);
		document.write(months[thisconferencelist[0][2].getMonth()]+" "+thisconferencelist[0][2].getDate()+"&nbsp;&ndash; ");
		document.write(months[thisconferencelist[0][3].getMonth()]+" "+thisconferencelist[0][3].getDate()+", ");
		document.write(thisconferencelist[0][3].getFullYear());
		if(counter>1){
			for(i=1;i<counter;i++){
				document.write("<br />"+months[thisconferencelist[i][2].getMonth()]+" "+thisconferencelist[i][2].getDate()+"&nbsp;&ndash; ");
				document.write(months[thisconferencelist[i][3].getMonth()]+" "+thisconferencelist[i][3].getDate()+", ");
				document.write(thisconferencelist[i][3].getFullYear());
			}
		}
	}
	else{
		document.write("To be announced<br /><i>Call 1-800-255-1200 for the next available session.</i>");
	}
}

function populateform(){
	document.seminarform.SeminarName.value=thisconferencelist[0][0];
	if(thisconferencelist[0][4] != "0"){
		document.seminarform.SeminarCost.value=thisconferencelist[0][4];
	}
	else{
		document.seminarform.SeminarCost.value="0";
	}
	document.seminarform.SeminarCredits.value=thisconferencelist[0][5]+" CEU";
}

function showcost(){
	if(thisconferencelist[0][4] != "0"){
		document.write("$ "+thisconferencelist[0][4]);
	}
	else{
		document.write("Free");
	}
}

function showcredits(){
	if(thisconferencelist[0][5] != "0"){
		document.writeln("<tr>");
		document.writeln("<td nowrap><b>Credits:&nbsp;&nbsp;</b></td>");
		document.writeln("<td>"+thisconferencelist[0][5]+" CEU*</td>");
		document.writeln("</tr>");
	}
	if(thisconferencelist[0][6]=="yes"){
		document.writeln("<tr>");
		document.writeln("<td colspan=\"2\">Learning units available*</td>");
		document.writeln("</tr>");
	}
}

function showsigmssg(){
	if(thisconferencelist[0][7]=="print"){
		document.write("<b>Your registration form must be signed by your GE Lighting Sales Representative before submitting.</b>");
	}
}

function showCEUfootnote(){
	if(thisconferencelist[0][5] != "0" || thisconferencelist[0][6]=="yes"){
		document.write("* Continuing Education Units (CEU) may be awarded to those who successfully complete the relevant conferences. Please speak to the conference chairperson on arrival for additional information.");
	}
}

function showRegistration(){
	if(thisconferencelist[0][2] != ""){
		document.writeln("<p><a href=\"http://www.gelearningcentral.com/\" class=\"bold\" target=\"_blank\">Register for this conference at Learning Central</a></p>");
	}
}

longmonth=new Array("January","February","March","April","May","June","July","August","September","October","November","December");

function writeConfMainPageArea(){
	if(conferences[0][2] != ""){
		for(i=0;i<5;i++){
			smallMargin = (i<4)?"class='smallMargin'":"";
			if(conferences[i][2] && conferences[i][2] != ""){
				document.writeln("<p "+smallMargin+"><b><a href=\""+conferences[i][1]+"\">"+unescape(conferences[i][0])+"</a></b><br>");
				document.write(longmonth[conferences[i][2].getMonth()]+" "+conferences[i][2].getDate()+" &ndash; ");
				document.writeln(longmonth[conferences[i][3].getMonth()]+" "+conferences[i][3].getDate()+"</p>");
			}
		}
	}
}

function ShowDatedConferences() {
	oldmonth="";
	for(i=0;i<conferences.length;i++) {
		if(conferences[i][2] !="") {
			thismonth=longmonth[conferences[i][2].getMonth()];
			if(thismonth != oldmonth){
				document.writeln("<tr><td colspan=\"6\">&nbsp;<br /><b>"+thismonth+"</b></td></tr>");
				oldmonth=thismonth;
			}
			document.writeln("<tr>");
			document.writeln("<td valign=\"top\">"+conferences[i][2].getDate()+"&ndash;"+conferences[i][3].getDate()+", "+conferences[i][2].getFullYear()+"</td>");
			document.write("<td valign=\"top\"><a href=\""+conferences[i][1]+"\">"+unescape(conferences[i][0]));
			if(conferences[i][0].indexOf("Educat") != -1) {
				document.write("&#134;");
			}
			document.writeln("</a></td>");
			document.writeln("<td valign=\"top\">$ "+conferences[i][4]+"</td>");
			
			if(conferences[i][5] == 0){
				document.writeln("<td valign=\"top\">&nbsp;</td>"); 
			} else {
				document.writeln("<td valign=\"top\">"+conferences[i][5]+"</td>");
			}
			
			document.write("<td valign=\"top\"><a href=\"http://www.gelearningcentral.com/\" target=\"_blank\">Register</a></td>");
			document.writeln("</tr>");
			counter++;
		}
	}
}


function ShowUndatedConferences(){
	for(i=0;i<conferences.length;i++){
		if(conferences[i][2] == ""){
			document.writeln("<li><a href=\""+conferences[i][1]+"\">"+unescape(conferences[i][0]));
			      if(conferences[i][0].indexOf("Educat") != -1) {
			        document.write("&#134;");
			      }
			      if(conferences[i][7]== "print") {
			        document.write("**");
			      }
			document.write("</a></li>");
		}
	}
}

/*
function ShowInstSidebar(){
	var ShownConferences=0;
	for(i=0;i<4;i++){
		if(i>conferences.length || conferences[i][2] == ""){
			break;
		}
		else{
			ShownConferences++;
			document.write("<p><span class=\"leftsubhead\">");
			document.write(longmonth[conferences[i][2].getMonth()]+" | ");
			document.writeln(conferences[i][2].getDate()+"-"+conferences[i][3].getDate()+" |</span><br>");
			document.writeln("<a href=\""+conferences[i][1]+"\">"+conferences[i][0]+"</a></p>");
		}
	}
	if(ShownConferences != 0){
	document.writeln("<p><a href=\"/na/institute/conf_schedule.html\"><img src=\"/na/institute/images/btn_registerblue.gif\" alt=\"Register Online!\" width=\"146\" height=\"40\" border=\"0\"></a></p>");
	}
}
*/



