/**
 * @author ilkinulas@gmail.com
 * jquery plugin that rotates div elements inside a given div element
 */
var hiddenDivs = [];

jQuery.fn.divroller = function(options) {
	settings = jQuery.extend( {
		visible : 3,
		pause : 3000
	}, options);

	start(settings, this);
	
	function start(settings, container) {
		var divs = container.children();
		//hide unvisible divs
		while (settings.visible < divs.length) {
			var removedDiv = $(divs[divs.length - 1]).remove();
			hiddenDivs.push(removedDiv);
			divs = container.children();
		}
		
		setTimeout( function() {
			roll(settings, container)
		}, settings.pause);
		
	};

	function roll(settings, container) {
		//Dom manipulation.
		container.prepend(hiddenDivs.pop());
		hiddenDivs.unshift($(container.children()[settings.visible]).remove());
		
		//Efect
		$(container.children()[0]).hide();
		$(container.children()[0]).slideDown("slow");

		//Repeat
		setTimeout( function() {
			roll(settings, container)
		}, settings.pause);
	}
}

function showOrHide(ob) {
	
	if(ob.style.display == 'none') {
		ob.style.display = '';
	}
	else {
		ob.style.display = 'none';		
	}
}

function showOrHide2(ob) {
	if(ob.hasClass('hide')) {
		ob.removeClass('hide');
		ob.addClass('show');
	}
	else {
		//alert(ob);
		ob.addClass('show');	
	}
}

// -*** Keep at the bottom of this page
$(document).ready(function () {
	// Tips
    $(".qTip").tooltip({ position: "top right", opacity: 0.9});
    $(".qTipTL").tooltip({ position: "top left", opacity: 0.9});
	$(".qTipBL").tooltip({ position: "bottom left", opacity: 0.9});
    // overlay setup
	$("a[rel]").overlay();
});
// DO NOT add any more below here ***
