// JavaScript Document

	var obj = null;
	var obj2 = null;
	var timers = null;
	var speed = null;
	var wrapperWidth = 390;
	var o2l = 0;
	var o2w = 0;


	function f_clientWidth() {
		return f_filterResults (
			window.innerWidth ? window.innerWidth : 0,
			document.documentElement ? document.documentElement.clientWidth : 0,
			document.body ? document.body.clientWidth : 0
		);
	}
	function f_clientHeight() {
		return f_filterResults (
			window.innerHeight ? window.innerHeight : 0,
			document.documentElement ? document.documentElement.clientHeight : 0,
			document.body ? document.body.clientHeight : 0
		);
	}
	function f_scrollLeft() {
		return f_filterResults (
			window.pageXOffset ? window.pageXOffset : 0,
			document.documentElement ? document.documentElement.scrollLeft : 0,
			document.body ? document.body.scrollLeft : 0
		);
	}
	function f_scrollTop() {
		return f_filterResults (
			window.pageYOffset ? window.pageYOffset : 0,
			document.documentElement ? document.documentElement.scrollTop : 0,
			document.body ? document.body.scrollTop : 0
		);
	}
	function f_filterResults(n_win, n_docel, n_body) {
		var n_result = n_win ? n_win : 0;
		if (n_docel && (!n_result || (n_result > n_docel)))
			n_result = n_docel;
		return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	}
	function setPPPos(elemId) {
		var pp = document.getElementById(elemId);
		
		var newLeft = (f_clientWidth() - wrapperWidth) / 2;
		if ( newLeft < 0 )
			newLeft = 96;
		pp.style.left = newLeft+'px';
	}

	function expand(elem,cl,nl,cw,nw) {
	
		obj = elem;
		speed = 10;
		
		if ( obj2 ) {
			obj2.style.zIndex = 0;
			obj2.style.left = o2l+'px';
			obj2.style.width = o2w+'px';
			obj2.style.backgroundPosition = (-o2l)+'px 0px';
		}
		
		obj.style.zIndex = 99;
		obj.style.left = cl+'px';
		obj.style.width = cw+'px';
			
		timers = [setTimeout('moveAndResize('+nl+','+nw+',99)',20)];
	
	}
	
	function collapse(elem,nl,nw) {
		
		obj2 = elem;
		o2l = nl;
		o2w = nw;
	
		for (i=0;i<timers.length;i++) {
			clearTimeout(timers[i]);
		}
	
		timers = [setTimeout('moveAndResize('+nl+','+nw+',0)',20)];
		
	}
		
	function moveAndResize(newLeft,newWidth,zi) {
	
		var curLeft = parseInt(obj.style.left);
		var curWidth = parseInt(obj.style.width);
	
		if (curLeft < newLeft) {
			tempLeft = curLeft+speed;
			if (tempLeft >= newLeft) {
				obj.style.left = newLeft+'px';
				obj.style.backgroundPosition = (-newLeft) + 'px 0px';
			} else {
				obj.style.left = tempLeft+'px';
				obj.style.backgroundPosition = (-tempLeft) + 'px 0px';
			}
		} else if (curLeft > newLeft) {
			tempLeft = curLeft-speed;
			if (tempLeft <= newLeft) {
				obj.style.left = newLeft+'px';
				obj.style.backgroundPosition = (-newLeft) + 'px 0px';
			} else {
				obj.style.left = tempLeft+'px';
				obj.style.backgroundPosition = (-tempLeft) + 'px 0px';
			}
		}
		
		if (curWidth < newWidth) {
			tempWidth = curWidth+speed;		
			if (curLeft != newLeft && (curLeft+curWidth) < wrapperWidth) tempWidth = curWidth+(speed*2);
			if (tempWidth+curLeft >= wrapperWidth) tempWidth = wrapperWidth-curLeft+speed;
				
			if (tempWidth >= newWidth) {
				obj.style.width = newWidth+'px';
				obj.style.zIndex= zi;
			} else {
				obj.style.width = tempWidth+'px';
				speed++;
				timers[0] = setTimeout('moveAndResize('+newLeft+','+newWidth+','+zi+')',20);
			}
		} else if (curWidth > newWidth) {
			tempWidth = curWidth-speed;
			if (curLeft != newLeft && (curLeft+curWidth) > (newLeft+newWidth)) tempWidth = curWidth-(speed*2);
			if ((tempWidth+curLeft) < (newLeft+newWidth)) tempWidth = (newLeft+newWidth)-curLeft-speed;
			
			if (tempWidth < newWidth) {
				obj.style.width = newWidth+'px';
				obj.style.zIndex= zi;
			} else {
				obj.style.width = tempWidth+'px';
				speed++;
				timers[0] = setTimeout('moveAndResize('+newLeft+','+newWidth+','+zi+')',20);
			}
		}
	
			
	}
// JavaScript Document