<!--

function lightlinkON(id,col)
{
	var obj1=document.getElementById(id);
	if (col) obj1.style.color=col; else obj1.style.color='194CE8';
};
function lightlinkOFF(id,col)
{
	var obj1=document.getElementById(id);
	if (col) obj1.style.color=col;else obj1.style.color='0C2C8D';
};

function lightboxON(id,col)
{
	var obj1=document.getElementById(id);
	if (col) obj1.style.backgroundColor=col; else obj1.style.backgroundColor='194CE8';
};
function lightboxOFF(id,col)
{
	var obj1=document.getElementById(id);
	if (col) obj1.style.backgroundColor=col;else obj1.style.backgroundColor='0C2C8D';
};

 function _getBoundingClientRect( p_domElem )
 {
 	if (!p_domElem) return;
   if(p_domElem.getBoundingClientRect)
   {
     return p_domElem.getBoundingClientRect();
   }else
   {
     var cR = new Object;
     cR.left  = getRealLeft(p_domElem);
     cR.top   = getRealTop(p_domElem);
     cR.right = cR.left + p_domElem.offsetWidth;
     cR.bottom= cR.top + p_domElem.offsetHeight;
     return cR;
   }
 };
 function getRealLeft(el)
 {
   xPos = el.offsetLeft;
   tempEl = el.offsetParent;
   while (tempEl != null)
   {
     xPos += tempEl.offsetLeft;
     tempEl = tempEl.offsetParent;
   }
   return xPos;
 };
 function getRealTop(el)
 {
   yPos = el.offsetTop;
   tempEl = el.offsetParent;
   while (tempEl != null)
   {
     yPos += tempEl.offsetTop;
     tempEl = tempEl.offsetParent;
   }
   return yPos;
 }
var LASTVISIBLEWINDOW=0;
var LASTVISIBLEWINDOWTOP=0;
function hidewindow(win)
{
	var obj1=document.getElementById(win);
	obj1.style.visibility='hidden';
	obj1.style.top=-1000;
	obj1.style.left=-1000;
	LASTVISIBLEWINDOW=0;
};
function showwin(win,posx,posy)
{
	if (LASTVISIBLEWINDOW)
	{
		LASTVISIBLEWINDOW.style.visibility='hidden';
		LASTVISIBLEWINDOW.style.left=-1000;
		LASTVISIBLEWINDOW.style.top=-1000;
		LASTVISIBLEWINDOW=0;
		LASTVISIBLEWINDOWTOP=0;
	};
	wobj=document.getElementById(win);
	mobj=document.getElementById('bodydiv');
	Mrect  =_getBoundingClientRect(mobj);
	Wrect  =_getBoundingClientRect(wobj);
	scrollOffsetTop=document.body.scrollTop;
	scrollOffsetLeft=document.body.scrollLeft;

	var dispy;
	if (Mrect.top>=0)
	{
		dispy=(Mrect.top+posy);
	}else
	{
		dispy=posy;
	};

	wobj.style.left=scrollOffsetLeft+posx;
	wobj.style.top=dispy+scrollOffsetTop;
	zzz=wobj.innerHTML;
	wobj.innerHTML='';
	wobj.innerHTML=zzz;
	wobj.style.visibility='visible';
	LASTVISIBLEWINDOW=wobj;
	LASTVISIBLEWINDOWTOP=posy;
};
function toglewin(name)
{
	obj=document.getElementById(name)
	if (obj)
	{
		if (obj.style.display=='none')
		{
			obj.style.display='inline';
			return 1;
		}else
		{
			obj.style.display='none';
			return 0;
		};
	};
};

