var host = 'http://www.digi-images.de';
var loadingImage = host +'/gfx/icons/lightbox/loading.gif';
var closeButton = host +'/gfx/icons/lightbox/close.gif'
var isPostershop = false;
function JSONscriptRequest(fullUrl) {
this.fullUrl = fullUrl;
this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
this.headLoc = document.getElementsByTagName("head").item(0);
this.scriptId = 'JscriptId' + JSONscriptRequest.scriptCounter++;
}
JSONscriptRequest.scriptCounter = 1;
JSONscriptRequest.prototype.buildScriptTag = function () {
this.scriptObj = document.createElement("script");
this.scriptObj.setAttribute("type", "text/javascript");
this.scriptObj.setAttribute("charset", "utf-8");
this.scriptObj.setAttribute("src", this.fullUrl + this.noCacheIE);
this.scriptObj.setAttribute("id", this.scriptId);
}
JSONscriptRequest.prototype.removeScriptTag = function () {
this.headLoc.removeChild(this.scriptObj);
}
JSONscriptRequest.prototype.addScriptTag = function () {
this.headLoc.appendChild(this.scriptObj);
}
function getPage(start, fullUrl){
document.getElementById('myGallery').innerHTML = '';
var req = fullUrl +"&start=" +start;
bObj = new JSONscriptRequest(req);
bObj.buildScriptTag();
bObj.addScriptTag();
}
function getCollectionDetail(start, collectionId, fullUrl){
document.getElementById('myGallery').innerHTML = '';
var req = fullUrl +"&cid=" +collectionId +'&start=' +start;
bObj = new JSONscriptRequest(req);
bObj.buildScriptTag();
bObj.addScriptTag();
}
function getGallery(jsonData) {
// gallery container
var myGallery = document.createElement("div");
if(jsonData.Gallery.MyGallery.bgColor != ""){
myGallery.style.backgroundColor = "#" +jsonData.Gallery.MyGallery.bgColor;
}
myGallery.style.width = (jsonData.Gallery.MyGallery.imagesPerRow * 140 +60) +'px';
myGallery.style.padding = "20px";
myGallery.style.cssFloat = "left";
myGallery.style.styleFloat = "left"; // for IE
myGallery.style.clear = "both";
// css
var headElem = document.getElementsByTagName("head").item(0);
var cssStyle=document.createElement('style');
headElem.appendChild(cssStyle); // todo fix ie
cssStyle.setAttribute('type', 'text/css');
cssStyle.setAttribute('media', 'screen');
if(cssStyle.styleSheet){// IE
cssStyle.styleSheet.cssText = generateCss();
} else {// w3c
cssStyle.appendChild(document.createTextNode(generateCss()));
}
// title
if(jsonData.Gallery.MyGallery.title != ''){
var myGalleryTitle = document.createElement("div");
if(jsonData.Gallery.Collection.isCollection == 'true' && jsonData.Gallery.Collection.collectionId != '-1' && jsonData.Gallery.MyGallery.sorting != 'oneCollection'){
if(jsonData.Gallery.MyGallery.linkColor != ""){
myGalleryTitle.innerHTML = jsonData.Gallery.Collection.collectionTitle +" Zurück" +"
";
}else{
myGalleryTitle.innerHTML = jsonData.Gallery.Collection.collectionTitle +" Zurück" +"
";
}
}else{
myGalleryTitle.innerHTML = jsonData.Gallery.MyGallery.title +"
";
}
if(jsonData.Gallery.MyGallery.textColor != ""){
myGallery.style.color = "#" + jsonData.Gallery.MyGallery.textColor;
}
myGallery.style.fontSize = "18px";
myGallery.style.fontWeight = "bold";
myGallery.style.fontFamily = "Verdana, Arial, sans-serif"
myGallery.appendChild(myGalleryTitle);
}
var images = jsonData.Gallery.Images.Image;
for (var i=0; i < images.length; i++) {
var imageContainer = document.createElement("div");
var centerElem = document.createElement('center');
imageContainer.appendChild(centerElem);
imageContainer.style.width ="100px";
imageContainer.style.minHeight ="100px";
if(document.all && !window.opera){ // IE
imageContainer.style.margin = "5px";
imageContainer.style.paddingLeft = "15px";
imageContainer.style.styleFloat = "left";
}else{
imageContainer.style.margin = "10px";
imageContainer.style.padding = "10px";
imageContainer.style.cssFloat = "left";
}
if(jsonData.Gallery.ImageContainer.borderColor != ""){
imageContainer.style.border = "1px " +jsonData.Gallery.ImageContainer.borderStyle +" #" +jsonData.Gallery.ImageContainer.borderColor;
}
// the link to large image
var imageLink = document.createElement('a');
if(jsonData.Gallery.Collection.isCollection == 'false' || (jsonData.Gallery.Collection.isCollection == 'true' && jsonData.Gallery.Collection.collectionId != '-1')) {
imageLink.href = host +"/include/image.jpg?imageId=" +images[i].id +"&size=500";
imageLink.rel = "lightbox";
imageLink.id = images[i].id;
}else{
imageLink.href = '#';
imageLink.setAttribute("onclick", "getCollectionDetail(" +0 +',' +images[i].collectionId +",'" +jsonData.Gallery.Gallery.url +"')" );
}
imageLink.style.textDecoration = 'none';
imageLink.title = images[i].title;
centerElem.appendChild(imageLink)
// the image
var image = document.createElement("img");
image.src = host +"/include/image.jpg?imageId=" +images[i].id +"&size=100&cropped=true"
image.style.padding = "20px 20 0 0";
image.title = images[i].title;
image.border = "0";
image.style.border = "0px solid #000000";
if(jsonData.Gallery.MyGallery.effect == 'reflection'){
image.setAttribute('onload','Reflection.add(this,{opacity: 1/3})');
}
imageLink.appendChild(image);
// metadata
if(jsonData.Gallery.Gallery.displayTitle == 'true' || jsonData.Gallery.Gallery.displayVoting == 'true' || jsonData.Gallery.Gallery.displayCommentCount == 'true'){
var metadataContainer = document.createElement("div");
if(jsonData.Gallery.MyGallery.textColor != ""){
metadataContainer.style.color = "#" +jsonData.Gallery.MyGallery.textColor;
}
metadataContainer.style.fontSize = "10px";
metadataContainer.style.fontWeight = "normal";
metadataContainer.style.overflow = "hidden";
metadataContainer.innerHTML = "";
if(jsonData.Gallery.Gallery.displayTitle == 'true'){
metadataContainer.innerHTML += "" +images[i].title +"";
}
if(jsonData.Gallery.Gallery.showProfileLink){
if(jsonData.Gallery.MyGallery.linkColor != ''){
metadataContainer.innerHTML += '
von ' +images[i].ownerName +'';
}else{
metadataContainer.innerHTML += '
von ' +images[i].ownerName +'';
}
}
// we do not display at collection overview
if(jsonData.Gallery.Gallery.displayVoting == 'true' && !(jsonData.Gallery.Collection.isCollection == 'true' && jsonData.Gallery.Collection.collectionId == '-1')){
metadataContainer.innerHTML += "
Bewertung:" +(images[i].vote - 0).toFixed(1);
}
if(jsonData.Gallery.Gallery.displayCommentCount == 'true' && !(jsonData.Gallery.Collection.isCollection == 'true' && jsonData.Gallery.Collection.collectionId == '-1')){
metadataContainer.innerHTML += "
" +images[i].commentCount +" Kommentare";
}
var seperator = document.createElement('div');
seperator.style.clear = 'both';
imageContainer.appendChild(metadataContainer);
imageContainer.appendChild(seperator);
}
if((i % jsonData.Gallery.MyGallery.imagesPerRow) == 0){
var seperator = document.createElement('div');
seperator.style.clear = 'both';
myGallery.appendChild(seperator);
}
myGallery.appendChild(imageContainer);
}
// paging
var pageContainer = document.createElement("div");
var pages = jsonData.Gallery.Pages.Page;
for(var j=0; j < pages.length; j++){
var page = document.createElement("div");
page.innerHTML = pages[j].label;
page.style.cssFloat = "left";
page.style.styleFloat = "left"; // for IE
page.style.padding = "5px";
if(cssStyle.styleSheet){// IE
page.style.cursor = "hand";
} else {// w3c
page.style.cursor = "pointer";
}
page.style.fontSize = "12px";
page.style.fontFamily = "Verdana, Arial, sans-serif";
if(pages[j].current == true){
page.style.fontWeight = "bold";
if(jsonData.Gallery.MyGallery.textColor != ""){
page.style.color = "#" +jsonData.Gallery.MyGallery.textColor;
}
}else{
page.style.fontWeight = "normal";
if(jsonData.Gallery.MyGallery.linkColor != ""){
page.style.color = "#" +jsonData.Gallery.MyGallery.linkColor;
}
}
var start = jsonData.Gallery.Pages.Page[j].start;
if(jsonData.Gallery.Collection.isCollection == 'true' && jsonData.Gallery.Collection.collectionId != '-1'){
page.setAttribute("onclick", "getCollectionDetail(" +start +',' +jsonData.Gallery.Collection.collectionId +",'" +jsonData.Gallery.Gallery.url +"')" );
}else{
page.setAttribute("onclick", "getPage(" +start +",'" +jsonData.Gallery.Gallery.url +"')" );
}
pageContainer.appendChild(page);
}
var splitter = document.createElement('div');
splitter.style.clear = "both";
myGallery.appendChild(splitter);
var seperator = document.createElement('div');
seperator.style.clear = 'both';
myGallery.appendChild(seperator);
myGallery.appendChild(document.createElement('br'));
myGallery.appendChild(pageContainer);
myGallery.appendChild(seperator);
// footer
var footer = document.createElement('div');
if(jsonData.Gallery.MyGallery.textColor != ""){
footer.style.color = "#" +jsonData.Gallery.MyGallery.textColor;
}
footer.style.fontSize = "9px";
footer.style.fontWeight = "normal";
footer.style.fontFamily = "Verdana, Arial, sans-serif";
footer.innerHTML = "";
if(jsonData.Gallery.MyGallery.sorting != 'bestByPrintable' && jsonData.Gallery.MyGallery.sorting != 'lastupByPrintable' && jsonData.Gallery.MyGallery.sorting != 'bestByPrintableUser' && jsonData.Gallery.MyGallery.sorting != 'lastupByPrintableUser'){
if(jsonData.Gallery.MyGallery.linkColor != ""){
footer.innerHTML += "
mein Profil auf digi-images.de";
}else{
footer.innerHTML += "
mein Profil auf digi-images.de";
}
}else{
isPostershop = true;
}
footer.innerHTML += "";
myGallery.appendChild(footer);
document.getElementById('myGallery').appendChild(myGallery);
document.getElementById('myGallery').innerHTML += '