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 userAgent = window.navigator.userAgent
var isIE = (window.navigator.userAgent.indexOf("MSIE") != -1);
var isIE6 = (info.name == "MSIE" && info.version < 7);
/*var isSafari = (window.navigator.userAgent.indexOf("Safari") != -1);
var isMac = navigator.appVersion.indexOf("Mac")!=-1;*/
var isFireFox = (window.navigator.userAgent.indexOf("Firefox") != -1);
/*var isMacFireFox = isMac && isFireFox;
var is_iPod = navigator.appVersion.indexOf("iPod")!=-1;
var is_iPhone = navigator.appVersion.indexOf("iPhone")!=-1;*/

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" />');
/*if (isMac || isSafari)
document.writeln('<link href="stylesMac.css" rel="stylesheet" type="text/css" />');

if (isMacFireFox)
document.writeln('<link href="stylesMacFireFox.css" rel="stylesheet" type="text/css" />');

if (is_iPod || is_iPhone)
document.writeln('<link href="styles_iPod.css" rel="stylesheet" type="text/css" />');*/


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 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 writePngImageMap(url, width, height, alt, map) {
    if (!isIE6)
        document.write("<img usemap=\"" + map + "\" alt=\"" + alt + "\" src=\"" + url + "\" style=\"width: " + width + "px; height: " + height + "px;\">");
    else
        document.write("<img usemap=\"" + map + "\" src=\"spacer.png\" style=\"width: " + width + "px; height: " + height +
			"px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url + "', sizingMethod=scale);\">");
}

function renderFlash(src, width, height, features) {
    document.writeln('<embed src="' + src + '" quality="high" bgcolor="#ffffff" width="' + width +
					 '" height="' + height + '" align="middle" allowscriptaccess="sameDomain" ' +
					 'type="application/x-shockwave-flash" ' + features +
					 'pluginspage="http://www.macromedia.com/go/getflashplayer" />');
}

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;
}

var fontSize = 12;
function zoomIn() {
    if (fontSize < 17) {
        fontSize += 1;
        document.body.style.fontSize = fontSize + "px";
    }
}
function zoomOut() {
    if (fontSize > 9) {
        fontSize -= 1;
        document.body.style.fontSize = fontSize + "px";
    }
}