function NewHttpReq()
{
     var httpReq = false;
    if(window.XMLHttpRequest)
    {
        try
        {
             httpReq = new XMLHttpRequest();
        }catch(e)
        {
             httpReq = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject)
    {
        try
        {
             httpReq = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e)
        {
                try
                {
                        httpReq = new ActiveXObject("Microsoft.XMLHTTP");
                } catch(e)
                {
                        httpReq = false;
                }
        }
    }
    return httpReq;
}

function DoRequest(httpReq,url,Rtype,param)
{
    // httpReq.open (Method("get","post"), URL(string), Asyncronous(true,false))
    httpReq.open(Rtype, url,false);
    httpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    httpReq.send(param);
    if (httpReq.status == 200)
    {
        return httpReq.responseText;
    } else
    {
        return httpReq.status;
    }
}

function FormatSize(size) 
{
	var roundup=0;
	if (size < Math.pow(2,10)) return size + ' bytes';	
	if (size >= Math.pow(2,10) && size < Math.pow(2,20)) return Math.round(size / Math.pow(2,10), 0) + ' KB';
	if (size >= Math.pow(2,20) && size < Math.pow(2,30)) return Math.round(size / Math.pow(2,20), roundup?0:1) + ' MB';
	if (size > Math.pow(2,30)) 									return Math.round(size / Math.pow(2,30), roundup?0:2) + ' GB';
}





var isoHelper = {
	 getWeekNumber: function(date) 
	 {
		 // 1. Convert input to Y M D
		 var Y = date.getFullYear();
		 var M = date.getMonth();
		 var D = date.getDay();
 
		 // 4. Find the DayOfYearNumber for Y M D
		 var DayOfYearNumber = isoHelper.findDayOfYearNumber(date);
		 
		 // 5. Find the Jan1Weekday for Y (Monday=1, Sunday=7)
		 var Jan1Weekday = isoHelper.findJan1Weekday(date);
 
		 // 6. Find the Weekday for Y M D
		 var WeekDay = isoHelper.findDayWeek(date);

		 // 7. Find if Y M D falls in YearNumber Y-1, WeekNumber 52 or 53
		 var YearNumber = Y;
		 var WeekNumber = 0;
		 if((DayOfYearNumber <= (8 - Jan1Weekday)) && (Jan1Weekday > 4)) 
		 {
			 YearNumber = Y - 1
			 if((Jan1Weekday == 5) || (Jan1Weekday == 6 && isoHelper.isLeapYear(date))) 
			 {
				 WeekNumber = 53;
			 }else 
			 {
				 WeekNumber = 52;
			 }
		} 

		// 8. Find if Y M D falls in YearNumber Y+1, WeekNumber 1
		if(YearNumber == Y) 
		{
			var I;
		 	if(isoHelper.isLeapYear(date)) 
		 	{
		 		I = 366;
			}else 
			{
				I = 365
			}
 
			if ((I - DayOfYearNumber) < (4 - WeekDay)) 
			{
				YearNumber = Y + 1;
				WeekNumber = 1;
			 }
		}
 
		// 9. Find if Y M D falls in YearNumber Y, WeekNumber 1 through 53
		if(YearNumber == Y) 
		{
			var J;
			J = DayOfYearNumber + (7 - WeekDay) + (Jan1Weekday - 1)
			WeekNumber = J / 7;
			if(Jan1Weekday > 4 ) 
			{
				 WeekNumber -= 1;
			}
		 }
		 return WeekNumber;
	 },
	 isLeapYear: function(date) 
	 {
		 var Y = date.getFullYear();
		 if ((Y % 4) == 0) 
		 {
		 	if ((Y % 100) != 0) 
		 	{
				if((Y % 400) == 0) 
				{
		 			return false;
			 	}else 
			 	{
			 		return true;
			 	} 
		 	}
		}
		return false;
	},
	findDayOfYearNumber: function(date) 
	{
		 var months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
		 var day = date.getDate() + months[date.getMonth()];
		 if(isoHelper.isLeapYear(date)) 
		 {
		 	day++;
		 }
		 return day;
	 }, 
	 findJan1Weekday: function(date) 
	 {
	 	var d = new Date(date.getFullYear(), 0, 1);
	 	return d.getDay();
	 },
	 findDayWeek: function (date) 
	 {
	 	var WeekDay = date.getDay(); 
		if(WeekDay == 0) 
		{
			WeekDay = 7;
	 	}
		 return WeekDay;
	 } 
}



function getWeekNr(y,m,d)
{
	var today = new Date();
	today.setDate(d);
	today.setMonth(m);
	today.setFullYear(y);

	Year = takeYear(today);
	Month = today.getMonth();
	Day = today.getDate();
	now = Date.UTC(Year,Month,Day+1,0,0,0);
	var Firstday = new Date();
	Firstday.setYear(Year);
	Firstday.setMonth(0);
	Firstday.setDate(1);
	then = Date.UTC(Year,0,1,0,0,0);
	var Compensation = Firstday.getDay();
	if (Compensation > 3) Compensation -= 4;
	else Compensation += 3;
	NumberOfWeek =  Math.round((((now-then)/86400000)+Compensation)/7);
	return NumberOfWeek;
}

function getWeek(year,month,day)
{
    month += 1; //use 1-12
    var a = Math.floor((14-(month))/12);
    var y = year+4800-a;
    var m = (month)+(12*a)-3;
    var jd = day + Math.floor(((153*m)+2)/5) + 
                 (365*y) + Math.floor(y/4) - Math.floor(y/100) + 
                 Math.floor(y/400) - 32045;      
    var d4 = (jd+31741-(jd%7))%146097%36524%1461;
    var L = Math.floor(d4/1460);
    var d1 = ((d4-L)%365)+L;
    NumberOfWeek = Math.floor(d1/7) + 1;
    return NumberOfWeek;        
}


function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}






//-->


