function EduPodClass( sNewQuestion, sNewFlash ){
  this.sQuestion = sNewQuestion;
  this.sFlash = sNewFlash;
  
  this.getQuestion = function(){ return this.sQuestion; }
  this.getFlash = function(){ return this.sFlash; }
}
EduPodClass.prototype.getListEntry = function( iIndex, sObjName ){
  var sOut = "<tr>";
  var sClassName = "EduPodList-font ";
  var sLinkClassName = ( iIndex == 0? "EduPodList-link-active ": "EduPodList-link-inactive " );
  var sArrowClassName = "EduPodList-arrow "; 
  var sOnclick = sObjName + ".updateContent( " + iIndex + ", true )";
  sClassName += ( iIndex%2 == 0? "EduPodList-odd-row ": "" );
  sClassName += ( iIndex == 0? "EduPodList-link-active ": "EduPodList-link-inactive " );
  sArrowClassName += ( iIndex%2 == 0? "EduPodList-arrow-gray-bg ": "EduPodList-arrow-white-bg " );
  sOut += "<td class='" + sArrowClassName + sClassName + "'><div class='" + sClassName + "' style='color: #000099;'>" + ( iIndex + 1 ) + ".</div></td>";
  sOut += "<td class='" + sClassName + "'><a href='javascript:" + sOnclick + ";' class='" + sLinkClassName + "'>" + this.getQuestion() + "</a></td>";
  sOut += "</tr>";
  return sOut;
}
function DisplayEduPods( sNewObjName, saNewEduPods, sNewListAreaID, sNewFlashAreaID, sNewQuestionAreaID, sNewTopicListHeader ){
  this.sObjName = sNewObjName;
  this.saEduPods = saNewEduPods;
  this.sListAreaID = sNewListAreaID;
  this.sFlashDisplayAreaID = sNewFlashAreaID;
  this.sQuestionDisplayAreaID = sNewQuestionAreaID;
  this.sTopicListHeader = sNewTopicListHeader;
  
  this.iCols = 2;

  this.getTopicListHeader = function(){
    var sOut = "";
    if ( this.sTopicListHeader += "" ){
      sOut = "<div style='padding: 11px 0px 5px 2px; color: #2e74ff; font-size: 14px; font-weight: bold;'>" + this.sTopicListHeader + "</div>";
    }
    return sOut;
  }  
  this.getCellContent = function( iIn ){
    var sOut = "<td>";
    var sOnClick = this.sObjName + ".updateContent( " + iIn + ", true );' "
    sOut += "<a href='JavaScript:" + sOnClick + ">" + this.saEduPods[ iIn ].getQuestion() + "</a>";
    sOut += "</td>";
    return sOut;
  }
  this.getListContent = function(){
    var nl = "\n"
    var sOut = this.getTopicListHeader() + 
               "<table cellpadding=0 cellspacing=0 border=0 style='width: 322px;' id='" + this.sListAreaID + "'>"
    for ( var i = 0; i < this.saEduPods.length; i++ ){
      sOut += this.saEduPods[ i ].getListEntry( i, this.sObjName );
    }
    sOut += "</table>";
    return sOut;
  }
  this.createQuestionList = function(){
    document.write( this.getListContent() );
  }
  this.getQuestionDisplayAreaObj = function(){ return document.getElementById( this.sQuestionDisplayAreaID ); }
  this.getQuestionContent = function( i ){ return ( i + 1 ) + ". " + this.saEduPods[ i ].getQuestion(); }
  this.updateQuestionDisplayAreaContent = function( i ){ 
    this.getQuestionDisplayAreaObj( i ).innerHTML = this.getQuestionContent( i ); 
  }
  
  this.updateFlashConent = function( i ){
    var sMovie = this.saEduPods[ i ].getFlash();
    if ( document.embeds && document.embeds[ this.sFlashDisplayAreaID ] && document.embeds[ this.sFlashDisplayAreaID ].LoadMovie ){
      document.embeds[ this.sFlashDisplayAreaID ].src = sMovie;
      document.embeds[ this.sFlashDisplayAreaID ].LoadMovie( sMovie );
    } else if ( document.getElementById ) {
      var oObj = document.getElementById( this.sFlashDisplayAreaID );
      if ( oObj.Movie ){
        oObj.Movie = sMovie;
      }
    }  
  }
  this.getListTable = function(){ return document.getElementById( this.sListAreaID ); }
  this.updateRow = function( oRow, bCurrent ){
    var oaCells = oRow.getElementsByTagName( "td" );
    var oaLinks = null;
    for ( var i = 1; i < oaCells.length; i++ ){
      oaLinks = oaCells[ i ].getElementsByTagName( "a" );
      if ( bCurrent ){
        oaCells[ i ].className =oaCells[ i ].className.replace( /EduPodList-link-inactive/gi, "EduPodList-link-active" );
        for ( var j = 0; j < oaLinks.length; j++ ){
          oaLinks[ j ].className = oaLinks[ j ].className.replace( /EduPodList-link-inactive/gi, "EduPodList-link-active" );
        }
      } else {
        oaCells[ i ].className = oaCells[ i ].className.replace( /EduPodList-link-active/gi, "EduPodList-link-inactive" )
        for ( var j = 0; j < oaLinks.length; j++ ){
          oaLinks[ j ].className = oaLinks[ j ].className.replace( /EduPodList-link-active/gi, "EduPodList-link-inactive" )
        }
      }
    }
  }
  this.ListOnclick = function( iItem ){
    var oTable = this.getListTable();
    var oaRows = oTable.getElementsByTagName( "tr" );
    var bCurRow = false;
    for ( var i = 0; i < oaRows.length; i++ ){
      bCurRow = i == iItem;
      this.updateRow( oaRows[ i ], bCurRow )
    }
  }
  this.updateContent = function( i, bUpdateFlash ){
    this.ListOnclick( i )
    if ( bUpdateFlash ){
      try{
        this.updateFlashConent( i );
      } catch( e ){}
    }
    this.updateQuestionDisplayAreaContent( i );
  }
}
DisplayEduPods.prototype.makeExpandedContent = function( iNewVideoListLength ){
  this.iVideoListLength = iNewVideoListLength;
  
  
  this.getListContent = function(){
    var nl = "\n"
    var sOut = "<div style='margin: 0px 13px 0px 13px;'>" + 
               this.getTopicListHeader() + 
               "<table cellpadding=0 cellspacing=0 border=0 style='width: 171px;' id='" + this.sListAreaID + "'>"
    for ( var i = 0; i < this.iVideoListLength; i++ ){
      sOut += this.saEduPods[ i ].getListEntry( i, this.sObjName );
    }
    sOut += "</table>";
    sOut += "<a href='/llc-guide/limited-liability-company-education.html' class='EduPodMore'>See more video</a>"
    sOut += "</div>";
    return sOut;
  }
  this.getTopicListHeader = function(){
    var sOut = "";
    if ( this.sTopicListHeader += "" ){
      sOut = "<div style='padding: 3px 0px 3px 2px; color: #000066; font-size: 14px; font-weight: bold;'>" + this.sTopicListHeader + "</div>";
    }
    return sOut;
  }  
  this.updateQuestionDisplayAreaContent = function( i ){ }
  this.init = function(){
    for ( var i = 0; i < this.saEduPods.length; i++ ){
      this.saEduPods[ i ].makeExpandedContent();
    }
  }
  this.init();
}
EduPodClass.prototype.makeExpandedContent = function(){
  
  EduPodClass.prototype.getListEntry = function( iIndex, sObjName ){
    var sOut = "<tr>";
    var sClassName = "EduPodList-font EduPodList-font-expanded ";
    var sLinkClassName = ( iIndex == 0? "EduPodList-link-active ": "EduPodList-link-inactive " );
    var sArrowClassName = " EduPodList-arrow-gray-bg EduPodList-arrow-expanded "; 
    var sOnclick = sObjName + ".updateContent( " + iIndex + ", true )";
    sClassName += ( iIndex == 0? "EduPodList-link-active ": "EduPodList-link-inactive " );
    sOut += "<td class='" + sArrowClassName + sClassName + "'><div class='" + sClassName + "' style='color: #000099;'>" + ( iIndex + 1 ) + ".</div></td>";
    sOut += "<td class='" + sClassName + "'><a href='javascript:" + sOnclick + ";' class='" + sLinkClassName + "'>" + this.getQuestion() + "</a></td>";
    sOut += "</tr>";
    return sOut;
  }
}

