var http = createRequestObject();

function createRequestObject() {
        var xmlhttp;
        try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); }
        catch(e) {
    try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
        catch(f) { xmlhttp=null; }
  }
  if(!xmlhttp&&typeof XMLHttpRequest!="undefined") {
        xmlhttp=new XMLHttpRequest();
  }
        return  xmlhttp;
}

function trim(a) {
        return a.replace(/^s*(S*(s+S+)*)s*$/, "$1");
}


var dayarray=new Array("Chủ nhật","Thứ 2","Thứ 3","Thứ 4","Thứ 5","Thứ 6","Thứ 7")
var montharray=new Array("01","02","03","04","05","06","07","08","09","10","11","12")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+daym+"/"+montharray[month]+"/"+year+" "+hours+":"+minutes+":"+seconds+" "+dn
+"</b></font></small>"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}

// + ------------------- +
// |     CHECK EMAIL     |
// + ------------------- +

function echeck(str) {

                var at="@"
                var dot="."
                var lat=str.indexOf(at)
                var lstr=str.length
                var ldot=str.indexOf(dot)
                if (str.indexOf(at)==-1){
                   alert("Địa chỉ E-mail không chính xác")
                   return false
                }

                if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
                        alert("Địa chỉ E-mail không chính xác")
                   return false
                }

                if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
                    alert("Địa chỉ E-mail không chính xác")
                    return false
                }

                 if (str.indexOf(at,(lat+1))!=-1){
                    alert("Địa chỉ E-mail không chính xác")
                    return false
                 }

                 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
                    alert("Địa chỉ E-mail không chính xác")
                    return false
                 }

                 if (str.indexOf(dot,(lat+2))==-1){
                    alert("Địa chỉ E-mail không chính xác")
                    return false
                 }

                 if (str.indexOf(" ")!=-1){
                    alert("Địa chỉ E-mail không chính xác")
                    return false
                 }

                 return true

        }

// + ------------------- +
// |     NEWS COMMENT    |
// + ------------------- +

