// Close Announcement box with cookie. //Author : Aakash Chakravarthy (www.aakashweb.com) //Email : aakash.19493@gmail.com var expDate = new Date(); expDate.setDate(expDate.getDate()+365); jQuery(document).ready(function(){ if(jQuery('#announcer_box').length > 0){ // Check for cookie if(announcer_cookie() == 'hidden'){ jQuery('#announcer_box').hide(); }else{ document.cookie = "announcer-state=visible; expires=" + expDate.toGMTString()+"; path=/"; jQuery('#announcer_box').fadeIn(); } // Close button on click jQuery('.announcer_closebt').click(function(){ document.cookie = "announcer-state=hidden; expires=" + expDate.toGMTString()+"; path=/"; jQuery(this).parent().slideUp(function(){ jQuery('body').css('margin', 0); }); }); announcer_adjheight('top'); announcer_adjheight('bottom'); } }); function announcer_cookie(){ var nameEQ = 'announcer-state='; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0){ return c.substring(nameEQ.length,c.length); } } } function announcer_adjheight(pos){ if(jQuery('.announcer_' + pos + '-float').length > 0 && jQuery('.announcer_' + pos + '-float').is(':visible')){ jQuery('body').css('margin-' + pos, jQuery('.announcer_' + pos + '-float').outerHeight()); } }