	var TimerOut, TimerOver;
	var PopupId ='rent_link_popup';
	function ShowPopup(ob){
		clearTimeout(TimerOut);
		clearTimeout(TimerOver);
		var pos = findPos(ob);
		
		var objPopup = document.getElementById(PopupId);
		if (objPopup.onmouseover==null){
			objPopup.onmouseover = function (){
				clearTimeout(TimerOut);
			}
			objPopup.onmouseout = function (){
				HidePopup()
			}
		}
		
		var winW = document.body.offsetWidth;
		var winH = document.body.offsetHeight;
		var scrOfY = 0;
		var scrOfX = 0;
		
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			scrOfY = window.pageYOffset;
			scrOfX = window.pageXOffset;
		  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			//DOM compliant
			scrOfY = document.body.scrollTop;
			scrOfX = document.body.scrollLeft;
		  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			//IE6 standards compliant mode
			scrOfY = document.documentElement.scrollTop;
			scrOfX = document.documentElement.scrollLeft;
		}
	
		var obwidth = 387;
		var obheight = 410;
		var leftpos = (pos[0]-10);
		var toppos = (pos[1]-obheight);
		
		if (toppos+obheight>winH){
			toppos = toppos - (toppos+obheight - winH) - 20;
		}
		if ((toppos-scrOfY)<0){
			toppos = scrOfY+20;
		}
		if (leftpos+obwidth > winW){
			leftpos = leftpos - (leftpos+obwidth - winW) - 20;
		}
		
		
		objPopup.style.position = 'absolute';
		objPopup.style.left = leftpos+'px';
		objPopup.style.top = toppos+'px';
		
		TimerOver = setTimeout('Show(\''+PopupId+'\');',500);
	}
	function HidePopup(){
		clearTimeout(TimerOut);
		clearTimeout(TimerOver);
		TimerOut = setTimeout('Hide(\''+PopupId+'\');',500);
	}
	function Show(id){
		clearTimeout(TimerOut);
		clearTimeout(TimerOver);
		var obj = document.getElementById(id);
		if (obj==null) return;
		obj.style.display = 'block';
	}
	function Hide(id){
		clearTimeout(TimerOut);
		clearTimeout(TimerOver);
		var obj = document.getElementById(id);
		if (obj==null) return;
		obj.style.display = 'none';
	}
	function findPos(obj)
	{
		var curleft = curtop = 0;
		var width = obj.offsetWidth;
		var height = obj.offsetHeight;
		ob = obj;
		if (ob.parentNode) {
			curleft = ob.offsetLeft;
			curtop = ob.offsetTop;
			while (ob = ob.offsetParent) {
				curleft += ob.offsetLeft;
				curtop += ob.offsetTop;
			}
		}
		return [curleft,curtop,width,height];
	}

	
	jQuery(function( $ ){
	//borrowed from jQuery easing plugin
	//http://gsgd.co.uk/sandbox/jquery.easing.php
	$.easing.elasout = function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	};
	var sectionsCount = 4;
	var aActions = new Array(
							 function(i){
							 	 selectNavButton(i);
								 goTo(paneTarget1,i);
								 goTo(paneTarget2,sectionsCount-1-i);
								},
							 function(i){
								 selectNavButton(i);
								 goTo(paneTarget1,i);
								 goTo(paneTarget2,sectionsCount-1-i);
								 },
							 function(i){
								 selectNavButton(i);
								 goTo(paneTarget1,i);
								 goTo(paneTarget2,sectionsCount-1-i);
							 	},
							 function(i){
								 selectNavButton(i);
								 goTo(paneTarget1,i);
								 goTo(paneTarget2,sectionsCount-1-i);
								 }
							 );

	var currentSection = '';
	
	function selectNavButton(buttonNum){
		var buttonNum = buttonNum!=null?buttonNum:1;
		jQuery.each($('#nav>ul>li>a'),function(){
	 	 	var tabnumber = this.href.split('#')[1];
	 	 	
	 	 	if (buttonNum==tabnumber){
	 	 		jQuery(this).removeClass('tab'+tabnumber+'off').addClass('tab'+tabnumber+'on');
	 	 	}else{
	 	 		jQuery(this).removeClass('tab'+tabnumber+'on').addClass('tab'+tabnumber+'off');
	 	 	}
	 	 });
	}
	
	function Finish(){
		
	}

	function Forward(paneTarget){
		if (paneTarget.currentSection<sectionsCount-1){
			var i=currentSection+1;
			startAction(i);
		}else{
			startAction(0);
		}
	}

	function Back(paneTarget){
		if (paneTarget.currentSection>0){
			var i=currentSection-1;
			startAction(i);
		}				
	}
	
	function startAction(i){
		if (aActions[i]!=''){
			aActions[i](i);
		}
	}

	function goTo(paneTarget,i){
		if (paneTarget.currentSection == i && paneTarget.currentSection!=''){
			return;
		}
		paneTarget.currentSection = i;
		if (paneTarget.currentSection!=''){
			//$('#back').css('visibility','visible');
		}
		//$('#forward').removeClass('stop');
		//$('#back').removeClass('stop');
		if (paneTarget.currentSection==sectionsCount-1){
			//$('#forward').addClass('stop');
		}else if (paneTarget.currentSection==0){
			//$('#back').addClass('stop');
		}
		
		var target = jQuery(paneTarget.find('ul>li')[i]);
		
		paneTarget.stop(); paneTarget.scrollTo( target ,  { duration: 620 } );
		//$('.bluealpha>a').removeClass('selected');
		//$('#'+aSections[i]+'_go').addClass('selected').blur();
		//stopLoading();
	}
	//by default, the scroll is only done vertically ('y'), change it to both.
	$.scrollTo.defaults.axis = 'x'; 			
	
	//Target examples bindings
	var paneTarget1 = $('#sections1');
	paneTarget1.currentSection = 0;			
	var paneTarget2 = $('#sections2');
	paneTarget2.currentSection = 0;			
	
	//paneTarget2.find('ul').css('position','inherit');
	paneTarget2.attr('scrollLeft','2550px');
	
	goTo(paneTarget1,0);
	goTo(paneTarget2,3);
	
	//
	
	
	
	$('#nav>ul>li>a').click(function(){ startAction(this.href.split('#')[1]); });
	
	//$('#back').click(function(){Back()});
	//$('#forward').click(function(){Forward()});
	
	$('.boxa,.boxb,.boxc,.boxd,.boxe').mouseover(
		function (){
					$(this).css('margin-top','-5px');
					window.status = $(this).children("span").children("a")[0].href;
					}
		);
	$('.boxa,.boxb,.boxc,.boxd,.boxe').click(
		function (){
					window.location.href = $(this).children("span").children("a")[0].href;
			}
		);
	$('.boxa,.boxb,.boxc,.boxd,.boxe').mouseout(
		function (){
					$(this).css('margin-top','0px');
					window.status = '';
			}
	);
});