jQuery.noConflict();

jQuery(document).ready(function()
{
			
	var anchors = document.getElementsByTagName("a");
	
	for (var i=0; i<anchors.length; i++) 
	{
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("class") == "external"  ) anchor.target = "_blank";
	}										
	
	jQuery('#iframe').load(function() 
	{	
	   this.style.height = '900px';
	   this.style.width =  '600px'; 	   
	});

	jQuery('#emailform').focus(function()
									{
									if( jQuery(this).val() == 'Uw E-mailadres' )
									{
										jQuery(this).val('');
									}
	});

	jQuery('#emailform').blur(function()
									{
									if( jQuery(this).val() == '' )
									{
										jQuery(this).val('Uw E-mailadres');
									}
	});
	
	function validate(email)
	{ 
	 	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	   if(reg.test(email) == false) 
	   {
		  return false;
	   }
	   else
	   {
		   return true;
	   }
	}
	
	jQuery('#nieuwbriefform').submit(function()
	{		
		var email = jQuery('#emailform').val();
	
		if( !validate(email) )
		{
			jQuery('#melding').html('Uw e-mailadres is niet correct.');
			jQuery('#melding').show(); 
		}
		else
		{
			
			jQuery.ajax({
						  url: base_dir+"index/inschrijven/email/"+email,
						  success: function()
						  {		
							  	jQuery('#melding').html('Bedankt, u bent ingeschreven');
							  	jQuery('#emailform').val('Reeds ingeschreven');
								jQuery('#emailform').attr("disabled", true); 
								jQuery('#button').attr("disabled", true); 
						  },
					});
			

		}
		
		return false;								
	});
	
	
	
	
	
	jQuery('#zoekveld').focus(function()
										{
											if( jQuery(this).val() == 'Uw zoekterm' )
											{
												jQuery(this).val('');
											}
										}
							 );
	
	jQuery('img.rounded').one('load',function () {
	var img = jQuery(this);
	var img_width = img.width();
	var img_height = img.height();
 
	// build wrapper
	var wrapper = jQuery('<div class="rounded_wrapper"></div>');
	wrapper.width(img_width+2);
	wrapper.height(img_height+2);
 
	// move CSS properties from img to wrapper
	wrapper.css('float', img.css('float'));
	img.css('float', 'none')
 
	wrapper.css('margin-right', img.css('margin-right'));
	img.css('margin-right', '0')
 
	wrapper.css('margin-left', img.css('margin-left'));
	img.css('margin-left', '0')
 
	wrapper.css('margin-bottom', img.css('margin-bottom'));
	img.css('margin-bottom', '0')
 
	wrapper.css('margin-top', img.css('margin-top'));
	img.css('margin-top', '0')
 
	wrapper.css('display', 'block');
	img.css('display', 'block')
 
	// IE6 fix (when image height or width is odd)
	if (jQuery.browser.msie && jQuery.browser.version == '6.0')
	{
		if(img_width % 2 != 0)
		{
			wrapper.addClass('ie6_width')
		}
		if(img_height % 2 != 0)
		{
			wrapper.addClass('ie6_height')			
		}
	}
 
	// wrap image
	img.wrap(wrapper);
 
	// add rounded corners
	img.after('<div class="tl"></div>');
	img.after('<div class="tr"></div>');
	img.after('<div class="bl"></div>');
	img.after('<div class="br"></div>');
}).each(function(){
	if(this.complete) jQuery(this).trigger("load");
});
	
	
});
