 function gotosamples(){
  setTimeout("document.location.href='samples.php'",4000);
 }
 function myclose(id){
  msg = '';
  document.getElementById('cell'+id).innerHTML = msg;
 }

function show(id,codems,codeif,cbwif,ccolorif,cbwms,ccolorms,inf,ms,desc){
  msg = '';
  msg = msg + '<table cellspacing="0" cellpadding="0" bgcolor="#FFFFCC" width="100%">';
  msg = msg + ' <tr>';
  msg = msg + '  <td style="padding-left:10px;" width="100%">';
  msg = msg + '   <table cellspacing="0" cellpadding="0" width="100%">';
  msg = msg + '    <tr>';
  msg = msg + '     <td width="600" valign="top" class="dropdown">' + desc + '</td>';
  msg = msg + '     <td width="80" valign="top" align="right"><a href="#" onclick="myclose('+id+');" class="close_link">[close]</a></td>';
  msg = msg + '    </tr>';
  msg = msg + '   </table>';
  msg = msg + '  </td>';
  msg = msg + ' </tr>';
  msg = msg + ' <tr height="5">';
  msg = msg + '  <td width="100%"></td>';
  msg = msg + ' </tr>';
  msg = msg + ' <tr>';
  msg = msg + '  <td style="padding-left:10px;" width="100%">';
  msg = msg + '   <table cellspacing="0" cellpadding="0" width="100%">';
  msg = msg + '    <tr>';
  msg = msg + '     <td width="170" valign="top" class="dropdown" style="text-decoration: underline;">Availability</td>';
  msg = msg + '     <td width="170" valign="top" class="dropdown" style="text-decoration: underline;">Course Code</td>';
  msg = msg + '     <td width="170" valign="top" class="dropdown" style="text-decoration: underline;">Printed Manuals</td>';
  msg = msg + '     <td width="170" valign="top" class="dropdown">&nbsp</td>';
  msg = msg + '    </tr>';
  msg = msg + '    <tr>';
  msg = msg + '     <td width="170" valign="top" class="dropdown">Master Series: <font color="#FF0000">'+ms+'</font></td>';
  msg = msg + '     <td width="170" valign="top" class="dropdown_black"><b>'+codems+'</b></td>';
  msg = msg + '     <td width="170" valign="top" class="dropdown_black"><b>'+cbwms+'</b></td>';
  msg = msg + '     <td width="170" valign="top" class="dropdown_black"><b> </b></td>';
  msg = msg + '    </tr>';
  msg = msg + '    <tr>';
  msg = msg + '     <td width="170" valign="top" class="dropdown">InFocus Series: <font color="#FF0000">'+inf+'</font></td>';
  msg = msg + '     <td width="170" valign="top" class="dropdown_black"><b>'+codeif+'</b></td>';
  msg = msg + '     <td width="170" valign="top" class="dropdown_black"><b>'+cbwif+'</b></td>';
  msg = msg + '     <td width="170" valign="top" class="dropdown_black"><b>'+ccolorif +'</b></td>';
  msg = msg + '    </tr>';
  msg = msg + '   </table>';
  msg = msg + '  </td>';
  msg = msg + ' </tr>';
  msg = msg + ' <tr height="5">';
  msg = msg + '  <td width="100%"></td>';
  msg = msg + ' </tr>';
  msg = msg + ' <tr>';
  msg = msg + '  <td style="padding-left:10px;" width="100%">';
  msg = msg + '   <table cellspacing="0" cellpadding="0" width="100%">';
  msg = msg + '    <tr>';
  msg = msg + '     <td width="100%" valign="top" class="dropdown">All titles are available to purchase as a courseware license, with unlimited editing and reproduction rights. Please contact us for details.</td>';
  msg = msg + '    </tr>';
  msg = msg + '   </table>';
  msg = msg + '  </td>';
  msg = msg + ' </tr>';
  msg = msg + '</table>';  
  document.getElementById('cell'+id).innerHTML = msg;
 }
 
 
 function checkcontactform(){
  var error = false;
  var errormsg = 'ERROR!!! The following fields are mandatory:\n\n';
  if (document.getElementById('name').value == ''){
   errormsg = errormsg + ' - Name\n';
   error = true;
  }
  if (document.getElementById('email').value == ''){
   errormsg = errormsg + ' - Email\n';
   error = true;
  }
  if (document.getElementById('message').value == ''){
   errormsg = errormsg + ' - Message\n';
   error = true;
  }
  if (error == true){
   alert (errormsg);
  }
  else{
   if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email').value)){
    myform=document.getElementById('contactform');								
    myform.method='post';
    myform.action='sendcontact.php';
    myform.submit();
   }
   else{
	alert("ERROR!!! That is not a valid email address.")
   }	  
  }
 }
 function checksignupform(){
  var error = false;
  var errormsg = 'ERROR!!! The following fields are mandatory:\n\n';
  if (document.getElementById('name').value == ''){
   errormsg = errormsg + ' - Name\n';
   error = true;
  }
  if ((document.getElementById('email1').value == '')||(document.getElementById('email2').value == '')){
   errormsg = errormsg + ' - Email\n';
   error = true;
  }
  if ((document.getElementById('email1').value != document.getElementById('email2').value)&&(error == false)){
   errormsg = 'ERROR!!! The email addresses typed do not match.';
   error = true;
  }
  if (error == true){
   alert (errormsg);
  }
  else{
   if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email1').value)){
    myform=document.getElementById('signupform');								
    myform.method='post';
    myform.action='sendsignup.php';
    myform.submit();
   }
   else{
	alert("ERROR!!! That is not a valid email address.")
   }	  
  }
 }
 function checksubscribeform(){
  var error = false;
  var errormsg = 'ERROR!!! The following fields are mandatory:\n\n';
  if (document.getElementById('name').value == ''){
   errormsg = errormsg + ' - Name\n';
   error = true;
  }
  if (document.getElementById('email').value == ''){
   errormsg = errormsg + ' - Email\n';
   error = true;
  }
  if (error == true){
   alert (errormsg);
  }
  else{
   if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email').value)){
    myform=document.getElementById('subscribeform');								
    myform.method='post';
    myform.action='presamples.php';
    myform.submit();
   }
   else{
	alert("ERROR!!! That is not a valid email address.")
   }	  
  }
 }
 function checksmallsignupform(){
  var error = false;
  var errormsg = 'ERROR!!! The following fields are mandatory:\n\n';
  if ((document.getElementById('email').value == '')||(document.getElementById('email').value == '')){
   errormsg = errormsg + ' - Email\n';
   error = true;
  }
  if (error == true){
   alert (errormsg);
  }
  else{
   myform=document.getElementById('smallsubscribeform');								
   myform.method='post';
   myform.action='subscribe.php';
   myform.submit();
  }
 }

