// JavaScript Documentvar loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){
document.getElementById(containerid).innerHTML="";
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
url=url+"&sid="+Math.random();
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}
function scroll_status(seed)
{
        var m1 = "  Công ty TNHH TM-DV Hoàng Tín  ";
        var m2 = "    Dịch vụ nạp mực, Cho thue photocopy tphcm    ";
        var m3 = "   Mọi chi tiết xin liên hệ Mr.Hieu 0907.111.665  ";
        var msg=m1+m2+m3;
        var out = " ";
        var c   = 1;
        if (seed > 100) {
                seed--;
               var cmd="scroll_status(" + seed + ")";
                timerTwo=window.setTimeout(cmd,100);
        }
        else if (seed <= 100 && seed > 0) {
                for (c=0 ; c < seed ; c++) {
                        out+=" ";
                }
                out+=msg;
                seed--;
               var cmd="scroll_status(" + seed + ")";
                    window.status=out;
                timerTwo=window.setTimeout(cmd,100);
        }
        else if (seed <= 0) {
                if (-seed < msg.length) {
                        out+=msg.substring(-seed,msg.length);
                        seed--;
                        var cmd="scroll_status(" + seed + ")";
                        window.status=out;
                        timerTwo=window.setTimeout(cmd,100);
                }
                else {
                        window.status=" ";
                        timerTwo=window.setTimeout("scroll_status(100)",75);
                }
        }
}
function checkInputContact()
	   {
	  	if (document.frmContact.txtUser.value=="")
		{
			alert("Vui lòng nhập tên đầy đủ");
			document.frmContact.txtUser.focus();
			return false;
		}
	   	
		if (document.frmContact.txtPhone.value=="")
		{
			alert("Vui lòng nhập số phone");
			document.frmContact.txtPhone.focus();
			return false;
		}
		
		if (document.frmContact.txtMail.value=="")
		{
			alert("Vui lòng nhập Email");
			document.frmContact.txtMail.focus();
			return false;
		}
		if (document.frmContact.txtCode.value=="")
		{
			alert("Vui lòng nhập mã nhận dạng");
			document.frmContact.txtCode.focus();
			return false;
		}
		if(!checkEmail()) return false;
		if(!checkPhone()) return false;
		return true;
	   }
function checkInputDangky()
	   {
	  	if (document.frmNhantin.txtUser.value=="")
		{
			alert("Vui lòng nhập tên đầy đủ");
			document.frmNhantin.txtUser.focus();
			return false;
		}
	   	
		if (document.frmNhantin.txtPhone.value=="")
		{
			alert("Vui lòng nhập số phone");
			document.frmNhantin.txtPhone.focus();
			return false;
		}
		
		if (document.frmNhantin.txtMail.value=="")
		{
			alert("Vui lòng nhập Email");
			document.frmNhantin.txtMail.focus();
			return false;
		}
		if (document.frmNhantin.txtCode.value=="")
		{
			alert("Vui lòng nhập mã nhận dạng");
			document.frmNhantin.txtCode.focus();
			return false;
		}
		if(!checkEmail()) return false;
		if(!checkPhone()) return false;
		return true;
	   }

function checkEmail() 
{
	var email = document.getElementById('txtMail');
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email.value)) 
	{
		alert('Nhập sai chuẩn email.Xin nhập lại');
		email.focus;
		return false;
	}
	return true;
}
function checkPhone() 
{
	var phone = document.getElementById('txtPhone');
	var filter = /^([0-9_\.\-])+(([0-9\-]))+([0-9]{2,4})+$/;
	if (!filter.test(phone.value)) 
	{
		alert('Nhập số phone đúng.Xin nhập lại');
		phone.focus;
		return false;
	}
	return true;
}