function comment_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("Đã nhận thông tin! Thông tin sẽ được kiểm soát trước khi được hiển thị!");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function submit_comment() {
        var news_id = document.getElementById("news_id").value;
        var name = document.getElementById("name_cmt").value;
        var email = document.getElementById("email").value;
        var title = document.getElementById("title").value;
        var content = document.getElementById("content").value;
        var content = content.replace(/&/g,"");
                if(trim(name) == "" || trim(email) == "" || trim(title) == "" || trim(content) == "") {
                alert("Vui lòng nhập đầy đủ những thông tin trên!");
                 } else {
                        if (echeck(email)) {
                        if (confirm("Bạn có chắc những thông tin trên là chính xác?")) {
                                http.open('POST',  'submit_comment.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.setRequestHeader("Content-length", content.length);
                                http.onreadystatechange = comment_handleResponse;
                                http.send("act=news_comment&news_id="+news_id+"&name="+name+"&email="+email+"&title="+title+"&content="+content+"&sid="+Math.random());
                           }
                         }
                     }

}

// + ------------------- +
// |     KNOW COMMENT    |
// + ------------------- +

function submit_comment_know() {
        var know_id = document.getElementById("know_id").value;
        var name = document.getElementById("name_cmt").value;
        var email = document.getElementById("email").value;
        var title = document.getElementById("title").value;
        var content = document.getElementById("content").value;
        var content = content.replace(/&/g,"");  
                if(trim(name) == "" || trim(email) == "" || trim(title) == "" || trim(content) == "") {
                alert("Vui lòng nhập đầy đủ những thông tin trên!");
                 } else {
                        if (echeck(email)) {
                        if (confirm("Bạn có chắc những thông tin trên là chính xác?")) {
                                http.open('POST',  'submit_comment.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = comment_handleResponse;
                                http.send('act=know_comment&news_id='+know_id+'&name='+name+'&email='+email+'&title='+title+'&content='+content+'&sid='+Math.random());
                           }
                        }
                     }

}

// + ------------------- +
// |      CONTACT        |
// + ------------------- +

function contact_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("Cảm ơn! Chúng tôi sẽ liên lạc sớm nhất có thể!");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function submit_contact() {
        var contact_name = document.getElementById("contact_name").value;
        var email = document.getElementById("email").value;
        var phone = document.getElementById("phone").value;
        var content = document.getElementById("content").value;

                if(trim(contact_name) == "" || trim(content) == "") {
                alert("Vui lòng nhập đầy đủ thông tin ở những vùng đánh dấu sao!");
                 } else {
                        if (echeck(email)) {
                        if (confirm("Bạn có chắc những thông tin trên là đúng?")) {
                                http.open('POST',  'submit_contact.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = contact_handleResponse;
                                http.send('contact_name='+contact_name+'&email='+email+'&phone='+phone+'&content='+content+'&sid='+Math.random());
                           }
                        }
                     }

}

function reset_contact() {
        if (confirm("Bạn có muốn xoá hết để làm lại?")) {
                document.getElementById("contact_name").value ='';
                document.getElementById("email").value ='';
                document.getElementById("phone").value ='';
                document.getElementById("content").value ='';
        }
}

// + ------------------- +
// |     EMAIL INFO      |
// + ------------------- +

function email_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("Đã gửi thông tin theo yêu cầu!");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function send_email() {
        var name_send = document.getElementById("name_send").value;
        var email_send = document.getElementById("email_send").value;
        var name = document.getElementById("name_rec").value;
        var email = document.getElementById("email").value;
        var title = document.getElementById("title").value;
        var content = document.getElementById("content").value;
        var id = document.getElementById("id").value;
        var type = document.getElementById("type").value;
                if(trim(name) == "" || trim(email) == "" || trim(title) == "" || trim(content) == "") {
                alert("Vui lòng nhập đầy đủ những thông tin trên!");
                 } else {
                        if (echeck(email)) {
                        if (confirm("Bạn có chắc những thông tin trên là chính xác?")) {
                                http.open('POST',  'send_email.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = email_handleResponse;
                                http.send('name='+name+'&email='+email+'&name_send='+name_send+'&email_send='+email_send+'&title='+title+'&content='+content+'&type='+type+'&id='+id+'&sid='+Math.random());
                           }
                        }
                     }

}

// + ------------------- +
// |     EMAIL INFO EN   |
// + ------------------- +

function email_en_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("E-mail sent to your friend!");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function send_email_en() {
        var name = document.getElementById("name_rec").value;
        var email = document.getElementById("email").value;
        var title = document.getElementById("title").value;
        var content = document.getElementById("content").value;
                if(trim(name) == "" || trim(email) == "" || trim(title) == "" || trim(content) == "") {
                alert("Please submit all fields!");
                 } else {
                        if (echeck(email)) {
                        if (confirm("Do you want to continue?")) {
                                http.open('POST',  'send_email.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = email_en_handleResponse;
                                http.send('name='+name+'&email='+email+'&title='+title+'&content='+content+'&sid='+Math.random());
                           }
                        }
                     }

}

var dayarray_en=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray_en=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

function getthedate_en(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate="<small><font color='000000' face='Arial'><b>"+dayarray_en[day]+", "+montharray_en[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
+"</b></font></small>"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate_en()
function goforit_en(){
if (document.all||document.getElementById)
setInterval("getthedate_en()",1000)
}

// + ------------------- +
// |    NEWS COMMENT EN  |
// + ------------------- +

function comment_en_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("Comment received! We'll check it before display!");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function submit_comment_en() {
        var news_id = document.getElementById("news_id").value;
        var name = document.getElementById("name_cmt").value;
        var email = document.getElementById("email").value;
        var title = document.getElementById("title").value;
        var content = document.getElementById("content").value;
                if(trim(name) == "" || trim(email) == "" || trim(title) == "" || trim(content) == "") {
                alert("Please submit all fields!");
                 } else {
                        if (echeck(email)) {
                        if (confirm("Do you want to continue?")) {
                                http.open('POST',  'submit_comment.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = comment_en_handleResponse;
                                http.send('act=news_comment&news_id='+news_id+'&name='+name+'&email='+email+'&title='+title+'&content='+content+'&sid='+Math.random());
                           }
                         }
                     }

}

// + ------------------- +
// |     KNOW COMMENT    |
// + ------------------- +

function submit_comment_know_en() {
        var know_id = document.getElementById("know_id").value;
        var name = document.getElementById("name_cmt").value;
        var email = document.getElementById("email").value;
        var title = document.getElementById("title").value;
        var content = document.getElementById("content").value;
                if(trim(name) == "" || trim(email) == "" || trim(title) == "" || trim(content) == "") {
                alert("Please submit all fields!");
                 } else {
                        if (echeck(email)) {
                        if (confirm("Do you want to continue?")) {
                                http.open('POST',  'submit_comment.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = comment_en_handleResponse;
                                http.send('act=know_comment&news_id='+know_id+'&name='+name+'&email='+email+'&title='+title+'&content='+content+'&sid='+Math.random());
                           }
                        }
                     }

}

// + ------------------- +
// |      CONTACT EN     |
// + ------------------- +

function contact_en_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("Thank you! We'll reply as soon as we can!");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function contact_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("Chúng tôi sẽ trả lời nhanh nhất có thể!");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function submit_contact_en() {
        var contact_name = document.getElementById("contact_name").value;
        var email = document.getElementById("email").value;
        var phone = document.getElementById("phone").value;
        var content = document.getElementById("content").value;
        var subject = document.getElementById("subject").value;

                if(trim(contact_name) == "" || trim(content) == "" || trim(phone) == "" || trim(email) == "" || trim(subject) == "") {
                alert("Please submit all fields!");
                 } else {
                        if (echeck(email)) {
                        if (confirm("Do you want to continue?")) {
                                http.open('POST',  'submit_contact.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = contact_en_handleResponse;
                                http.send('subject='+subject+'&contact_name='+contact_name+'&email='+email+'&phone='+phone+'&content='+content+'&sid='+Math.random());
                           }
                         }
                     }

}

function submit_contact() {
        var contact_name = document.getElementById("contact_name").value;
        var email = document.getElementById("email").value;
        var phone = document.getElementById("phone").value;
        var content = document.getElementById("content").value;
        var subject = document.getElementById("subject").value;

                if(trim(contact_name) == "" || trim(content) == "" || trim(phone) == "" || trim(email) == "" || trim(subject) == "") {
                alert("Vui lòng nhập tất cả các ô có đánh dấu *!");
                 } else {
                        if (echeck(email)) {
                        if (confirm("Bạn có chắc những thông tin trên là chính xác?")) {
                                http.open('POST',  'submit_contact.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = contact_handleResponse;
                                http.send('subject='+subject+'&contact_name='+contact_name+'&email='+email+'&phone='+phone+'&content='+content+'&sid='+Math.random());
                           }
                        }
                     }

}

function reset_contact() {
        if (confirm("Bạn có muốn xoá hết để nhập lại?")) {
                document.getElementById("contact_name").value ='';
                document.getElementById("email").value ='';
                document.getElementById("phone").value ='';
                document.getElementById("content").value ='';
                document.getElementById("subject").value ='';
        }
}

function reset_contact_en() {
        if (confirm("Do you want to clear all fields")) {
                document.getElementById("contact_name").value ='';
                document.getElementById("email").value ='';
                document.getElementById("phone").value ='';
                document.getElementById("content").value ='';
                document.getElementById("subject").value ='';
        }
}

function move_step1() {
        document.getElementById("step1").style.display = "block";
        document.getElementById("step2").style.display = "none";
        document.getElementById("step3").style.display = "none";
        document.getElementById("step4").style.display = "none";
}

function move_step2() {
        var con_name = document.getElementById("con_name").value;
        var con_position = document.getElementById("con_position").value;
        var con_phone = document.getElementById("con_phone").value;
        var con_email = document.getElementById("con_email").value;
        var com_name = document.getElementById("com_name").value;
        var com_address = document.getElementById("com_address").value;
        var com_phone = document.getElementById("com_phone").value;
        if (trim(con_name) == "" || trim(con_position) == "" || trim(con_phone) == "" || trim(con_email) == "" || trim(com_name) == "" || trim(com_address) == "" || trim(com_phone) == "") {
                alert ("Vui lòng nhập các vùng đánh dấu *");
       } else {
        if (echeck(con_email)) {
        document.getElementById("step1").style.display = "none";
        document.getElementById("step2").style.display = "block";
        document.getElementById("step3").style.display = "none";
        document.getElementById("step4").style.display = "none";
        }
        }
}

function move_step3() {
        document.getElementById("step1").style.display = "none";
        document.getElementById("step2").style.display = "none";
        document.getElementById("step3").style.display = "block";
        document.getElementById("step4").style.display = "none";
}

function move_step4() {
        document.getElementById("step1").style.display = "none";
        document.getElementById("step2").style.display = "none";
        document.getElementById("step3").style.display = "none";
        document.getElementById("step4").style.display = "block";
}

function reset_step1() {
        if (confirm("Bạn có chắc muốn xoá hết thông tin ở bước này để điền lại không?")) {
                document.getElementById("con_name").value ='';
                document.getElementById("con_position").value ='';
                document.getElementById("con_phone").value ='';
                document.getElementById("con_email").value ='';
                document.getElementById("com_name").value ='';
                document.getElementById("com_address").value ='';
                document.getElementById("com_phone").value ='';
                document.getElementById("com_fax").value ='';
                document.getElementById("com_email").value ='';
                document.getElementById("com_website").value ='';
                document.getElementById("com_director").value ='';
                document.getElementById("com_taxcode").value ='';
                document.getElementById("com_business").value ='';
        }
}

function reset_step2() {
        if (confirm("Bạn có chắc muốn xoá hết thông tin ở bước này để điền lại không?")) {
                document.getElementById("com_history").value ='';
                document.getElementById("com_products").value ='';
                document.getElementById("com_structure").value ='';
        }
}

function reset_step3() {
        if (confirm("Bạn có chắc muốn xoá hết thông tin ở bước này để điền lại không?")) {
                document.getElementById("com_staff_des").value ='';
                document.getElementById("com_dealer").value ='';
                document.getElementById("com_informatics").value ='';
                document.getElementById("com_computer").value ='';
                document.getElementById("com_software").value ='';
        }
}

function reset_step4() {
        if (confirm("Bạn có chắc muốn xoá hết thông tin ở bước này để điền lại không?")) {
                document.getElementById("serv_develop").value ='';
                var serv_cat = document.getElementsByName("serv_cat");
                        for (var i = 0; i < serv_cat.length; i++) {
                        serv_cat[i].checked = false;
                        }
                document.getElementById("serv_cat_other").value ='';
                document.getElementById("serv_time").value ='';
                document.getElementById("serv_spend").value ='';
                document.getElementById("other").value ='';
        }
}

function submit_request() {
        var con_name = document.getElementById("con_name").value;
        var con_position = document.getElementById("con_position").value;
        var con_phone = document.getElementById("con_phone").value;
        var con_email = document.getElementById("con_email").value;
        var com_name = document.getElementById("com_name").value;
        var com_address = document.getElementById("com_address").value;
        var com_phone = document.getElementById("com_phone").value;
        var com_fax = document.getElementById("com_fax").value;
        var com_email = document.getElementById("com_email").value;
        var com_website = document.getElementById("com_website").value;
        var com_director = document.getElementById("com_director").value;
        var com_taxcode = document.getElementById("com_taxcode").value;
        var com_business = document.getElementById("com_business").value;
        var com_type = document.getElementById("com_type").value;
        var com_history = document.getElementById("com_history").value;
        var com_products = document.getElementById("com_products").value;
        var com_revenue = document.getElementById("com_revenue").value;
        var com_revenue2 = document.getElementById("com_revenue2").value;
        var com_worker = document.getElementById("com_worker").value;
        var com_structure = document.getElementById("com_structure").value;
        var com_staff_des = document.getElementById("com_staff_des").value;
        var com_dealer = document.getElementById("com_dealer").value;
        var com_informatics = document.getElementById("com_informatics").value;
        var com_computer = document.getElementById("com_computer").value;
        var com_software = document.getElementById("com_software").value;
        var type = document.getElementsByName("serv_type");
        if (type[0].checked) serv_type_val = type[0].value;
        if (type[1].checked) serv_type_val = type[1].value;
        var serv_develop = document.getElementById("serv_develop").value;
        var serv_cat_other = document.getElementById("serv_cat_other").value;
        var serv_time = document.getElementById("serv_time").value;
        var serv_spend = document.getElementById("serv_spend").value;
        var other = document.getElementById("other").value;
        var serv_cat_value = "";
        var serv_cat = document.getElementsByName("serv_cat");
              for (var i = 0; i < serv_cat.length; i++) {
              if (serv_cat[i].checked) { serv_cat_value +=","+i  }
              }
       if (trim(con_name) == "" || trim(con_position) == "" || trim(con_phone) == "" || trim(con_email) == "" || trim(com_name) == "" || trim(com_address) == "" || trim(com_phone) == "") {
                alert ("Vui lòng nhập các vùng đánh dấu *");
       } else {
                if (echeck(con_email)) {
                if (confirm("Bạn có muốn tiếp tục?")) {
                        http.open('POST',  'submit_request.php');
                        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                        http.onreadystatechange = request_handleResponse;
                        http.send('con_name='+con_name+'&con_position='+con_position+'&con_phone='+con_phone+'&con_email='+con_email+'&com_name='+com_name+'&com_address='+com_address+'&com_phone='+com_phone+'&com_fax='+com_fax+'&com_email='+com_email+'&com_website='+com_website+'&com_director='+com_director+'&com_taxcode='+com_taxcode+'&com_business='+com_business+'&com_type='+com_type+'&com_history='+com_history+'&com_products='+com_products+'&com_revenue='+com_revenue+'&com_revenue2='+com_revenue2+'&com_worker='+com_worker+'&com_structure='+com_structure+'&com_staff_des='+com_staff_des+'&com_dealer='+com_dealer+'&com_informatics='+com_informatics+'&com_computer='+com_computer+'&com_software='+com_software+'&serv_type='+serv_type_val+'&serv_develop='+serv_develop+'&serv_cat_other='+serv_cat_other+'&serv_time='+serv_time+'&serv_spend='+serv_spend+'&other='+other+'&serv_cat_value='+serv_cat_value+'&sid='+Math.random());
                        }
                }

       }

}

function submit_request2() {
        var con_name = document.getElementById("con_name").value;
        var con_position = document.getElementById("con_position").value;
        var con_phone = document.getElementById("con_phone").value;
        var con_email = document.getElementById("con_email").value;
        var com_name = document.getElementById("com_name").value;
        var com_address = document.getElementById("com_address").value;
        var com_phone = document.getElementById("com_phone").value;
        var com_fax = document.getElementById("com_fax").value;
        var com_email = document.getElementById("com_email").value;
        var com_website = document.getElementById("com_website").value;
        var com_director = document.getElementById("com_director").value;
        var com_taxcode = document.getElementById("com_taxcode").value;
        var com_business = document.getElementById("com_business").value;
        var com_type = document.getElementById("com_type").value;
        var com_history = document.getElementById("com_history").value;
        var com_products = document.getElementById("com_products").value;
        var com_revenue = document.getElementById("com_revenue").value;
        var com_revenue2 = document.getElementById("com_revenue2").value;
        var com_worker = document.getElementById("com_worker").value;
        var com_structure = document.getElementById("com_structure").value;
        var com_staff_des = document.getElementById("com_staff_des").value;
        var com_dealer = document.getElementById("com_dealer").value;
        var com_informatics = document.getElementById("com_informatics").value;
        var com_computer = document.getElementById("com_computer").value;
        var com_software = document.getElementById("com_software").value;
        var serv_type = document.getElementById("serv_type").value;
        var other = document.getElementById("other").value;
       if (trim(con_name) == "" || trim(con_position) == "" || trim(con_phone) == "" || trim(con_email) == "" || trim(com_name) == "" || trim(com_address) == "" || trim(com_phone) == "") {
                alert ("Vui lòng nhập các vùng đánh dấu *");
       } else {
                if (echeck(con_email)) {
                if (confirm("Bạn có muốn tiếp tục?")) {
                        http.open('POST',  'submit_request.php');
                        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                        http.onreadystatechange = request_handleResponse;
                        http.send('con_name='+con_name+'&con_position='+con_position+'&con_phone='+con_phone+'&con_email='+con_email+'&com_name='+com_name+'&com_address='+com_address+'&com_phone='+com_phone+'&com_fax='+com_fax+'&com_email='+com_email+'&com_website='+com_website+'&com_director='+com_director+'&com_taxcode='+com_taxcode+'&com_business='+com_business+'&com_type='+com_type+'&com_history='+com_history+'&com_products='+com_products+'&com_revenue='+com_revenue+'&com_revenue2='+com_revenue2+'&com_worker='+com_worker+'&com_structure='+com_structure+'&com_staff_des='+com_staff_des+'&com_dealer='+com_dealer+'&com_informatics='+com_informatics+'&com_computer='+com_computer+'&com_software='+com_software+'&serv_type='+serv_type+'&other='+other+'&sid='+Math.random());
                        }
                }

       }

}

function request_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("Cám ơn quý doanh nghiệp đã đăng ký dịch vụ, chúng tôi sẽ cố gắng phản hồi trong thời gian sớm nhất.");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

// + ------------------- +
// |     POOL SUBMIT     |
// + ------------------- +
function submit_vote(id) {
        var tt_opt = document.getElementsByName(id).length;
        var opt = document.getElementsByName(id);
        var c= "";
        for(var i = 0; i < tt_opt; i++) {
                if(opt[i].checked) {
                        var c = opt[i].value;
                }
        }
        if (trim(c) == "") {
        alert ("Vui lòng chọn câu trả lời trước khi bình chọn!");
        } else {
                        http.open('POST',  'submit_vote.php');
                        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                        http.onreadystatechange = voted_handleResponse;
                        http.send('pool_id='+id+'&opt_id='+c+'&sid='+Math.random());
        }

}

function voted_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("Đã nhận ý kiến của bạn! Cảm ơn!");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

// + ------------------- +
// |     POOL SUBMIT EN  |
// + ------------------- +
function submit_vote_en(id) {
        var tt_opt = document.getElementsByName(id).length;
        var opt = document.getElementsByName(id);
        var c= "";
        for(var i = 0; i < tt_opt; i++) {
                if(opt[i].checked) {
                        var c = opt[i].value;
                }
        }
        if (trim(c) == "") {
        alert ("Please select your answer before submit!");
        } else {
                        http.open('POST',  'submit_vote.php');
                        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                        http.onreadystatechange = voted_en_handleResponse;
                        http.send('pool_id='+id+'&opt_id='+c+'&sid='+Math.random());
        }

}

function voted_en_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("You'd voted this pool! Thank you!");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function page_focus() {
       var name = document.getElementById("name_cmt");
       name.focus();
}

// + ------------------- +
// |       LOGIN VN      |
// + ------------------- +

function login_user_vn_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("Đăng nhập thành công!");
                                url = window.location.href;
                                url = url.replace("#","");
                                window.location.href = url;
                        }
                }
        }
        catch(e){}
        finally{}
}

function login_user_vn() {
        var name = document.getElementById("name").value;
        var pwd = document.getElementById("password").value;
        if (trim(name) == "" && trim(pwd) == "") {
        alert("Vui lòng nhập tài khoản/mật khẩu để đăng nhập");
        return false;
        } else {
                http.open('POST',  'source/member_login.php');
                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                http.onreadystatechange = login_user_vn_handleResponse;
                http.send('name='+name+'&pwd='+pwd+'&sid='+Math.random());
                return false;
        }
}

function login_user_vn1() {
        var name = document.getElementById("name1").value;
        var pwd = document.getElementById("password1").value;
        if (trim(name) == "" && trim(pwd) == "") {
        alert("Vui lòng nhập tài khoản/mật khẩu để đăng nhập");
        return false;
        } else {
                http.open('POST',  'source/member_login.php');
                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                http.onreadystatechange = login_user_vn_handleResponse;
                http.send('name='+name+'&pwd='+pwd+'&sid='+Math.random());
                return false;
        }
}

// + ------------------- +
// |       LOGIN EN      |
// + ------------------- +

function login_user_en_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert ("Login success!");
                                url = window.location.href;
                                url = url.replace("#","");
                                window.location.href = url;
                        }
                }
        }
        catch(e){}
        finally{}
}

function login_user_en() {
        var name = document.getElementById("name").value;
        var pwd = document.getElementById("password").value;
        if (trim(name) == "" && trim(pwd) == "") {
        alert("You must enter username & password to login");
        return false;
        } else {
                http.open('POST',  'source/member_login.php');
                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                http.onreadystatechange = login_user_en_handleResponse;
                http.send('name='+name+'&pwd='+pwd+'&sid='+Math.random());
                return false;
        }
}

function login_user_en1() {
        var name = document.getElementById("name1").value;
        var pwd = document.getElementById("password1").value;
        if (trim(name) == "" && trim(pwd) == "") {
        alert("You must enter username & password to login");
        return false;
        } else {
                http.open('POST',  'source/member_login.php');
                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                http.onreadystatechange = login_user_en_handleResponse;
                http.send('name='+name+'&pwd='+pwd+'&sid='+Math.random());
                return false;
        }
}

// + ------------------- +
// |      LOGOUT EN      |
// + ------------------- +
function user_logout_en() {
        if (confirm("You really want to log out?")) {
                var url="source/member_logout.php";
                http.open("GET",url,true);
                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                http.onreadystatechange = user_logout_en_handleResponse;
                http.send(null);
        }
}

function user_logout_en_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (!response) {
                                url = window.location.href;
                                url = url.replace("#","");
                                window.location.href = url;
                        }
                }
        }
        catch(e){}
        finally{}
}

