// this code would normally by placed in a external javascript file to handle any
// errors that would come up.
onerror=handleErr;
var txt="";

// this array is outside the functions to allow it to be used by
// multiple functions, it makes it global

var report_array = new Array();

report_array[0] = "../polling_images/report-types_blank.jpg";
report_array[1] = "../polling_images/report-types_3D_pie.jpg";
report_array[2] = "../polling_images/report-types_3D_column.jpg";
report_array[3] = "../polling_images/report-types_2D_column.jpg";
report_array[4] = "../polling_images/report-types_2D_pie.jpg";

function handleErr(msg,url,l) {
  txt="There was an error in the logic of this page.\n\n";
  txt+="Error: " + msg + "\n";
  txt+="URL: " + url + "\n";
  txt+="Line: " + l + "\n\n";
  txt+="Click OK to continue.\n\n";
  alert(txt);
  return true;
}


/*

this javascript will change the colour of the id based on the day of the week

first get the day and check using a switch to see which should have
the colour changed to light grey

*/



// function to change column colour in the Freak Fitness Training Times

function change_col_colour() {

  // set up variables
  var make_day_red;
  var check_single_day;
  var y_cols_0;
  var y_cols_1;
  var y_cols_2;
  var y_cols_3;
  var y_cols_4;
  var y_cols_5;  
  var y_cols_6;  
  var y_cols_7;
  var y_cols_8;
  var y_cols_9;
  var y_cols_10;  
  var y_cols_11;  
  var y_cols_12;  
  var y_cols_13;
  var y_cols_14;

  y_cols_0 = document.getElementById("schedule_table").rows[0].cells;
  y_cols_1 = document.getElementById("schedule_table").rows[1].cells;
  y_cols_2 = document.getElementById("schedule_table").rows[2].cells;
  y_cols_3 = document.getElementById("schedule_table").rows[3].cells;
  y_cols_4 = document.getElementById("schedule_table").rows[4].cells;
  y_cols_5 = document.getElementById("schedule_table").rows[5].cells;
  y_cols_6 = document.getElementById("schedule_table").rows[6].cells;
  y_cols_7 = document.getElementById("schedule_table").rows[7].cells;
  y_cols_8 = document.getElementById("schedule_table").rows[8].cells;
  y_cols_9 = document.getElementById("schedule_table").rows[9].cells;
  y_cols_10 = document.getElementById("schedule_table").rows[10].cells;
  y_cols_11 = document.getElementById("schedule_table").rows[11].cells;
  y_cols_12 = document.getElementById("schedule_table").rows[12].cells;
  y_cols_13 = document.getElementById("schedule_table").rows[13].cells;

  // set up variables

  
  make_day_red = new Date();
  
  check_single_day = make_day_red.getDay();
  
  // since the date function treats Sunday as the start of the week, it assigns it a 0 and 
  // thus the schedule will have the timetable coloured red instead of the Sunday line
  if (check_single_day == 0) {
    check_single_day = 7;
  }

  y_cols_0[check_single_day].style.color = "#ffffff";
  y_cols_0[check_single_day].style.backgroundColor = "#89030a";
  y_cols_1[check_single_day].style.color = "#ffffff";
  y_cols_1[check_single_day].style.backgroundColor = "#89030a";
  y_cols_2[check_single_day].style.color = "#ffffff";
  y_cols_2[check_single_day].style.backgroundColor = "#89030a";
  y_cols_3[check_single_day].style.color = "#ffffff";
  y_cols_3[check_single_day].style.backgroundColor = "#89030a";
  y_cols_4[check_single_day].style.color = "#ffffff";
  y_cols_4[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_5[check_single_day].style.color = "#ffffff";
  y_cols_5[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_6[check_single_day].style.color = "#ffffff";
  y_cols_6[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_7[check_single_day].style.color = "#ffffff";
  y_cols_7[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_8[check_single_day].style.color = "#ffffff";
  y_cols_8[check_single_day].style.backgroundColor = "#89030a";
  y_cols_9[check_single_day].style.color = "#ffffff";
  y_cols_9[check_single_day].style.backgroundColor = "#89030a";
  y_cols_10[check_single_day].style.color = "#ffffff";
  y_cols_10[check_single_day].style.backgroundColor = "#89030a";
  y_cols_11[check_single_day].style.color = "#ffffff";
  y_cols_11[check_single_day].style.backgroundColor = "#89030a";
  y_cols_12[check_single_day].style.color = "#ffffff";
  y_cols_12[check_single_day].style.backgroundColor = "#89030a";
  y_cols_13[check_single_day].style.color = "#ffffff";
  y_cols_13[check_single_day].style.backgroundColor = "#89030a";


}


// function to change column colour in the Freak Fitness Training Times new schedule
// as of July 5th 2010

function change_new_col_colour() {

  // set up variables
  var make_day_red;
  var check_single_day;
  var y_cols_0;
  var y_cols_1;
  var y_cols_2;
  var y_cols_3;
  var y_cols_4;
  var y_cols_5;  
  var y_cols_6;  
  var y_cols_7;
  var y_cols_8;
  var y_cols_9;
  var y_cols_10;  
  var y_cols_11;  
  var y_cols_12;  
  var y_cols_13;
  var y_cols_14;
  var y_cols_15;
  var y_cols_16;
  var y_cols_17;
  var y_cols_18;

  y_cols_0 = document.getElementById("schedule_table").rows[0].cells;
  y_cols_1 = document.getElementById("schedule_table").rows[1].cells;
  y_cols_2 = document.getElementById("schedule_table").rows[2].cells;
  y_cols_3 = document.getElementById("schedule_table").rows[3].cells;
  y_cols_4 = document.getElementById("schedule_table").rows[4].cells;
  y_cols_5 = document.getElementById("schedule_table").rows[5].cells;
  y_cols_6 = document.getElementById("schedule_table").rows[6].cells;
  y_cols_7 = document.getElementById("schedule_table").rows[7].cells;
  y_cols_8 = document.getElementById("schedule_table").rows[8].cells;
  y_cols_9 = document.getElementById("schedule_table").rows[9].cells;
  y_cols_10 = document.getElementById("schedule_table").rows[10].cells;
  y_cols_11 = document.getElementById("schedule_table").rows[11].cells;
  y_cols_12 = document.getElementById("schedule_table").rows[12].cells;
/*
  y_cols_13 = document.getElementById("schedule_table").rows[13].cells;
  y_cols_14 = document.getElementById("schedule_table").rows[14].cells;
  y_cols_15 = document.getElementById("schedule_table").rows[15].cells;
  y_cols_16 = document.getElementById("schedule_table").rows[16].cells;
  y_cols_17 = document.getElementById("schedule_table").rows[17].cells;
*/
  // set up variables

  
  make_day_red = new Date();
  
  check_single_day = make_day_red.getDay();
  
  // since the date function treats Sunday as the start of the week, it assigns it a 0 and 
  // thus the schedule will have the timetable coloured red instead of the Sunday line
  if (check_single_day == 0) {
    check_single_day = 7;
  }

  y_cols_0[check_single_day].style.color = "#ffffff";
  y_cols_0[check_single_day].style.backgroundColor = "#89030a";
  y_cols_1[check_single_day].style.color = "#ffffff";
  y_cols_1[check_single_day].style.backgroundColor = "#89030a";
  y_cols_2[check_single_day].style.color = "#ffffff";
  y_cols_2[check_single_day].style.backgroundColor = "#89030a";
  y_cols_3[check_single_day].style.color = "#ffffff";
  y_cols_3[check_single_day].style.backgroundColor = "#89030a";
  y_cols_4[check_single_day].style.color = "#ffffff";
  y_cols_4[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_5[check_single_day].style.color = "#ffffff";
  y_cols_5[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_6[check_single_day].style.color = "#ffffff";
  y_cols_6[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_7[check_single_day].style.color = "#ffffff";
  y_cols_7[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_8[check_single_day].style.color = "#ffffff";
  y_cols_8[check_single_day].style.backgroundColor = "#89030a";
  y_cols_9[check_single_day].style.color = "#ffffff";
  y_cols_9[check_single_day].style.backgroundColor = "#89030a";
  y_cols_10[check_single_day].style.color = "#ffffff";
  y_cols_10[check_single_day].style.backgroundColor = "#89030a";
  y_cols_11[check_single_day].style.color = "#ffffff";
  y_cols_11[check_single_day].style.backgroundColor = "#89030a";
  y_cols_12[check_single_day].style.color = "#ffffff";
  y_cols_12[check_single_day].style.backgroundColor = "#89030a";
/*
  y_cols_13[check_single_day].style.color = "#ffffff";
  y_cols_13[check_single_day].style.backgroundColor = "#89030a";
  y_cols_14[check_single_day].style.color = "#ffffff";
  y_cols_14[check_single_day].style.backgroundColor = "#89030a";
  y_cols_15[check_single_day].style.color = "#ffffff";
  y_cols_15[check_single_day].style.backgroundColor = "#89030a";
  y_cols_16[check_single_day].style.color = "#ffffff";
  y_cols_16[check_single_day].style.backgroundColor = "#89030a";
  y_cols_17[check_single_day].style.color = "#ffffff";
  y_cols_17[check_single_day].style.backgroundColor = "#89030a";
*/  

}





// function to change column colour in the Freak Fitness Training Times new schedule
// as of September 1st 2010

function change_Sept_2010_colour() {

  // set up variables
  var make_day_red;
  var check_single_day;
  var y_cols_0;
  var y_cols_1;
  var y_cols_2;
  var y_cols_3;
  var y_cols_4;
  var y_cols_5;  
  var y_cols_6;  
  var y_cols_7;
  var y_cols_8;
  var y_cols_9;
  var y_cols_10;  
  var y_cols_11;  
  var y_cols_12;  
  var y_cols_13;
  var y_cols_14;
  var y_cols_15;
  var y_cols_16;
  var y_cols_17;
  var y_cols_18;

  y_cols_0 = document.getElementById("schedule_table").rows[0].cells;
  y_cols_1 = document.getElementById("schedule_table").rows[1].cells;
  y_cols_2 = document.getElementById("schedule_table").rows[2].cells;
  y_cols_3 = document.getElementById("schedule_table").rows[3].cells;
  y_cols_4 = document.getElementById("schedule_table").rows[4].cells;
  y_cols_5 = document.getElementById("schedule_table").rows[5].cells;
  y_cols_6 = document.getElementById("schedule_table").rows[6].cells;
  y_cols_7 = document.getElementById("schedule_table").rows[7].cells;
  y_cols_8 = document.getElementById("schedule_table").rows[8].cells;
  y_cols_9 = document.getElementById("schedule_table").rows[9].cells;
  y_cols_10 = document.getElementById("schedule_table").rows[10].cells;
  y_cols_11 = document.getElementById("schedule_table").rows[11].cells;
/*
  y_cols_12 = document.getElementById("schedule_table").rows[12].cells;
  y_cols_13 = document.getElementById("schedule_table").rows[13].cells;
  y_cols_14 = document.getElementById("schedule_table").rows[14].cells;
  y_cols_15 = document.getElementById("schedule_table").rows[15].cells;
  y_cols_16 = document.getElementById("schedule_table").rows[16].cells;
  y_cols_17 = document.getElementById("schedule_table").rows[17].cells;
*/
  // set up variables

  
  make_day_red = new Date();
  
  check_single_day = make_day_red.getDay();
  
  // since the date function treats Sunday as the start of the week, it assigns it a 0 and 
  // thus the schedule will have the timetable coloured red instead of the Sunday line
  if (check_single_day == 0) {
    check_single_day = 7;
  }

  y_cols_0[check_single_day].style.color = "#ffffff";
  y_cols_0[check_single_day].style.backgroundColor = "#89030a";
  y_cols_1[check_single_day].style.color = "#ffffff";
  y_cols_1[check_single_day].style.backgroundColor = "#89030a";
  y_cols_2[check_single_day].style.color = "#ffffff";
  y_cols_2[check_single_day].style.backgroundColor = "#89030a";
  y_cols_3[check_single_day].style.color = "#ffffff";
  y_cols_3[check_single_day].style.backgroundColor = "#89030a";
  y_cols_4[check_single_day].style.color = "#ffffff";
  y_cols_4[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_5[check_single_day].style.color = "#ffffff";
  y_cols_5[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_6[check_single_day].style.color = "#ffffff";
  y_cols_6[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_7[check_single_day].style.color = "#ffffff";
  y_cols_7[check_single_day].style.backgroundColor = "#89030a";  
  y_cols_8[check_single_day].style.color = "#ffffff";
  y_cols_8[check_single_day].style.backgroundColor = "#89030a";
  y_cols_9[check_single_day].style.color = "#ffffff";
  y_cols_9[check_single_day].style.backgroundColor = "#89030a";
  y_cols_10[check_single_day].style.color = "#ffffff";
  y_cols_10[check_single_day].style.backgroundColor = "#89030a";
  y_cols_11[check_single_day].style.color = "#ffffff";
  y_cols_11[check_single_day].style.backgroundColor = "#89030a";
/*  
  y_cols_12[check_single_day].style.color = "#ffffff";
  y_cols_12[check_single_day].style.backgroundColor = "#89030a";
  y_cols_13[check_single_day].style.color = "#ffffff";
  y_cols_13[check_single_day].style.backgroundColor = "#89030a";
  y_cols_14[check_single_day].style.color = "#ffffff";
  y_cols_14[check_single_day].style.backgroundColor = "#89030a";
  y_cols_15[check_single_day].style.color = "#ffffff";
  y_cols_15[check_single_day].style.backgroundColor = "#89030a";
  y_cols_16[check_single_day].style.color = "#ffffff";
  y_cols_16[check_single_day].style.backgroundColor = "#89030a";
  y_cols_17[check_single_day].style.color = "#ffffff";
  y_cols_17[check_single_day].style.backgroundColor = "#89030a";
*/  

}
