 $(document).ready(function()
        {
		var browserReady = !(window.navigator.appName == "Microsoft Internet Explorer" && window.navigator.appVersion.indexOf("IE 6.0") != -1) && !(window.navigator.appVersion.indexOf("iPhone") != -1);

            if (getCookie('show_message') != 'no' && browserReady)
            {
                var pos = parseInt($(window).scrollTop()) + parseInt($(window).height());
                $('#message_box').css("top", pos - 90 + "px");
                $('#message_box').show(); //display the message box

                //scroll the message box to the top offset of browser's scrool bar
                $(window).scroll(function()
                {
                    var pos = parseInt($(window).scrollTop()) + parseInt($(window).height());
                    $('#message_box').animate({top:pos - 90 + "px" }, {queue: false, duration: 500});
                });
		// same happens when you re-size
		$(window).resize(function()
                {
                    var pos = parseInt($(window).scrollTop()) + parseInt($(window).height());
                    $('#message_box').animate({top:pos - 90 + "px" }, {queue: false, duration: 500});
                });
            }
            //when the close button at right corner of the message box is clicked
            $('.close_message').click(function()
            {
                //the messagebox gets scrool down with top property and gets hidden with zero opacity
                $('#message_box').animate({ top:"-=15px",opacity:0 }, "slow");
                setCookie('show_message', 'no', 7); //cookies is set to no value
            });
        });

        //function to set the cookie name, values and expiry time in hours
        function setCookie(c_name, value, expireDays)
        {
            var exhour = new Date(); //create the current date object
            //exhour.setHours(exhour.getHours() + 1);
	    exhour.setDate(exhour.getDate()+expireDays);
            document.cookie = c_name + "=" + escape(value) +
                              ((expireDays == null) ? "" : ";expires=" + exhour.toGMTString());
        }

        //function to get the value from cookie name
        function getCookie(c_name)
        {
            if (document.cookie.length > 0)
            {
                c_start = document.cookie.indexOf(c_name + "=");
                if (c_start != -1)
                {
                    c_start = c_start + c_name.length + 1;
                    c_end = document.cookie.indexOf(";", c_start);
                    if (c_end == -1) c_end = document.cookie.length;
                    return unescape(document.cookie.substring(c_start, c_end));
                }
            }
            return "";
        }

       // form validation
function validate_af_form(f)
    {
      e = f.email.value;
      if (e==null||e==""){
        $("#af-form-errors").text("Please enter your email address");
        return false;
      }
      return true;
    }

