/* ajx_fun.js  */

// Copyright (c) 2008. PSL Technologies.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//   * Redistributions of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//   * Redistributions in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//   * Neither the name of PSL Technologies nor the names of its
//     contributors may be used to endorse or promote products derived from this
//     software without specific prior written permission.


<!--
function PSL_clearbx(objId) {
 with (document){ if (getElementById){
    var obj = getElementById(objId);} 
	if (obj) {obj.value = (obj.value =='Site Search...') ? '' : obj.value;}
  }
}
function PSL_set_text(objId,x,newText) { 
  with (document){ if (getElementById){
    var obj = getElementById(objId);} 
	if (obj) {obj.value = (obj.value =='') ? newText : obj.value;}
  }
}
//-->


//function to collect form variables
function send_msg(targetDiv)
{
var name = document.getElementById("txtname").value;
var mail = document.getElementById("txtmail").value;
var phone = document.getElementById("txtphone").value;
var interest = document.getElementById("txtinterest").value;
var combinatn = "nme=" + name + "&email=" + mail + "&phn=" + phone + "&msg=" + interest;
getData("proc_contact.php?send=1&" + combinatn , targetDiv);
}


function getData(dataSource, divid)
{

var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new
ActiveXObject("Microsoft.XMLHttp");
}
if(XMLHttpRequestObject) {
XMLHttpRequestObject.open("GET", dataSource);

XMLHttpRequestObject.onreadystatechange = function()
{
document.getElementById(divid).innerHTML = "<span class='frm_status'><img src='loading-1.gif' alt='sending' align='left' /> Sending Message...</span>";
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200) {
var response = XMLHttpRequestObject.responseText;
document.getElementById(divid).innerHTML = (response == 'empty') ? '' :  "<span class='frm_status'>" + response + "</span>";

delete XMLHttpRequestObject;
XMLHttpRequestObject = null;
}
}
XMLHttpRequestObject.send(null);

}
}
