//Copyright 2011 Toodledo.com
var jsLoaded=1,animationLock=!1;
$(document).ready(function(){$("#showleft").click(home_scrollLeft);$("#showright").click(home_scrollRight);$(".tourcard").click(home_tourClick);$("#showclose").click(home_tourClose);$("#modalBack").click(home_tourClose);$("#signin").click(signin);$("#register").click(register);$("#mobios").click(home_tour_special);$("#mobdroid").click(home_tour_special);$("#mobbb").click(home_tour_special);home_updateScrollArrows();$(document.documentElement).keyup(function(a){if(a.keyCode)var b=a.keyCode;else if(a.charCode)b=
a.charCode;else if(a.which)b=a.which;b==13&&!$("#signinform").is(":visible")&&!$("#registerform").is(":visible")&&!$("#showpop").is(":visible")&&signin(a)})});function signin(a){a.stopPropagation();$("#signinform").toggle();$(".firstField").focus();return!1}function register(a){a.stopPropagation();$("#signinform").hide();$("#registerform").fadeIn(200,function(){$("#reg_first").focus();$("#modalBack").fadeTo(800,0.5)});return!1}
function home_tour_special(){home_tourDisplay(this.id);$("#showpop").fadeIn(200,function(){$("#modalBack").fadeTo(800,0.5)});$("#showleft2").unbind();$("#showright2").unbind()}function home_tourClick(){home_tourDisplay(this.id.numberPart());$("#showpop").fadeIn(200,function(){$("#modalBack").fadeTo(800,0.5)});$("#showleft2").unbind();$("#showright2").unbind();$("#showleft2").click(home_tourLeft);$("#showright2").click(home_tourRight)}
function home_tourClose(){$("#showpop").hide();$("#registerform").hide();$("#modalBack").fadeOut(300);$("#showleft2").unbind();$("#showright2").unbind();animationLock=!1}
function home_tourDisplay(a){if(!animationLock&&(animationLock=!0,$("#tb"+a).length)){var b=$("#tb"+a).parent().children("b").html(),c=$("#tb"+a).parent().children(".noshow").attr("val");$("#showdetails").fadeOut(200,function(){$("#showdetails").attr("tbid",a);$("#showdetails").html("<h3>"+b.toUpperCase()+"</h3>"+c);$("#showdetails").fadeIn(200,function(){animationLock=!1})});a=="mobios"||a=="mobdroid"||a=="mobbb"?($("#showleft2").hide(),$("#showright2").hide()):a==0?($("#showleft2").fadeTo("fast",
0.4),$("#showright2").fadeTo("fast",1)):a==home_tourNum()-1?($("#showleft2").fadeTo("fast",1),$("#showright2").fadeTo("fast",0.4)):($("#showleft2").fadeTo("fast",1),$("#showright2").fadeTo("fast",1))}}function home_tourNum(){return $(".tourbox").size()}function home_chunkWidth(){return $("#tb1").parent().outerWidth()+7}function home_tourWidth(){var a=$("#window").outerWidth()+7,a=$("#tb0").position();return a=$("#tb4").position().left-a.left}
function home_tourRight(){var a=parseInt($("#showdetails").attr("tbid"));a<home_tourNum()-1&&home_tourDisplay(a+1)}function home_tourLeft(){var a=parseInt($("#showdetails").attr("tbid"));a>0&&home_tourDisplay(a-1)}function loadDelayedResources(){$(".tourcard").each(function(a,b){b=$(b);b.attr("delay")&&(b.attr("style",b.attr("delay")),b.removeAttr("delay"))})}
function home_scrollRight(){if(!animationLock){animationLock=!0;loadDelayedResources();home_tourNum();var a=home_tourWidth(),b=parseInt($("#scroller").css("marginLeft").replace("px","")),c=home_chunkWidth()*(home_tourNum()-4);b<=-(c-100)?animationLock=!1:(b-=a,$("#scroller").animate({marginLeft:b},1E3,"swing",function(){animationLock=!1;home_updateScrollArrows()}))}}
function home_scrollLeft(){if(!animationLock){animationLock=!0;loadDelayedResources();var a=home_tourWidth(),b=parseInt($("#scroller").css("marginLeft").replace("px",""));b+=a;b>-40&&(b=0);$("#scroller").animate({marginLeft:b},1E3,"swing",function(){animationLock=!1;home_updateScrollArrows()})}}
function home_updateScrollArrows(){var a=parseInt($("#scroller").css("marginLeft").replace("px","")),b=home_tourNum()-4,c=home_chunkWidth();a<=-(c*b-100)?($("#showleft").fadeTo("fast",1),$("#showright").fadeTo("fast",0.4)):(a>=0?$("#showleft").fadeTo("fast",0.4):$("#showleft").fadeTo("fast",1),$("#showright").fadeTo("fast",1))}String.prototype.numberPart=function(){return this.replace(/\D+/,"")};
