// JavaScript Document
<!--
var bgW=0;
var bgH=0;

var h=0;

function resizeBg() {
	if (!document.getElementById('backgroundImage')) return false;
	if (bgW==0) bgW=document.getElementById('backgroundImage').width;
	if (bgH==0) bgH=document.getElementById('backgroundImage').height;
	var ratio=bgW/bgH;
	
	//window.status=bgW+'x'+bgH+' '+ratio;
  var h = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
  var w = self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  var elem = document.getElementById('backgroundImage');

	if (h<w/ratio) {
		elem.width = w;
		elem.height = w/ratio;
	} else {
		elem.width = h*ratio;
		elem.height = h;
	}
	window.onresize=resizeBg;
}

function fadeIn(id,speed,f) {
	if (!f) f=1;
		if (f>=100) 
		f=100
	else
		setTimeout('fadeIn("'+id+'",'+speed+','+(f+1)+')',speed);
	t=document.getElementById(id);
	t.style.opacity=(f/100);
	t.style.filter="alpha(opacity="+f+")";
	t.style.visibility='';
}

function fadeOut(id,speed,f) {
	window.status='f:'+f;
	if (!f) f=100;
	if (f<=1) 
		f=0
	else
		setTimeout('fadeOut("'+id+'",'+speed+','+(f-1)+')',speed);
	t=document.getElementById(id);
	t.style.opacity=(f/100);
	t.style.filter="alpha(opacity="+f+")";
	t.style.visibility='';
}

var canClose=true;
var fotoWidth=540;
var totalWidth=0;

var mouseX=0;
var mouseY=0;
function getMouseXY(evt) {
	mouseX=evt.clientX;
	mouseY=evt.clientY;
}

function fotoscroll2() {
	if (self.innerWidth!=undefined) 
		w=self.innerWidth;
	else
		w=document.documentElement.clientWidth;
	d=(w/2)-mouseX;
	d=d/30;
	if (d>-2 && d<2) d=0;
	if (d>=2) d=d-2;
	if (d<=-2) d=d+2;
	t=document.getElementById('fotoscroll');
	s=t.scrollLeft;
	s=s-d;
	if (s<0) s=0;
	if (s>totalWidth-fotoWidth)s=totalWidth-fotoWidth;
	t.scrollLeft=s;
	window.status=mouseX+' '+d;
}
function fotoscroll(w) {
	totalWidth=w;
	setInterval("fotoscroll2()",40);
}

var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-27588892-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