// + ------------------- +
// |      LOGOUT VN      |
// + ------------------- +
function user_logout_vn() {
        if (confirm("Bạn muốn đăng xuất khỏi hệ thống?")) {
                var url="source/member_logout.php";
                http.open("GET",url,true);
                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                http.onreadystatechange = user_logout_vn_handleResponse;
                http.send(null);
        }
}

function user_logout_vn_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (!response) {
                                url = window.location.href;
                                url = url.replace("#","");
                                window.location.href = url;
                        }
                }
        }
        catch(e){}
        finally{}
}

function reset_comment() {
        if (confirm("Bạn có muốn xoá hết để nhập lại?")) {
                document.getElementById("name_cmt").value ='';
                document.getElementById("email").value ='';
                document.getElementById("content").value ='';
                document.getElementById("title").value ='';
        }
}

function reset_comment_en() {
        if (confirm("Do you want to clear all fields?")) {
                document.getElementById("name_cmt").value ='';
                document.getElementById("email").value ='';
                document.getElementById("content").value ='';
                document.getElementById("title").value ='';
        }
}

// + ------------------- +
// |    EMAIL AVAILABLE  |
// + ------------------- +

function check_email() {
        var email = document.getElementById("email").value;
        if(     trim(email) == "")
                alert("Bạn chưa nhập E-mail");
        else {
                if (echeck(email)) {
                http.open('POST',  'source/check_email.php');
                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                http.onreadystatechange = checkemail_handleResponse;
                http.send('email='+email+'&sid='+Math.random());
                }

        }
        return false;
}

