if(_MobileCheck()){$(document).ready(function(){$('#navigation').removeClass('hidden').find('.extra').remove();var lessonNameRaw=$('h1').attr("title");lessonName=lessonNameRaw.toLowerCase();var opts={id:'j5video',width:300,height:185,qt:false,mobile:false,html5:false,src:'http://purinacanada.cachefly.net/puppy_training/'+lessonName+'-unregistered.mov',poster:'/Content/img/poster-'+lessonName+'1.jpg',autoplay:false,classid:"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B",pluginspage:"http://www.apple.com/quicktime/download/",codebase:"http://www.apple.com/qtactivex/qtplugin.cab",params:{'autoplay':false,'bgcolor':'white','controller':false,'scale':'aspect','target':'myself','showlogo':false}};function _j5GetParam(name){return opts.params[name];};function _j5GetHTML(){var xhtml;xhtml='<embed type="video/quicktime" pluginspage="'+opts.pluginspage+'"';xhtml+=' href="'+opts.src+'"  src="'+opts.poster+'"';xhtml+=' width="'+opts.width+'" height="'+opts.height+'" id="'+opts.id+'_embed" name="'+opts.id+'"';for(var param in opts.params){xhtml+=' '+param+'="'+_j5GetParam(param)+'"';}
xhtml+='></embed>';return xhtml;};$('#video').html(_j5GetHTML()).css({'visibility':'visible'});});}else{var videoInt;var lessonName='';var registered=false;function openPuppyBagFlash(){$('#stf-dialog').dialog('open');}
$(document).ready(function(){var lessonNameRaw=$('h1').attr("title");if(lessonNameRaw!=null){lessonName=lessonNameRaw.toLowerCase();}
var hoverconfig={sensitivity:1,interval:100,over:function(){$(this).parent().find('.blind').animate({width:'132px'},{queue:false,duration:250});},timeout:200,out:function(){$(this).parent().find('.blind').css({width:'0px'});}};$('#navigation').removeClass('hidden');$('ul#navigation li').prepend('<div class="blind"></div>');$('ul#navigation li a').hoverIntent(hoverconfig);$('#social-bookmark').bookmark({'sites':['tumblr','facebook','myspace','delicious','digg','twitthis','stumbleupon','technorati'],'icons':'/Content/img/bookmarks.png','target':'_blank'});$('#social-bookmark ul li a').click(function(){pageTracker._trackEvent('Lesson','Bookmark','social bookmark clicked');});$('#overall-progress .progress-bar').width($('.completion').html()+'%');$('#home-slides').cycle();if($('#live-search-field').length>0){$('#error-dialog').dialog({title:false,bgiframe:true,height:180,width:367,modal:true,resizable:false,autoOpen:false,zIndex:2000});$('#live-search-field').focus(function(){$(this).liveUpdate('#kb-live-questions');});$('#experts').fadeIn('slow');$('.questions li').click(function(){$('.questions li').removeClass('hover');$('.questions li .answer').hide();$(this).addClass('hover');$(this).find('.answer').fadeIn('slow');pageTracker._trackEvent('Experts','Question','viewed question');});if(document.URL.indexOf('#')>=0){var $sQuestion=$('.questions li.'+document.URL.split('#')[1]);var positionQ=$sQuestion.position();$sQuestion.click();$('html,body').animate({scrollTop:positionQ.top},800);}
$('.button-cancel').click(function(){$('#ask-question-reponse').hide();$('#ask-errors').html('');return false;});$("#ajax-loader").ajaxStart(function(){$('#saving-img').css({top:($(document).scrollTop()+10)}).show();});$("#ajax-loader").ajaxStop(function(){$('#saving-img').hide();});$('#ask-form').validate({rules:{'ask-email':{required:true,email:true},'ask-firstName':{required:true,minlength:2},'ask-lastName':{required:true,minlength:2},'ask-question':{required:true,minlength:5}},errorLabelContainer:$("#ask-errors"),messages:{'ask-email':'Please enter a valid email.','ask-firstName':'Please enter your first name.','ask-lastName':'Please enter your last name.'},submitHandler:function(form){var qItem={'email':$("#ask-email").val(),'firstName':$("#ask-firstName").val(),'lastName':$("#ask-lastName").val(),'question':$("#ask-question").val()};var encoded=$.toJSON(qItem);var postUrl="/Experts/SaveQuestion/";$.ajax({url:postUrl,type:"POST",data:encoded,dataType:'json',contentType:"application/json; charset=utf-8",error:function(){$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');},success:function(data){if(data.Value){$('#ask-question-reponse strong').html($("#ask-firstName").val());$("#ask-email").val('');$("#ask-firstName").val('');$("#ask-lastName").val('');$("#ask-question").val('Type your puppy-related question here');$('#ask-question-reponse').show();pageTracker._trackEvent('Experts','Question','asked a question');}else{$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');}}});}});}
if($('#stf-dialog').length>0){function resetSTF(){$('.stf-icon').removeClass('stf-icon-on');$('#stf-my-name').val('your name');$('#stf-my-email').val('your email');$('#stf-thier-name').val('friend\'s name');$('#stf-thier-email').val('friend\'s email');$('#stf-count span').html(5);$('#stf-selected').val(0);$('#stf-errors span').html('');}
$('#stf-dialog').dialog({title:false,bgiframe:true,open:function(){resetSTF();pageTracker._trackEvent('PuppyBag','Clicked','intention of sending to a friend');},height:459,width:585,modal:true,resizable:false,autoOpen:false,zIndex:2000});$('.stf-icon').click(function(){var iconCount=$('.stf-icon-on').length;if($(this).hasClass('stf-icon-on')){$(this).removeClass('stf-icon-on');$('#stf-selected').val(iconCount-1);$('#stf-count span').html(5-(iconCount-1));}else{if(iconCount<5){$(this).addClass('stf-icon-on');$('#stf-selected').val(iconCount+1);$('#stf-count span').html(5-(iconCount+1));}}
return false;});$('.puppy-bag').click(function(){$('#stf-dialog').dialog('open');return false;});$('#stf-cancel').click(function(){$('#stf-dialog').dialog('close');resetSTF();return false;});$('#stf-my-name').focus(function(){if($(this).val()=='your name'){$(this).val('');}}).blur(function(){if($(this).val()==''){$(this).val('your name');}});$('#stf-my-email').focus(function(){if($(this).val()=='your email'){$(this).val('');}}).blur(function(){if($(this).val()==''){$(this).val('your email');}});$('#stf-thier-name').focus(function(){if($(this).val()=='friend\'s name'){$(this).val('');}}).blur(function(){if($(this).val()==''){$(this).val('friend\'s name');}});$('#stf-thier-email').focus(function(){if($(this).val()=='friend\'s email'){$(this).val('');}}).blur(function(){if($(this).val()==''){$(this).val('friend\'s email');}});$('#stf-form').validate({errorLabelContainer:$("#stf-errors span"),rules:{'stf-selected':{required:true,min:5},'stf-my-name':{required:true,minlength:2},'stf-my-email':{required:true,email:true},'stf-thier-name':{required:true,minlength:2},'stf-thier-email':{required:true,email:true}},messages:{'stf-selected':'Oops! You still have a few more items to pick.'},submitHandler:function(form){var iconsArray=Array();$('.stf-icon-on').each(function(){iconsArray.push($(this).find('img').attr('value'));});var emailObj={'Name':$('#stf-my-name').val(),'From':$('#stf-my-email').val(),'FriendName':$('#stf-thier-name').val(),'To':$('#stf-thier-email').val(),'Icons':iconsArray};var encoded=$.toJSON(emailObj);var postUrl="/Home/SendToFriend";$.ajax({url:postUrl,type:"POST",data:encoded,dataType:'json',contentType:"application/json; charset=utf-8",error:function(){$('#stf-dialog').dialog('close');$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');},success:function(data){resetSTF();if(data.Value){$("#stf-errors div").html("You've done it! You've sent your friend a puppy school bag full of great items. Thanks!").show();pageTracker._trackEvent('PuppyBag','Sent','successfully sent to a friend');}else{$('#stf-dialog').dialog('close');$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');}}});}});}
if($('#form-register-submit').length>0){var catCount=0;var dogCount=1;var step2=true;var formPosition=$('#form-register').position();var current=0;function addDog(){if(dogCount<5){dogCount++;$('#reg-dog-'+dogCount).show('fast',function(){$(this).find('.s225').resetSS({ddMaxHeight:'250px'});});$('#registration_dog_name'+dogCount).addClass('pageRequired').focus();$('#registration_dog_dob'+dogCount).addClass('pageRequired');}else{$('#dog-error-msg').html('You may only enter up to 5 dogs.').show().fadeOut(4000);}}
function removeDog(){if(dogCount>1){$('#reg-dog-'+dogCount).hide('fast');$('#registration_dog_name'+dogCount).removeClass('pageRequired').valid();$('#registration_dog_dob'+dogCount).removeClass('pageRequired').valid();dogCount--;}else{$('#dog-error-msg').html('You need to register at least one puppy.').show().fadeOut(4000);}}
function addCat(){if(catCount==0){$('#register-cat-info').show().find('.s225').resetSS({ddMaxHeight:'250px'});bindCatSelects();}
if(catCount<5){catCount++;$('#reg-cat-'+catCount).show('fast',function(){$(this).find('.s225').resetSS({ddMaxHeight:'250px'});$('#registration_cat_name'+catCount).addClass('pageRequired').focus();$('#registration_cat_dob'+catCount).addClass('pageRequired');});}else{$('#cat-error-msg').html('You may only enter up to 5 cats.').show().fadeOut(4000);}}
function removeCat(){if(catCount>0){$('#reg-cat-'+catCount).hide('fast');$('#registration_cat_name'+catCount).removeClass('pageRequired').valid();$('#registration_cat_dob'+catCount).removeClass('pageRequired').valid();catCount--;}
if(catCount==0){$('#register-cat-info').hide();unBindCatSelects();}}
function bindDogSelects(){$('#registration_dog_dryfood, #registration_dog_wetfood, #registration_dog_treats, #registration_dog_purchase').addClass('pageRequired');$('#registration_dog_dryfood_select').change(function(){var $thisval=$('#registration_dog_dryfood_select option:selected').val();if($thisval=='other'){$('#registration_dog_dryfood').val('').show().focus();}else{$('#registration_dog_dryfood').blur().hide().val($thisval).valid();}});$('#registration_dog_wetfood_select').change(function(){var $thisval=$('#registration_dog_wetfood_select option:selected').val();if($thisval=='other'){$('#registration_dog_wetfood').val('').show().focus();}else{$('#registration_dog_wetfood').blur().hide().val($thisval).valid();}});$('#registration_dog_treats_select').change(function(){var $thisval=$('#registration_dog_treats_select option:selected').val();if($thisval=='Yes'){$('#registration_dog_treats').val('').show().focus();}else{$('#registration_dog_treats').blur().hide().val($thisval).valid();}});$('#registration_dog_purchase_select').change(function(){var $thisval=$('#registration_dog_purchase_select option:selected').val();if($thisval=='other'){$('#registration_dog_purchase').val('').show().focus();}else{$('#registration_dog_purchase').blur().hide().val($thisval).valid();}});}
function unBindCatSelects(){$('#registration_cat_dryfood, #registration_cat_wetfood, #registration_cat_treats, #registration_cat_purchase').removeClass('pageRequired').valid();}
function bindCatSelects(){$('#registration_cat_dryfood, #registration_cat_wetfood, #registration_cat_treats, #registration_cat_purchase').addClass('pageRequired');$('#registration_cat_dryfood_select').change(function(){var $thisval=$('#registration_cat_dryfood_select option:selected').val();if($thisval=='other'){$('#registration_cat_dryfood').val('').show().focus();}else{$('#registration_cat_dryfood').blur().hide().val($thisval).valid();}});$('#registration_cat_wetfood_select').change(function(){var $thisval=$('#registration_cat_wetfood_select option:selected').val();if($thisval=='other'){$('#registration_cat_wetfood').val('').show().focus();}else{$('#registration_cat_wetfood').blur().hide().val($thisval).valid();}});$('#registration_cat_treats_select').change(function(){var $thisval=$('#registration_cat_treats_select option:selected').val();if($thisval=='Yes'){$('#registration_cat_treats').val('').show().focus();}else{$('#registration_cat_treats').blur().hide().val($thisval).valid();}});$('#registration_cat_purchase_select').change(function(){var $thisval=$('#registration_cat_purchase_select option:selected').val();if($thisval=='other'){$('#registration_cat_purchase').val('').show().focus();}else{$('#registration_cat_purchase').blur().hide().val($thisval).valid();}});}
$('.reg-add-dog').click(function(){addDog();return false;});$('.reg-remove-dog').click(function(){removeDog();return false;});$('.reg-add-cat').click(function(){addCat();return false;});$('.reg-remove-cat').click(function(){removeCat();return false;});$('.date-picker-main').datepicker({onClose:function(){$(this).next().val($(this).val());},minDate:'-12M',maxDate:0,changeMonth:true,changeYear:true});$('.date-picker').datepicker({onClose:function(){$(this).next().val($(this).val());},minDate:'-10Y',maxDate:0,changeMonth:true,changeYear:true});$('#reg-step-1 .s225').sSelect({ddMaxHeight:'250px'});$('#registration_source_select').change(function(){var $thisval=$('#registration_source_select option:selected').val();if($thisval=='other'){$('#registration_source').val('').show().focus();}else{$('#registration_source').blur().hide().val($thisval).valid();}});$('#form-register-next').click(function(){if(v.form()){$('html,body').animate({scrollTop:formPosition.top},400,function(){$('#reg-step-1').hide();$('#reg-step-2').show();if(step2){$('#reg-step-2 .s225').sSelect({ddMaxHeight:'250px'});bindDogSelects();step2=false;}
current=1;});}else{$('html,body').animate({scrollTop:formPosition.top},400);}
return false;});$('#form-register-back').click(function(){$('#form-error-msg').html('').hide();$('html,body').animate({scrollTop:formPosition.top},400,function(){$('#reg-step-2').hide();$('#reg-step-1').show();});current=0;return false;});$.validator.addMethod("pageRequired",function(value,element){var $element=$(element)
function match(index){return current==index&&$(element).parents("#reg-step-"+(index+1)).length;}
if(match(0)||match(1)){return!this.optional(element);}
return"dependency-mismatch";},$.validator.messages.required);$.validator.addMethod("postalcode",function(value,element){return this.optional(element)||/^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ])\ {0,1}(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$/.test(value);},"Your Postal code must be in X1X 1X1 format.");$('input.shiftv').blur(function(){$(this).next().val($(this).val());});var v=$("#form-register").validate({submitHandler:function(form){pageTracker._trackEvent('Registration','Complete','completed the registration');$('input.shiftv').each(function(){$(this).next().val($(this).val());});$('#saving-img').css({top:($(document).scrollTop()+10)}).show();if(catCount==0){$('#register-cat-info, #reg-cat-collection').remove();}else{var rCatCount=(5-catCount);for(var i=0;i<rCatCount;i++){$('#reg-cat-'+(5-i)).remove();};}
var rDogCount=(5-dogCount);for(var i=0;i<rDogCount;i++){$('#reg-dog-'+(5-i)).remove();};form.submit();},errorLabelContainer:$('#form-error-msg'),messages:{'registration.first_name':"Please enter your first name.",'registration.last_name':"Please enter your last name.",'registration.email':"Please enter a valid email address.",'registration.ConfirmEmail':"Please verify the emails are the same.",'registration.password':{pageRequired:"Please provide a password.",minlength:jQuery.format("Passwords are required to be a minimum of {0} characters.")},'registration.ConfirmPassword':"The passwords you entered do not match.",'registration.phone1':"Please enter a valid area code.",'registration.phone2':"Please enter 3 digits in the second part of the phone number.",'registration.phone3':"Please enter 4 digits in the last part of the phone number.",'registration.address':"Please enter a valid street address (e.g. 123 Main Street)",'registration.city':"Please enter a valid city.",'registration.province':"Please select a province.",'registration.postal':"Please enter your postal code (e.g. A2B 3Y4)",'registration.source':"Please tell us how you heard about MyPuppy School.",'registration.dog_dryfood':"Please select which dry dog food you purchase most often.",'registration.dog_wetfood':"Please select which wet dog food you purchase most often.",'registration.dog_purchase':"Please select where you purchase your dog food most often.",'registration.dog_treats':"Please indicate if you use dog treats.",'registration.cat_dryfood':"Please select which dry cat food you purchase most often.",'registration.cat_wetfood':"Please select which wet cat food you purchase most often.",'registration.cat_purchase':"Please select where you purchase your cat food most often.",'registration.cat_treats':"Please indicate if you use cat treats."}});$('.button-cancel').click(function(){$('input').val('');$('#form-error-msg').html('').hide();return false;});}
if(lessonName!=''&&$('#quiz-ui').length>0&&$('#video').length>0&&$('#checklist').length>0&&$('#training-log').length>0){var LoggedInSection=$('#logged-in-state');var quizReady=false;var checklistReady=false;videoInt=function(){if(registered){swfobject.getObjectById("flash-video").sendTextToFlash('http://purinacanada.cachefly.net/puppy_training/'+lessonName+'-registered-desktop.f4v');pageTracker._trackEvent('Lesson','Video','registered video watched');setVideoStatus(lessonName);}else{pageTracker._trackEvent('Lesson','Video','unregistered video watched');swfobject.getObjectById("flash-video").sendTextToFlash('http://purinacanada.cachefly.net/puppy_training/'+lessonName+'-unregistered-desktop.f4v');}};function setVideoStatus(lessonName){var getUrl="/Lessons/"+lessonName+"/SetVideoStatus";$.ajax({url:getUrl,type:"GET",dataType:'json',contentType:"application/json; charset=utf-8",error:function(){$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');},success:function(data){if(data.Status==200){$('#video-status').html('True');checkActivityTasks();}else if(data.Status==401){$('#error-dialog p').hide();$('#error-dialog p:first').show();$('#error-dialog').dialog('open');}else{$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');}}});};function getQuizQuestion(lessonName,n,callback){var sourc="/Lessons/"+lessonName+"/GetQuestion/"+n;$.getJSON(sourc,null,function(data){$('.question-q'+n+' p.quiz-text').html(n+'. '+data.Question);$('.result-q'+n+' p.result-description').html(data.Answers[0].AnswerDesc);var html="";for(var i=0;i<data.Answers.length;i++){if(data.Answers[i].IsAnswer){html+='<li> <button class="radio-off is-answer';if(i==0){html+=' radio-on';}
html+='"><span class="hide">'+(i+1)+'</span></button>'+data.Answers[i].Text+'</li>';}else{html+='<li> <button class="radio-off';if(i==0){html+=' radio-on';}
html+='"><span class="hide">'+(i+1)+'</span></button>'+data.Answers[i].Text+'</li>';}}
$('.question-q'+n+' ul.quiz-answers').html(html);if(typeof callback=='function'){callback();}});};function getCheckList(lessonName,callback){var source="/Lessons/"+lessonName+"/CheckList";$.getJSON(source,null,function(data){for(var i=0;i<data.List.length;i++){var listItem=data.List[i].IsChecked?'<li class="checked "><div class="id hide">'+data.List[i].Id+'</div>'+data.List[i].Text+"</li>":'<li><div class="id hide">'+data.List[i].Id+'</div>'+data.List[i].Text+"</li>";$("#checklist-items").append(listItem);}
$("#checklist ul li").prepend('<span class="bone-off"></span>').click(function(){var $this=$(this);var id=$this.find('div.id').html();var checked=true;if($this.hasClass('strike-through')){checked=false;}
var CheckItem={'Text':null,'IsChecked':checked,'Id':id};var encoded=$.toJSON(CheckItem);var postUrl="/Lessons/"+lessonName+"/UpdateCheckItem/";$.ajax({url:postUrl,type:"POST",data:encoded,dataType:'json',contentType:"application/json; charset=utf-8",error:function(){$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');},success:function(data){if(data.Status==200){$this.toggleClass("strike-through");$this.find('span').toggleClass("bone-on");checkActivityTasks();pageTracker._trackEvent('Lesson','Checklist','clicked todo');}else if(data.Status==401){$('#error-dialog p').hide();$('#error-dialog p:first').show();$('#error-dialog').dialog('open');}else{$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');}}});});$("#checklist ul li.checked").addClass('strike-through').find('span.bone-off').addClass('bone-on');$("#checklist-items").fadeIn('slow');if(typeof callback=='function'){callback();}});};function limitChars(textid,limit,infodiv){var text=textid.val();var textlength=text.length;if(textlength>limit){infodiv.html('You reached the max '+limit+' characters!');textid.val(text.substr(0,limit));return false;}else{infodiv.html('You have '+(limit-textlength)+' characters left.');return true;}};function checkActivityTasks(){if(quizReady&&checklistReady){var activityVideo=0;var activityQuiz=0;var activityCheckListTotal=$('#checklist-items li').length;var activityCheckListCount=$('#checklist-items li.strike-through').length;if($('#video-status').html()=='True'){activityVideo=1;}
if(parseInt($('#previous-score').html())>1){activityQuiz=1;}
var activityProgress=activityVideo+activityCheckListCount+activityQuiz;var activityTotal=2+activityCheckListTotal;var activityPrev=parseInt($('.activity-complete').html());$('.activity-complete').html(activityProgress);$('.activity-total').html(activityTotal);$('.lesson-check').show();if(activityTotal==activityProgress&&activityPrev!=0){var postUrl="/Lessons/"+lessonName+"/Complete/LessonStatus/true";$.ajax({url:postUrl,type:"GET",dataType:'json',contentType:"application/json; charset=utf-8",error:function(){$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');},success:function(data){if(data.Status==200){var compNum=parseInt($('.completion').html())+10;$('.star').addClass('star-on');$('.completion').html(compNum);$('#overall-progress .progress-bar').animate({width:compNum+'%'},{queue:false,duration:200});pageTracker._trackEvent('Lesson','Sheet','lesson completed');}else if(data.Status==401){$('#error-dialog p').hide();$('#error-dialog p:first').show();$('#error-dialog').dialog('open');}else{$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');}}});}else if(activityPrev==activityTotal){var postUrl="/Lessons/"+lessonName+"/Complete/LessonStatus/false";$.ajax({url:postUrl,type:"GET",dataType:'json',contentType:"application/json; charset=utf-8",error:function(){$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');},success:function(data){if(data.Status==200){var compNum=parseInt($('.completion').html())-10;$('.star').removeClass('star-on');$('.completion').html(compNum);$('#overall-progress .progress-bar').animate({width:compNum+'%'},{queue:false,duration:100});}else if(data.Status==401){$('#error-dialog p').hide();$('#error-dialog p:first').show();$('#error-dialog').dialog('open');}else{$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');}}});}}}
$('#error-dialog').dialog({title:false,bgiframe:true,height:180,width:367,modal:true,resizable:false,autoOpen:false,zIndex:2000});$('#logged-in-disabled').css({'height':(LoggedInSection.outerHeight()+20)+'px'});$('#video').cycle().click(function(){$(this).fadeOut('fast',function(){$('#video').unbind().html('<div id="flash-video"></div>').show();swfobject.embedSWF("/Content/swf/video-player.swf","flash-video","400","260","9.0.115","/Content/swf/expressInstall.swf",null,{'menu':"false",'quality':"best",'bgcolor':"#ffffff",'wmode':'transparent','allowFullScreen':'true','allowScriptAccess':'always'},null);});});$(".help-tip").tooltip({delay:0,fade:250,showURL:false,opacity:1,fixPNG:true,top:-106,left:-25});if($('#lessons-completion').length==1){registered=true;pageTracker._trackEvent('Registration','Login','logged in user viewed lesson');$("#ajax-loader").ajaxStart(function(){$(this).css({'height':($('#logged-in-state').outerHeight()+20)+'px'}).show();$('#saving-img').css({top:($(document).scrollTop()+10)}).show();});$("#ajax-loader").ajaxStop(function(){if($.browser.msie){$(this).hide();}else{$(this).fadeOut('fast');}
$('#saving-img').hide();});getQuizQuestion(lessonName,1,function(){getQuizQuestion(lessonName,2,function(){getQuizQuestion(lessonName,3,function(){var preScore=$('#previous-score').html();var sIndex=7;if(preScore=='-1'){sIndex=0;}
$('#quiz div.loader').hide();$('#quiz-ui').divSlider({'width':186,'height':304,'background':'none','startSlide':sIndex},function(){var quizScore=0;$('.question-q1 button.button-go').click(function(){$('.result-q1 p.true').hide();$('.result-q1 p.false').hide();if($('.question-q1 button.radio-on').hasClass('is-answer')){$('.result-q1 p.true').show();quizScore=quizScore+1;pageTracker._trackEvent('Lesson','Quiz','right answer');}else{$('.result-q1 p.false').show();pageTracker._trackEvent('Lesson','Quiz','wrong answer');}});$('.question-q2 button.button-go').click(function(){$('.result-q2 p.false').hide();$('.result-q2 p.true').hide();if($('.question-q2 button.radio-on').hasClass('is-answer')){$('.result-q2 .true').show();quizScore=quizScore+1;pageTracker._trackEvent('Lesson','Quiz','right answer');}else{$('.result-q2 p.false').show();pageTracker._trackEvent('Lesson','Quiz','wrong answer');}});$('.question-q3 button.button-go').click(function(){$('.result-q3 p.false').hide();$('.result-q3 p.true').hide();if($('.question-q3 button.radio-on').hasClass('is-answer')){$('.result-q3 p.true').show();quizScore=quizScore+1;pageTracker._trackEvent('Lesson','Quiz','right answer');}else{$('.result-q3 p.false').show();pageTracker._trackEvent('Lesson','Quiz','wrong answer');}});$('.result-q3 button.button-next').click(function(){$('.score-0, .score-1, .score-2, .score-3').hide();$('.score-'+quizScore).show();var postUrl="/Lessons/"+lessonName+'/SaveQuizResult/';var encoded=$.toJSON({'score':quizScore});$.ajax({url:postUrl,type:"POST",data:encoded,dataType:'json',contentType:"application/json; charset=utf-8",error:function(){$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');},success:function(data){if(data.Status==200){$('#previous-score').html(quizScore);checkActivityTasks();pageTracker._trackEvent('Lesson','Quiz','quiz completed');}else if(data.Status==401){$('#error-dialog p').hide();$('#error-dialog p:first').show();$('#error-dialog').dialog('open');}else{$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');}}});});$('button.button-retake').click(function(){quizScore=0;});$('ul.quiz-answers li').click(function(){$(this).parent().find('button.radio-off').removeClass("radio-on");$(this).find('button.radio-off').addClass("radio-on");});if(preScore!='-1'){$('.score-0, .score-1, .score-2, .score-3').hide();$('.score-'+preScore).show();}});quizReady=true;checkActivityTasks();});});});getCheckList(lessonName,function(){$('#checklist div.loader').hide();checklistReady=true;checkActivityTasks();});function removeLogItem($e){var $el=$($e).parent();var rID=$el.attr('title');var postUrl="/Lessons/"+lessonName+"/DeleteLog/"+rID;$.ajax({url:postUrl,type:"GET",dataType:'json',contentType:"application/json; charset=utf-8",error:function(){$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');},success:function(data){if(data.Status==200){$el.fadeOut('slow',function(){$el.remove();});}else if(data.Status==401){$('#error-dialog p').hide();$('#error-dialog p:first').show();$('#error-dialog').dialog('open');}else{$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');}}});}
$("#log-desc-task").keyup(function(){limitChars($(this),100,$('#log-count'));});$("#training-log ul li span.log-duration").click(function(){removeLogItem($(this));});$('#open-log-ui').click(function(){$('#training-log-ui').slideDown('slow');return false;});$('#close-log-ui').click(function(){$('#training-log-ui').fadeOut('slow');return false;});$('#slider-attempts').slider({value:1,min:1,max:10,step:1,slide:function(event,ui){$("#log-attempts-output").html(ui.value+" Correct");$("#log-attempts-output-val").val(ui.value);}});$('#slider-duration').slider({value:1,min:1,max:60,step:1,slide:function(event,ui){$("#log-duration-output").html(ui.value+" Min");$("#log-duration-output-val").val(ui.value);}});$("#log-desc-task").focus(function(){if($(this).val()=='How did your puppy do?'){$(this).val('');}});$("#log-desc-task").blur(function(){if($(this).val()==''){$(this).val('How did your puppy do?');}});$('#submit-log-ui').click(function(){var logText=$("#log-desc-task").val();if(logText==' '){logText=' ';}
var logItem={'log_duration':$("#log-duration-output-val").val(),'log_attempts':$("#log-attempts-output-val").val(),'log_text':logText};var encoded=$.toJSON(logItem);var postUrl="/Lessons/"+lessonName+"/SaveLog/";$.ajax({url:postUrl,type:"POST",data:encoded,dataType:'json',contentType:"application/json; charset=utf-8",error:function(){$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');},success:function(data){if(data.Status==200){var html='<li title="'+data.Value+'"><span class="log-duration"><strong>'+
$("#log-duration-output-val").val()+' mins</strong></span><p>'+
logText+'</p> <span class="log-attempts">'+
$("#log-attempts-output-val").val()+'</span></li>';$('#training-log ul').append(html);$('.log-duration:last').click(function(){removeLogItem($(this));});$('#training-log-ui').fadeOut('slow',function(){$("#log-desc-task").val('How did your puppy do?');$('#slider-attempts').slider('value',1);$('#slider-duration').slider('value',1);$("#log-duration-output").html("1 Min");$("#log-attempts-output").html("1 Correct");$('#log-count').html(' ');});pageTracker._trackEvent('Lesson','Log','added item in log');}else if(data.Status==401){$('#error-dialog p').hide();$('#error-dialog p:first').show();$('#error-dialog').dialog('open');}else{$('#error-dialog p').hide();$('#error-dialog p:last').show();$('#error-dialog').dialog('open');}}});return false;});}else{getCheckList(lessonName,function(){$('#checklist div.loader').hide();});getQuizQuestion(lessonName,1,function(){$('#quiz div.loader').hide();$('#quiz-ui').divSlider({'width':186,'height':304,'background':'none'});});}}
if($.browser.msie&&$.browser.version==6){$('body').prepend('<div style="border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative; z-index:1100;"><div style="position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;"><a href="#"><img src="http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg" style="border: none;" alt="Close this notice"></a></div><div style="width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;"><div style="width: 75px; float: left;"><img src="http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg" alt="Warning!"></div><div style="width: 275px; float: left; font-family: Arial, sans-serif;"><div style="font-size: 14px; font-weight: bold; margin-top: 12px;">Time to fetch a new browser</div><div style="font-size: 12px; margin-top: 6px; line-height: 12px;">Your browser is out of date. Upgrade that puppy for a much better browsing experince!</div></div><div style="width: 75px; float: left;"><a href="http://www.firefox.com" target="_blank"><img src="http://www.ie6nomore.com/files/theme/ie6nomore-firefox.jpg" style="border: none;" alt="Get Firefox 3.5"></a></div><div style="width: 73px; float: left;"><a href="http://www.apple.com/safari/download/" target="_blank"><img src="http://www.ie6nomore.com/files/theme/ie6nomore-safari.jpg" style="border: none;" alt="Get Safari 4"></a></div><div style="width: 73px; float: left;"><a href="http://www.google.com/chrome" target="_blank"><img src="http://www.ie6nomore.com/files/theme/ie6nomore-chrome.jpg" style="border: none;" alt="Get Google Chrome"></a></div><div style="float: left;"><a href="http://www.mozilla.com/en-US/firefox/ie.html#feature-vsie" target="_blank"><img src="http://www.ie6nomore.com/files/theme/ie6nomore-ie8.jpg" style="border: none;" alt="Get IE8"></a></div></div></div>');$('a:first').click(function(){$('div:first').hide();return false;});}
if(!$.browser.msie){$(window).puppies(function(){$('body').append('<div id="gofetch" style="height:165px; width:565px; position:absolute; z-index:11000; top:0px; right:0px;"><div id="gofetch-flash"></div></div>');swfobject.embedSWF("/Content/swf/fetch.swf","gofetch-flash","565","165","9.0.115",null,null,{'menu':"false",'quality':"best",'bgcolor':"#ffffff",'wmode':'transparent'},null);setTimeout(function(){window.resizeBy(-30,0);setTimeout(function(){window.resizeBy(-20,0);setTimeout(function(){window.resizeBy(-10,0);setTimeout(function(){window.resizeBy(-10,0);setTimeout(function(){$('#gofetch').remove();},8000);},500);},500);},500);},4700);},"38,38,71,79,70,69,84,67,72");}});}