function replaceMainpic(picPath, background,title) { $('#imageMain').fadeOut("slow", function() { var img = new Image(); // wrap our new image in jQuery, then: $(img) // once the image has loaded, execute this code .load(function () { // set the image hidden by default var image = $(this); image.hide(); image.attr('id','imageMain'); var oldclass = $('#imageMain').attr('class'); image.addClass(oldclass); // with the holding div #loader, apply: $('#imageMain').replaceWith(image); var w = $('#imageMain').width(); var h = $('#imageMain').width(); var newW = (705 - image.width()) / 2; image.css('padding-left',newW); image.css('padding-right',newW); image.css('background', background); // fade our image in to create a nice effect image.fadeIn("slow"); }) // if there was an error loading the image, react accordingly .error(function () { // notify the user that the image could not be loaded }) // *finally*, set the src attribute of the new image to our image .attr('src', picPath) .attr('title',title); } ); } var lastTab; var catalog; function clickGalleryTab() { // put last tab to back if (lastTab!=null) { var lastpath = lastTab.attr("src"); src = lastpath.replace(/_top.png/g, ".png"); lastTab.attr("src",src); } // bring next tap to front var path = $(this).attr("src"); src = path.replace(/.png/g, "_top.png"); $(this).attr("src",src); catalog = $(this).attr("cat"); loadGallery(); lastTab = $(this); } var lastMainTab; var hideMethod; function clickMainTab() { // put last tab to back if (lastMainTab!=null) { var lastpath = lastMainTab.attr("src"); src = lastpath.replace(/_top.png/g, ".png"); lastMainTab.attr("src",src); lastMainTab.addClass("ltNormal"); } // bring next tap to front var path = $(this).attr("src"); src = path.replace(/.png/g, "_top.png"); $(this).attr("src",src); $(this).removeClass("ltNormal"); lastMainTab = $(this); if (hideMethod!="undefined()") eval(hideMethod); hideMethod = $(this).attr("hide")+"()"; var execute = $(this).attr("execute")+"()"; if (execute!="undefined()") eval(execute); } function clickBildbearbeitungTab() { // put last tab to back if (lastMainTab!=null) { var lastpath = lastMainTab.attr("src"); src = lastpath.replace(/_top.png/g, ".png"); lastMainTab.attr("src",src); lastMainTab.addClass("ltNormal"); } // bring next tap to front var tab = $("#bildbearbeitungTab"); var path = tab.attr("src"); src = path.replace(/.png/g, "_top.png"); tab.attr("src",src); tab.removeClass("ltNormal"); lastMainTab = tab; if (hideMethod!="undefined()") eval(hideMethod); hideMethod = tab.attr("hide")+"()"; var execute = tab.attr("execute")+"()"; if (execute!="undefined()") eval(execute); } function enableGallery() { loadGallery(); $("#footer").show(); } function hideGallery() { $("#footer").hide(); } function showHome() { var img="images/menschen/julia_titel_0715.png"; var path = $("#imageMain").attr("src"); if (img!=path) { replaceMainpic("images/menschen/julia_titel_0715.png"); } } function hideHome() { } function showBio() { $("#imageMain").hide(); $("#bio").show(); } function hideBio() { $("#imageMain").show(); $("#bio").hide(); } function showBildbearbeitung() { $("#imageMain").hide(); $("#bildbearbeitung").show(); $("#dvd-content").show(); } function hideBildbearbeitung() { $("#imageMain").show(); $("#bildbearbeitung").hide(); $("#dvd-content").hide(); } function disableEbookLinks(disable) { if (disable) { $("#bestellenLink").hide(); $("#downloadLink1").hide(); $("#downloadLink2").hide(); } else { $("#bestellenLink").show(); $("#downloadLink1").show(); $("#downloadLink2").show(); } } function showEbook() { disableEbookLinks(true); $("#ebook").show(); } function showEbookDownload(type) { disableEbookLinks(true); if (typeof(type) =='undefined' || type=='') { $("#eldtype").val(''); } else { $("#eldtype").val(type); } $("#ebookDownload").show(); } function hideEbook() { disableEbookLinks(false); $("#ebook").hide(); } function hideEbookDownload() { disableEbookLinks(false); $("#ebookDownload").hide(); } function setupGalleryTabs() { $("#footer img[class*=footerPic]").each(function () { var path = $(this).attr("src"); if ($(this).hasClass("default")) { if (path.indexOf("_top.png")==-1) { src = path.replace(/.png/g, "_top.png"); $(this).attr("src",src); } catalog = $(this).attr("cat"); lastTab = $(this); } else { src = path.replace(/_top.png/g, ".png"); $(this).attr("src",src); } $(this).click( clickGalleryTab); }); } function setupForm() { $("#form_submit").attr("disabled", "disabled"); $("#ebookForm input[class*=change-field]").each(function () { $(this).keyup( function() { var name = $("#name").val(); var strasse = $("#strasse").val(); var plzort = $("#plzort").val(); var emal = $("#emal").val(); if (name!='' && strasse!='' && plzort!='' && emal!='') { $("#form_submit").removeAttr('disabled'); } else { $("#form_submit").attr("disabled", "disabled"); } }); // }); } function setupMainTabs() { $("#main img[class*=lefttab-image]").each(function () { var path = $(this).attr("src"); if ($(this).hasClass("default")) { if (path.indexOf("_top.png")==-1) { src = path.replace(/.png/g, "_top.png"); $(this).attr("src",src); } lastMainTab = $(this); } else { src = path.replace(/_top.png/g, ".png"); $(this).attr("src",src); } $(this).click(clickMainTab); }); } function loadGallery() { $("#pics img").remove(); $.getJSON(catalog+"/bilderinfo.txt", function(data){ $.each(data.items, function(i,item){ var img = $("").attr("src", item.media.t); img.attr("class","footerbarImg"); img.attr("onClick","replaceMainpic('"+item.media.m+"','"+item.media.background+"','"+item.description+"')"); img.attr("title",item.description); //img.attr("alt",item.description); img.appendTo("#pics"); }); }); } function notifyEmail() { $('#emalerr').fadeIn('slow') } function echeck(str) { var at="@"; var dot="."; var lat=str.indexOf(at) ; var lstr=str.length; var ldot=str.indexOf(dot); if (str.indexOf(at)==-1){ notifyEmail(); return false; } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ notifyEmail(); return false; } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ notifyEmail(); return false; } if (str.indexOf(at,(lat+1))!=-1){ notifyEmail(); return false; } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ notifyEmail(); return false; } if (str.indexOf(dot,(lat+2))==-1){ notifyEmail(); return false; } if (str.indexOf(" ")!=-1){ notifyEmail(); return false; } return true; } $(document).ready(function(){ setupGalleryTabs(); setupMainTabs(); setupForm(); loadGallery(); } );