function checkemail_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                document.getElementById("checkemail_loading").innerHTML = response;
                                document.getElementById("checkemail_loading").style.display = "block";
                        }
                }
        }
        catch(e){}
        finally{}
}

// + ------------------- +
// |      REGISTER EN    |
// + ------------------- +

function submit_register_en_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                document.getElementById("reg_loading").innerHTML = response;
                                document.getElementById("reg_loading").style.display = "block";
                        }
                        else {
                                alert("Your account will be reviewed before using. Thanks for register!");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function submit_register_en() {
        var email = document.getElementById("email").value;
        var name = document.getElementById("contact_name").value;
        var company = document.getElementById("company").value;
        var title = document.getElementById("title").value;
        var address = document.getElementById("address").value;
        var city = document.getElementById("city").value;
        var country = document.getElementById("country").value;
        var phone = document.getElementById("phone").value;
        var interest = document.getElementById("interest").value;
        var role = document.getElementById("role").value;
        var industry = document.getElementById("industry").value;
        var project = document.getElementById("project").value;
        var note = document.getElementById("note").value;
        var agree = document.getElementById("agree").checked;

                if(trim(email) == "" || trim(name) == "" || trim(title) == "" || trim(address) == "" || trim(city) == "" || trim(country) == "" || trim(phone) == "")
                alert("Please submit all fields.");
                else if (!agree) alert("You are not agree with the Terms of Service.");
                else {
                                http.open('POST',  'source/register.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = submit_register_en_handleResponse;
                                http.send('email='+email+'&name='+name+'&title='+title+'&company='+company+'&address='+address+'&city='+city+'&country='+country+'&phone='+phone+'&interest='+interest+'&role='+role+'&industry='+industry+'&project='+project+'&note='+note+'&sid='+Math.random());

                     }

}

function reset_register_en() {
        if (confirm("Do you want to clear all fields?")) {
                document.getElementById("contact_name").value ='';
                document.getElementById("title").value ='';
                document.getElementById("company").value ='';
                document.getElementById("address").value ='';
                document.getElementById("city").value ='';
                document.getElementById("country").value ='';
                document.getElementById("phone").value ='';
                document.getElementById("project").value ='';
                document.getElementById("note").value ='';
        }
}

// + ------------------- +
// |      REGISTER VN    |
// + ------------------- +

function submit_register_vn_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                document.getElementById("reg_loading").innerHTML = response;
                                document.getElementById("reg_loading").style.display = "block";
                        }
                        else {
                                alert("Tài khoản của bạn sẽ được admin kích hoạt trước khi sử dụng. Cảm ơn đã đăng kí!");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function submit_register_vn() {
        var email = document.getElementById("email").value;
        var name = document.getElementById("contact_name").value;
        var company = document.getElementById("company").value;
        var title = document.getElementById("title").value;
        var address = document.getElementById("address").value;
        var city = document.getElementById("city").value;
        var country = document.getElementById("country").value;
        var phone = document.getElementById("phone").value;
        var interest = document.getElementById("interest").value;
        var role = document.getElementById("role").value;
        var industry = document.getElementById("industry").value;
        var project = document.getElementById("project").value;
        var note = document.getElementById("note").value;
        var agree = document.getElementById("agree").checked;

                if(trim(email) == "" || trim(name) == "" || trim(title) == "" || trim(address) == "" || trim(city) == "" || trim(country) == "" || trim(phone) == "")
                alert("Vui lòng nhập đầy đủ các vùng có đánh dấu *.");
                else if (!agree) alert("Bạn chưa đồng ý với các Điều kiện sử dụng.");
                else {
                                http.open('POST',  'source/register.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = submit_register_en_handleResponse;
                                http.send('email='+email+'&name='+name+'&title='+title+'&company='+company+'&address='+address+'&city='+city+'&country='+country+'&phone='+phone+'&interest='+interest+'&role='+role+'&industry='+industry+'&project='+project+'&note='+note+'&sid='+Math.random());

                     }

}

function reset_register_vn() {
        if (confirm("Bạn muốn xoát hết để làm lại?")) {
                document.getElementById("contact_name").value ='';
                document.getElementById("title").value ='';
                document.getElementById("company").value ='';
                document.getElementById("address").value ='';
                document.getElementById("city").value ='';
                document.getElementById("country").value ='';
                document.getElementById("phone").value ='';
                document.getElementById("project").value ='';
                document.getElementById("note").value ='';
        }
}

// + ------------------- +
// |    UPDATE INFO EN   |
// + ------------------- +

function submit_info_en_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert("Your information has been changed.");
                                window.location.href = 'member.php?act=info';
                        }
                }
        }
        catch(e){}
        finally{}
}

