// JavaScript Document
var currElementIndex = 1;
var prevElementIndex = 6;
function moduledescriptions() {

  if (document.getElementById("text"+currElementIndex) && document.getElementById("text"+(7-currElementIndex)))
    {

      document.getElementById("text"+prevElementIndex).className='indexpage';
      document.getElementById("text"+currElementIndex).className='indexpagebold';
    if(document.getElementById("text"+currElementIndex)== 5){
    document.getElementById("text5").className='indexpage';
      document.getElementById("text5").className='indexpagebold';
    }
      prevElementIndex = currElementIndex;
    }

  //  setInterval('',750);
  //if (document.getElementById("text"+i)) document.getElementById("text"+i).className='indexpage';
   if(currElementIndex % 7 == 0) {
    if (document.getElementById("text6"))  {
      document.getElementById("text6").className='indexpage';
      return false;
      currElementIndex = 1;
    }

   } else {
     currElementIndex = currElementIndex +1;
   }

}


function rotatemoduledescriptions() {
  setInterval('moduledescriptions()',3500);
}

function testimonial() {
  if (document.getElementById("testimonial"))	{
  document.getElementById("testimonial").innerHTML = TESIMONIALS[t];
  }
  if (t<TESIMONIALS.length-1) {
    t = t + 1;
  } else {
    t = 0;
  };
};



function rotatetestimonial(){
  setInterval('testimonial()', 4000);
};

// steps variables
var StepNo = 0;

function StepChange(direction) {
  var NextStep = StepNo;
  if (direction == 'next' && StepNo < 3) {
    NextStep++;
  } else if (direction == 'prev' && StepNo > 0) {
    NextStep--;
  }
  if (NextStep != StepNo) {
    var htmlPrev = document.getElementById("step_prev");
    var htmlText = document.getElementById("step_text");
    var htmlNext = document.getElementById("step_next");
    var textPrev = '';
    var textNext = '';
    for (i = 1; i < NextStep + 1; i++) {
      textPrev += SetStepImage(i) + ' ';
    }
    htmlPrev.innerHTML = textPrev;
    switch (NextStep) {
      case 0:
        htmlText.innerHTML = 'Standards-Based Lessons in <strong>3 Easy Steps</strong>';
        break;
      case 1:
        htmlText.innerHTML = 'Click to add your State\'s Standards <strong>&nbsp;</strong>';
        break;
      case 2:
        htmlText.innerHTML = 'Type or paste in your lesson plan <strong>&nbsp;</strong>';
        break;
      case 3:
        htmlText.innerHTML = 'Save / Print / E-mail your standards-based plans <strong>&nbsp;</strong>';
        break;
    }
    for (i = NextStep + 1; i <= 3; i++) {
      textNext += SetStepImage(i) + ' ';
    }
    htmlNext.innerHTML = textNext;
    StepNo = NextStep;
  }
}

function SetStepImage(ThisStep) {
  return '<img src="images2/home/step_' + ThisStep + '.png" alt="Step ' + ThisStep + '" />';
}

function SetHdActionVal(HdAction)	{
  document.LoginFrm.hdAction.value = HdAction;
  document.LoginFrm.action = "index.php";
  document.LoginFrm.submit();
}

function showfeatures(){
  if (document.getElementById("featuresHide").style.display == 'block') {
    document.getElementById("featuresHide").style.display = 'none';
    document.getElementById("featuresHide").style.visibility = 'hidden';
  } else {
    document.getElementById("featuresHide").style.display = 'block';
    document.getElementById("featuresHide").style.visibility = 'visible';
  };
};

function isZip(s)
{
     reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);
     if (!reZip.test(s)) {
          return false;
     }
return true;
}


function check(frm)
 {
 re = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
// re = /([0-9a-zA-Z\.-_]+)@([0-9a-zA-Z\.-_]+)(\.)([0-9a-zA-Z\.-_])/;
 var firstname, lastname, state, zip, school, grade,city, username, password, password1, email, dataRight = true;
 message = "";
 firstname=frm.first_name.value;
 lastname=frm.last_name.value;
 state=frm.state.value;
 zip=frm.zip.value;
 school=frm.school.value;
 grade=frm.grade.value;
// address=frm.address.value;
// city=frm.city.value;
 username=frm.username.value;
 password=frm.password.value;
 password1 =frm.password1.value;
 email=frm.email.value;
 MainSubject = frm.MainSubject.value;

  if (firstname.length==0)
    {
    message += "\n -  First Name";
    dataRight=false;
    }
if (lastname.length==0)
    {
    message += "\n -  Last Name";
    dataRight=false;
    }
if (school.length==0)
   {
   message += "\n -  School";
   dataRight=false;
   }
//if (grade=='0')
//   {
//   message += "\n -  Grade-level";
//   dataRight=false;
//   }
if (MainSubject=='0')
   {
   message += "\n -  Main Subject";
   dataRight=false;
   }
//if (address.length==0)
//   {
//   message += "\n -  Address";
//   dataRight=false;
//   }
//if (city.length==0)
//   {
//   message += "\n -  City";
//   dataRight=false;
//   }
if (state=='0')
   {
   message += "\n -  State";
   dataRight=false;
   }
if (zip.length==0)
   {
   message += "\n -  Zip";
   dataRight=false;
   }
if (email.length==0)
   {
   message += "\n -  Your E-Mail Address is not Valid";
   dataRight=false;
   }
if (email.length!=0 && email.match(re)==null)
   {
   dataRight=false;
   message += "\n -  Your E-Mail is Incorrect";
   }
if (username.length==0)
   {
   message += "\n -  Username";
   dataRight=false;
   }
if (password.length==0)
   {
   message += "\n -  Password";
   dataRight=false;
   }
if (password!==password1)
   {
   message += "\n -  Password does not march";
   dataRight=false;
   }

if (!dataRight)
    {
if (message != "")
   {
   message = "\n" +  "Please complete the form.\n" + message;
   }
    alert(message);
    }
 return dataRight;
 }

