// Offermatica check box detect

// Look for the host URL
var host = window.location.host;

// Set the cookie and detect its status
function setCookie(cookie, checkbox){	
	document.cookie = cookie + "=0; domain=" + host + "; path=/;";	
	$(document).ready(function(){
		$('#' + checkbox).click(function() {
		if ($('input:checkbox[id=' + checkbox + ']').is(':checked')) {
			document.cookie = cookie + "=1; domain=" + host + "; path=/;";
			return true;
		  }
		  document.cookie = cookie + "=2; domain=" + host + "; path=/;";
		  return true;		
		});	
	});	
		
}

// Read the cookie
function getCookie(cookie_name){
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
  if (results)
    return (unescape(results[2]));
  else
    return null;
}
