function contact_submit() {
    var ok = true;
    if (document.contactform.naam.value == '') {
        document.contactform.naam.className = 'inputfout'
        ok = false
    } else {
        document.contactform.naam.className = 'input'
    }
    if (document.contactform.bedrijf.value == '') {
        document.contactform.bedrijf.className = 'inputfout'
        ok = false
    } else {
        document.contactform.bedrijf.className = 'input'
    }
    if (document.contactform.poastcodeplaats.value == '') {
        document.contactform.poastcodeplaats.className = 'inputfout'
        ok = false
    } else {
        document.contactform.poastcodeplaats.className = 'input'
    }
    if (ok) {
        return true;
    } else {
        alert('Vul alle verplichte velden in.')
        return false;
    }
}

function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function aanmeld_submit() {

    var ok = true;
		var emailID=document.aanmeldform.email;
    if (document.aanmeldform.naam.value == '') {
        document.aanmeldform.naam.className = 'inputfout'
        ok = false
    } else {
        document.aanmeldform.naam.className = 'input'
    }
		
    if ((emailID.value == '') || (emailID.value==null)){
        emailID.className = 'inputfout'
        ok = false
    } 
		
		if (echeck(emailID.value)==false) {
			emailID.value=""
			ok = false
		} else {
        emailID.className = 'input'
    }

		if (ok) {
        return true;
    } else {
        alert('Vul alle verplichte velden in.')
        return false;
    }

			
//	if ((emailID.value==null)||(emailID.value=="")){
//		emailID.className = 'inputfout'
//		//alert("Please Enter your Email ID")
//		emailID.focus()
//		return false
//	}
//	if (echeck(emailID.value)==false){
//		emailID.value=""
//		emailID.focus()
//		return false
//	}
//	return true
}
			

/*************************
Cross Browser Gradient Backgrounds
See http://slayeroffice.com/code/gradient/ for more examples.
*************************/
window.addEventListener?window.addEventListener("load",createGradient,false):window.attachEvent("onload",createGradient);

function createGradient() {
	if(!document.getElementById)return;
	
	objArray = getGradientObjects();
	if(!objArray.length) return;
	
	for(i=0;i<objArray.length;i++) {
		params = objArray[i].className.split(" ");
		x=parseInt(params[2]);
		w=3;
		makeGrandParent(objArray[i]);
		tmpDOM = document.createDocumentFragment();
		for(p=95;p>10;p--) {
			g = document.createElement("div");
			g.setAttribute("style","position:absolute;z-index:0;top:0px;left:" + x + "px;height:68px;width:" + w + "px;-moz-opacity:."+p+"; filter:alpha(opacity="+p+"); opacity:."+p+";background-color:#"+params[1]+";float:left;");
			x+=w;
			tmpDOM.appendChild(g);
		}
		objArray[i].appendChild(tmpDOM);
		tmpDOM = null;
	}
}

function getGradientObjects() {
	a = document.getElementsByTagName("*");
	objs = new Array();
	for(i=0;i<a.length;i++) {
		c = a[i].className;
		if(c != "") if(c.indexOf("gradient") == 0) objs[objs.length] = a[i];
	} 
	return objs;
}
	
function makeGrandParent(obj) {
	nSpan = document.createElement("span");
	mHTML = obj.innerHTML;
	obj.innerHTML = "";
	nSpan.innerHTML = mHTML;
	nSpan.setAttribute("style","position:relative;z-index:10;");
	obj.appendChild(nSpan);
}



// IXF1.11 :: Image cross-fade 
// *****************************************************
// DOM scripting by brothercake -- http://www.brothercake.com/
//******************************************************
var ixf = { 'clock' : null, 'count' : 1 }
ixf.imgs = [
		'./images/foto/projecten/stralen.jpg',
		'./images/foto/projecten/coaten.jpg',
		'./images/foto/projecten/isoleren.jpg',
		'./images/foto/projecten/plaatsing.jpg',
		'./images/foto/nieuw/popup/rvs_tot_300_1.jpg',
		'./images/foto/nieuw/popup/rvs_tot_300_2.jpg',
		'./images/foto/nieuw/popup/rvs_tot_300_3.jpg',
		'./images/foto/nieuw/popup/rvs_tot_300_5.jpg'
	];

