/* Accessible way to open page in a new window */
function externalLinks() { 
	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";
	}
}
function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {var x = Math.round(num * Math.pow(10,dec));if (x >= 0) n1=n2='';var y = (''+Math.abs(x)).split('');var z = y.length - dec; if (z<0) z--; for(var i = z; i < 0; i++) y.unshift('0');y.splice(z, 0, pnt); if(y[0] == pnt) y.unshift('0'); while (z > 3) {z-=3; y.splice(z,0,thou);}var r = curr1+n1+y.join('')+n2+curr2;return r;}

var os="Unknown OS";
function identifyBrowser() {
	var agent = navigator.userAgent.toLowerCase();
	if (navigator.appVersion.indexOf("Win")!=-1) os="windows";
	if (navigator.appVersion.indexOf("Mac")!=-1) os="mac";
	if (navigator.appVersion.indexOf("X11")!=-1) os="unix";
	if (navigator.appVersion.indexOf("Linux")!=-1) os="linux";
	if (typeof navigator.vendor != "undefined" && navigator.vendor == "KDE" && typeof window.sidebar != "undefined")  {
		return "kde";
	}else if (typeof window.opera != "undefined"){
		var version = parseFloat(agent.replace(/.*opera[\/ ]([^ $]+).*/, "$1"));
	    if (version >= 7){
			return "opera7";
		}else if (version >= 5){
			return "opera5";
		}
	    return false;
	}else if (typeof document.all != "undefined"){
		if (typeof document.getElementById != "undefined"){
			var browser = agent.replace(/.*ms(ie[\/ ][^ $]+).*/, "$1").replace(/ /, "");
			if (typeof document.uniqueID != "undefined"){
				if (browser.indexOf("5.5") != -1){
					return browser.replace(/(.*5\.5).*/, "$1");
				}else{
					return browser.replace(/(.*)\..*/, "$1");
				}
      		}else{
				return "ie5mac";
			}
		}
		return false;
	}else if (typeof document.getElementById != "undefined")  {
		if( window.devicePixelRatio && window.getMatchedCSSRules && !window.Opera){
			return "safari3";
		}else if (navigator.vendor.indexOf("Apple Computer, Inc.") != -1){
			if (typeof window.XMLHttpRequest != "undefined"){
				return "safari1.2";
			}
			return "safari1";
		}else if (agent.indexOf("gecko") != -1){
			return "mozilla";
		}
	}
	return false;
}

function currencyDropDown(){
    var selCurrency = document.getElementById('selCurrency')
    
    if (selCurrency != null){
   
        selCurrency.onchange = function(){
           $('fmCurrency').submit();
        }
    }
}

var browser = identifyBrowser();
Event.observe(window,"load",function() { externalLinks(); currencyDropDown();});