function submit_info_en() {
        var name = document.getElementById("contact_name").value;
        var company = document.getElementById("company").value;
        var title = document.getElementById("title").value;
        var address = document.getElementById("address").value;
        var city = document.getElementById("city").value;
        var country = document.getElementById("country").value;
        var phone = document.getElementById("phone").value;
        var interest = document.getElementById("interest").value;
        var role = document.getElementById("role").value;
        var industry = document.getElementById("industry").value;
        var project = document.getElementById("project").value;
        var note = document.getElementById("note").value;
                if(trim(name) == "" || trim(address) == "" || trim(title) == "" || trim(city) == "" || trim(country) == "" || trim(phone) == "")
                alert("Please submit all fields.");
                else {
                                http.open('POST',  'source/member_info.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = submit_info_en_handleResponse;
                                http.send('&name='+name+'&title='+title+'&company='+company+'&address='+address+'&city='+city+'&country='+country+'&phone='+phone+'&interest='+interest+'&role='+role+'&industry='+industry+'&project='+project+'&note='+note+'&sid='+Math.random());

                     }

}

// + ------------------- +
// |     RESET INFO EN   |
// + ------------------- +
function reset_info_en() {
        if (confirm("Do you want to clear all fields?")) {
                document.getElementById("contact_name").value ='';
                document.getElementById("company").value ='';
                document.getElementById("title").value ='';
                document.getElementById("address").value ='';
                document.getElementById("city").value ='';
                document.getElementById("country").value ='';
                document.getElementById("phone").value ='';
                document.getElementById("project").value ='';
                document.getElementById("note").value ='';
        }
}

// + ------------------- +
// |     UPDATE PWD EN   |
// + ------------------- +
function update_pass_en() {
        var old_pwd = encodeURIComponent(document.getElementById("old_pwd").value);
        var new_pwd = encodeURIComponent(document.getElementById("new_pwd").value);
        var new_pwd2 = encodeURIComponent(document.getElementById("new_pwd2").value);

        if (trim(old_pwd) == "" || trim(new_pwd) == "" || trim(new_pwd2) == "") alert ("Please submit all fields");
        else if (old_pwd.length <=5 || new_pwd.length <=5 || new_pwd2.length <=5) alert ("All passwords must be at least 6 character");
        else if (old_pwd == new_pwd2) alert("Old password & new password cannot be the same.");
        else if (new_pwd != new_pwd2) alert("Repeat password is not match.");
        else {
                http.open('POST',  'source/member_pass.php');
                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                http.onreadystatechange = update_pass_en_handleResponse;
                http.send('old_pwd='+old_pwd+'&new_pwd='+new_pwd+'&sid='+Math.random());
        }
}

function update_pass_en_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        } else {
                        alert ("Password changed! You can use new password to login!");
                        window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function reset_pass_en() {
        if (confirm("Do you want to clear all fields?")) {
                document.getElementById("old_pwd").value ='';
                document.getElementById("new_pwd").value ='';
                document.getElementById("new_pwd2").value ='';
        }
}

// + ------------------- +
// |    FORGOT PWD EN    |
// + ------------------- +

function forgot_pass_en_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert("New password has been emailed to your account.");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function forgot_pass_en() {
        var email = document.getElementById("email").value;
                if(trim(email) == "")
                alert("Please submit your email account.");
                else {
                        if (echeck(email)) {
                                http.open('POST',  'source/member_for_pwd.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = forgot_pass_en_handleResponse;
                                http.send('email='+email+'&sid='+Math.random());
                        }
                     }

}


// + ------------------- +
// |     UPDATE PWD VN   |
// + ------------------- +
function update_pass_vn() {
        var old_pwd = encodeURIComponent(document.getElementById("old_pwd").value);
        var new_pwd = encodeURIComponent(document.getElementById("new_pwd").value);
        var new_pwd2 = encodeURIComponent(document.getElementById("new_pwd2").value);

        if (trim(old_pwd) == "" || trim(new_pwd) == "" || trim(new_pwd2) == "") alert ("Vui lòng nhập tất cả các ô trên");
        else if (old_pwd.length <=5 || new_pwd.length <=5 || new_pwd2.length <=5) alert ("Tất cả mật khẩu phải ít nhất 6 kí tự");
        else if (old_pwd == new_pwd2) alert("Mật khẩu cũ và mới không được trùng nhau.");
        else if (new_pwd != new_pwd2) alert("Mật khẩu nhập lại không trùng.");
        else {
                http.open('POST',  'source/member_pass.php');
                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                http.onreadystatechange = update_pass_vn_handleResponse;
                http.send('old_pwd='+old_pwd+'&new_pwd='+new_pwd+'&sid='+Math.random());
        }
}

function update_pass_vn_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        } else {
                        alert ("Mật khẩu đã được thay đổi! Bạn có thể dử dụng mật khẩu mới để đăng nhập!");
                        window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function reset_pass_vn() {
        if (confirm("Bạn muốn xoát hết để làm lại?")) {
                document.getElementById("old_pwd").value ='';
                document.getElementById("new_pwd").value ='';
                document.getElementById("new_pwd2").value ='';
        }
}

// + ------------------- +
// |    UPDATE INFO EN   |
// + ------------------- +

function submit_info_vn_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert("Thông tin cá nhân đã được thay đổi.");
                                window.location.href = 'member.php?act=info';
                        }
                }
        }
        catch(e){}
        finally{}
}

