} });

function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else { begin += 2; var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } } // because unescape has been deprecated, replaced with decodeURI //return unescape(dc.substring(begin + prefix.length, end)); return decodeURI(dc.substring(begin + prefix.length, end)); }

var myCookie = getCookie("oncarrot_forms"); var myCookieClose = getCookie("ctaPop"); $(window).load(function(){ if($('.single-idx-property').length == 0) {

} else { if (myCookie == null && myCookieClose== null) { // alert("no cookie") // do cookie doesn't exist stuff; setTimeout(function() { $('#enquirypopup').modal('show'); }, 3000); } else if(!(myCookie == null) && myCookieClose== null){ // do cookie exists stuff // alert(myCookie); // end of pop }else{} } //if closed and not filled $('#enquirypopup').on('hidden.bs.modal', function (e) { // do something...

function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+ d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } setCookie("ctaPop", "WasClosed", 1); }) });

$(window).load(function(){ if($('.single-idx-property').length == 0) {

} else { if (myCookieClose == "WasClosed") { //alert(myCookieClose +"!"); // do cookie doesn't exist stuff; } else if(myCookie == null){ // do cookie exists stuff // alert(myCookieClose); setTimeout(function() { $('#enquirypopup').modal('show'); }, 3000); // end of pop } } });

//open search block $('.eurekaSearchButton').click(function(){ $('#eurekaSearchModal').modal('show');});