
function element(id){
	if(document.getElementById(id) != null){
		return document.getElementById(id);
	}
	if(document.all != null){
		return document.all[id];
	}
	if(document.layers != null){
		return document.layers[id];
	}
	return null;
}



function numonly(number)
{
	var valid   = "0123456789"
	var ok    = "yes";
	var temp;

	for (var i=0; i<number.length; i++)	
	{
		temp = "" + number.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}

	if (ok == "no")
	{
		return false;
	} 
	else
	{
			return true;
	}
}


function checkMail(email) 
{
	var x = email;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) 
	{
		return true;
	} 
	Else 
	{
		return false;
	}
}

function checkform(pForm) {
	var error   = 0;
	var error_text  = "";
	var checkArray = document.getElementById(pForm).elements;

	for (x in checkArray)
	{
		try{
			if (checkArray[x].id != "")
			{

				if (checkArray[x].type =="text" ||
				checkArray[x].type =="password" ||
				checkArray[x].type =="select-one")
				{
					if(checkArray[x].value == "")
					{
						error     =   1;
						error_text  = error_text + '- Vul ' + checkArray[x].id + ' in\r\n';
					}
				}
			}
		}
		catch(err){
		}
	}

	if (error==1)
	{
		alert(error_text);
	}
	else
		{
			//alert(document.getElementById(pForm).id);
			document.getElementById(pForm).submit();
		}

	}

function checkformNoSubmit(pForm)
{
	var error   = 0;
	var error_text  = "";
	var checkArray = document.getElementById(pForm).elements;

	for (x in checkArray)
	{
		try{
			if (checkArray[x].id != "")
			{

				if (checkArray[x].type =="text" ||
				checkArray[x].type =="password" ||
				checkArray[x].type =="select-one")
				{
					if(checkArray[x].value == "")
					{
						error     =   1;
						error_text  = error_text + '- Vul field ' + checkArray[x].id + ' in\r\n';
					}
				}
			}
		}
		catch(err){
		}
	}


	if (error==1)
	{
		alert(error_text);
		return false;
	}
	else
		{
			return true;
		}
}


function replaceBreaks(pStr)
{
	str=Pstr;
	if (str.length>0)
	{
		pnt=str.indexOf("<br>");
		if (pnt>0)
		{
			newstr=str.replace("<br>",";");
			str=newstr;
		}		
	}
	document.write(str);
}

function placeDecimals(pStr)      
{
	str=pStr;
	
	if (str.length>0)
	{	
		x = parseFloat(str.replace(",","."));
		pnt=str.indexOf(".");
		if (pnt>0)
		{
			newstr=str.replace(".",",");
			str=newstr;
		}
		ind=str.indexOf(",");
		
		if(x>0 )
		{	
			if(x<1)
			{
				if(ind==str.length-2)
				{
					document.write('&euro; 0'+str+'0');
				}
				else
				{
					document.write('&euro; 0'+str);
				}
				
			
			}else
			{
				if(ind<0)
				{
					document.write('&euro; '+str+',00');
				}
				else
				{
					if(ind==str.length-2)
					{
						document.write('&euro; '+str+'0');
					}
					else
					{
						document.write('&euro; '+str);
					}
				}
			}
		} else
		{
			document.write('Prijs op aanvraag');
		}
	} else
	{
		document.write('Prijs op aanvraag');
	}
}

function getDecimals(pStr)
{
	str=String(pStr);

	if (str.length>0)
	{
		pnt=str.indexOf(".");
		if (pnt>0)
		{
			newstr=str.replace(".",",");
			str=newstr;
		}

		ind=str.indexOf(",");
		if(ind<0)
		{
			return '&euro; '+str+',00';
		}
		else
		{
			if(ind==str.length-2)
			{
				return '&euro; '+str+'0';
			}
			else
			{
				return '&euro; '+str;
			}
		}
	}
}

function openWindow(URL,tx,ty) 
{
	myWindow= window.open(URL, 'newWindow', 'width='+tx+',height='+ty+', menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0');
	                                      

	/*myWindow= open(file, "newWindow", "width="+tx+",height="+ty+",resizable=yes");*/
}