function ShowModuleDescription(Module)	{
  var Title = "";
  var Content = "";
  var icon = "";
  var rightMargin = 0;
  switch (Module) {
    case "LP":
      Title = "Lesson Planner";
      Content = "<i>Success takes planning.</i><br><br>The free lesson planner makes planning a breeze! Share standards-based lessons with colleagues, and edit, print, or email your lessons from any online computer. It's fast. It's easy. It's free!";
      icon = "lesson_planner.png";
      rightMargin = 390;
      break;
    case "SS":
      Title = "My State Standards";
      Content = "<i>Maintain the highest standards.</i><br><br>Align to state standards with just a click -- it  takes just seconds to input an existing lesson and align it to your state standards. Even view suggested state standards for each lesson plan.";
      icon = "my_state_standards.png";
      rightMargin = 390;
      break;
    case "TIG":
      Title = "Test Generator";
      Content = "<i>Measure progress for motivation.</i><br><br>Link Instruction and Assessment to really pump up student  achievement! Create your own test bank or team up with other teachers. Then print tests for students along with an answer key for yourself.";
      icon = "test_generator.png";
      rightMargin = 390;
      break;
    case "RES":
      Title = "Resources";
      Content = "<i>Use the right tools.</i><br><br>Store your files to use again later, and use the many free worksheets included with the site. School Solutions and our partners will provide you with the best teaching methods and products.";
      icon = "resources.png";
      break;
    case "SUP":
      Title = "Calendar";
      Content = "<i>Organize your day.</i><br><br>Keep organized and on schedule with the simple-yet-powerful online calendar tool. View at a glance each week's events, lesson plans, and assignments.";
      icon = "calendar.png";
      break;
    case "GB":
      Title = "Grade Book";
      Content = "<i>Communication is key.</i><br><br>The innovative and easy-to-organize grade book will help you track student progress.";
      icon = "grade_book.png";
      break;
    case "S2H":
      Title = "School-To-Home";
      Content = "<i>Communication is key.</i><br><br>Use your personal school-to-home web page to share information with students and families at home.";
      icon = "school_to_home.png";
      break;
  }
  var LPContent = "";
   LPContent += '<table border="1" style="margin:0 '+rightMargin+'px 0 0;border-color:A35065; border-collapse:collapse;" cellspacing="0" cellpadding="0">';
   LPContent += '<tr>';
   LPContent += '<td>';
   LPContent += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
   LPContent += '<tr style="background-color: white;">';
   LPContent += '<td align="left" style="padding: 1px;" height="27" width="40"><img src="images2/icons/overview/small/'+icon+'" alt="" /></td>';
   LPContent += '<td align="left" style="font-size: 14px;"><strong>'+Title+'</strong></td>';
   LPContent += '<td align="center" width="30"><img src="images2/common/close.gif" style="cursor:pointer;" onclick="HideModuleDescription()"></td>';
   LPContent += '</tr>';
   LPContent += '</table>';
   LPContent += '</td>';
   LPContent += '</tr>';
   LPContent += '<tr>';
   LPContent += '<td height="170" width="220" valign="top" class="Window_div"><p style="font-family:Arial, Helvetica, sans-serif; color:#000000;">'+Content+'</p>';
   LPContent += '</td>';
   LPContent += '</tr>';
   LPContent += '</table>';
   if (document.getElementById('ModuleDescription'))	{
     document.getElementById('ModuleDescription').innerHTML = LPContent;
     Effect.Appear('ModuleDescription',{duration:0.3});
   }
   return false;
}

function HideModuleDescription()	{
  if (document.getElementById('ModuleDescription'))	{
   Effect.Fade('ModuleDescription', {duration:0.3});
  }
}

function IsValid(Val,Label)
{
  if(trim(Val)=="")
  {
    alert(Label+" Should Not be Empty")
    return false
  }
  return true
}

