/*
* Facebox (for jQuery)
* version: 1.2 (05/05/2008)
* @requires jQuery v1.2 or later
*
* Examples at http://famspam.com/facebox/
*
* Licensed under the MIT:
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2007, 2008 Chris Wanstrath [ chris@ozmm.org ]
*
* Usage:
*
* jQuery(document).ready(function() {
* jQuery('a[rel*=facebox]').facebox()
* })
*
* Terms
* Loads the #terms div in the box
*
* Terms
* Loads the terms.html page in the box
*
* Terms
* Loads the terms.png image in the box
*
*
* You can also use it programmatically:
*
* jQuery.facebox('some html')
*
* The above will open a facebox with "some html" as the content.
*
* jQuery.facebox(function($) {
* $.get('blah.html', function(data) { $.facebox(data) })
* })
*
* The above will show a loading screen before the passed function is called,
* allowing for a better ajaxy experience.
*
* The facebox function can also display an ajax page or image:
*
* jQuery.facebox({ ajax: 'remote.html' })
* jQuery.facebox({ image: 'dude.jpg' })
*
* Want to close the facebox? Trigger the 'close.facebox' document event:
*
* jQuery(document).trigger('close.facebox')
*
* Facebox also has a bunch of other hooks:
*
* loading.facebox
* beforeReveal.facebox
* reveal.facebox (aliased as 'afterReveal.facebox')
* init.facebox
*
* Simply bind a function to any of these hooks:
*
* $(document).bind('beforeReveal.facebox', function() { ...stuff to do after the facebox and contents are revealed... })
*
*/
var wideinfoboxwidth = 540;
var showVideo = false;
(function($) {
$.siteinfobox = function(data, klass) {
$.siteinfobox.loading()
if (data.ajax) fillFaceboxFromAjax(data.ajax)
else if (data.image) fillFaceboxFromImage(data.image)
else if (data.div) fillFaceboxFromHref(data.div)
else if ($.isFunction(data)) data.call($)
else $.siteinfobox.reveal(data, klass)
}
/*
* Public, $.siteinfobox methods
*/
$.extend($.siteinfobox, {
settings: {
opacity : 0,
overlay : true,
loadingImage : '/includes/facebox/loading.gif',
closeImage : '/includes/facebox/closelabel.gif',
imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],
siteinfoboxHtml : '\
\
\
'
},
loading: function() {
init()
if ($('#siteinfobox .loading').length == 1) return true
showOverlay()
$('#siteinfobox .content').empty();
$('#siteinfobox .body').children().hide().end().
append('')
$('#siteinfobox .content').css(
"width", "500px"
);
$('#siteinfobox').css({
"width": "540px",
"margin-left": "-270px",
top: getPageScroll()[1] + 30/*,
left: 385.5*/
}).show()
$(document).bind('keydown.siteinfobox', function(e) {
if (e.keyCode == 27) $.siteinfobox.close()
return true
})
$(document).trigger('loading.siteinfobox')
},
reveal: function(data, klass) {
$(document).trigger('beforeReveal.siteinfobox')
if (klass) $('#siteinfobox .content').addClass(klass)
$('#siteinfobox .content').append(data)
$(document).trigger('afterLoadingData.siteinfobox')
$('#siteinfobox .loading').remove()
$('#siteinfobox .body').children().fadeIn('normal')
//$('#siteinfobox').css('left', $(window).width() / 2 - ($('#siteinfobox table').width() / 2))
$(document).trigger('reveal.siteinfobox').trigger('afterReveal.siteinfobox')
},
close: function() {
$(document).trigger('close.siteinfobox')
return false
}
})
/*
* Public, $.fn methods
*/
$.fn.siteinfobox = function(settings) {
init(settings)
function clickHandler() {
$.siteinfobox.loading(true)
// support for rel="siteinfobox.inline_popup" syntax, to add a class
// also supports deprecated "siteinfobox[.inline_popup]" syntax
var klass = this.rel.match(/siteinfobox\[?\.(\w+)\]?/)
if ($(this).attr("class").indexOf("wideInfoBox_")>= 0)// wideinfobox = true;
wideinfoboxwidth = ($(this).attr("class").replace("wideInfoBox_", ""));
else
wideinfoboxwidth = 720;
if (typeof $f != 'undefined') {
$f().unload();
}
if ($(this).hasClass("playVideo")) {
wideinfoboxwidth = 680;
showVideo = true;
} else {
showVideo = false;
}
if (klass) klass = klass[1]
fillFaceboxFromHref(this.href, klass)
return false
}
return this.click(clickHandler)
}
/*
* Private methods
*/
// called one time to setup siteinfobox on this page
function init(settings) {
if ($.siteinfobox.settings.inited) return true
else $.siteinfobox.settings.inited = true
$(document).trigger('init.siteinfobox')
makeCompatible()
var imageTypes = $.siteinfobox.settings.imageTypes.join('|')
$.siteinfobox.settings.imageTypesRegexp = new RegExp('\.' + imageTypes + '$', 'i')
if (settings) $.extend($.siteinfobox.settings, settings)
$('body').append($.siteinfobox.settings.siteinfoboxHtml)
var preload = [ new Image(), new Image() ]
preload[0].src = $.siteinfobox.settings.closeImage
preload[1].src = $.siteinfobox.settings.loadingImage
$('#siteinfobox').find('.b:first, .bl, .br, .tl, .tr').each(function() {
preload.push(new Image())
preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
})
$('#siteinfobox .close').click($.siteinfobox.close)
$('#siteinfobox .close_image').attr('src', $.siteinfobox.settings.closeImage)
}
// getPageScroll() by quirksmode.com
function getPageScroll() {
var xScroll, yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
xScroll = self.pageXOffset;
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
xScroll = document.documentElement.scrollLeft;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
xScroll = document.body.scrollLeft;
}
return new Array(xScroll,yScroll)
}
// Adapted from getPageSize() by quirksmode.com
function getPageHeight() {
var windowHeight
if (self.innerHeight) { // all except Explorer
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowHeight = document.body.clientHeight;
}
return windowHeight
}
// Backwards compatibility
function makeCompatible() {
var $s = $.siteinfobox.settings
$s.loadingImage = $s.loading_image || $s.loadingImage
$s.closeImage = $s.close_image || $s.closeImage
$s.imageTypes = $s.image_types || $s.imageTypes
$s.siteinfoboxHtml = $s.siteinfobox_html || $s.siteinfoboxHtml
}
// Figures out what you want to display and displays it
// formats are:
// div: #id
// image: blah.extension
// ajax: anything else
function fillFaceboxFromHref(href, klass) {
// div
if (href.match(/#/)) {
var url = window.location.href.split('#')[0]
var target = href.replace(url,'')
$.siteinfobox.reveal($(target).clone().show(), klass)
// image
} else if (href.match($.siteinfobox.settings.imageTypesRegexp)) {
fillFaceboxFromImage(href, klass)
// ajax
} else {
fillFaceboxFromAjax(href, klass)
}
}
function fillFaceboxFromImage(href, klass) {
var image = new Image()
image.onload = function() {
$.siteinfobox.reveal('', klass)
}
image.src = href
}
function fillFaceboxFromAjax(href, klass) {
$.get(href, function(data) { $.siteinfobox.reveal(data, klass) })
}
function skipOverlay() {
return $.siteinfobox.settings.overlay == false || $.siteinfobox.settings.opacity === null
}
function showOverlay() {
if (skipOverlay()) return
if ($('siteinfobox_overlay').length == 0)
$("body").append('')
$('#siteinfobox_overlay').hide().addClass("siteinfobox_overlayBG")
.css('opacity', $.siteinfobox.settings.opacity)
.click(function() { $(document).trigger('close.siteinfobox') })
.fadeIn(200)
return false
}
function hideOverlay() {
if (skipOverlay()) return
$('#siteinfobox_overlay').fadeOut(200, function(){
$("#siteinfobox_overlay").removeClass("siteinfobox_overlayBG")
$("#siteinfobox_overlay").addClass("siteinfobox_hide")
$("#siteinfobox_overlay").remove()
})
return false
}
/*
* Bindings
*/
$(document).bind('close.siteinfobox', function() {
$(document).unbind('keydown.siteinfobox')
$('#siteinfobox').fadeOut(function() {
$('#siteinfobox .content').removeClass().addClass('content')
hideOverlay()
$('#siteinfobox .loading').remove()
})
})
})(jQuery);
//custom scripts
function php_urlencode (str) {
str = escape(str);
return str.replace(/[*+\/@]|%20/g,
function (s) {
switch (s) {
case "*": s = "%2A"; break;
case "+": s = "%2B"; break;
case "/": s = "%2F"; break;
case "@": s = "%40"; break;
case "%20": s = "+"; break;
}
return s;
}
);
}
jQuery(document).ready(function($) {
$('a[rel*=overview]').siteinfobox();
})
$(document).bind('afterLoadingData.siteinfobox', function() {
if (wideinfoboxwidth) {
$('#siteinfobox').css({
"width": wideinfoboxwidth + "px",
"margin-left": "-" + wideinfoboxwidth / 2 + "px"
});
$('#siteinfobox .content').css(
"width", (wideinfoboxwidth - 40) + "px"
);
}
// else $('#siteinfobox').removeClass("wideinfobox");
$('#siteinfobox .content').css("max-height", ($(window).height() - 200) + "px").css("overflow", "auto");
if ($('#siteinfobox h1').length != 0) {
$('#siteinfobox span#siteinfoboxTitle').html($('#siteinfobox h1').html());
}
else if ($('#siteinfobox h2').length != 0) {
$('#siteinfobox span#siteinfoboxTitle').html($('#siteinfobox h2').html());
}
if ($('#boxVideos').length != 0) {
$('#showOverview').click(function(){
$('#boxMenu a').removeClass("current");
$(this).addClass("current");
$('#boxVideos').css("display", "none");
$('#boxOverview').css("display", "block");
});
$('#showVideo').click(function(){
$('#boxMenu a').removeClass("current");
$(this).addClass("current");
$('#boxOverview').css("display", "none");
$('#boxVideos').css("display", "block");
});
$('#boxMenu a').css("display", "inline-block");
$('#showOverview').trigger('click');
} else {
$('#boxMenu a').css("display", "none");
}
if (showVideo) {
$('#boxMenu a').css("display", "none");
$('#showVideo').trigger('click');
}
$("#siteinfobox .content tr:odd").addClass("oddRow");
});