
hdFadeOut = function( element ) {
	var options = Object.extend({
		from: 1.0,
		to:   0.0,
		afterFinish: function(effect) { 
			document.getElementById(element).style.visibility = "hidden";
			alert(this.from)
		} 
	}, arguments[1] || {});
	new Effect.Opacity(element,options);
}

hdFadeIn = function( element ) {
	var options = Object.extend({
		from: 0.0,
		to:   1.0,
		afterFinish: function(effect) { 
			document.getElementById(element).style.visibility = "visible";
		} 
	}, arguments[1] || {});
	return new Effect.Opacity(element,options);
}

rotateTestimonials = function( duration ) {
	var ul = document.getElementById( "testimonials" ); // parent element
	var items = NiceDOM.children(ul); // array containing all testimonials
	for (var i=0;i<items.length;i++) {
		if (items[i].className == "current") {
			var currentItem = items[i];
			break;
		} 
	}
	
	if (NiceDOM.node_after(currentItem) != null) {
		var nextItem = NiceDOM.node_after(currentItem);
	} else {
		var nextItem = items[0];
	}

	var options = Object.extend({
		from: 1.0,
		to:   0.0,
		afterFinish: function(effect) { 
			currentItem.className = "";
			nextItem.className = "current";
			var innerOptions = Object.extend({
				from: 0.0,
				to:   1.0,
				afterFinish: function(effect) { 
					timer = setTimeout( "rotateTestimonials("+duration+")" , duration );
				} 
			}, arguments[1] || {});
			new Effect.Opacity("testimonials",innerOptions);
		} 
	}, arguments[1] || {});
	new Effect.Opacity("testimonials",options);
}

rotateRates = function( duration ) {
	var ul = document.getElementById( "rrates" ); // parent element
	var items = NiceDOM.children(ul); // array containing all testimonials
	for (var i=0;i<items.length;i++) {
		if (items[i].className == "current") {
			var currentItem = items[i];
			break;
		} 
	}
	
	if (NiceDOM.node_after(currentItem) != null) {
		var nextItem = NiceDOM.node_after(currentItem);
	} else {
		var nextItem = items[0];
	}

	var options = Object.extend({
		from: 1.0,
		to:   0.0,
		afterFinish: function(effect) { 
			currentItem.className = "";
			nextItem.className = "current";
			var innerOptions = Object.extend({
				from: 0.0,
				to:   1.0,
				afterFinish: function(effect) { 
					timer = setTimeout( "rotateRates("+duration+")" , duration );
				} 
			}, arguments[1] || {});
			new Effect.Opacity("rrates",innerOptions);
		} 
	}, arguments[1] || {});
	new Effect.Opacity("rrates",options);
}

rotateCrossBanner = function( duration ) {
	var ul = document.getElementById( "crossbanner" ); // parent element
	var items = NiceDOM.children(ul); // array containing all CrossBanner
	for (var i=0;i<items.length;i++) {
		if (items[i].className == "current") {
			var currentItem = items[i];
			break;
		} 
	}
	
	if (NiceDOM.node_after(currentItem) != null) {
		var nextItem = NiceDOM.node_after(currentItem);
	} else {
		var nextItem = items[0];
	}

	var options = Object.extend({
		from: 1.0,
		to:   0.0,
		afterFinish: function(effect) { 
			currentItem.className = "";
			nextItem.className = "current";
			var innerOptions = Object.extend({
				from: 0.0,
				to:   1.0,
				afterFinish: function(effect) { 
					timer = setTimeout( "rotateCrossBanner("+duration+")" , duration );
				} 
			}, arguments[1] || {});
			new Effect.Opacity("crossbanner",innerOptions);
		} 
	}, arguments[1] || {});
	new Effect.Opacity("crossbanner",options);
}
