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({"bottom": -1 * height})
	    	.height(height)
			.hide()
			.appendTo("body");
		
		ShowPopup(description, lifetime, popup, duration); 
	});
}

function ShowPopup(description, lifetime, popup, duration) 
{ 
	popup.show().animate( { bottom: 0 }, duration);
	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=/"; 


   var today = new Date(); 
   today.setTime( today.getTime() ); 
   // if the expires variable is set, make the correct expires time, the 
   // current script below will set it for x number of days, to make it 
   // for hours, delete * 24, for minutes, delete * 60 * 24 
   //if ( expires ) 
   //{ 
    //  expires = expires * 1000 * 60 * 60; 
   //} 
   //alert( 'today ' + today.toGMTString() );// this is for testing purpose only 
   var expires_date = new Date( today.getTime()); 
   //alert('expires ' + expires_date.toGMTString());// this is for testing purposes only 

   document.cookie = description + "=true";expires=" + expires_date.toGMTString() + ";path=/" + //expires.toGMTString() 
     }








function IsUnsupportedUserAgent() { 
	return (!window.XMLHttpRequest); 
}

function DestroyPopup(duration) {
	$("#sliding_popup").animate({ bottom: $("#sliding_popup").height() * -1 }, duration, function () { $("#sliding_popup").remove(); })
}