// JavaScript Document
function viewsubject(url)
{
	if(document.getElementById('c_cate').value == ''){
		alert("Vui lòng chọn chủ đề!");
		document.getElementById('c_cate').focus();
		return false;
	}
	window.location = url + document.getElementById('c_cate').value;
}

function validatelogin()
{
	if(document.getElementById('str_top_wtt_id').value==''){
		alert ("Vui lòng nhập IDWTT  !");
		document.getElementById('str_top_wtt_id').focus();
		return false;
	}
	if(document.getElementById('str_top_wtt_pass').value==''){
		alert ("Vui lòng nhập mật khẩu !");
		document.getElementById('str_top_wtt_pass').focus();
		return false;
	}
	return true;
}

function login(url,show)
{
	if(document.getElementById('idwtt').value==''){
		alert ("Vui lòng nhập IDWTT  !");
		document.getElementById('idwtt').focus();
		return ;
	}
	if(document.getElementById('pass').value==''){
		alert ("Vui lòng nhập mật khẩu !");
		document.getElementById('pass').focus();
		return ;
	}
	document.formlogin.submit();
	/*
	var idwtt=document.getElementById('idwtt').value;
	var pass=document.getElementById('pass').value;
	var poststr = "idwtt=" + encodeURIComponent(idwtt)+ "&" + "pass=" + encodeURIComponent(pass);
	makePOSTRequest(url, poststr,show);
	*/
}
function popup( windowWidth, windowHeight, windowName, windowUri, windowscroll)
{
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;
    newWindow = window.open(windowUri, windowName, 'resizable=no,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight +
		',scrollbars='+windowscroll);
    newWindow.focus();
    return newWindow.name;
}

function answerview(id,type)
{
	var poststr = "id=" + encodeURIComponent(id) + "&type=" + encodeURIComponent(type) ;
	makePOSTRequest('http://www.webtretho.com/tuvan/index.php/question/answer', poststr,'answerview');
	
}

function changepage(url,div)
{
    makePOSTRequest(url, '',div);
}

function valsearch(frm){ 
	if(frm.strSearch.value==''){
		alert('Nhập thông tin cần tìm');
		frm.strSearch.focus();
		return false;
	}
	return true;
}

