function fancyPopup(u , w , h)
 {
	w = window.open(u, "fancyPopup", "width="+w+", height="+h+", location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no, statusbar=no");	
	if(w)w.focus();	
	return false;	
	}

function submitForm(f , u)
	{
	f.action = u;
	f.submit();
	return false;		
	}

function PostBack(naam)
	{
	this.naam = naam;
	this.variables = new Array();
	this.act = document.location;
	
	this.setVar = function(k , v)
		{
		temp = new Array();
		temp[0] = k;
		temp[1] = v;
		this.variables[this.variables.length] = temp;	
		}
	
	this.setAction = function(v)
		{
		this.act = v;	
		}
	
	this.submit = function()
		{
		//alert('b') 
		formEl = document.createElement("form");
		//alert('a') 
		formEl.setAttribute("name" , this.naam);	
			formEl.setAttribute("id" , "pbform___");	
		formEl.setAttribute("method" , "post");		
		formEl.setAttribute("action" , this.act);	
				
		for(i=0; i< this.variables.length; i++)
			{
			ip = document.createElement("input");
			ip.setAttribute("type" , "hidden");
			ip.setAttribute("name" , this.variables[i][0]);
			ip.setAttribute("value" , this.variables[i][1]);
			formEl.appendChild(ip);	
			}
		
		document.getElementsByTagName("body")[0].appendChild(formEl);
		// alert(document.getElementById("pbform___"));
		formEl.submit();
		}
	this.test = function()
		{
		alert(this.naam);	
		}
		
		
	this.gatherCheckboxes = function(f)
		{
		boxes = f.getElementsByTagName("INPUT");
		for(i = 0; i < boxes.length; i++)
			{
			if(boxes[i].type == "checkbox" && boxes[i].checked)
				{
				this.setVar(boxes[i].name , boxes[i].value)	
				}	
			}
			
		}
	}
	
function cbAll(f)
	{
		
	limit = 20;
	boxes = f.getElementsByTagName("input");
	// alert(boxes.length)
	if(boxes.length == 0)
		{
		 
		boxes = document.getElementsByTagName("input");
	 
		}
		
	ct = 0;
	for(i = 0; i < boxes.length; i++)
		{
		if(boxes[i].type == "checkbox")
			{			
			boxes[i].checked = (f.alleCBAan != "ja") && ct < limit;
			ct++;
			}	
		}
	f.alleCBAan = f.alleCBAan != "ja" ? "ja" : "nee"	
	cbCountCheck(f)
	}
	
function cbCountCheck(f)
	{
	limit = 20;
	ct = 0;
	boxes = f.getElementsByTagName("INPUT");
	if(boxes.length == 0)
		{
		 
		boxes = document.getElementsByTagName("input");
	 
		}
	for(i = 0; i < boxes.length; i++)
		{
		if(boxes[i].type == "checkbox")
			{			
			if (boxes[i].checked)
				{
				ct++;
				}		 
			}	
		}
	if(ct > limit)
		{
			if(document.getElementById("cbCountError"))
			{
			if(f.getElementsByTagName("INPUT").length == 0)
				{
				alert("U kunt niet meer dan 20 domeinen tegelijk selecteren!")	
				}
			else
				{
				document.getElementById("cbCountError").style.display = "block";
				}
			}
		return false;
		}
	else
		{
		if(document.getElementById("cbCountError"))
			{
			document.getElementById("cbCountError").style.display = "none";
			}
		return true;
		}
	}
	
dCheckMaxSteps = 2;
dCheckSteps = 0;
dCheckInterval = null;
dCheckError = null;
function dCheckProgress(errorMessage)
	{
	dCheckError = errorMessage
	document.getElementById("domeinProgress").style.display="";
	document.getElementById("domeinProgressDef").style.display="none";
		
	dCheckInterval = setInterval("dCheckProgressUpdate()" , 1000);
	}
	
function dCheckProgressUpdate()
	{
	if(dCheckSteps++ == dCheckMaxSteps)
		{
		clearInterval(dCheckInterval);	
		document.getElementById("domeinProgressError").innerHTML = dCheckError;
		
		}
	else
		{
		document.getElementById("domeinProgress").getElementsByTagName("td").item(0).innerHTML += "."	
		}
	}


function apb(el, id)
	{
		pb = new PostBack("def")
		pb.setVar("tcId" , id)
		pb.setAction(el.href)
		pb.submit()
	}
