<!--

/* Copyright Muchachamaca SCP, Spain - All rights reserved */

//String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }
String.prototype.trim = function () { return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"); }
//function trim (s,r="") { return s.replace(/^\s*(\S*(\s+\S+)*)\s*$/, r); }

var lang = "en";

var docParms = new Array();
function GetParams()
{
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	for (var i=0; i<parms.length; i++) {
		var pos = parms[i].indexOf('=');
		if (pos > 0) {
			var key = parms[i].substring(0,pos);
			var val = parms[i].substring(pos+1);
			docParms[key] = val;
		}
	}
}


function escramble(domein,adres,params,display)
{
	var a,b,c,d,e,f,g,h,i
	a='<a href=\"mai'
	b=adres
	c='" '+params+'>'
	a+='lto:'
	b+='@'
	e='</a>'
	b+=domein
	d=display
	document.write(a+b+c+d+e)
}

function escramble_auto(domein,adres,params)
{
	var a,b,c,d,e,f,g,h,i
	a='<a href=\"mai'
	b=adres
	c='" '+params+'>'
	a+='lto:'
	b+='@'
	e='</a>'
	b+=domein
	d=b
	document.write(a+b+c+d+e)
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;	if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function MM_reloadPage(init) {	//reloads the window if Nav4 resized
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);


//-------------------------------------------------------------------------------------------


function FormatAmount (inAmount)
{
	var theThousandsSep = ",";
	var theDecimalSep = ".";
	var theString = "";

	// round extra decimals
	theAmount = Math.round(inAmount * 100);
	
	// get the part after the decimal
	theFrac = theAmount % 100;

	// get the part before the decimal
	theInt = Math.round ((theAmount - theFrac) / 100);
	
	if (theInt == 0)
		theString = "0";
	else
	{
		while (theInt > 0)
		{
			theVal = theInt % 1000;
			if (theInt >= 1000)
			{
				if (theVal < 10)
					theVal = "00" + theVal;
				else if (theVal < 100)
					theVal = "0" + theVal;
			}
			
			if (theString == "")
				theString = theVal;
			else
				theString = theVal + theThousandsSep + theString;
			theInt = (theInt - theVal) / 1000;
		}
	}
	
	theString += theDecimalSep;
	
	if (theFrac < 10) theString += "0";
	theString += theFrac;
	
	return theString;
}


//-------------------------------------------------------------------------------------------

// event stuff

//*** This code is copyright 2003 by Gavin Kistner, !@phrogz.net
//*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt
//*** Reuse or modification is free provided you abide by the terms of that license.
//*** (Including the first two lines above in your source code satisfies the conditions.)

//***Cross browser attach event function. For 'evt' pass a string value with the leading "on" omitted
//***e.g. AttachEvent(window,'load',MyFunctionNameWithoutParenthesis,false);

function AttachEvent(obj,evt,fnc,useCapture){
	if (!useCapture) useCapture=false;
	if (obj.addEventListener){
		obj.addEventListener(evt,fnc,useCapture);
		return true;
	} else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc);
	else{
		MyAttachEvent(obj,evt,fnc);
		obj['on'+evt]=function(){ MyFireEvent(obj,evt) };
	}
} 

//The following are for browsers like NS4 or IE5Mac which don't support either
//attachEvent or addEventListener
function MyAttachEvent(obj,evt,fnc){
	if (!obj.myEvents) obj.myEvents={};
	if (!obj.myEvents[evt]) obj.myEvents[evt]=[];
	var evts = obj.myEvents[evt];
	evts[evts.length]=fnc;
}
function MyFireEvent(obj,evt){
	if (!obj || !obj.myEvents || !obj.myEvents[evt]) return;
	var evts = obj.myEvents[evt];
	for (var i=0,len=evts.length;i<len;i++) evts[i]();
}

// blur anchors after focus to avoid ugly highlighting

function MyBlur (event)
{
	var evt = window.event || event; //evt evaluates to window.event or inexplicit e object, depending on which one is defined
	if (!evt.target) //if event obj doesn't support e.target, presume it does e.srcElement
		evt.target=evt.srcElement //extend obj with custom e.target prop
	evt.target.blur();
	return true;
}

function addMenuBlur()
{
	var anchors = document.getElementsByTagName("a");
	for (var i = 0; i < anchors.length; i++)
		AttachEvent (anchors[i], 'focus', MyBlur, false);
}

//-->

