Event.addListener(window, "resize", fnCallback);

function fnCallback(e) { 
	YAHOO.multifinish.checkBrowserWidth();
	YAHOO.multifinish.initSlideInInfo();
}

YAHOO.multifinish.checkBrowserWidth = function() {
	var theWidth = YAHOO.multifinish.getBrowserWidth();
	var theHeight = YAHOO.multifinish.getBrowserHeight();
	//alert(theWidth + "x" + theHeight);
	
	imgNewHoehe = theHeight-34;
	imgNewBreite = imgNewHoehe * 1.5;
	
	//alert(imgNewBreite + "x" + imgNewHoehe);
	
	if ((imgNewHoehe * 1.5) < theWidth)
	{
		imgNewHoehe = (theWidth/1.5);
		imgNewBreite = theWidth;
	}
	
	//alert(imgNewBreite + "x" + imgNewHoehe);
	
	Dom.setStyle('bgImg', 'width', imgNewBreite + "px");
	Dom.setStyle('bgImg', 'height', imgNewHoehe + "px");
	
	Dom.setStyle('divBgImg', 'width', theWidth + "px");
	Dom.setStyle('divBgImg', 'height', (theHeight-34) + "px");
	
	
	return true;
};

YAHOO.multifinish.getBrowserWidth = function() {
	if (window.innerWidth) {
		return window.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth != 0) {
		return document.documentElement.clientWidth;
	} else if (document.body) {
		return document.body.clientWidth;
	}
	
	return 0;
};

YAHOO.multifinish.getBrowserHeight = function() {
	if (window.innerHeight) {
		return window.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight != 0) {
		return document.documentElement.clientHeight;
	} else if (document.body) {
		return document.body.clientHeight;
	}
	
	return 0;
};






YAHOO.multifinish.initSlideInInfo = function() {

	var isOpen = false;

	var startX = Dom.getX('slidein_info_content');
	var startY = Dom.getY('slidein_info_content');
	
	//alert(startX + "x" + startY);

	var moveLeftAnim = new YAHOO.util.Motion('slidein_info_content', { points: {to: [startX-154,startY] } }, 0.2 );
	var moveRightAnim = new YAHOO.util.Motion('slidein_info_content', { points: {to: [startX,startY] } }, 0.2 );
	
	var doTransition = function(e) {
		if (isOpen) {
			moveRightAnim.animate();
			isOpen = false;
		} else {
			moveLeftAnim.animate();
			isOpen = true;
		}
		return false;
	}
	
	Event.addListener('slidein_info_content', 'click', doTransition);
}

Event.addListener(window, 'load', YAHOO.multifinish.initSlideInInfo);
