function HtmlContent(id, data) {
var __CLASS__ = "HtmlContent"; var __SELF__ = this; var cont; var item; this.isShow = false; this.Show = function(_item) {
this.isShow = true; item = _item.base64_decode(); eval("item = " + item + ";"); if (!UA.isFirefox()) {
var scTop = document.body.parentNode.scrollTop; document.body.parentNode.style.overflow = 'hidden'; document.body.parentNode.scrollTop = scTop; } else if (UA.isChrome() || UA.isSafari()) {
document.body.parentNode.style.overflow = 'hidden'; } else {
var scTop = document.body.parentNode.scrollTop; document.body.parentNode.style.overflow = 'hidden'; document.body.parentNode.scrollTop = scTop; }
cont = Element.Create('div'); cont.className = __CLASS__ + "-pictureViewer"; if (UA.isChrome() || UA.isSafari()) {
cont.style.top = document.body.scrollTop + 'px'; cont.style.left = document.body.scrollLeft + 'px'; } else {
cont.style.top = document.body.parentNode.scrollTop + 'px'; cont.style.left = document.body.parentNode.scrollLeft + 'px'; }
cont.style.width = '100%'; cont.style.height = '100%'; cont.style.position = "absolute"; var contInnerHTML = ""; contInnerHTML += "<div class=\"hider\">&nbsp;</div>"; contInnerHTML += "<div id=\"" + __CLASS__ + "-" + id + "-ImagePlace\" class=\"ImagePlace Loader\"></div>"; contInnerHTML += "<img src=\"images/transparent.gif\" onclick=\"HtmlContent.Items[" + id + "].Close();\" class=\"close\">"; cont.innerHTML = contInnerHTML; document.body.appendChild(cont); var imagePlace = Element(__CLASS__ + "-ImagePlace"); if (imagePlace) {
imagePlace.style.left = Math.round((cont.offsetWidth - imagePlace.offsetWidth) / 2) + 'px'; imagePlace.style.top = Math.round((cont.offsetHeight - imagePlace.offsetHeight) / 2) + 'px'; }
ShowItem(); }; this.Close = function() {
this.isShow = false; if (cont) {
document.body.removeChild(cont); cont = null; if (UA.isFirefox()) {
var scTop = document.body.parentNode.scrollTop; document.body.parentNode.style.overflow = 'auto'; document.body.parentNode.scrollTop = scTop; } else if (UA.isChrome() || UA.isSafari()) {
document.body.parentNode.style.overflow = 'auto'; var tmp = Element.Create('div'); tmp.id = __CLASS__ + "-scrollFix"; tmp.style.fontSize = '0.5px'; tmp.innerHTML = "..."; document.body.appendChild(tmp); window.setTimeout("document.body.removeChild(Element('" + tmp.id + "'));",100); } else {
document.body.parentNode.style.overflow = 'auto'; }}
}; function ShowItem() {
var imagePlace = Element(__CLASS__ + "-" + id + "-ImagePlace"); if (imagePlace) {
switch(item.type) {
case HtmlContent.Type_Picture: imagePlace.innerHTML = '<h2 style="display: none;">' + item.title + '</h2><div imageloader="1" style="width: 1px; height: 1px; overflow: hidden;"><img src="about:blank"></div>' + ("description" in item && item.description != '' ? "<div description=\"1\" class=\"description\" style=\"display: none;\"><h3>:</h3>" + item.description + "</div>" : ""); imagePlace.childNodes[1].firstChild.id = __CLASS__+"-" + id + "-previewImage"; imagePlace.childNodes[1].firstChild.setAttribute('loaded', 'false'); imagePlace.childNodes[1].firstChild.onload = function() {
if (this.offsetWidth < 3) {
window.setTimeout("(function(){var tmp = Element('" + this.id + "'); if (tmp) { tmp.onload(); }})();",100); return; }
this.setAttribute('loaded', 'true'); imagePlace.className = "ImagePlace"; imagePlace.firstChild.style.display = ''; __SELF__.ResizeImage(); }; imagePlace.childNodes[1].firstChild.src = item.src; break; case HtmlContent.Type_Video: imagePlace.className = "ImagePlace"; imagePlace.style.width = 'auto'; imagePlace.style.height = 'auto'; if (UA.isFlashInstalled()) {
imagePlace.innerHTML = '<h2>' + item.title + '</h2>' + item.src + ("description" in item && item.description != '' ? "<div description=\"1\" class=\"description\"><h3>:</h3>" + item.description + "</div>" : ""); } else {
imagePlace.innerHTML = '<strong><span style="color: #000000;">You need to upgrade your Adobe Flash Player to watch this video.&nbsp;<br></span><span style="color: #000000;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; font-weight: normal; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://get.adobe.com/flashplayer/">Download it from Adobe.</a>&nbsp;</span></strong>'; }
break; case HtmlContent.Type_Music: imagePlace.className = "ImagePlace"; imagePlace.style.width = 'auto'; imagePlace.style.height = 'auto'; if (UA.isFlashInstalled()) {
imagePlace.innerHTML = "<h2>" + item.title + "</h2><div id=\"fPlayer\" style=\"width: 320px; height: 24px;\"></div>" + ("description" in item && item.description != '' ? "<div description=\"1\" class=\"description\"><h3>:</h3>" + item.description + "</div>" : ""); flowplayer("fPlayer", "flash/flowplayer/flowplayer-3.1.1.swf", {
plugins: {
audio: {
url: "flash/flowplayer/flowplayer.audio-3.1.0.swf"
}}, clip: {
url: item.src, autoPlay: true, autoBuffering: true
}}); } else {
imagePlace.innerHTML = '<strong><span style="color: #000000;">You need to upgrade your Adobe Flash Player to watch this video.&nbsp;<br></span><span style="color: #000000;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; font-weight: normal; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://get.adobe.com/flashplayer/">Download it from Adobe.</a>&nbsp;</span></strong>'; }
break; }
__SELF__.ResizeImage(); }}
this.ResizeImage = function() {
var imagePlace = Element(__CLASS__ + "-" + id + "-ImagePlace"); if (item && cont && cont.childNodes.length > 0) {
var description = null; if (imagePlace.lastChild.getAttribute('description')) {
description = imagePlace.lastChild; description.style.display = 'block'; }
switch(item.type) {
case HtmlContent.Type_Picture: var img = Element(__CLASS__+"-" + id + "-previewImage"); if (img.getAttribute('loaded') == 'false') {
break; }
var contentWidth = cont.offsetWidth - 10; var contentHeight = cont.offsetHeight - (description ? description.offsetHeight : 0) - 40 - 10; if (!img.getAttribute('true_height')) {
img.setAttribute('true_width', img.offsetWidth); img.setAttribute('true_height', img.offsetHeight); }
var width = img.getAttribute('true_width'); var height = img.getAttribute('true_height'); var arany = width / height; if (width > contentWidth || height > contentHeight) {
if (width > height) {
width = contentWidth; height = Math.round(width / arany); if (height > contentHeight) {
height = contentHeight; width = Math.round(height * arany); }} else {
height = contentHeight; width = Math.round(height * arany); if (width > contentWidth) {
width = contentWidth; height = Math.round(width / arany); }}
img.height = height; img.width = width; }
if (description) {
if (width >= 200) {
description.style.width = width + 'px'; } else {
description.style.width = '200px'; }}
var tCont = img.parentNode; if (tCont && tCont.getAttribute('imageloader')) {
tCont.parentNode.insertBefore(img, tCont); tCont.parentNode.removeChild(tCont); }
imagePlace.style.width = 'auto'; imagePlace.style.height = 'auto'; break; case HtmlContent.Type_Video: if (description) {
var width = (imagePlace.offsetWidth - 10); if (width >= 200) {
description.style.width = width + 'px'; } else {
description.style.width = '200px'; }}
break; case HtmlContent.Type_Music: if (description) {
var width = (imagePlace.offsetWidth - 10); if (width >= 200) {
description.style.width = width + 'px'; } else {
description.style.width = '200px'; }}
break; }
imagePlace.style.left = Math.round((cont.offsetWidth - imagePlace.offsetWidth) / 2) + 'px'; imagePlace.style.top = Math.round((cont.offsetHeight - imagePlace.offsetHeight) / 2) + 'px'; }}; }; HtmlContent.Type_Folder = "folder"; HtmlContent.Type_Picture = "picture"; HtmlContent.Type_Video = "video"; HtmlContent.Type_Music = "music"; HtmlContent.Items = {}; HtmlContent.Init = function(id, data) {
if (!(id in HtmlContent.Items)) {
HtmlContent.Items[id] = new HtmlContent(id, data); }}; eventObject(window).addEvent("resize", function() {
for(var i in HtmlContent.Items) {
if (HtmlContent.Items[i].isShow) {
HtmlContent.Items[i].ResizeImage(); }}
});