/*
# ©2010 ActualTechSolutions/BlueBQ.com
# Version:    1.0
*/	
	
function GetXmlHttpObject() {
var xmlHttp=null;
  try
	{
	// Firefox, Opera 8.0+, Safari
	xmlHttp=new XMLHttpRequest();
	}
  catch (e)
	{
	// Internet Explorer
	try
	  {
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	catch (e)
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	}
  return xmlHttp;
}

/*--------------------------*/

var tmr;
function cntform(e) {
	var x;
	var y;
	//
	if (window.event) {
		x = (window.event.clientX) - 5;
		y = (window.event.clientY) - 150;
	} else {
		x = (e.clientX) - 5;
		y = (e.clientY) - 150;			
	}
	//
	var tmp = document.getElementById('cntfrm');
	if ((!tmp == '') || (!tmp == 'null')) { document.body.removeChild(tmp); }
	//
	var odiv = document.createElement('div');
	odiv.setAttribute('id','cntfrm');
	odiv.style.width = '350px';
	odiv.style.height = '200px';
	odiv.style.backgroundColor = 'white';
	odiv.style.border = '3px double #32b9e3';
	odiv.style.position = 'absolute';
	odiv.style.top = y + 'px';
	odiv.style.left = x + 'px';
	odiv.style.padding = '5px';
	//
	document.body.appendChild(odiv);
	//
	var cont = document.getElementById('cntfrm');
	var ohttp = GetXmlHttpObject();	
	if (ohttp == null) {
		alert('No Support For AJAX!');
		return false;
	}
	ohttp.onreadystatechange=function() {
		if (ohttp.readyState == 4) {
			cont.innerHTML = ohttp.responseText;
		   } else {
			cont.innerHTML = '<p style="font-size: 8pt; font-weight: bold; font-family: verdana">Getting Data...</p>';
		}
	}
	//
	ohttp.open("GET","includes/mailr.php?v=1",true);
	ohttp.send(null);	
}

/*--------------------------*/

function phpmailr(frm) {	
	//CHK REQUIRED FIELDS
	if (frm.txtname.value == "")
	{
		alert("Alert!\nProblem:  Missing form value (Name).\nPlease fix this and resend.");
		frm.txtname.focus();
		return false;			
	}
	if (frm.txtemail.value == "")
	{
		alert("Alert!\nProblem:  Missing form value (Email).\nPlease fix this and resend.");
		frm.txtemail.focus();
		return false;
	}
	if (frm.txtphone.value == "")
	{
		alert("Alert!\nProblem:  Missing form value (Phone Number).\nPlease fix this and resend.");
		frm.txtphone.focus();
		return false;
	}
	//
	var v1 = frm.txtname.value;
	var v2 = frm.txtphone.value;
	var v3 = frm.txtemail.value;
	var v4 = frm.txtmsg.value;
	//
	var cont = document.getElementById('cntfrm');
	var ohttp = GetXmlHttpObject();	
	if (ohttp == null) {
		alert('No Support For AJAX!');
		return false;
	}
	ohttp.onreadystatechange=function() {
		if (ohttp.readyState == 4) {
			cont.innerHTML = ohttp.responseText;
			var tmp = document.getElementById('cntfrm');
			if ((!tmp == '') || (!tmp == 'null')) { document.body.removeChild(tmp); }
		   } else {
			cont.innerHTML = '<p style="font-size: 8pt; font-weight: bold; font-family: verdana">Getting Data...</p>';
		}
	}
	//
	var vals = "&v1=" + v1 + "&v2=" + v2 + "&v3=" + v3 + "&v4=" + v4;
	ohttp.open("GET","includes/mailr.php?v=2" + vals,true);
	ohttp.send(null);
}