ixf.imgsLen = ixf.imgs.length;
ixf.cache = [];
for(var i=0; i<ixf.imgsLen; i++)
{
	ixf.cache[i] = new Image;
	ixf.cache[i].src = ixf.imgs[i];
}

function crossfade()
{
	if(ixf.clock == null)
	{
		ixf.obj = arguments[0];
		ixf.src = arguments[1];
		
		if(typeof ixf.obj.style.opacity != 'undefined')
		{
			ixf.type = 'w3c';
		}
		else if(typeof ixf.obj.style.MozOpacity != 'undefined')
		{
			ixf.type = 'moz';
		}
		else if(typeof ixf.obj.style.KhtmlOpacity != 'undefined')
		{
			ixf.type = 'khtml';
		}
		else if(typeof ixf.obj.filters == 'object')
		{
			ixf.type = (ixf.obj.filters.length > 0 && typeof ixf.obj.filters.alpha == 'object' && typeof ixf.obj.filters.alpha.opacity == 'number') ? 'ie' : 'none';
		}
		else
		{
			ixf.type = 'none';
		}
		
		if(typeof arguments[3] != 'undefined' && arguments[3] != '')
		{
			ixf.obj.alt = arguments[3];
		}
		
		if(ixf.type != 'none')
		{
			ixf.newimg = document.getElementsByTagName('body')[0].appendChild((typeof document.createElementNS != 'undefined') ? document.createElementNS('http://www.w3.org/1999/xhtml', 'img') : document.createElement('img'));
			ixf.newimg.className = 'idupe';
			ixf.newimg.src = ixf.src
			ixf.newimg.style.left = ixf.getRealPosition(ixf.obj, 'x') + 'px';
			ixf.newimg.style.top = ixf.getRealPosition(ixf.obj, 'y') + 'px';
			ixf.length = parseInt(arguments[2], 10) * 1000;
			ixf.resolution = parseInt(arguments[2], 10) * 20;
			ixf.clock = setInterval('ixf.crossfade()', ixf.length/ixf.resolution);
		}
		else
		{
			ixf.obj.src = ixf.src;
		}
	}
};

ixf.crossfade = function()
{
	ixf.count -= (1 / ixf.resolution);
	if(ixf.count < (1 / ixf.resolution))
	{
		clearInterval(ixf.clock);
		ixf.clock = null;
		ixf.count = 1;
		ixf.obj.src = ixf.src;
	}
	switch(ixf.type)
	{
		case 'ie' :
			ixf.obj.filters.alpha.opacity = ixf.count * 100;
			ixf.newimg.filters.alpha.opacity = (1 - ixf.count) * 100;
			break;
			
		case 'khtml' :
			ixf.obj.style.KhtmlOpacity = ixf.count;
			ixf.newimg.style.KhtmlOpacity = (1 - ixf.count);
			break;
			
		case 'moz' : 
			ixf.obj.style.MozOpacity = (ixf.count == 1 ? 0.9999999 : ixf.count);
			ixf.newimg.style.MozOpacity = (1 - ixf.count);
			break;
			
		default : 
			ixf.obj.style.opacity = (ixf.count == 1 ? 0.9999999 : ixf.count);
			ixf.newimg.style.opacity = (1 - ixf.count);
	}
	ixf.newimg.style.visibility = 'visible';
	ixf.newimg.style.left = ixf.getRealPosition(ixf.obj, 'x') + 'px';
	ixf.newimg.style.top = ixf.getRealPosition(ixf.obj, 'y') + 'px';
	if(ixf.count == 1)
	{
		ixf.newimg.parentNode.removeChild(ixf.newimg);
	}
};

ixf.getRealPosition = function()
{
	this.pos = (arguments[1] == 'x') ? arguments[0].offsetLeft : arguments[0].offsetTop;
	this.tmp = arguments[0].offsetParent;
	while(this.tmp != null)
	{
		this.pos += (arguments[1] == 'x') ? this.tmp.offsetLeft : this.tmp.offsetTop;
		this.tmp = this.tmp.offsetParent;
	}
	
	return this.pos;
};

