﻿
function SendRegistInfo() {			// Gui thong tin dang ky thanh vien
  var url = page_domain + '/import.php';
  var postdata  = '';
  var username  = document.regform.username.value;
  var password  = document.regform.password.value;
  var cpassword = document.regform.cpassword.value;
  var email	= document.regform.email.value;
  var ccode  = document.regform.ccode.value;
  var cvalue  = document.regform.cvalue.value;
  
  if ((username=='') || (email=='') || (password=='') || (cpassword=='') || (ccode=='')) {
	alert(' Bạn hãy điền đầy đủ những thông tin cần thiết  !  ');
	
  } else {
        postdata = 'f=register&username=' + username + '&password=' + password;
	postdata+= '&cpassword=' + cpassword + '&email=' + email + '&ccode=' + ccode + '&cvalue=' + cvalue;
	    MakeRequest(url, 'PrintResult', 'POST', postdata);
	    DisableClick('regbutton');
 }

}



function GetMyPass() {			// Gui thong tin dang ky thanh vien
  var url = page_domain + '/import.php';
  var postdata  = '';
  var email  = document.pasform.email.value;
  var cvalue  = document.pasform.cvalue.value;
  var ccode  = document.pasform.ccode.value;
  
  if ((ccode=='') || (email=='')) {
	alert(' Bạn hãy điền đầy đủ những thông tin cần thiết  !  ');
	
  } else {
            postdata = 'f=register&o=getpassword&email=' + email + '&ccode=' + ccode + '&cvalue=' + cvalue;
	    MakeRequest(url, 'PrintResult', 'POST', postdata);
	    DisableClick('regpassbutton');

 }

}


 
 function SendContact() {			// Gui thong tin dang ky thanh vien
  var url = page_domain + '/import.php';
  var postdata  = '';
  var name  = document.contactform.name.value;
  var email  = document.contactform.email.value;
  var location	= document.contactform.location.value;
  var title  = document.contactform.title.value;
  var content  = document.contactform.content.value;
  var ccode  = document.contactform.ccode.value;
  var cvalue  = document.contactform.cvalue.value;
  out_id="contact_form";
  
  if ((name=='') || (email=='') || (location=='') || (title=='') || (content=='') || (ccode=='')) {
	alert(' Bạn hãy điền đầy đủ những thông tin cần thiết !  ');
  } else {
        postdata = 'f=contact&name=' + name + '&email=' + email;
	postdata+= '&location=' + location + '&title=' + title + '&content=' + content + '&ccode=' + ccode + '&cvalue=' + cvalue;
	    MakeRequest(url, 'PrintResult', 'POST', postdata);
	    DisableClick('contactbutton');
 }

}

  function SendEmailFriend() {
  var url = page_domain + '/import.php';
  var postdata  = '';
  
  var name  = document.emailfform.name.value;
  var email  = document.emailfform.email.value;
  var content  = document.emailfform.content.value;
  var ccode  = document.emailfform.ccode.value;
  var cvalue  = document.emailfform.cvalue.value;
  
  if ((name=='') || (email=='') || (content=='') || (ccode=='')) {
	alert(' Bạn hãy điền đầy đủ những thông tin cần thiết !  ');
  }  else {
        postdata = 'f=emailfriend&sendname=' + name + '&email=' + email;
	postdata+= '&content=' + content + '&ccode=' + ccode + '&cvalue=' + cvalue;
	out_id = 'emailfriend_form';
	MakeRequest(url, 'PrintResult', 'POST', postdata);
	DisableClick('emailfbutton');
 }
}



function BookMark() { // Them mot danh dau trang moi
	var title = document.bookmarkform.title.value;
	if(title=='') {
		alert(' Nhận tiêu đề cho đánh dấu của bạn ! ');
		document.bookmarkform.title.focus();
	} else {
		var url = page_domain + '/import.php';
		var postdata = 'f=bookmark&o=new&title=' + title;
		out_id = 'bookmark_form';
		DisableClick('bookmarkbutton');
		MakeRequest(url, 'PrintResult', 'POST', postdata);
	}

}


function SendUserContent(libname) {
	var content = document.getElementById('libform_' + libname).content.value;
	if(content=="") {
		alert(" Bạn cần nhập nội dung vào ");
	} else {
	      var url = page_domain + '/import.php';
	      var postdata = 'f=usersend&userinfo=' + document.getElementById('libform_' + libname).userinfo.value + '&sendtype=' + document.getElementById('libform_' + libname).sendtype.value + '&senddata=' + content;
        out_id = 'library_form_' + libname;
		DisableClick('libbutton_' + libname);
		MakeRequest(url, 'PrintResult', 'POST', postdata);
	}
}


function DisableClick(idf) {  // khoa cac nut dang nhap khi nhap submit
    document.getElementById(idf).disabled='disabled';
    document.getElementById(idf).value=' Đang tải...';
}




function Changetopiclist(){  // Thay doi danh sach chu de trong trang viet bai
    var id = document.postform.fid.value;
	var data = document.getElementById('tidlist_' + id).innerHTML;
	document.getElementById('tidinnerhere').innerHTML = data;
}

  
