var strTryNewHtml = "<div id=\"NewSiteDiv\" style=\"display: none; position: absolute; left: 250px; top: 450px; width: 400px; padding: 15px; background-color: #BDE2F9; border: 1px solid blue;\"><h2 style=\"margin-top: 0px;\">Try Our New Website!</h2><p>We are very slowly developing a new version of <b>DVD Reviewer</b>. It loads faster in your browser, supports new features including inline replies, editing and a WYSIWYG editor!<br/><br/><b><a href=\"http://www.dvdreviewer.co.uk/Forums/\">Click Here to Give it a Try!</a> or <a id=\"HideNewSite\" href=\"#\">Hide This Message</a></b></p><div>";

$(document).ready(function(){
	if (String(window.location).search(/^http:\/\/[a-z0-9.]+\/forum/i) != -1)
	{
		if ($.cookie('newsiteprompted') != 1)
		{
			$('body').append(strTryNewHtml);
			$('#NewSiteDiv').fadeIn('slow');
			$('#HideNewSite').click(function() {
					$('#NewSiteDiv').fadeOut('slow');
					$.cookie('newsiteprompted', '1', { expires: 14, path: '/' });
					return false;
				});
		}
	}
});

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

