jQuery(document).ready(function() {
	
	/* Login Form */

    var loginPanelWrap = jQuery('#loginPanelWrap');
    var loginPanel = jQuery('#loginPanel');

    jQuery('#loginBtn').click(function () {
		loginPanelWrap.slideToggle(200);
		return false;
	});

    jQuery('#loginCross').click(function () {
		loginPanelWrap.slideUp(200);
    });


    /* Featured Rotator */


	
//	var currentFeature = jQuery('#featured .current');
//	var currentHandle = jQuery('#rotatorNav ul .current');
//	var count = 0;
//	var rotateTime = 6000;
//	var fadeTime = 300;
//	var	numFeatures = 0;
//	var features = jQuery('#featured div.feature');
//	var allowChange = true;
//	
//	jQuery.each(features, function() {
//		numFeatures++;
//	});
//	
//	var setCurrent = function(num) {
//		currentFeature.fadeOut(fadeTime, function() {
//			currentFeature.removeClass('current');
//			currentHandle.removeClass('current');
//			currentFeature = jQuery('#featured div.feature:eq('+num+')');
//			currentHandle = jQuery('#rotatorNav ul li:eq('+num+')');
//			currentHandle.addClass('current');
//			currentFeature.addClass('current');
//			currentFeature.hide();
//			currentFeature.fadeIn(fadeTime);
//			allowChange = true;
//		});
//			
//		count = num;
//		
//	}
//	
//	var setRotate = function() {
//		count++;
//		if(count >= numFeatures) {
//			count = 0;	
//		}
//		setCurrent(count);
//	}	
//	
//	jQuery('#featuredRotator').everyTime(rotateTime, "rotate", function() {
//		setRotate()
//	});
//	
//	jQuery('#rotatorNav li').click(function() {
//		
//		if(!jQuery(this).hasClass('current')) {
//			setCurrent(jQuery(this).index());	
//		}
//		
//	});
//	
//	jQuery('#rotatorNav .left').click(function() {
//		if(allowChange) {
//			allowChange = false;
//			if(count <= 0) {
//				count = 3;	
//			}
//			setCurrent(count-1);
//		}		
//	});
//	
//	jQuery('#rotatorNav .right').click(function() {
//		if(allowChange) {
//			allowChange = false;
//			if(count >= numFeatures-1) {
//				count =-1;	
//			}
//			setCurrent(count+1);
//		}		
//	});
//	
//	jQuery('#featuredRotator').hover(
//	  	function () {
//			jQuery('#featuredRotator').stopTime("rotate");
//	  	}, 
//	  	function () {
//			jQuery('#featuredRotator').everyTime(rotateTime, "rotate", function() {
//				setRotate()
//			});
//	  	}
//	);
//	
//	var textNum = 0;
//	var currentText = jQuery('#textRotator p:eq(0)');
//	currentText.addClass('current');
//	
//	var scrollSpeed = 10; //pixels per second
//	
//	var scrollText = function(obj) {
//		var scrollWidth = -1*((obj.outerWidth(true) - jQuery('#textRotator .text').outerWidth(true))+25);
//		var time = (obj.outerWidth(true)/scrollSpeed)*100;
//		obj.animate({left: scrollWidth}, time, 'linear', function() {
//			jQuery('#textRotator').oneTime(1000, "pause", function() {
//				jQuery('#textRotator').oneTime(4000, "rotate", function() {
//					rotateText();
//				});
//			});
//		});
//	}
//	
//	var rotateText = function() {
//		
//		textNum += 1;
//		if(textNum >= jQuery('#textRotator p').size()) textNum = 0;
//		var nextText = $('#textRotator p:eq('+textNum+')');
//		currentText.animate({top:50}, 900, function() {
//			currentText.css({'top' : '-25px', 'left' : '3px'});
//		});
//		nextText.animate({top:5}, 1000, function() {
//			currentText.removeClass('current');
//			currentText = nextText;
//			currentText.addClass('current');
//			
//			if(currentText.outerWidth(true) > jQuery('#textRotator').outerWidth()) { 
//				jQuery('#textRotator').oneTime(1000, "scroll", function() {
//					scrollText(currentText);	
//				});
//			} else {
//				jQuery('#textRotator').oneTime(4000, "rotateText", function() {
//					rotateText();
//				});			
//			}
//		});
//	}
//	
//	jQuery('#textRotator').oneTime(2000, "rotateText", function() {
//		if(currentText.outerWidth(true) > jQuery('#textRotator').outerWidth()) { 
//			jQuery('#textRotator').oneTime(1000, "scroll", function() {
//				scrollText(currentText);	
//			});
//		} else {
//			jQuery('#textRotator').oneTime(4000, "rotateText", function() {
//				rotateText();
//			});			
//		}
//	});
	
	
});
