Shadowbox.init({
skipSetup: true,
adapter: 'base',
language: 'en',
overlayColor: '#000000',
overlayOpacity: '0.7',
handleOversize: 'resize',
players: ["img", "swf", "html", "iframe", "flv", "qt", "wmp"]
});
function fixpng(){
var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);
if ((version >= 5.5) && (document.body.filters) && (version < 7)){
var png_images = $$('.pngfix');
png_images.each(function(element) {
if(!$(element).hasClass('pngfixed')){
$(element).addClass('pngfixed');
var img = $(element);
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = ""
img.outerHTML = strNewHTML
}
});
} else {
$$('.pngfix').addClass('pngfixed');
}
}
function make_scrollarea(content, scrollbar, handle){
var steps = (content.getScrollSize().y - content.getSize().y);
if(steps > 0){
scrollbar.removeClass('scrollcover');
$$(scrollbar, handle).removeEvents();
var slider = new Slider(scrollbar, handle, {
steps: steps,
mode: 'vertical',
onChange: function(step){
content.scrollTo(0,step);
}
}).set(0);
$$(content, scrollbar).removeEvents('mousewheel');
$$(content, scrollbar).addEvent('mousewheel', function(e){
e = new Event(e).stop();
var step = slider.step - e.wheel * 30;
slider.set(step);
});
scrollbar.setStyle('visibility', 'visible');
handle.setStyle('visibility', 'visible');
}
}
function init_ajaxlinks(){
// (aja)x a links
var xs = $$('a.xlink');
for(i=0;i= 0 || in_url.indexOf('http://www.seedarchitects.nl/', 0) == -1){
window.open(in_url);
} else {
debug('ajax pageload: '+in_url);
ajaxFX = new Fx.Tween($('container'), {duration: 250}).start('opacity', 1, 0);
window.fireEvent('ajaxunload');
window.removeEvents('ajaxunload');
// get grid
new Request.HTML({
method: 'get',
url: in_url,
evalScripts: true,
headers: {'X-REQUEST': 'AJAX', 'X-DIV': 'container'},
update: $('container'),
onComplete: function(){
pageTracker._trackPageview(in_url);
window.fireEvent('ajaxload');
window.removeEvents('ajaxload');
ajaxFX.cancel();
ajaxFX = new Fx.Tween($('container'), {duration: 200}).start('opacity', $('container').getStyle('opacity'), 1);
setTimeout("fix();", 200);
}
}).send();
}
}
}
function loadDiv(in_url, in_div, in_show_loader){
if(in_show_loader){
$(in_div).set('html', '')
}
if(in_url && in_div){
debug('ajax divload: '+in_url);
// get grid
new Request.HTML({
method: 'get',
url: in_url,
evalScripts: true,
headers: {'X-REQUEST': 'AJAX'},
update: in_div,
onComplete: function(){
pageTracker._trackPageview(in_url);
window.fireEvent('divload');
window.removeEvents('divload');
setTimeout("fix();", 200);
}
}).send();
}
}
var HistoryManager;
var hrefs = new Array();
var currentIndex = 0;
function history_init(){
// initiate object
HistoryManager = new HistoryManagerX();
// initialize manager
HistoryManager.initialize();
// register handlers
reqHistory = HistoryManager.register(
'page-index',
[0],
function(values){ history_go(values[0]); },
function(values) {
return 'page-index(' + values[0] + ')';
},
/page-index\((\d+)\)/ // the regexp to match "page-index(0)"
);
// start manager
HistoryManager.start();
// store first page
history_add(location.href);
}
var ajax_last_url = '';
function history_go(index){
if(index.toInt() >= 0){
if(hrefs[index]){
loadPage(hrefs[index]);
}
}
}
function history_add(url) {
try{
if(url && currentIndex >= 0){
// set current index
index = hrefs.length;
hrefs[index] = url;
currentIndex = index;
// updating the history
reqHistory.setValue(0, index);
}
} catch(e) {
// void;
}
};
function init(){
fixpng();
Shadowbox.cache = new Array();
Shadowbox.setup();
history_init();
$('container').setStyle('display', 'block');
fix();
$$('.lang').setStyle('opacity', .25);
$('lang_en').setStyle('opacity', 1);
setInterval("fix();", 5000);
}
function open_shadowbox(in_gallery){
Shadowbox.open({gallery: in_gallery});
}
var gridsize = 106;
var current_blockswidth = 0;
var current_blocksheight = 0;
var grid_interval = 0;
var fix_lock = 0;
var fix_interval = 0;
var fix_counter = 0;
function fixtrigger(e){
if(fix_lock == 0){
fix_lock = 1;
fix();
setTimeout('fix_lock = 0;', 250);
} else {
clearInterval(fix_interval);
fix_interval = setTimeout('fix();', 250);
}
}
function fix(){
debug('fix');
// clear grid
$('grid').setStyle('display', 'none');
// calculate block widths * heights
blockswidth = Math.max(Math.floor((($('body').getSize().x-25)/2) / gridsize)*2, 10);
blocksheight = Math.max(Math.floor(($('body').getSize().y/2) / gridsize)*2, 8);
// setup site area (outer container)
$('site').setStyles({
'width': blockswidth*gridsize+'px',
'height': blocksheight*gridsize+'px',
'left': '50%',
'top': '50%',
'marginLeft': Math.ceil(-0.5*(blockswidth*gridsize))+'px',
'marginTop': Math.ceil(-0.5*(blocksheight*gridsize))+'px'
});
// setup container area (inner container)
$('container').setStyles({
'width': (blockswidth-1)*gridsize+'px',
'height': (blocksheight-1)*gridsize+'px',
'marginLeft': Math.ceil(-0.5*((blockswidth-2)*gridsize))-(0.5*gridsize)+'px',
'marginTop': Math.ceil(-0.5*((blocksheight-2)*gridsize))-(0.5*gridsize)+'px'
});
// check screen size
if($('site').getPosition().y < 0){
$('site').setStyles({'marginTop': '0px', 'top': '0px'});
y_offset = ($('body').getSize().y - $('site').getSize().y) / 2;
$('logo').setStyles({'marginTop': -y_offset-43+'px'});
} else {
y_offset = 0;
$('site').setStyles({'marginTop': Math.ceil(-0.5*(blocksheight*gridsize))+'px', 'top': '50%'});
$('logo').setStyles({'marginTop': '-43px'});
}
if($('site').getPosition().x < 0){
$('site').setStyles({'marginLeft': '0px', 'left': '0px'});
x_offset = ($('body').getSize().x - $('site').getSize().x) / 2;
$('logo').setStyles({'marginLeft': -x_offset-43+'px'});
} else {
x_offset = 0;
$('site').setStyles({'marginLeft': Math.ceil(-0.5*(blockswidth*gridsize))+'px', 'left': '50%'});
$('logo').setStyles({'marginLeft': '-43px'});
}
// position logo
debug("scroll: "+window.getScrollSize().y);
debug("size: "+window.getSize().y);
height = Math.max($('body').getScrollSize().y, $('body').getSize().y);
width = Math.max($('body').getScrollSize().x, $('body').getSize().x);
if(Browser.Engine.webkit){
if(x_offset){
y_offset -= 8;
x_offset -= 8;
$('logo').setStyles({'marginLeft': -x_offset-43+'px'});
$('logo').setStyles({'marginTop': -y_offset-43+'px'});
}
height = $('body').scrollHeight;
width = $('body').scrollWidth;
}
var num_x = Math.ceil(width / gridsize) + (x_offset < -53?1:0);
var num_y = Math.ceil(height / gridsize) + (y_offset < -53?1:0);
$('grid').set('html', '');
// generate grid
for(i=0;i'+$('debug').get('html'));
}
phasingFps = 24;
phasingDuration = 250;
phasingDuration01 = 250;
phasingDuration12 = 0;
phasingDuration21 = 0;
phasingDuration10 = 250;
phaseTimeout = 50;
phasefx = new Array();
function phase_in(in_block_id, in_duration){
if($defined($(in_block_id))){
var el = $(in_block_id);
var current_phase = el.getProperty('phase');
switch(current_phase){
case '0':
if(!el.getProperty('phasing') == 0){
el.setProperty('phasing', 1);
// fade out phase 0
phase0 = el.getElement('.phase0');
if(phasefx[in_block_id]){ phasefx[in_block_id].cancel(); }
phasefx[in_block_id] = new Fx.Tween(phase0, {fps: phasingFps, duration: (in_duration?in_duration:phasingDuration01), onComplete: function(){
el.setProperty('phase', 1);
el.setProperty('phasing', 0);
debug('phase in 0: '+in_block_id+' current phase: '+el.getProperty('phase'));
}}).start('opacity', 1, 0);
// fade in phase 1
phase1 = el.getElement('.phase1');
new Fx.Tween(phase1, {fps: phasingFps, duration: (in_duration?in_duration:phasingDuration01)}).start('opacity', 0, 1);
}
break;
case '1':
if(!el.getProperty('phasing') == 0){
if(phase2 = el.getElement('.phase2')){
el.setProperty('phasing', 1);
// fade out phase 1
phase1 = el.getElement('.phase1');
if(phasefx[in_block_id]){ phasefx[in_block_id].cancel(); }
phasefx[in_block_id] = new Fx.Tween(phase1, {fps: phasingFps, duration: (in_duration?in_duration:phasingDuration12), onComplete: function(){
el.setProperty('phase', 2);
el.setProperty('phasing', 0);
debug('phase in 1: '+el.id+' current phase: '+el.getProperty('phase'));
}}).start('opacity', 1, 0);
// fade out phase 2
new Fx.Tween(phase2, {fps: phasingFps, duration: (in_duration?in_duration:phasingDuration12)}).start('opacity', 0, 1);
}
}
break;
case '2':
if(!el.getProperty('phasing') == 0){
debug('phase in 2: '+el.id+' current phase: '+el.getProperty('phase'));
if(phaseinterval = el.getProperty('interval')){
clearInterval(phaseinterval);
}
}
break;
}
}
}
function unphase_in(in_block_id, in_timeout){
if($defined($(in_block_id))){
var el = $(in_block_id);
var current_phase = el.getProperty('phase');
switch(current_phase){
case '1':
if(!el.getProperty('phasing') == 0){
debug('un phase in 1: '+el.id+' current phase: '+el.getProperty('phase'));
if(phaseinterval = el.getProperty('interval')){
clearInterval(phaseinterval);
}
phaseinterval = setTimeout("phase_out('"+in_block_id+"');", 5000);
el.setProperty('interval', phaseinterval);
}
break;
case '2':
if(!el.getProperty('phasing') == 0){
debug('un phase in 2: '+el.id+' current phase: '+el.getProperty('phase'));
if(phaseinterval = el.getProperty('interval')){
clearInterval(phaseinterval);
}
phaseinterval = setTimeout("phase_out('"+in_block_id+"');", in_timeout);
el.setProperty('interval', phaseinterval);
}
break;
}
}
}
function phase_out(in_block_id){
if($defined($(in_block_id))){
var el = $(in_block_id);
var current_phase = el.getProperty('phase');
debug('phase out: '+in_block_id+', current phase: '+current_phase);
switch(current_phase){
case '1':
if(el.hasClass('block0')){
if(phaseinterval = el.getProperty('interval')){
clearInterval(phaseinterval);
}
if(el.getProperty('phasing') == 0){
debug('phasing out: '+in_block_id);
el.setProperty('phasing', 1);
// fade in phase 0
phase0 = el.getElement('.phase0');
if(phasefx[in_block_id]){ phasefx[in_block_id].cancel(); }
phasefx[in_block_id] = new Fx.Tween(phase0, {fps: phasingFps, duration: phasingDuration10, onComplete: function(){
el.setProperty('phase', 0);
el.setProperty('phasing', 0);
}}).start('opacity', 0, 1);
// fade out phase 1
phase1 = el.getElement('.phase1');
new Fx.Tween(phase1, {fps: phasingFps, duration: phasingDuration10}).start('opacity', 1, 0);
}
}
break;
case '2':
if(phaseinterval = el.getProperty('interval')){
clearInterval(phaseinterval);
}
if(el.getProperty('phasing') == 0){
debug('phasing out: '+in_block_id);
el.setProperty('phasing', 1);
// fade in phase 1
phase1 = el.getElement('.phase1');
if(phasefx[in_block_id]){ phasefx[in_block_id].cancel(); }
phasefx[in_block_id] = new Fx.Tween(phase1, {fps: phasingFps, duration: phasingDuration21, onComplete: function(){
el.setProperty('phase', 1);
el.setProperty('phasing', 0);
if(el.hasClass('block0')){
unphase_in(in_block_id, 3000);
}
}}).start('opacity', 0, 1);
// fade out phase 2
phase2 = el.getElement('.phase2');
new Fx.Tween(phase2, {fps: phasingFps, duration: phasingDuration21}).start('opacity', 1, 0);
}
break;
default:
debug(in_block_id+', strange phase? '+current_phase);
break;
}
}
}
function sendonenter(e, el){
evt = new Event(e);
if(evt.key == 'enter'){
var action = $(el).getParent('form').getProperty('onsubmit');
window.addEvent('formsubmit', action);
window.fireEvent('formsubmit');
window.removeEvents('formsubmit');
return false;
} else {
return true;
}
}
window.addEvent('load', init);
window.addEvent('resize', fixtrigger);