function ray_getbyid(id) {
	itm = null;
	if (document.getElementById) {
		itm = document.getElementById(id);
	} else if (document.all)	{
		itm = document.all[id];
	} else if (document.layers) {
		itm = document.layers[id];
	}
	return itm;
}


function ctlent(event) {
	if((event.ctrlKey && event.keyCode == 13) || (event.altKey && event.keyCode == 83)) {
		sax_getbyid("submit").click();
	}
}

function addquote(obj,strAuthor){
	var text = ray_getbyid(obj).innerHTML;
	text = text.replace(/alt\=(\"|)([^\"\s]*)(\"|)/g,"> $2 <");
	text = text.replace(/\<[^\<\>]+\>/g,"\n");
	text = text.replace(/ +/g," ");
	text = text.replace(/\n+/g,"\n");
	text = text.replace(/^\n*/gm,"");
	text = text.replace(/^\s*/gm,"");
	text = text.replace(/\n*$/gm,"");
	text = text.replace(/\s*$/gm,"");
	text = text.replace(/&lt;/g,"<");
	text = text.replace(/&gt;/g,">");
	text = text.replace(/&nbsp;&nbsp;/g,"  ");
	text = text.replace(/&amp;/g,"&");
	ray_getbyid("detail").value += "[quote="+strAuthor+"]"+text+"[/quote]";
	ray_getbyid("detail").focus();
}

function checkform() {
	if (ray_getbyid('subject')) {
		if (ray_getbyid('subject').value == "") {
			alert("Please enter the mail subject.");
			ray_getbyid("subject").focus();
			return false;
		}
	}
	if (ray_getbyid('contact_person')) {
		if (ray_getbyid('contact_person').value == "") {
			alert("Please enter the contact person name.");
			ray_getbyid("contact_person").focus();
			return false;
		}
	}
	if (ray_getbyid('tel')) {
		if (ray_getbyid('tel').value == "") {
			alert("Please enter your contact telephone number.");
			ray_getbyid("tel").focus();
			return false;
		}
	}
	if (ray_getbyid('email')) {
		if (ray_getbyid('email').value == "") {
			alert("Please enter your contact Email.");
			ray_getbyid("email").focus();
			return false;
		}
	}
	if (ray_getbyid('detail').value == "")	{
		alert("Please enter the detail information.");
		ray_getbyid("detail").focus();
		return false;
	}

	if (((postminchars != 0 && ray_getbyid('detail').value.length < postminchars) || (postmaxchars != 0 && ray_getbyid('detail').value.length > postmaxchars))) {
		alert("Your detail information is too short or too long.\n\nCurrent length: "+ray_getbyid('detail').value.length+" bytes\n:We had limited the length from "+postminchars+" to "+postmaxchars+" bytes");
		return false;
	}			
	ray_getbyid('submit').disabled = true;
	return true;
}


function checkpform() {
	
	if (ray_getbyid('email')) {
		if (ray_getbyid('email').value == "") {
			alert("Please enter your contact Email.");
			ray_getbyid("email").focus();
			return false;
		}
	}
	if (ray_getbyid('companyname')) {
		if (ray_getbyid('companyname').value == "") {
			alert("Please enter your company name.");
			ray_getbyid("companyname").focus();
			return false;
		}
	}
	if (ray_getbyid('detail').value == "")	{
		alert("Please enter the detail information.");
		ray_getbyid("detail").focus();
		return false;
	}

	if (((postminchars != 0 && ray_getbyid('detail').value.length < postminchars) || (postmaxchars != 0 && ray_getbyid('detail').value.length > postmaxchars))) {
		alert("Your detail information is too short or too long.\n\nCurrent length: "+ray_getbyid('detail').value.length+" bytes\n:We had limited the length from "+postminchars+" to "+postmaxchars+" bytes");
		return false;
	}			
	ray_getbyid('submit').disabled = true;
	return true;
}


function showhide(obj) {
	var fh = ray_getbyid(obj);
	fh.className == "divON" ? fh.className = "divOFF" : fh.className = "divON";
}