﻿// JavaScript Document

/*@cc_on
(function(f){
 window.setTimeout =f(window.setTimeout);
 window.setInterval =f(window.setInterval);
})(function(f){return function(c,t){var a=[].slice.call(arguments,2);return f(function(){c.apply(this,a)},t)}});
@*/

$(document).ready(function() {
						   
	$(".rotator").each(function() {
	
		var rotator = {items:new Array(),el:this}
		var items = new Array()
			
		$(this).css({height:$(this).height()+"px",display:"block"})
		
		$(this).find(".rotator-item").each(function() {
			
			items.push(this)
			$(this).css("display","none")
		
		})
		rotator.items = items
		rotator.index = 0
		
		$(items[rotator.index]).css("display","block")
		
		var rotatorClass = rotator.el.className
		
		rotator.del = parseInt(rotatorClass.substring(rotatorClass.indexOf("rt-del-")+7,rotatorClass.length))
		rotator.dur = parseInt(rotatorClass.substring(rotatorClass.indexOf("rt-dur-")+7,rotatorClass.length))
			
		rotator.rotate = function(rotator) {
			
			$(rotator.el).fadeOut(rotator.dur,function() {
				
				rotator.index++
				if(rotator.index>=rotator.items.length) {rotator.index=0}
				
				for(var i=0;i<rotator.items.length;i++) {
				
					$(rotator.items[i]).css("display",i==rotator.index ? "block" : "none")
					
				}
				
				$(rotator.el).fadeIn(rotator.dur,function() {
				
					window.setTimeout(rotator.rotate,rotator.del,rotator)
				
				})
													   
			})
			
		}
		
		window.setTimeout(rotator.rotate,rotator.del,rotator)
		
	})
	

	
});


// Curved Corners
  $(document).ready(function(){
    $('.rounded10').corners("10px");
    $('.rounded15Bot').corners("15px bottom");
  });