function submit_info_vn() {
         var name = document.getElementById("contact_name").value;
        var company = document.getElementById("company").value;
        var title = document.getElementById("title").value;
        var address = document.getElementById("address").value;
        var city = document.getElementById("city").value;
        var country = document.getElementById("country").value;
        var phone = document.getElementById("phone").value;
        var interest = document.getElementById("interest").value;
        var role = document.getElementById("role").value;
        var industry = document.getElementById("industry").value;
        var project = document.getElementById("project").value;
        var note = document.getElementById("note").value;
                if(trim(name) == "" || trim(address) == "" || trim(title) == "" || trim(city) == "" || trim(country) == "" || trim(phone) == "")
                alert("Vui lòng nhập tất cả các vùng có dấu sao.");
                else {
                                http.open('POST',  'source/member_info.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = submit_info_vn_handleResponse;
                                http.send('&name='+name+'&title='+title+'&company='+company+'&address='+address+'&city='+city+'&country='+country+'&phone='+phone+'&interest='+interest+'&role='+role+'&industry='+industry+'&project='+project+'&note='+note+'&sid='+Math.random());

                     }

}

// + ------------------- +
// |     RESET INFO EN   |
// + ------------------- +
function reset_info_vn() {
        if (confirm("Bạn muốn xoát hết để làm lại?")) {
                document.getElementById("contact_name").value ='';
                document.getElementById("company").value ='';
                document.getElementById("title").value ='';
                document.getElementById("address").value ='';
                document.getElementById("city").value ='';
                document.getElementById("country").value ='';
                document.getElementById("phone").value ='';
                document.getElementById("project").value ='';
                document.getElementById("note").value ='';
        }
}

// + ------------------- +
// |    FORGOT PWD VN    |
// + ------------------- +

function forgot_pass_vn_handleResponse() {
        try {
                if((http.readyState == 4)&&(http.status == 200)){
                        var response = http.responseText;
                        if (response) {
                                alert(response);
                        }
                        else {
                                alert("Mật khẩu mới đã được gửi về email của bạn.");
                                window.location.href = 'index.php';
                        }
                }
        }
        catch(e){}
        finally{}
}

function forgot_pass_vn() {
        var email = document.getElementById("email").value;
                if(trim(email) == "")
                alert("Vui lòng nhập địa chỉ email của bạn.");
                else {
                        if (echeck(email)) {
                                http.open('POST',  'source/member_for_pwd.php');
                                http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                                http.onreadystatechange = forgot_pass_vn_handleResponse;
                                http.send('email='+email+'&sid='+Math.random());
                        }
                     }

}

function whichButton(event)
{
if (event.button==2)//RIGHT CLICK
{
alert("Vui lòng đăng nhập/đăng ký thành viên!");
window.location.href = 'member.php';
}

}
function noCTRL(e)
{
var code = (document.all) ? event.keyCode:e.which;

var msg = "Vui lòng đăng nhập/đăng ký thành viên!";
if (parseInt(code)==17) //CTRL
{
alert(msg);
window.location.href = 'member.php';
window.event.returnValue = false;
}
}

// + ------------------- +
// |     S SEARCH EN     |
// + ------------------- +
function search() {
        var kw = document.getElementById("kw").value;
        if (trim(kw) == "") {
        alert ("Please submit your keyword");
        return false;
        } else {
        window.location.href = 'search.php?act=simple&kw='+kw;
        return false;
        }
}

// + ------------------- +
// |     A SEARCH EN     |
// + ------------------- +
function advance_search() {
        var kw = document.getElementById("kw").value;
        var type = document.getElementById("selOne").value;
        if (trim(type) == "news") {
        var cat = document.getElementById("cat_news").value;
        }
        if (trim(type) == "knowledge") {
        var cat = document.getElementById("cat_know").value;
        }
        if (trim(type) == "service") {
        var cat = document.getElementById("cat_serv").value;
        }
        if (trim(kw) == "") {
        alert ("Please submit your keyword");
        return false;
        } else {
        if (trim(type) == "all") {
        window.location.href = 'search.php?act=simple&kw='+kw;
        return false;
        } else {
        window.location.href = 'search.php?act=advance&type='+type+'&cat='+cat+'&kw='+kw;
        return false;
        }
        }
}

// + ------------------- +
// |     S SEARCH VN     |
// + ------------------- +
function search_vn() {
        var kw = document.getElementById("kw").value;
        if (trim(kw) == "") {
        alert ("Vui lòng nhập từ khoá");
        return false;
        } else {
        window.location.href = 'search.php?act=simple&kw='+kw;
        return false;
        }
}

// + ------------------- +
// |     A SEARCH VN     |
// + ------------------- +
function advance_search_vn() {
        var kw = document.getElementById("kw").value;
        var type = document.getElementById("selOne").value;
        if (trim(type) == "news") {
        var cat = document.getElementById("cat_news").value;
        }
        if (trim(type) == "knowledge") {
        var cat = document.getElementById("cat_know").value;
        }
        if (trim(type) == "service") {
        var cat = document.getElementById("cat_serv").value;
        }
        if (trim(kw) == "") {
        alert ("Vui lòng nhập từ khoá");
        return false;
        } else {
        if (trim(type) == "all") {
        window.location.href = 'search.php?act=simple&kw='+kw;
        return false;
        } else {
        window.location.href = 'search.php?act=advance&type='+type+'&cat='+cat+'&kw='+kw;
        return false;
        }
        }
}
