var c1def = '';
var c2def = '';

$(function() {
	
	initialize();
	poll();
	
	$("#work li a").colorbox();
	
	var curr_point = 0;
	
	$('.imageviewer a.next').live('click', function(){
		if(curr_point == (($('.imageviewer li').length)-1)){
			$('.imageviewer ul').animate({'left': 0})
			curr_point = 0;
		} else {
			$('.imageviewer ul').animate({'left': 0-((curr_point+1)*630)})
			curr_point++;
		}
	})
	
	$('.imageviewer a.prev').live('click', function(){
		if(curr_point == 0){
			$('.imageviewer ul').animate({'left': 0-(($('.imageviewer li').length)-1)*630});
			curr_point = ($('.imageviewer li').length)-1;
		} else {
			curr_point = curr_point - 1;
			$('.imageviewer ul').animate({'left': 0-((curr_point)*630)});
			
		}
 	});

	$('#mce-EMAIL').focus(function(){
		if(this.value == 'email@adres.nl'){
			this.value = '';
		}
	});
	
	$('#mce-EMAIL').blur(function(){
		if(this.value == ''){
			this.value = 'email@adres.nl';
		}
	});

});

function initialize() {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map_canvas"));
		var point = new GLatLng(52.366429,4.901104);
		map.setCenter(point, 13);
		map.addOverlay(new GMarker(point))
	}
}

function poll(){
		do_check();
}
	
function do_check(){
	var c1 = $('#mce-error-response').text();
	var c2 = $('#mce-success-response').text();
	if(c1 && c1 != c1def){
		$('#mce_custom_error').css('display', 'block');
	}
	
	if(c2 && c2 != c1def){
		$('#mce_custom_success').css('display', 'block');
	}
	
	var timeout = setTimeout(poll, 200);
}
