/* <![CDATA[ */
function sendContact(token,userIP) {
		var commentName=document.getElementById('commentName').value;
		var comment=document.getElementById('comment').value;
		var commentEmail=document.getElementById('commentEmail').value;
		var company=document.getElementById('company').value;
		var telephone=document.getElementById('telephone').value;
		var interested=document.getElementById('interested').value;
		var other=document.getElementById('other').value;
        var url = "process/sendContact.php?other="+other+"&interested="+interested+"&telephone="+telephone+"&company="+company+"&commentEmail="+commentEmail+"&commentName="+commentName+"&comment="+comment+"&userIP="+userIP+"&token="+token;
        if(window.XMLHttpRequest) {
                req = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
                req = new ActiveXObject("Microsoft.XMLHTTP");
        }
        req.open("GET", url, true);
        req.onreadystatechange = callback;
        req.send(null);
}

function callback() {        
        cobj = document.getElementById("contactForm");
		cobj.innerHTML = '<div style="text-align:center;width:100%;margin-top:50px"><img src="images/loading_gif.gif" alt="sending comment" /><p>making contact...</p></div>';
        setFade(100);
		
		if(req.readyState == 4) {
                if(req.status == 200) {
                        response = req.responseText;
                        cobj.innerHTML = response;
						fade(0);
                } else {
                        alert("There was a problem retrieving the data:\n" + req.statusText);
                }
        }
}
function fade(amt) {
	if(amt <= 100) {
		setFade(amt);
		amt += 10;
		setTimeout("fade("+amt+")", 5);
    }
}

function setFade(amt) {
	cobj = document.getElementById("contactForm");
	
	amt = (amt == 100)?99.999:amt;
  
	// IE
	cobj.style.filter = "alpha(opacity:"+amt+")";
  
	// Safari<1.2, Konqueror
	cobj.style.KHTMLOpacity = amt/100;
  
	// Mozilla and Firefox
	cobj.style.MozOpacity = amt/100;
  
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	cobj.style.opacity = amt/100;
}
/* ]]> */
