//Rightmouse Filter
IE4plus = (document.all) ? true : false;
NS4 = (document.layers) ? true : false;
function clickIE(){
		//return false;
}
function clickNS(e){
	if (e.which==2 || e.which==3) {
		//return false;
	}
}
if (!IE4plus) {
	document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP);
	document.onmousedown=clickNS;
	document.onmouseup= clickNS;
	document.oncontextmenu=clickIE; // For NS 6+
} else {
	document.onmouseup= clickIE;
	document.oncontextmenu=clickIE;
}

//Field clear
function doClear(theText) {
     if (theText.value == theText.defaultValue) {
         theText.value = ""
     }
}

//show tabs
ns4 = (document.layers) ? true:false //required for Functions to work
ie4 = (document.all) ? true:false //required for Functions to work
ng5 = (document.getElementById) ? true:false //required for Functions to work

function showTab(layer) {
	document.getElementById('tab1').style.display='none';
	document.getElementById('tab2').style.display='none';
	document.getElementById('tab3').style.display='none';
	document.getElementById('tab4').style.display='none';	
	document.getElementById(layer).style.display='block';
	if (layer=='tab1'){
		document.getElementById('waardering').style.display='block';					
	}else{
		document.getElementById('waardering').style.display='none';					
	}	
}

//show paging
ns4 = (document.layers) ? true:false //required for Functions to work
ie4 = (document.all) ? true:false //required for Functions to work
ng5 = (document.getElementById) ? true:false //required for Functions to work

function showpaging(layer,totaal) {
  for (var i = 1; i < totaal; i++){
	   document.getElementById('page_'+i).style.display='none';
	}	
	document.getElementById('page_'+layer).style.display='block';
}

//Create cookie
function createCookie(name,value,days) {
  	if (days) {
  		var date = new Date();
  		date.setTime(date.getTime()+(days*24*60*60*1000));
  		var expires = "; expires="+date.toGMTString();
  	}
  	else var expires = "";
  	document.cookie = name+"="+value+expires+"; path=/";
}

//iframe scaling 
function iFrameHeight() {
	var h = 0;
	var h2 = 160;
	if (self.innerHeight) // all except Explorer
	{
		h = self.innerHeight;
		document.getElementById('iframe_redpixel').style.height = h - h2 + 'px';
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		h = document.documentElement.clientHeight;
		document.getElementById('iframe_redpixel').style.height = h - h2 + 'px';
	}
	else if (document.body) // other Explorers
	{
		h = document.body.clientHeight;
		document.getElementById('iframe_redpixel').style.height = h - h2 + 'px';
	}
}
function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { 
		i = 0.00; 
	}
	var minus = '';
	if(i < 0) {
		 minus = '-'; 
	}
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) {
		 s += '.00'; 
 	}
	if(s.indexOf('.') == (s.length - 2)) {
		s += '0'; 
	 }
	s = minus + s;
	return CommaFormatted(s);
}
function CommaFormatted(amount)
{
	var delimiter = ".";
	var comma = ",";
	var a = amount.split('.',2)
	var d = a[1];
	var i = parseInt(a[0]);
	if(isNaN(i)) { return ''; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	var n = new String(i);
	var a = [];
	while(n.length > 3)
	{
		var nn = n.substr(n.length-3);
		a.unshift(nn);
		n = n.substr(0,n.length-3);
	}
	if(n.length > 0) { a.unshift(n); }
	n = a.join(delimiter);
	if(d.length < 1) { amount = n; }
	else { amount = n + comma + d; }
	amount = minus + amount;
	return amount;
}