/*
CSS Browser Selector v0.2.7
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/

var css_browser_selector = function() {var ua=navigator.userAgent.toLowerCase(),is=function(t){return ua.indexOf(t) != -1;},h=document.getElementsByTagName('html')[0],b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?'gecko ff2':is('firefox/3')?'gecko ff3':is('gecko/')?'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';var c=b+os+' js'; h.className += h.className?' '+c:c;}();

var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly = (is_nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );
var is_nav6 = (is_nav && (is_major == 5));
var is_nav6up = (is_nav && (is_major >= 5));
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 4.5") !=-1));
var is_ie4up  = (is_ie && (is_major >= 4));
var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
var is_mac = (agt.indexOf("mac")!=-1);

function upgrade() {
  top.location.href = "http://www.webstandards.org/upgrade/";
}

function browserCheck() {
  if (is_nav4 || is_ie3) {
    upgrade();
  } 
}

function goToUrl(theUrl) {
  top.location.href = theUrl;
}

// DOM-enabled?
if (!document.getElementById) { 
	var is_dom = false;
} else {
	var is_dom = true;
}

function writeNewDiv(id,newCnt) {
	
	var theDelay = true;
	
	if (is_dom) {
		document.getElementById(id).innerHTML=newCnt;
	}
	else {
		if (is_nav) {
			document.layers[id].document.write(newCnt);
			document.layers[id].document.close();
		}
		else {
		//IE4 crashes if you set the innerhtml without a delay, strange
			if (is_ie4) {
				if (theDelay == true) {
					thisID = id;
					setTimeout("writeNewDiv(thisID);",100);
					theDelay = false;
				}
				else {
					document.all[id].innerHTML=newCnt;
					theDelay = true;
				}
			}
			else {
				document.all[id].innerHTML=newCnt;
			}
		}
	}
	return false;
}

function checkPlugin(plgIn, autoGo) { //checkPlugin('Shockwave Flash',false);return document.MM_returnValue
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
	
  if (!ok) { 
	var hasPlugin = false;
  } else {
	var hasPlugin = true;
  }
}

function mplayerStatus(title) {
  writeNewDiv('mplayer_status', '<div class=\"mplayer\">NOW PLAYING <strong>' + title + '</strong> &nbsp;<sup>&ndash;<a href=\"mplayer_init.php\" target=\"player\" onClick=\"mplayerStop();\">STOP</a></sup></span></div>');
}
function mplayerStop() {
  writeNewDiv('mplayer_status', '');
}

