function setCookie() {  
 	if (location.search.length > 1) {
		var expDays = 28; // number of days the cookie should last
		var expDate = new Date();
		expDate.setTime(expDate.getTime() +  (24 * 60 * 60 * 1000 * expDays)); 

		var ref_cookie = 'sbh_ref=' + location.search.substring(1, location.search.length) + '; expires=' + expDate.toGMTString(); 
		document.cookie = ref_cookie;  
	}
}