//var effect = $('box').effect('background-color', {duration: 5000});
var periodical;
var my_periodical;
var count = 0;
var which_one = 'fol_1';
	
var fx = function() {
	count = count+1;
	if(count%5==0)
	{
		which_one = 'fol_2';		
	}
	if(count%10==0)
	{
		which_one = 'fol_1';
	}
	if(count==200)
	{
		$clear(periodical);
	}
	slideFolio(count%5,which_one);
}
periodical = fx.periodical(5000); //5000

$('mask').addEvent("mouseenter", function(){
		$clear(periodical);
		
	});
        //this clears the periodical, and highlights the timer bar
	$('mask').addEvent("mouseleave", function(){
		//fx();
		periodical = fx.periodical(5000);
	});
 


function slideFolio(col,this_one){

	var str = window.location+'';
	var mySplitResult = str.split("/");
	var my_url = mySplitResult[2];
	
	var i = document.getElementById("feat_property");
	var right_width = i.offsetWidth; //height of side bit
	if(this_one=='fol_1')
	{
		var x = ((col)*-right_width);
		var y = ((col-4)*-right_width);
	}
	else if(this_one=='fol_2')
	{
		var y = ((col)*-right_width);
		var x = ((col-4)*-right_width);
	}
	var folioChange = new Fx.Style('folio', 'left', {duration:500});
	var folioChange_2 = new Fx.Style('folio_2', 'left', {duration:500});
	
	
	if(col==0)
	{
	//	my_periodical = hide_me.periodical(100); //500
	}
	if(col==1)
	{
		if(this_one=='fol_1')
		{
			$('folio_2').setStyle('visibility', 'hidden');
			
			$('folio').setStyle('visibility', 'visible');
			//load all props into fol_2
			var url = "http://"+my_url+"/get_prop.php";
			new Ajax(url, {
					method: 'get',
					update: $('folio_2')
			}).request();

		}
		else if(this_one=='fol_2')
		{
			$('folio').setStyle('visibility', 'hidden');
			$('folio_2').setStyle('visibility', 'visible');

			//load all props into fol_2

			var url = "http://"+my_url+"/get_prop.php";
			new Ajax(url, {
					method: 'get',
					update: $('folio')
			}).request();

		}
	}
	if(col==2)
	{
		if(this_one=='fol_1')
		{
			$('folio_2').setStyle('visibility', 'visible');

		}
		else if(this_one=='fol_2')
		{
			$('folio').setStyle('visibility', 'visible');
		}
	}
	if(col==4)
	{
	//	fx();
		my_periodical = hide_me.periodical(500); //500
	
	}
	
	
	folioChange.start(x);	
	folioChange_2.start(y);	
	
}

var hide_me = function() {
	
	if(which_one=='fol_2')
	{
		$('folio_2').setStyle('visibility', 'hidden');

		$('folio').setStyle('visibility', 'visible');
		//load all props into fol_2

	}
	else if(which_one=='fol_1')
	{
		$('folio').setStyle('visibility', 'hidden');
		$('folio_2').setStyle('visibility', 'visible');

	}

	$clear(my_periodical);
	fx();
}

function dave(col){
//alert(col);
slideFolio(col);
}