var lockTeaser = false; function showTeaser(el,direction){ if(lockTeaser){ return; } else { lockTeaser = true; } var block = $(el).parent().parent(); var id = parseInt(block.find("div[sel='true']").attr("txtid")); var nextID = direction=="next"?id+1:id-1; if(block.find("div[txtid]").length == nextID){ nextID = 0; } if(nextID<0){ nextID = block.find("div[txtid]").length-1; } block.find("div[txtid='"+id+"']").fadeOut(500,function(){ $(this).attr("sel","false"); }); block.find("div[txtid='"+nextID+"']").fadeIn(500,function(){ $(this).attr("sel","true"); lockTeaser = false; }); } var lockBigTeaser = false; function slideBigTeaser(direction){ var activeEl = $(".bannerSlider .teaserSlide[sel='true']"); var nextIDX = activeEl.attr("idx"); var maxIDX = $(".bannerSlider .teaserSlide").length -1; if(direction=="right"){ nextIDX++; if(nextIDX>maxIDX){ nextIDX = 0; } } else { nextIDX--; if(nextIDX<0){ nextIDX = maxIDX; } } var nextEl = $(".bannerSlider .teaserSlide[idx='"+nextIDX+"']"); activeEl.fadeOut(1000,function(){ $(this).attr("sel","false"); }); nextEl.fadeIn(1000,function(){ $(this).attr("sel","true"); }); } function reloadCapcha(){ document.getElementById("inseciaCaptchaImage").src = "lib/captchapic.php?fontcolor=FFFFFF&bgcolor=65AB65" + "&" + (new Date()).getTime(); } function checkVal(el){ var self=$(el); if(el.value == ""){ self.css("border","1px dashed #EE0000"); } else { self.css("border",""); } } function sendValidForm(){ var valid = true; $(".contactForm input,.contactForm textarea").each(function(){ var self = $(this); if(self.attr("type") != "submit"){ if(self.val() == ""){ self.css("border","1px dashed #EE0000"); valid = false; } else{ self.css("border",""); } } }); return valid; } function sendValidCanditature(){ var valid = true; $(".applicatsForm input,.applicatsForm select").each(function(){ var self = $(this); if(self.attr("type") != "submit"){ if(self.val() == ""){ self.css("border","1px dashed #EE0000"); valid = false; } else{ self.css("border",""); } } }); return valid; } function hideBigPicture(){ $(".picBoxDescription").hide(); jQuery("#bigPictureBox").hide(); } function showBigPicture(idx){ $(".picBoxNav").hide(); $("#bigPicture").css({ "width":"100px", "height":"100px", "margin-top":"-50px", "margin-left":"-50px", "background-image":"url('http://testserver.mueritzshop.de/Insecia/images/insecia_loader_smal.gif')" }); $(".picBoxDescription").hide(); $("#bigPictureBox").show(); showImage(idx); jQuery(document).off("keydown"); jQuery(document).on('keydown', function(event) { switch(event.keyCode){ case 27: hideBigPicture(); break; case 39: nextImage("right",event); break; case 37: nextImage("left",event); break; } }); } function nextImage(direction,event){ event.stopPropagation(); if(direction=="left"){ shownIDX--; } else { shownIDX++; } var max = $(".galleryImage").length-1; if(shownIDX>max){ shownIDX=0; } else if(shownIDX<0){ shownIDX = max; } showImage(shownIDX); } function showImage(idx){ shownIDX = idx; var imgID = jQuery(".galleryImage[data-id='"+idx+"']").attr("img-id"); var imgDescription = jQuery(".galleryImage[data-id='"+idx+"']").attr("data-desc"); var imgLink = "lib/media.php?id="+imgID; var image = new Image(); image = new Image(); var maxW = jQuery(window).width()*0.65; var maxH = jQuery(window).height()*0.9; //$(".picBoxDescription").hide(); $(image).load(function () { var w=image.width,h=image.height; if(w>h){ h = (maxW/w)*h; w = maxW; $("#bigPicture").css("background-size",maxW+"px auto"); } else { w = (maxH/h)*w; h = maxH; $("#bigPicture").css("background-size","auto "+maxH+"px"); } //$("#bigPicture").animate({width:w,height:h,marginTop:(0-(h/2)),marginLeft:(0-(w/2))}); $("#bigPicture").css({ "width":w+"px", "height":h+"px", "margin-top":(0-(h/2))+"px", "margin-left":(0-(w/2))+"px" }); $(".picBoxDescription").css({ "width":w+"px", "margin-top":((h/2)+5)+"px" }); $(".picBoxDescription").html(imgDescription); $(".picBoxDescription").show(); // jQuery("#bigImageBox .img_alt").html(description); $("#bigPicture").css("background-image","url('"+image.src+"')"); $(".picBoxNav").show(); }); image.src = imgLink; }