///*
// *  palaw.js - javascript for Palaw Library project
// *------------------------------------------------------------------------
// * Copyright (c) 2003,  GBee's  All rights reserved
// * RCSID $Id: palaw.js,v 1.4 2004/07/04 13:20:36 gary Exp $
// *------------------------------------------------------------------------
// */

function chk_login_values()
{
   if ( document.login_form.user_name.value == "" || document.login_form.password.value == "" )
   {
      alert ("Both User Name and Password must be entered")
      if ( document.login_form.user_name.value == "" )
      {
         document.login_form.user_name.focus();
         document.login_form.user_name.select();
      }
      else if ( document.login_form.password.value == "" )
      {
         document.login_form.password.focus();
         document.login_form.password.select();
      }
      return false;
   }
   else
   {
      return true;
   }
}

function chk_forgot_values()
{
   if ( document.forgot_form.user_name.value == "" || document.forgot_form.fname.value == "" || document.forgot_form.lname.value == "" )
   {
      alert ("Your User Name, first name and last name must all be entered")
      if ( document.forgot_form.user_name.value == "" )
      {
         document.forgot_form.user_name.focus();
         document.forgot_form.user_name.select();
      }
      else if ( document.forgot_form.fname.value == "" )
      {
         document.forgot_form.fname.focus();
         document.forgot_form.fname.select();
      }
      else if ( document.forgot_form.lname.value == "" )
      {
         document.forgot_form.lname.focus();
         document.forgot_form.lname.select();
      }
      return false;
   }
   else
   {
      return true;
   }
}

function chk_join_values()
{
   if ( document.join_form.fname.value == "" ||
        document.join_form.lname.value == "" ||
        document.join_form.company_name.value == "" ||
        document.join_form.addr1.value == "" ||
        document.join_form.city.value == "" ||
        document.join_form.state.value == "" ||
        document.join_form.zip.value == "" ||
        document.join_form.email.value == "" ||
        document.join_form.phone.value == "" ||
        document.join_form.occupation.value == "" ||
        document.join_form.associations.value == "" ||
        document.join_form.source1.value == ""
      )
   {
      alert ("A required field has not been entered")
      return false;
   }
}

function chk_user_values()
{
   if ( document.user_edit_form.fname.value == "" ||
        document.user_edit_form.lname.value == "" ||
        document.user_edit_form.user_name.value == "" ||
        document.user_edit_form.session_time.value == "" ||
        document.user_edit_form.site_id.value == "" ||
        document.user_edit_form.exp_date.value == "" ||
        document.user_edit_form.email.value == "" ||
        document.user_edit_form.phone.value == "" ||
        document.user_edit_form.occupation.value == "" ||
        document.user_edit_form.associations.value == "" ||
        document.user_edit_form.source1.value == ""
      )
   {
      alert ("A required field has not been entered")
      return false;
   }
   else
   {
     if ( document.user_edit_form.password1.value == document.user_edit_form.password2.value )
     {
          return true;
     }
     else
     {
           alert ("Your passwords do not match, please re-enter");
           document.user_edit_form.password1.focus();
           return false;
        }
   }
}
//        document.user_edit_form.password1.value == "" ||
//        document.user_edit_form.password2.value == "" ||

function chk_site_values()
{
   if ( document.site_edit_form.company_name.value == "" ||
        document.site_edit_form.addr1.value == "" ||
        document.site_edit_form.city.value == "" ||
        document.site_edit_form.state.value == "" ||
        document.site_edit_form.zip.value == "" ||
        document.site_edit_form.ip_addr.value == "" ||
        document.site_edit_form.max_users.value == "" ||
        document.site_edit_form.exp_date.value == ""
      )
   {
      alert ("A required field has not been entered")
      return false;
   }
}

function pr_msg()
{
   if ( document.form1.login_msg.value != '' )
   {
      alert(document.form1.login_msg.value);
   }
}

function ViewImage(ifile,ix,iy,ititle)
{
     var win;
     var sWidth;
     var sHeight;
     var NS = (document.layers) ? 1 : 0;

     win = window.open("","imageviewer","width="+ix+",height="+iy+",menubar=no,toolbar=no");
     if (NS)
     {
          sWidth = win.innerWidth;
          sHeight = win.innerHeight;
     }
     else
          {
          sWidth = win.document.body.clientWidth;
          sHeight = win.document.body.clientHeight;
     }
     if(sWidth!=ix || sHeight!=iy)
     {
          win.close();
          setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);
          return;
     }
     win.document.open();
     win.document.write("<html><head><title>"+ititle+"</title>");
     win.document.write("</head><body>");
     win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
     win.document.write("<img src="+ifile+"></div></body></html>");
     win.document.close();
}

function ad_random(ad_type)
{
     var ad;
     if (ad_type == 1)
     {
          var RandomNumber = parseInt(Math.random()*4)+1;
          switch (RandomNumber) {
               case 4:
                    ad= '<a href="/prodinfo/chargeback.html"><img src="/images/ads/chargeback_external_available.jpg" border="0"></a>';
                    break
               case 3:
                    ad= '<img src="/images/ads/counties.gif" border="0">';
                    break
               case 2:
                    ad= '<img src="/images/ads/citysol_external3.jpg" border="0">';
                    break
               case 1:
                    ad= '<a href="javascript:void(0);" target="content" onClick="window.open(\'http://testing.palawlibrary.com/images/attorneydirectory.jpg\',\'new\',\'width=640,height=480,top=150,left=100,directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes\')" class="mainmenu"><!--<a href="/prodinfo/content.html#directory">--><img src="/images/ads/direct_ext_avail.jpg"  border="0"></a>';
                    break
          } //end switch
     }
     if (ad_type == 2)
     {
          var RandomNumber = parseInt(Math.random()*5)+1;
          switch (RandomNumber) {
               case 5:
                    ad= '<a href="/prodinfo/content.html#rules"><img src="/images/ads/out-courtrules.gif" border="0"></a>';
                    break
               case 4:
                    ad= '<a href="/prodinfo/chargeback.html"><img src="/images/ads/chargeback_external_available.jpg" border="0"></a>';
                    break
               case 3:
                    ad= '<img src="/images/ads/counties.gif" border="0">';
                    break
               case 2:
                    ad= '<img src="/images/ads/citysol_external4.jpg" border="0">';
                    break
               case 1:
                    ad= '<a href="/avs/vs_submit.html"><img src="/images/ads/gavel.gif"  border="0"></a><br /><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><font size="3"><b>For Attorneys:</b></font><br />Share with your legal community the <a href="/avs/vs_submit.html">verdicts/settlements</a> you&#039;ve earned.';
                    break
              /* case 1:
                    ad= '<a href="/prodinfo/cle.html"><img src="/images/ads/palaw_cle_ad2.gif" border="0"></a>';
                    break*/
          } //end switch
     }
     document.write(ad);
}
///*
// * $Log: palaw.js,v $
// * Revision 1.4  2004/07/04 13:20:36  gary
// * Added CVS logging and header
// *
// * Revision 1.3  2004/07/04 13:14:44  gary
// * Added check function for 'forgot' form
// *
// */

