
$(document).ready( function() {
	
	googleMap();
	
	$(".preview").tipsy({html: true });
	
	$(".box").bind("click", function() {
		$(".box").attr("checked", "");
		$(this).attr("checked", true);
	});
	
	$("#check_vat").bind("change", function() {
		var check_str = $("#check_vat").val();
		if (check_str.length > 0) {
			$(".check_btw").show();
			$(".check_btw_hidden").val(0);
		}
		else {
			$(".check_btw").hide();
			$(".check_btw_hidden").val(1);
		}
	});
	
	$(".google-map").bind("change", function() {
		googleMap();
	});
	
});

function googleMap() {
	var check_str_1 = $("#street").val();
	var check_str_2 = $("#street_nr").val();
	var check_str_3 = $("#postalcode").val();
	var check_str_4 = $("#city").val();
	var check_str_5 = $("#country1").val();
	if (check_str_1) {
		if (check_str_1.length > 0 && check_str_2.length > 0 && check_str_3.length > 0 && check_str_4.length > 0 && check_str_5.length > 0) {
			$("#google-map").removeAttr("disabled");
		}
		else {
			$("#google-map").attr("disabled", true); 
		}
	}
}

function showKeynet(){
	$("#button_keynet").hide();
	$("#keynet").show();
}

function showPrijs(){
	$("#button_prijs").hide();
	$("#prijs").show();
}

function showDisclaimer(){
	$("#button_disclaimer").hide();
	$("#disclaimer").show();
}

function showLogin(){
	$("#login").show();
}

function mailto(pre, dom) {
	window.open('mailto:'+pre+'@'+dom); 
}

function navigateToURL(urlStr) {
	window.location = urlStr; 
}

function QCcharCount() {
	var maxchars = 500;
	var count_str = $("#limitedCharsArea").val();
	var currentchars = count_str.length;
	if(currentchars > maxchars){
		$("#limitedCharsArea").val(count_str.substring(0, maxchars - 1));
		$("#countdown").text(leftchars);
	}else{
		var leftchars = maxchars - currentchars;
		$("#countdown").text(leftchars);
	}
}

function sLoad () {
	$("#loader").show();
}

function unCheck(classStr){
	$("." + classStr).attr("checked", "");
	//$(".box_1").attr("checked", "");
	//$(".box_2").attr("checked", "");
}
