function CreatePopup(url, height, duration, description, lifetime) {
    // Exit if the current browser has already received the popup, or 
    // the browser is not supported (IE6).
    if (HasAlreadyReceivedPopup(description) || IsUnsupportedUserAgent())
    	return;
	
	$.get(url, function(data) { 
		var popup = $("<div>" + data + "</div>")
			.attr({ "id": "sliding_popup" })
			//.css({"top": -1 * height})
			.css({"top": "0"})
	    	.height(height)
			.hide()
			.appendTo("body");
		
		ShowPopup(description, lifetime, popup, duration); 
	});
}

function ShowPopup(description, lifetime, popup, duration) 
{ 
	//popup.show().animate( { top: 0 }, duration);
	popup.show();
	ReceivedPopup(description, lifetime);
}

function HasAlreadyReceivedPopup(description) { 
	return document.cookie.indexOf(description) > -1; 
}

function ReceivedPopup(description, lifetime) { 
	var date = new Date(); 
	date.setDate(date.getDate() + lifetime); 
	document.cookie = description + "=true;expires=" + date.toUTCString() + ";path=/"; 
}

function IsUnsupportedUserAgent() { 
	return (!window.XMLHttpRequest); 
}

function DestroyPopup(duration) {
	//$("#sliding_popup").animate({ top: $("#sliding_popup").height() * -1 }, duration, function () { $("#sliding_popup").remove(); })
	$("#sliding_popup").hide();
}

$(document).ready(function() {
    if ($("#copyright_year"))
    {
        var thisYear = (new Date).getFullYear();
        $("#copyright_year").text(thisYear);
    }
});
