$(document).ready(function(){
	$('.dialog-comment').click(function(){
		var href = $(this).attr('dialoghref');
		if (!href || href.length < 1 ) {
			href = '';
		}
		$('#pollingobject-comment-frame').attr('src', href).show();
	});

	$('.dialog-close-button').click(function(){
		$('#pollingobject-comment-frame').attr('src', "").hide();
	});

	var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
	var eventer = window[eventMethod];
	var messageEvent = eventMethod === "attachEvent" ? "onmessage" : "message";
	eventer(messageEvent, function (e) {
		if (e.data === "reload-msg" || e.message === "reload-msg") {
			ShowModalWindow(true);
			$('#pollingobject-comment-dialog').dialog('close');
			location = location.href;
		}
	});	
});