/*
 * Upstate Tax.com
 * Copyright(c) 2005-2008, Scott Patterson.
 * 
 * 
 */


Ext.onReady(function(){Ext.QuickTips.init();var wizard=new UpstateTax.Wizard({renderTo:'wizard',debug:false,submitHtml:true,ajaxParams:{area:'taxschool',action:'addstudent'},headerConfig:{title:'Tax School<br>Registration',height:70},cardPanelConfig:{defaults:{border:false,monitorValid:true}},cards:[new UpstateTax.Wizard.Cards.Contact(),new UpstateTax.Wizard.Cards.tsAdditional(),new UpstateTax.Wizard.Cards.tsClass(),new UpstateTax.Wizard.Cards.tsOptional(),new UpstateTax.Wizard.Cards.tsLegal(),new UpstateTax.Wizard.Cards.Verify(),new UpstateTax.Wizard.Cards.Payment()],listeners:{finish:function(){cards=this.cards;for(var i=0,len=cards.length;i<len;i++){if(cards[i].id=='paymentCard'){this.on('finishSuccess',function(x,response){cards[i].setInvoice(response['invoice']);},this);break;}}}},onPreviousClick:function()
{if(this.currentCard==4&&this.cards[2].getCourse()=="13"){this.cardPanel.getLayout().setActiveItem(this.currentCard-2);}else UpstateTax.Wizard.superclass.onPreviousClick.call(this);},onNextClick:function(){if(this.currentCard==2&&this.cards[2].getCourse()=="13"){this.cardPanel.getLayout().setActiveItem(this.currentCard+2);}else UpstateTax.Wizard.superclass.onNextClick.call(this);},getWizardSummary:function(){var formValues=[];var cards=this.cards;for(var i=0,len=cards.length;i<len;i++){if(!(this.cards[2].getCourse()=="13"&&i==3)&&cards[i].form){var values=cards[i].getSummaryValues();if(values.values!==undefined)formValues.push(values);}}
return formValues;},getCourseId:function(){return this.cards[2].getCourse();},onCardShow:function(card)
{var parent=card.ownerCt;var items=parent.items;for(var i=0,len=items.length;i<len;i++){if(items.get(i).id==card.id){break;}}
this.currentCard=i;this.headPanel.updateStep(i,card.title);if(i==len-1){this.nextButton.hide();}else{this.nextButton.setText(this.nextButtonText);this.nextButton.show();this.previousButton.show();}
if(card.isValid()){this.nextButton.setDisabled(false);}
if(i==0){this.previousButton.setDisabled(true);}else{this.previousButton.setDisabled(false);}
if(this.loadButton.pressed&&items.get(i).loadTestData)items.get(i).loadTestData();}});});
