// JavaScript Document
function sendMail()
{
  if(!validate_form())
  {
    $('info').style.color = 'red';
   return;
  }
  $('info').innerHTML = "";
  $('button').style.display="none";
  $('loading').style.display= "";
  var fname = $('contactus_fname').value;
  var lname = $('contactus_lname').value;
  var email = $('email').value;
  var message = $('contactus_message').value;
  var params = 'fname='+fname+'&lname='+lname+'&email='+email+'&message='+message;
  var mal = new Ajax.Request('includes/mail.php',{method : 'post',asynchronous: true,postBody: params,onSuccess: mailResp});
}


function mailResp(tr)
{
  if(tr.responseText)
  {
//    $('info').style.color = "green";
//    $('info').innerHTML = "Your comment has been posted";
	document.location.href = 'thankyou.php';
  }
  else
  {
    $('info').style.color = "red";
    $('info').innerHTML = "Please make sure that you have filled all details and try again.In case there is an error again, you can write a mail directly to post[at]t2frameworks.com."
  }
 $("button").style.display="";
 $("loading").style.display= "none";
}

/*
function mailbox()
{

var avl = new Ajax.Request('includes/contactus.php',{method : 'get',asynchronous: true,postBody: null,onSuccess: arse});
}
function arse(t)
{
   Lightbox.showBoxString(t.responseText);
  $("close").style.display="";

}
window.onload = initLB;
function initLB()
{
        if(!$("mail"))
        {
            Lightbox.init(); var ml = $('maillink');
            ml.onclick = function(){ mailbox();  }
        }
}*/

