/* Updated version of main.js;
   now checks browers (changes in makeActive() )*/

// detect browser, everytime page is loaded;
var browser = navigator.appName;
var version = parseInt(navigator.appVersion);
var os = navigator.platform;  

//check for DHTML
if(!document.getElementById) {// && !document.all && !document.layers)  {
	//location.href="../badbrowser.html";
}

//alert(browser);

//DIE OPERA DIE
// 2006-01-30 (Gene) Opera no longer sucks
/*
   if (browser == 'Opera') {
	   alert(browser + "suckss");
	   location.href="http://www.mozilla.org/";
	   if(os == "MacPPC") {
		   alert('foo');
		   document.all['cs'].style.width = '900px';
		   alert(document.all['cs'].style.width);
	   }
   }
 */


function setAtt(element, attribute, value) {
	//check for DHTML
	var obj;
	var style;

	if (document.getElementById)
	{
		obj = document.getElementById(element);
		style = document.getElementById(element).style;
	}
	else if (document.all)
	{
		obj = document.all[element];
		style = document.all[element].style;
	}
	else if (document.layers)
	{
		obj = document.layers[element];
		style = document.layers[element];
	}

	style[attribute] = value;
}

function setTop3Borders (element, colorName) {
	setAtt(element, 'borderTop', colorname);
	setAtt(element, 'borderLeft', colorname);
	setAtt(element, 'borderRight', colorname);
}

var activeGifs = new Object();
activeGifs["cs"] = "../images/default.gif";
activeGifs["cs3"] = "../images/activecs3.gif";
activeGifs["cs61a"] = "images/activecs61a.gif";
activeGifs["cs61b"] = "images/activecs61b.gif";
activeGifs["cs61c"] = "images/activecs61c.gif";
var inactiveGifs = new Object();
inactiveGifs["cs"] = "../images/changedcs.gif";
inactiveGifs["cs3"] = "images/inactivecs3.gif";
inactiveGifs["cs61a"] = "images/inactivecs61a.gif";
inactiveGifs["cs61b"] = "images/inactivecs61b.gif";
inactiveGifs["cs61c"] = "images/inactivecs61c.gif";
var courseArray = new Array ("cs3", "cs61a" , "cs61b" , "cs61c");


/* Called onLoad for main.php */
function makeActive(course) {
	// jun's defaults
	var width1 = '38px';
	var width2 = '38px';
	var width3 = '36px';
	//alert ("." + browser + ".");
	if (browser == 'Microsoft Internet Explorer' &&
			version != 5 ) {
		//alert (os);
		if(os == "MacPPC") {
			//   width1 = '40px';
			//  width2 = '40px';
			// width3 = '40px';
		}
		else {
			//width1 = '40px'; // for 'cs3' in case of 'cs3'
			//width2 = '39px'; // for 'cs' in case of 'cs3'
			//width3 = '39px'; // for the rest
			//setAtt('cs', 'width', width2);
		}
	}
	else if (browser == 'Opera') {
		if(os == "MacPPC") {
			width1 = '30px';
			width2 = '30px';
			width3 = '30px';
		}
		//setAtt('cs', 'width', '60px');
		//width1 = '44px';
		//width2 = '44px';
		//width3 = '44px';
	}

	setAtt(course, 'backgroundColor', '#021423');
	if (course == 'cs3') {
		setAtt(course, 'border', '2px solid #FFB400');
		setAtt(course, 'width', width1);
		setAtt(course, 'height', '33px');
		setAtt(course, 'borderBottomWidth', '0');
		setAtt(course, 'borderLeftWidth', '0');
		setAtt('cs' , 'borderRightWidth', '0');
		setAtt('cs', 'borderRightColor', '#021423');
		setAtt('cs' , 'width', width2);
	}
	else {
		setAtt(course, 'border', '2px solid #FFB400');
		setAtt(course, 'width', width3);
		setAtt(course, 'height', '33px');
		setAtt(course, 'borderBottomWidth', '0');
	}

}


function fullScreen () {
	if (window != top) top.location.href = location.href;
	self.moveTo(0,0);
	self.resizeTo(screen.availWidth,screen.availHeight);
}
/*alert ("change border for: " + course);
  setAtt(course, 'color', 'yellow');
  for (var i=0; i<4; i++) {
  var current = courseArray[i];
  if (course != current) {
  setAtt(current, 'backgroundImage', 'url(' + inactiveGifs[current] + ')');
  }
  else {
  setAtt(current, 'backgroundImage', 'url(' + activeGifs[current] + ')');
  if(current == 'cs3') {
  setAtt('cs', 'backgroundImage', 'url(' + inactiveGifs['cs'] + ')');
  }
  }
  } 
  } */