/* --------------------------------------- list class start ------------------------- */
function EduPodListClass( sNewObjName, sNewHeaderLeadin, sNewHeaderDetail, sNewTopBlurb, saNewItems, iNewItemLength, saNewSeeMore ){
  this.sObjName = sNewObjName;
  this.sHeaderLeadin = sNewHeaderLeadin;
  this.sHeaderDetail = sNewHeaderDetail;
  this.sTopBlurb = sNewTopBlurb;
  this.saItems = saNewItems;
  this.iItemsLength = iNewItemLength;
  this.saSeeMore = saNewSeeMore;

  this.bListItemUsePopup = false;
    
  this.getHeaderLeadin = function(){
    return this.sHeaderLeadin == ""? "": "<span class='EduPod-subheader EduPod-subheader-lead-in'>" + this.sHeaderLeadin + " </span>";
  }
  this.getHeaderDetail = function(){
    return this.sHeaderDetail == ""? "": "<span class='EduPod-subheader EduPod-subheader-description'>" + this.sHeaderDetail + "</span>"
  }
  this.getHeading = function(){ 
    var sOut = "<table cellpadding=0 cellspacing=0 border=0><tr>";
    sOut += "<td nowrap style='padding-right: 4px;'>" + this.getHeaderLeadin() + "</td>";
    sOut += "<td nowrap>" + this.getHeaderDetail() + "</td>";
    sOut += "</tr></table>";
    return  sOut;
  }
  this.getTopBlurb = function(){ 
    var sOut = "<div class='BodyInText_Default'>" + this.sTopBlurb + "</div>";
    return this.sTopBlurb == ""? "": sOut;
  }
  this.getListID = function(){ return this.sObjName + "_list"; }
  this.getListLink = function( iIndex ){
    var sOut = "<a href='" + this.saItems[ iIndex ][ 0 ] + "'>" + this.saItems[ iIndex ][ 1 ] + "</a>";
    if ( this.bListItemUsePopup ){
      sOut = "<a href='javascript:showFAQ( \"" + this.saItems[ iIndex ][ 0 ] + "\" );'>" + this.saItems[ iIndex ][ 1 ] + "</a>"
    }
    return sOut;
  }
  this.getList = function( iLength ){
    var sOut = "<div id='" + this.getListID() + "'>";
    sOut += "<table cellpadding=0 cellspacing=0 border=0>";
    for ( var i = 0; i < iLength; i++ ){
      sOut += "<tr style='padding: 3px 0px 0px 0px;'>" + 
              "<td style='vertical-align: top;'><img src='/img/iconOrangeArrow4.gif' style='margin: 5px 5px 0px 0px;'></td>" +
              //"<td><a href='" + this.saItems[ i ][ 0 ] + "'>" + this.saItems[ i ][ 1 ] + "</a></td>" +
              //"<td><a href='javascript:showFAQ( \"" + this.saItems[ i ][ 0 ] + "\" );'>" + this.saItems[ i ][ 1 ] + "</a></td>" +
              "<td>" + this.getListLink( i ) + "</td>" +
              "</tr>";
    }
    sOut += "</table>";
    sOut += "</div>";
    return sOut;
  }
  this.getSeeMoreContentID = function(){ return this.sObjName + "_seeMore"; }
  this.getSeeMoreObj = function(){ return document.getElementById( this.getSeeMoreContentID() ); }
  this.getSeeMore = function( bExpanded ){
    var sLink = "javascript: " + this.sObjName + ".showMore();";
    var sPrompt = bExpanded? this.saSeeMore[ 1 ]: this.saSeeMore[ 0 ];
    var sOut = "<div style='text-align: right' id='" + this.getSeeMoreContentID() + "'>";
    sOut += "<a href='" + sLink + "' class='EduPodMore' style='padding: 5px 10px 0px 0px;'>" + sPrompt + "</a>";
    sOut += "</div>";
    return sOut;
  }
  this.getListObj = function(){ return document.getElementById( this.getListID() ); }
  this.bListExpanded = function(){
    var sList = this.getListObj().innerHTML;
    var re = new RegExp( this.saItems[ this.saItems.length - 1  ][ 0 ], "gi" );
    return sList.match( re )? true: false;
  }
  this.showMore = function(){
    var oTarget = this.getListObj();
    var bExpanded = this.bListExpanded();
    var iLength = bExpanded? this.iItemsLength: this.saItems.length;
    var sContent = this.getList( iLength );
    var sSeeMoreContent = this.getSeeMore( !bExpanded );
    this.getSeeMoreObj().innerHTML = sSeeMoreContent
    oTarget.innerHTML = sContent;
  }
  this.getContent = function(){
    var sOut = this.getHeading();
    var sTopBlurb = this.getTopBlurb();
    sOut += sTopBlurb;
    sOut += this.getList( this.iItemsLength );
    sOut += this.getSeeMore( false );
    return sOut;
  }
  this.create = function(){ document.write( this.getContent() ); }
}

