//-----------------------------------------------------------
/*
Program name :- sideLinks.js
Author :- Bharathi PV
Created Date :- 5th March 2007
Last Modified by :-
Last Modified date :-
Purpose: This program is to create a side menu
*/
//------------------------------------------------
//#######Function to generate side links########
function display_sideLinks()
{
  c_start=checkLogin();

///  if(c_start!="")
///    document.write('<br>&nbsp;<a href="../members/accountinfo.php">Account Information</a><br>');

///    document.write('<br>&nbsp;<a class="PageTextWt" href="../members/pricing.php">Purchase Greetings</a><br>');
//if (no==2 || no==3){
  //document.write('<a class="PageTextWt" href="javascript:Go(0)">Print or Email</a><br><br>');
//}else{
///    document.write('<br>&nbsp;<a class="PageTextWt" href="../members/print_check.php">Print or Email</a><br>');
//}
  ///  document.write('<br>&nbsp;<a class="PageTextWt" href="../members/occasion.php">Personalize</a><br>');
  ///  document.write('<br>&nbsp;<a class="PageTextWt" href="mailto:info@clientbirthday.com">Customer Support </a><br>');
///  document.write('<br>&nbsp;<a class="PageTextWt" href="javascript:open_win(\'../templates/help.html\',600,500,1)">Help</a><br>');



    ///if(c_start!="")
  ///    document.write('<br>&nbsp;<a class="PageTextWt" href="../members/signout.php" onclick="return confirm(\'Your current session is about to close returning you to clientbirthday.com. Would you like to continue?\')">Sign Out</a><br>');

  //document.write('<a class="PageTextWt" href="javascript:window.opener.location='+"'/'"+';window.self.close();">Home</a>');
  document.write('<br>&nbsp;<a class="PageTextWt" href="storeheader.php">Continue Shopping</a><br>');

  //document.write('<br>&nbsp;<a class="PageTextWt" href="javascript:window.opener.location='+"'/'"+';window.self.close();">Exit Store</a><br><br>');
  document.write('<br>&nbsp;<a class="PageTextWt" href="storeback.php">Back to ClientBirthday</a><br><br>');
  document.write('<br>');
  document.write('<br>');
  document.write('<br>');

  //document.write('</a>&nbsp;</p><br><br>');
}

//########################################################


function validate()
{
  var ret=true;
  if(document.myform1.member_id.value=="" && document.myform1.password.value=="")
  {
    alert("Please enter Member ID and Password");
    document.myform1.member_id.focus();
    ret=false;
  }
  else if(document.myform1.member_id.value!="" || document.myform1.password.value!="")
  {
    if(document.myform1.member_id.value=="")
    {
      alert("Please enter Member ID");
      document.myform1.member_id.focus();
      ret=false;
    }
    if(!emailchk(document.myform1.member_id.value))
    {
      document.myform1.member_id.focus();
      ret=false;
    }
    if(document.myform1.password.value=="")
    {
      alert("Please enter Password");
      document.myform1.password.focus();
      ret=false;
    }
  }
  if(ret == true)
  {
    document.myform1.submit();
  }
}
function emailchk(string)
{
    // check if email has a @ character
    if (string.indexOf("@") == -1)
    {
    alert (" Please enter a valid email address....");
      return false;
    }
    // check if email has a . character
    else if (string.indexOf(".") == -1)
    {
        alert (" Please enter a valid email address....");
      return false;
    }
  else if(string.indexOf(' ')!=-1)
  {
    alert (" Please enter a valid email address....");
      return false;
  }
  return true;
  }
function checkregistered()
{
  var ret=true;
  var val = "<!--registered-->";
  if (val == "true")
  {
    //temporarily commenting for the sake of client
    //ret = true;
    //alert("This site is in beta mode. Card purchasing will be available around 02/30/2006");
    //ret = false;
    document.myform.page.value='Y';
      if(isNaN(document.myform.bulkcards.value))
       {
         alert("Invalid data format.\nOnly numbers are allowed.");
         document.myform.bulkcards.focus();
         return (false);
       }
       else
       {
      if(document.myform.bulkcards.value>=60)
      {
        eval(document.myform.bulkprice.value=document.myform.bulkcards.value * 0.20);
        return true;
      }
      else
      {
        alert("The minimum cards limit in this plan is 60.");
        return false;
      }
     }
  }
  else
  {
    alert("New users, please register to purchase greetings.                                                                                                  Registered users, please login with your member ID and password before purchasing greetings.");
    ret = false;
  }
  if (ret == true)
  {
    document.myform.submit();
  }
}
function chkTotal()
{
    if(isNaN(document.myform.bulkcards.value))
   {
     alert("Invalid data format.\nOnly numbers are allowed.");
     document.myform.bulkcards.value="";
     document.myform.bulkcards.focus();
     return (false);
  }
  else
    {
    if(document.myform.bulkcards.value>=60)
    { var m=document.myform.bulkcards.value * 0.20;
        eval(document.myform.bulkprice.value=m.toFixed(2));
        return true;
    }
    else
    {
      alert("The minimum cards limit in this plan is 60.");
      return false;
    }
  }
}
function open_win(url,width,height)
  {
    remote=window.open(url,'calander','status=no,scrollbars=yes,resizable=yes,top=425,left=525,height='+height+',width='+width);
    if (remote != null)
    {
      if (remote.opener == null)
      remote.opener = self;
    }
  }

function checkLogin()
{
   var Name="member_id_temp";
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) {
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
  //alert(returnvalue);

}

