$(".horizScroll .control a").click(function(){if(!$(".scrollContent").is(":animated")){if($(this).parent().hasClass("right")){if($(".scrollContent").css("left")!="-3810px"){$(".scrollContent").animate({left:"-=635px"})}else{$(".scrollContent").animate({left:"0px"})}}else{if($(".scrollContent").css("left")!="0px"){$(".scrollContent").animate({left:"+=635px"})}else{$(".scrollContent").animate({left:"-3810px"})}}}});$(".horizScroll .thumb_animation").click(function(){$(".horizScroll .thumb_animation.selected").removeClass("selected");$(this).addClass("selected")});$(".horizScroll .thumb_animation").hover(function(){$(this).append("<span class='waiting'>loading...</span>");$(this).children("img").bind("load",function(){$(this).siblings(".waiting").remove()})},function(){$(this).children("img").unbind("load");$(this).children(".waiting").remove()});$("dl.screenTwo").hide();var downloadID="";var aniName,aniSrc;var gigyaPost="";function viewAnimation(){window.open("../avatar/?d="+downloadID)}function scrollToTop(){$.scrollTo(0)}function createAnimation(){var selAni=$(".horizScroll .thumb_animation.selected img");var aniid=selAni.attr("alt");aniName=selAni.next(".name").text();aniSrc=selAni.attr("src");$(".subAniInfo").html("");$(".subAniInfo").hide();var er="";if(aniid==null||aniid==undefined){er+="Step 1: Please select an animation <br />"}if(er!=""){$(".subAniInfo").fadeIn(100);$(".subAniInfo").html(er);return}var uaid=$(".currAv").val();var cmt=$("#txtComments").val();var isshr=$("#chkUse").is(":checked");$(".displayaction").hide();$(".displayLoading").show();serviceCommerceProxy.invoke("CreateAnimatedAvatar",{userAvatarID:uaid,animationID:aniid,comments:cmt,isShared:isshr},createAnimationResult,createAnimationFailed)}function createAnimationFailed(result){$(".displayaction").show();$(".displayLoading").hide();showError("Animation Failed")}function createAnimationResult(result){downloadID=result;if(gigyaPost==""){gigyaPost=$(".txWF").val()}var msg=gigyaPost;msg=msg.replace("DLID1",downloadID);msg=msg.replace("DLID2",downloadID);$(".txWF").val(msg);$(".screenTwo .aniName").text(aniName);$(".screenTwo .description span.text").text($("#txtComments").val());scrollToTop();$("dl.screenOne, .displayLoading").fadeOut("fast");$("dl.screenTwo, .displayaction").fadeIn("slow");animationStatus()}function sendEmail(){var emailFrom=$("#txtFrom").val();var emailTos=$("#txtTo").val();serviceCommerceProxy.invoke("ShareAvatar",{downloadID:downloadID,emailFrom:emailFrom,emailTos:emailTos},sendEmailResult,sendEmailFailed)}function sendEmailResult(result){$(".subInfo").fadeIn(100);if(result!=""){$(".subInfo").html(result)}else{$(".subInfo").html("Thank you, your email has been sent.");serviceCommerceProxy.invoke("ShareAvatarEvent",{downloadID:downloadID,shareType:"Email"},null,null)}setTimeout(function(){$(".subInfo").html("");$(".subInfo").hide()},5000)}function sendEmailFailed(){$(".subInfo").fadeIn(100);$(".subInfo").html("Email Failed.  Please try again.");setTimeout(function(){$(".subInfo").html("");$(".subInfo").hide()},5000)}function animationStatus(){if(downloadID!=""){serviceCommerceProxy.invoke("GetProductStatus",{downloadID:downloadID},animationStatusResult,null)}}function animationStatusResult(result){$("#aniStatusComplete").fadeOut("fast");$("#aniStatusProgress").fadeOut("fast");$("#aniStatusFailed").fadeOut("fast");$("#aniStatus"+result.split("|")[0]).fadeIn("slow");if(result.split("|")[0]=="Progress"){setTimeout("animationStatus();",10000)}else{$(".aniStatus").fadeOut("fast");$(".aniResult").show();$("#aniResultImg").attr("src",result.split("|")[1]).fadeIn("slow")}}$(".aniChange").click(function(){downloadID="";$("dl.screenOne").show();$("dl.screenTwo").hide();$(".aniResult").hide();$(".aniResultImg").hide();$(".aniStatus").show()});