<!--

//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 docParams = 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);
		  docParams[key] = val;
	   }
	}
}
GetParams();

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 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 escramble(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 jc_select (smallfile, largefile)
{
	document.getElementById("jc_galeryfoto").src = "../galerias/jcloading.png";
	document.getElementById("jc_galeryfoto").src = largefile;
}


function GetXmlHttpObject()
{
	var xmlHttp = null;
	
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	
	return xmlHttp;
}

/***************************************/

var thePreloadImageUrls = new Array();
var thePreloadImages = new Array();

function addPreloadImage (inImageUrl)
{
	thePreloadImageUrls.push (inImageUrl);
}

function preloadImages()
{
	for (i = 0; i < thePreloadImageUrls.length; i++)
	{
		thePreloadImages[i] = new Image;
		thePreloadImages[i].src = thePreloadImageUrls[i];
	}
}

function clearPreloadImages()
{
	thePreloadImageUrls = new Array();
	thePreloadImages = new Array();
}

/***************************************/

function toggleVisibility (inId)
{
	obj = document.getElementById (inId);
	if (obj)
		obj.style.display = (obj.style.display == "none") ? "" : "none";
}

function hideElement (inId)
{
	obj = document.getElementById (inId);
	if (obj)
		obj.style.display = "none";
}

function showElement (inId)
{
	obj = document.getElementById (inId);
	if (obj)
		obj.style.display = "";
}

/***************************************/

function getPopupValue (id, _default)
{
	obj = document.getElementById(id);
	if (!obj || obj.selectedIndex <= 0)
		value = _default;
	else
		value = obj.options[obj.selectedIndex].value;
	return value;
}

function selectOption (id, inValue)
{
	obj = document.getElementById (id);
	if (obj)
	{
		for (i = 0; i < obj.options.length; i++)
		{
			if (obj.options[i].value == inValue)
			{
				obj.options[i].selected = true;
				break;
			}
		}
	}
}

/***************************************/

Array.prototype.removeByValue = function (value, count)
{
	if (count == null)
		count = 1;
	else if (count == 0)
		count = 0x7FFFFFFF;
	
	for (var i = 0; i < this.length && count > 0; i++)
	{
		if (this[i] == value)
		{
			this.splice(i,1);
			count--;
		}
	}
}

/***************************************/

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

function setCookie(c_name,value,expiredays)
{
	var exdate = new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie = c_name+ "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
} 


function getCookie(c_name)
{
	if (document.cookie.length > 0)
	{
		c_start = document.cookie.indexOf (c_name + "=")
		if (c_start!=-1)
		{
			c_start=c_start + c_name.length+1
			c_end = document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end = document.cookie.length
			return unescape(document.cookie.substring(c_start,c_end))
		} 
	}
	return null
}

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

function addLoadEvent (func)
{	
	var oldFunc = window.onload;
	if (typeof window.onload != 'function')
		window.onload = func;
	else
		window.onload = function() { oldFunc(); func(); }
}

function addUnloadEvent (func)
{	
	var oldFunc = window.onunload;
	if (typeof window.onunload != 'function')
		window.onunload = func;
	else
		window.onunload = function() { oldFunc(); func(); }
}


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