
var agt = navigator.userAgent.toLowerCase();
var is_ie = (agt.indexOf("msie") != -1) ? true : false ;
var is_ie7 = (agt.indexOf("msie 7.0; windows") != -1) ? true : false ;
var is_ff = (agt.indexOf("firefox") != -1) ? true : false ;
var is_sf = (agt.indexOf("safari") != -1) ? true : false ;
var i = 0;
var cssClassName = (is_ie) ? "className" : "class" ;
var df = document.forms['cf'];


function getCheckedValue(radioObj) {
	if(!radioObj) {return false;}
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		if(radioObj.checked) {
			return radioObj.value;
		} else {
			return false;
		}
	}
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return false;
}


function getSelectedValue(k) {
	return k.options[k.selectedIndex].value;
}


function fev(e) {
	return document.forms['cf'].elements[e].value;
}


function AQ_submitForm() {
	var postr = '/contactusbin.php?action=contact';
	postr += '&company='+encodeURIComponent(fev('company'));
	postr += '&cname='+encodeURIComponent(fev('cname'));
	postr += '&email='+encodeURIComponent(fev('email'));
	postr += '&phone='+encodeURIComponent(fev('phone'));
	postr += '&address='+encodeURIComponent(fev('address'));
	postr += '&comments='+encodeURIComponent(fev('comments'));
	httpRequest('POST','html','text',postr,'AQ_submitFormHandle()');
	return false;
}


function AQ_submitFormHandle() {
	var r = eval("(" + this.responsed + ")");
	if(r.status == 'OK'){
		var go = function(){document.location.href='/';}
		alert("謝謝您來信，我們將儘速與您聯繫");
		setTimeout(go,200);
	}
	else if(r.status == 'ERROR') {
		if(r.focusfield){df.elements[r.focusfield].focus();}
		if(r.msg){alert(r.msg);}
	}
}

