var globalCookieName;

function ShowMessage(cookieName, dateFrom, dateTo)
{
	globalCookieName = cookieName;
	var cookieValue = $.cookie(globalCookieName);
	var currentDate = new Date();
	if(dateFrom != null && currentDate < dateFrom) return;
	if(dateTo !=null && currentDate > dateTo) return;
	if(cookieValue != null) return;
	$.blockUI({ message: $('#messageDiv'), css: { width: '360px' }});
	$('#messageBtnOK').click(function() { 
		HideMessage(); 
		return false; 
	});
}

function HideMessage()
{
	$.cookie(globalCookieName, '1', { path: '/', expires: 7 });
	$.unblockUI(); 
}

function initVideoThumbnail(imgId)
{
    var videoId = $('#'+imgId).attr('relvideo');
    $('#'+videoId).hide();
    $('#'+imgId).css('cursor','pointer').click(function(){
        $(this).hide();
        $('#'+$(this).attr('relvideo')).show();
        });
};

$(function() {
	//ShowMessage('msg20100716', null, new Date(2010,06,18)); 
	$('img[relvideo|=video]').each(function(index,el){
		initVideoThumbnail(el.id);
		});
});
