/* Greybox Redux * Required: http://jquery.com/ * Written by: John Resig * Based on code by: 4mir Salihefendic (http://amix.dk) * License: LGPL (read more in LGPL.txt) */ var GB_DONE = false; var GB_HEIGHT = 400; var GB_WIDTH = 400; function GB_show(caption, url, height, width, centerMe, hideCaption, hideClosebtn) { GB_HEIGHT = height || 400; GB_WIDTH = width || 400; // Voor center/caption hide centerGB = centerMe || false; hideCAPT = hideCaption || false; hideClose = hideClosebtn || false; if(!GB_DONE) { $(document.body) .append("
" + "Close window
"); $("#GB_window img").click(GB_hide); $("#GB_overlay").click(GB_hide); $(window).resize(function(){ GB_position(centerGB,hideCAPT); }); GB_DONE = true; } if(hideClose) $("#greyboxClose").hide(); else $("#greyboxClose").show(); if(hideCAPT) $("#GB_caption").hide(); else $("#GB_caption").show(); $("#GB_frame").remove(); $("#GB_window").append(""); if(!hideCAPT) $("#GB_caption").html(caption); $("#GB_overlay").show(); $("#GB_overlay").height($(document).height()); GB_position(centerGB,hideCAPT); if(GB_ANIMATION) $("#GB_window").slideDown("slow"); else $("#GB_window").show(); } function GB_hide() { $("#GB_window,#GB_overlay").hide(); } function GB_position(centerGB,hideCAPT) { var de = document.documentElement; var h = self.innerHeight|| (de&&de.clientHeight) || document.body.clientHeight; var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; // Center bugfix var scroll = $('html,body').scrollTop(); var topval = (centerGB == true) ? ((h/2) - (GB_HEIGHT/2))+scroll: "10"; $("#GB_window").css({width:GB_WIDTH+"px",height:GB_HEIGHT+"px", left: ((w - GB_WIDTH)/2)+"px", top: topval+"px"}); if(!hideCAPT) $("#GB_frame").css("height",GB_HEIGHT - 19 +"px"); else $("#GB_frame").css("height",GB_HEIGHT +"px"); }