// JavaScript Document

 function addLoadEvent(func) { 
      var oldonload = window.onload; 
      if (typeof window.onload != 'function') { 
           window.onload = func;
      }
      else {
           window.onload = function() {
                oldonload();
                func();
           }
      }
 }

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName('link')[i]); i++) {
    if(a.getAttribute("rel").indexOf('style') != -1 && a.getAttribute('title')) {
      a.disabled = true;
      if(a.getAttribute('title') == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getStylesheet()
{
	var browser=navigator.appName; 
 	var b_version=navigator.appVersion; 
 	var version=parseFloat(b_version); 
  	if(navigator.vendor == "Apple Computer, Inc.")
  		setActiveStyleSheet('saf');
		
  else if (browser=="Microsoft Internet Explorer"){
		if (b_version.indexOf('MSIE 6.0')>=0)
			setActiveStyleSheet('ie6');
		if (b_version.indexOf('MSIE 8.0')>=0)
			setActiveStyleSheet('ie8');
		else 
			setActiveStyleSheet('ie');
	}
	else
		setActiveStyleSheet('moz');
		
	/*else if(browser.toLowerCase() == "netscape")
		setActiveStyleSheet('moz');
	else
		setActiveStyleSheet('ie');*/
}
window.onload = getStylesheet;
addLoadEvent(getStylesheet);
/*window.addEvent('domready', function() {
		
	//We can use one Request object many times.
	//We can use one Request object many times.
	var req = new Request.HTML({url:'http://dev.schedulestar.com/schedulestar/new_website/html_and_images2/e_letter_article_archive.cfm', 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('result').set('text', '');
			//Inject the new DOM elements into the results div.
			$('result').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('result').set('text', 'The request failed.');
		}
	});
	
	$('makeRequest').addEvent('click', function() {
		req.send();
	});
	var issue = new Request.HTML({url:'http://dev.schedulestar.com/schedulestar/new_website/html_and_images2/e_letter_issue_archive.cfm', 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('result').set('text', '');
			//Inject the new DOM elements into the results div.
			$('result').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('result').set('text', 'The request failed.');
		}
	});
	
	$('issuebtn').addEvent('click', function() {
		issue.send();
	});
	var PR = new Request.HTML({url:'http://dev.schedulestar.com/schedulestar/new_website/html_and_images2/Press_Release_Year_Archive.cfm', 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('result').set('text', '');
			//Inject the new DOM elements into the results div.
			$('result').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('result').set('text', 'The request failed.');
		}
	});
	
	$('PRbtn').addEvent('click', function() {
		PR.send();
	});
});*/
