function BrowserInfo() 
{
	var agent = window.navigator.userAgent;
	if (agent.indexOf("MSIE") != -1) 
	{
		var start = agent.indexOf("MSIE");
		this.name = "MSIE";
		this.version = parseFloat(agent.substring(start + 5, agent.indexOf(";", start)));
	} 
	
	else if (agent.indexOf("Firefox") != -1) 
	{
		var start = agent.indexOf("Firefox");
		this.name = "Firefox";
		this.version = agent.substring(start + 8, agent.length);
		var firstDec = this.version.indexOf(".") + 1;
		while (this.version.indexOf(".", firstDec) != -1)
			this.version = this.version.substring(0, firstDec) + this.version.substring(firstDec).replace(".", "");
		this.version = parseFloat(this.version);
	} 
	
	else 
	{
		this.name = "Unknown";
		this.version = 0;
	}
}

var info = new BrowserInfo();
var isIE6 = (info.name == "MSIE" && info.version < 7);

if (info.name == "MSIE" && info.version < 7)
	document.writeln('<link href="stylesIE6.css" rel="stylesheet" type="text/css" />');	
else
	document.writeln('<link href="stylesDynamic.css" rel="stylesheet" type="text/css" />');

var userAgent = window.navigator.userAgent
var isIE = (window.navigator.userAgent.indexOf("MSIE") != -1);
var isFirefox = (window.navigator.userAgent.indexOf("Firefox") != -1);
var isIE6 = (parseFloat(userAgent.substring(userAgent.indexOf("MSIE ") + 5)) <= 6);
var isSafari = (navigator.userAgent.indexOf("Safari") > 0);

function writePngImage(url, width, height, alt) 
{
	if (!isIE6)
		document.write("<img alt=\"" + alt + "\" src=\"" + url + "\" style=\"width: " + width + "px; height: " + height + "px;\">");
	
	else
		document.write("<img alt=\"" + alt + "\" src=\"spacer.png\" style=\"width: " + width + "px; height: " + height + 
			"px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url + "', sizingMethod=scale);\">");
}

function writePngClass(url, width, height, alt, className) {
	if (!isIE6)
		document.write("<img alt=\"" + alt + "\" class=\"" + className + "\" src=\"" + url + "\" style=\"width: " + width + "px; height: " + height + "px;\">");
	else
		document.write("<img alt=\"" + alt + "\" class=\"" + className + "\"  src=\"spacer.png\" style=\"width: " + width + "px; height: " + height + 
			"px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url + "', sizingMethod=scale);\">");
}



function submitForm(id) 
{
	document.getElementById(id).submit();
	return false;
}

String.prototype.trim = function () 
{
	return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

reset_form_value = function(str1, str2, val) 
{
	if(str1 == val.value.trim())
		val.value = str2;
}

function displayOrgSection(index, section) {
    var obj = document.getElementById(index + "_" + section);
    if (obj.style.display == "")
    {
        obj.style.display = "none";
        return;
    }
    
    var i = 0;
    
    while (document.getElementById(i + "_courses") != null)
    {
        document.getElementById(i + "_courses").style.display = "none";
        document.getElementById(i + "_requirements").style.display = "none";
        document.getElementById(i + "_contact").style.display = "none";
        i++;
    }
    
    obj.style.display = "";
}
