jQuery.fn.extend({getJsonComment:function(){var code=jQuery(this).children("code.jsonComment");var par=null;if(code.length>0){code=code.get(0).innerHTML.replace("<!--","").replace("-->","");par=eval("("+code+")")}return par||false}});$().ready(function(){IG.init()});var IG={init:function(){$(document.body).addClass("hasJs");(function(){$("input.defaultValue, textarea.defaultValue").each(function(){var thisObj=this;var obj=$(this);obj.data("defaultVal",thisObj.value);obj.focus(function(){if(obj.hasClass("defaultValue")){obj.removeClass("defaultValue");obj.attr("value","")}});obj.blur(function(){var text=thisObj.value;if((text==obj.data("defaultVal"))||(text.length==0)){obj.addClass("defaultValue");thisObj.value=obj.data("defaultVal")}})})})();(function(){$("div.feedback").closest("form").submit(function(){var ta=$(this).find("textarea");if(ta.attr("value")==ta.data("defaultVal")){ta.attr("value","")}});var yes=$("#ratingNo");var no=$("#ratingYes");if(yes.length>0){yes.click(function(){var obj=$(this);obj.closest("form").find("div.feedback").slideDown("slow")});if(yes.get(0).checked){yes.click()}}if(yes.length>0){no.click(function(){var obj=$(this);obj.closest("form").find("div.feedback").slideUp("slow")});if(no.get(0).checked){no.click()}}})();(function(){$("form.ajaxForm").each(function(){var thisObj=this;var obj=$(this);obj.submit(IG.eventsHub.onAjaxSubmit)})})();(function(){$(".panelsCarousel").each(function(){var divObj=$(this);var intervalHnd=null;var params=divObj.getJsonComment();var duration=params.duration||6000;var ul=divObj.find("ul");var LIs=ul.find("li.panelsLi");LIs.each(function(i){$(this).data("index",i)});var currentPanel=LIs.eq(0).css("z-index",2).show(0);var nextPanel=currentPanel.next().length>0?currentPanel.next():currentPanel.prevAll(":last");ul.css("height",currentPanel.height());var buttons=$('<div class="panelControls"><ul><li class="back"><a title="back" href="#back"><span>Back</span></a></li><li class="pause"><a title="pause" href="#pause"><span>Pause</span></a></li><li class="play"><a title="play" href="#play"><span>Play</span></a></li><li title="forward" class="forward"><a href="#forward"><span>Forward</span></a></li></ul><div class="progress"></div></div>');var progressBar=buttons.find("div.progress");buttons.insertBefore(ul);if(params.showButtons===false){buttons.hide(0)}var transitionFx=eval(params.transitionFx||"fade");var linksUl=$('<div class="directLinks"><ul></ul></div>').insertAfter(ul).find("ul");LIs.each(function(i){var i=i+1;var panelLabel=$(this).find(".panelButtonLabel");panelLabel=panelLabel.text().length>0?panelLabel.text():i;$('<li><a title="goto '+panelLabel+'" href="#'+i+'">'+panelLabel+"</a></li>").appendTo(linksUl).find("a").click(function(){pause();goTo(this.hash.replace("#",""));return false})});linksUl.find(":first a").addClass("current");linksUl.find("li:first").addClass("first");linksUl.find("li:last").addClass("last");if(params.autoStart){start()}buttons.find("a").click(function(){switch(this.hash){case"#play":start();break;case"#pause":pause();break;case"#forward":pause();next();break;case"#back":pause();previous();break}return false});function start(){buttons.find("li.pause a").removeClass("active");buttons.find("li.play a").addClass("active");if(!intervalHnd){progressBar.stop(true,true);progressBar.css({borderLeftWidth:"0px"});progressBar.animate({borderLeftWidth:buttons.width()},duration);intervalHnd=setInterval(function(){progressBar.stop(true,true);progressBar.css({borderLeftWidth:"0px"});progressBar.animate({borderLeftWidth:buttons.width()},duration);transitionFx()},duration)}}function pause(){buttons.find("li.play a").removeClass("active");buttons.find("li.pause a").addClass("active");progressBar.stop(true,true);progressBar.css({borderLeftWidth:"0px"});clearInterval(intervalHnd);intervalHnd=null}function previous(){nextPanel=currentPanel.prev().length>0?currentPanel.prev():currentPanel.nextAll(":last");currentPanel.stop(true,true);nextPanel.stop(true,true);ul.stop(true,true);transitionFx()}function next(){currentPanel.stop(true,true);nextPanel.stop(true,true);ul.stop(true,true);transitionFx()}function goTo(panelIndex){if(currentPanel.data("index")==panelIndex-1){return false}currentPanel.stop(true,true);nextPanel.stop(true,true);ul.stop(true,true);nextPanel=LIs.eq(panelIndex-1);transitionFx()}function slide(){currentPanel.css("z-index",1);nextPanel.css("z-index",2).show(0);var viewportWidth=nextPanel.height();ul.animate({height:nextPanel.height()},1200);nextPanel.css("top",ul.height());currentPanel.animate({top:-viewportWidth},1200,function(){$(this).css("z-index",0).hide(0)});nextPanel.animate({top:0},1200);currentPanel=nextPanel;nextPanel=currentPanel.next().length>0?currentPanel.next():currentPanel.prevAll(":last");linksUl.find("a").removeClass("current").eq(currentPanel.data("index")).addClass("current")}function fade(){currentPanel.css("z-index",1);nextPanel.css("z-index",2);var viewportWidth=nextPanel.height();ul.animate({height:nextPanel.height()},1200);currentPanel.fadeOut(600,function(){$(this).css("z-index",0)});nextPanel.fadeIn(1200);currentPanel=nextPanel;nextPanel=currentPanel.next().length>0?currentPanel.next():currentPanel.prevAll(":last");linksUl.find("a").removeClass("current").eq(currentPanel.data("index")).addClass("current")}function swap(){currentPanel.css("z-index",1);nextPanel.css("z-index",2).show(0);var viewportWidth=nextPanel.height();ul.animate({height:nextPanel.height()},1000);nextPanel.css("top",-viewportWidth);currentPanel.animate({top:-viewportWidth},1000,function(){$(this).css("z-index",0).hide(0)});nextPanel.animate({top:0},1000);currentPanel=nextPanel;nextPanel=currentPanel.next().length>0?currentPanel.next():currentPanel.prevAll(":last");linksUl.find("a").removeClass("current").eq(currentPanel.data("index")).addClass("current")}})})()},eventsHub:{onAjaxSubmit:function(){var a=this;var d=$(this);var b=$(this).serialize();switch(a.id){case"feedbackForm":var c=d.find("span.activityLog");c.show(0).text("Sending...").get(0).className="activityLog";break}setTimeout(function(){$.ajax({url:a.action,type:"get",dataType:"json",data:b,success:function(e){IG.eventsHub.onAjaxResponse(a,e)},error:function(e,g,f){alert(g)}})},1000);return false},onAjaxResponse:function(a,d){var c=$(a);switch(a.id){case"feedbackForm":var b=c.find("span.activityLog");b.get(0).className="activityLog";b.addClass("code"+d.code).text(d.msg);setTimeout(function(){b.fadeOut("slow")},3000);if(d.code==0){c.hide(0);c.closest("div.rating").find(">h3").hide(0);c.closest("div.rating").find("div.thanks").show(0)}break}}}};