<!--
$(window).load(function () {
	
	// boxen met schaduw en gradient
	$('.box_shadow').each(function(index) {
		$original_html = $(this).html();
		$w = $(this).width() - 18;
		$h = $(this).height();
		//
		$new_html = "<div class='box_shadow_LB'></div><div class='box_shadow_B' style='width:" + $w + "px'></div><div class='box_shadow_RB'></div>";
		$new_html += "<div class='box_shadow_L' style='height:" + $h + "px'></div>";
		$new_html += "<div class='box_shadow_inner' style='width:" + $w + "px; height:" + $h + "px'>" + $original_html + "</div>";
		$new_html += "<div class='box_shadow_R' style='height:" + $h + "px'></div>";
		$new_html += "<div class='box_shadow_LO'></div><div class='box_shadow_O' style='width:" + $w + "px'></div><div class='box_shadow_RO'></div>";
		
		$(this).html($new_html);
	});
	
	// vertical effect op achtergrond
	$('.hover_vertical').each(function(index) {
		$bg_pos = $(this).css('backgroundPosition');
		if ($bg_pos == null || $bg_pos == undefined) {
			$bg_pos = "0px 0px";
		}
		$(this).css( {backgroundPosition: $bg_pos} )
		$height = $(this).css('height');
		$height = $height.substr(0, ($height.length - 2));
		$arr_bg_pos = $bg_pos.split(" ");
		$bg_pos_x = $arr_bg_pos[0];
		$bg_pos_y = $arr_bg_pos[1];
		$bg_pos_y_res = $bg_pos_y.substr(0, ($bg_pos_y.length - 2));
		$bg_pos_y_res = (parseInt($bg_pos_y_res) - parseInt($height)) + "px";
		$(this).attr('bg_pos_x', $bg_pos_x);
		$(this).attr('bg_pos_y', $bg_pos_y);
		$(this).attr('bg_pos_y_res', $bg_pos_y_res);
		//
		$(this).mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(" + $(this).attr('bg_pos_x')  + " " + $(this).attr('bg_pos_y_res') + ")"}, {duration:200});

		});
		$(this).mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(" + $(this).attr('bg_pos_x')  + " " + $(this).attr('bg_pos_y') + ")"}, {duration:200});
		});
	});
	
	
	$('.hover_vertical_revert').each(function(index) {
		$bg_pos = $(this).css('backgroundPosition');
		//alert($bg_pos);
		if ($bg_pos == null || $bg_pos == undefined) {
			$bg_pos = "0px 0px";
		}
		//$(this).css( {backgroundPosition: $bg_pos} )
		$height = $(this).css('height');
		$height = $height.substr(0, ($height.length - 2));
		$arr_bg_pos = $bg_pos.split(" ");
		$bg_pos_x = $arr_bg_pos[0];
		$bg_pos_y = $arr_bg_pos[1];
		$bg_pos_y_res = $bg_pos_y.substr(0, ($bg_pos_y.length - 2));
		$bg_pos_y_res = "0px";
		$(this).attr('bg_pos_x', $bg_pos_x);
		$(this).attr('bg_pos_y', $bg_pos_y);
		$(this).attr('bg_pos_y_res', $bg_pos_y_res);
		//
		$(this).mouseover(function(){
								 //  alert($(this).attr('bg_pos_x') + " ---- " + $(this).attr('bg_pos_y_res'));
			$(this).stop().animate({backgroundPosition:"(" + $(this).attr('bg_pos_x')  + " " + $(this).attr('bg_pos_y_res') + ")"}, {duration:200});

		});
		$(this).mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(" + $(this).attr('bg_pos_x')  + " " + $(this).attr('bg_pos_y') + ")"}, {duration:200});
		});
	});
	
	
	// navigatie
	regelNavigatie();
	
	// vlek
	regelVlek();
	$(window).resize(function() {
		regelVlek();
	});
	
});

function regelVlek() {
	if ($('#pagewrapper').width() + $('#rightBg').width() > $(window).width()) {
		$('#rightBg').css('left', ($('#pagewrapper').width()) + "px");
		$('#rightBg').css('right', 'auto');
	} else {
		$('#rightBg').css('right', '0');
		$('#rightBg').css('left', 'auto');
	} 
}

function regelNavigatie() {
	// navigatie
	$("#home, #dddstudio, #news, #portfolio, #services, #contact, #ddd, #media, #directmarketing").hover(
		function() {
			$(this).find("span").stop().animate({width: "100%"}, 200, 'easeOutQuad');
		},
		function() {
			$(this).find("span").stop().animate({width: "0"}, 150, 'easeInQuad');
		}
	);
	
	// subnavigatie
	if (!b_clap_clap) {
		$('#m_portfolio').bind('click', function() {
			sSubMenuId = "#" + $(this).attr('id') + "_submenu";
			if ($(sSubMenuId).css('display') == 'none') {
				$(sSubMenuId).css('display', 'block');	
			} else {
				$(sSubMenuId).css('display', 'none');
			}
		});
	}
}

function isValid(myForm) {
	//
	var bIsValid = true;
	//
	for (i=0; i<myForm.elements.length; i++) {
		for (r=0; r<arrRequiredFields.length; r++) {
			if (myForm.elements[i].id == arrRequiredFields[r] && myForm.elements[i].value != "") {
				// veld is ingevuld
				// border resetten
				document.getElementById(myForm.elements[i].id).style.borderColor = "#000000";
				// emailveld checken als het een geldig emailadres is
				if (myForm.elements[i].id == "txtemail") {
					if (!checkEmail(myForm.elements[i])) {
						document.getElementById(myForm.elements[i].id).style.borderColor = "#FF0000";								
						bIsValid = false;
					}
				}
				//
			} else if (myForm.elements[i].id == arrRequiredFields[r]) {
				document.getElementById(myForm.elements[i].id).style.borderColor = "#FF0000";
				// veld is niet ingevuld
				bIsValid = false;
			}
		}
	}
	//
	return bIsValid;
	//
}
//
function checkEmail(field) {
	//
	var bIsValid;
	sValue = field.value;
	var reg = /^([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))$/;
	//
	if(reg.exec(sValue)){
		bIsValid = true;
	} else {
		bIsValid = false;
	}
	//
	return bIsValid;
	//
}

function writeFlash(sMovie, iWidth, iHeight, sId, arrParams) {
	arrParams = arrParams || "";
	
	var so = new SWFObject(sMovie, "flash_" + sId, iWidth, iHeight, '10.0.12.36', '#FFFFFF');
	so.useExpressInstall('../swf/expressinstall.swf');
	so.addParam('scale', 'noscale');
	so.addParam('wmode', 'transparent');
	
	if (arrParams != "") {
		for (i = 0; i < arrParams.length; i++) {
			so.addVariable(arrParams[i][0], arrParams[i][1]);
		}	
	}
	
	so.write(sId);	
}
-->
