function createAttribute(desctinationElementId, attributeName, attributeValue) {
    var attribute = document.createAttribute(attributeName);
    attribute.value = attributeValue;
    document.getElementById(desctinationElementId).setAttributeNode(attribute);
}
                    
//jQuery must be imported in the document and jQuery.noConflict(); must be called before
function showMessage(msg, htmlElementId, hide) {
	jQuery('#'+htmlElementId).html(msg);
    jQuery('#'+htmlElementId).fadeIn(1000,function() {
    	if (hide == undefined) {
		    jQuery('#'+htmlElementId).fadeOut(3000, function() {
		    	jQuery('#'+htmlElementId).html('');
		    });
    	}
	});
}

function showPicturePopup(pictureURL, pictureWidth, pictureHeight) {
    var baseURL = document.getElementsByTagName("base")[0].href;
    var windowLeftPosition = (screen.width) ? (screen.width - pictureWidth) / 2 : 100;
    var windowTopPosition = (screen.height) ? (screen.height - pictureHeight) / 2 : 100;
    var settings = "resizable = yes, scrollbars = yes, width = " + pictureWidth + ", height = " + pictureHeight +
            ", left = " + windowLeftPosition + ", top = " + windowTopPosition;
    window.open(baseURL + "layout/picturePopup.xhtml?picture=" + pictureURL, "", settings);
}