/*
Created: 11/30/2009
Author: Mark Baumann, Ryan Wood

Purpose: main RECENTER js



Delta log:

--- innerfade function
$('ID or class of the element containing the fading objects').innerfade({ 
	animationtype: Type of animation 'fade' or 'slide' (Default: 'fade'), 
	speed: Fadingspeed in milliseconds or keywords (slow, normal or fast)(Default: 'normal'), 
	timeout: Time between the fades in milliseconds (Default: '2000'), 
	type: Type of slideshow: 'sequence', 'random' or 'random_start' (Default: 'sequence'), 
	containerheight: Height of the containing element in any css-height-value (Default: 'auto')  
	runningclass: CSS-Class which the container get’s applied (Default: 'innerfade') }); 
*/

$(function(){ 
	$('div#featured').innerfade({
		/* animationtype: 'slide', */
		speed: 1000, 
		timeout: 5000, 
		type: 'sequence', 
		containerheight: '264px' 
	});
});

/* main menu */

$(function(){
$(" #nav ul ").css({display: "none"}); // Opera Fix
$(" #nav li").hover(function(){
			$("a", this).addClass('navActive');
			//$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(800);
			$(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(500);
		},function(){
			$("a", this).removeClass('navActive');
			$(this).find('ul:first').css({visibility: "hidden",display: "none"});
			//$(this).find('ul:first').hide();
			//$(this).find('ul:first').hide(300,function() {$(this).parent().find('a').removeClass('navActive');});
			
		});
var html = "<ul>";

$('#searchbox').focus(function(){
	if($(this).attr("value") == "SEARCH") $(this).attr("value", "");
});

$('#searchbox').blur(function(){
	if($(this).attr("value") == "") $(this).attr("value", "SEARCH");
});

/* Register */
if( $("#registerButton").length != 0 ) {
	$('#registerButton').click(function(){
		
	});
}

/* faq.asp */
	$('.answertext').css({
		"display":"none",
		"cursor":"pointer"
	});
	$('.questions a').css("cursor","pointer").click(function() {
		$(this).parent().next().slideToggle('fast');
		return false;
	});

	/*
	$.jTwitter('TexRec', 10, function(data){
        $('#posts').empty();
        
		$.each(data, function(i, post){
			// filter post text to find URLs using jquery-text-tools.js
			var postText = $.link(post.text);

            $('#posts').append(
                '<div class="post">'
                +' <div class="txt">'
                // See output-demo.js file for details
                +    postText
                +' </div>'
                +'</div>'
            );
        });
    });
	*/


	// side bar menu (ex. recontemp.asp)
	var oldheight = 26;
	$('#pageNav > li').css({
		'display' : 'block',
		'height' : oldheight + 'px'
	});
	$('.window', '#pageNav').css({
		'display' : 'block'
	}).hide();
	
	$('#pageNav > li > a').click(function() {
		var $item = $(this).next();
		var $parent = $(this).parent();
		var height = $(this).next().height() + oldheight;

		if( $(this).next().is(':visible') ) {
			$(this).parent().animate({height : oldheight}, 600);
			$(this).next().fadeOut(600);
		} else {
			$(this).parent().animate({height : height}, 600);
			$(this).next().fadeIn(600);
		}
	});

});
