// BETA code for MooTools (mad4milk.net) FX.ScrollWindow. Customised to add 180px Offset on line 34

Fx.ScrollWindow = Fx.Base.extend({

	initialize: function(options){
		this.setOptions(options);
		this.now = [];
		var b = document.body;
		var stop = this.clearTimer.bind(this);
		if (!this.options.continuer){
			if (b.addEventListener) b.addEventListener('DOMMouseScroll', stop, false);
			else b.onmousewheel = stop;
		}
	},
	
	setNow: function(){
		[0,1].each(function(i){
			this.now[i] = this.compute(this.from[i], this.to[i]);
		}, this);
	},
	
	scrollTo: function(x, y){
		if (this.timer && this.options.wait) return;
		var left = Window.getScrollLeft();
		var top =  Window.getScrollTop();
		var width = Window.getWidth();
		var height = Window.getHeight();
		var fullWidth = Window.getScrollWidth();
		var fullHeight = Window.getScrollHeight();
		var maxScrollWidth = fullWidth - width;
		var maxScrollHeight = fullHeight - height;
		if (x > maxScrollWidth) x = maxScrollWidth;
		if (y > maxScrollHeight) y = maxScrollHeight;
		return this.custom([left, top], [x-180, y]); // ADD A MARGIN TO THE LEFT AT 180PX ** REMOVE FOR NORMAL FUNCTIONALITY
	},
	
	toElement: function(el){
		return this.scrollTo($(el).getLeft(), $(el).getTop());
	},
	
	increase: function(){
		window.scrollTo(this.now[0], this.now[1]);
	}

});



function openPictureWindow_Fever(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop) {  // v4.01
    var myLeft = (screen.width-imageWidth)/2;
    var myTop = (screen.height-imageHeight)/2;
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+myLeft+",top="+myTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'<\/title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	if (imageType == "swf"){
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<\/embed><\/object>');	}else{
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\" \/>'); 	}
	newWindow.document.write('<\/body><\/html>');
	newWindow.document.close();
	newWindow.focus();
}

function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}
