function showDateVN()
{
	var strdate;
	var dt = new Date();
	var strarrDay = new Array("Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"); 
	var strarrMonth = new Array("01","02","03","04","05","06","07","08","09","10","11","12"); 
		
	var strThu = dt.getDay();
	strThu = strarrDay[strThu] + ", ";
	var strDay=dt.getDate();
	if (strDay<10) strDay="0" + strDay
	var strMonth= dt.getMonth();
	strMonth= strarrMonth[strMonth] ;
	var strYears = dt.getYear();
	if (strYears<1900) strYears += 1900;
		
	strdate=strThu + " " + strDay + "-" + strMonth + "-" + strYears
	window.document.write (strdate);
}

function doPage(Cat_id, PageIndex)
{
	var frmSubmit=document.frmwebsite;
	frmSubmit.action="default.aspx?cat_id=" + Cat_id + "&PageIndex=" + PageIndex;
	frmSubmit.submit();
}

function doPageList(Cat_id, PageIndex)
{
	var frmSubmit=document.frmwebsite;
	frmSubmit.action="default.aspx?cat_id=" + Cat_id + "&PageIndex=" + PageIndex + "&tab=1";
	frmSubmit.submit();
}

function doPageSearchList(PageIndex)
{
	var frmSubmit=document.frmwebsite;
	frmSubmit.action="default.aspx?fsearch=1" + "&PageIndex=" + PageIndex + "#list";
	frmSubmit.submit();
}
	 
function doSearch()
{ 	
	var frmSubmit=document.frmwebsite;
	frmSubmit.method="post";
	frmSubmit.action="default.aspx?fsearch=1#list";
	frmSubmit.submit();
}

function checkContactForm()
{
	var frmForm=document.frmContact;
	var fullname;
	var content;
	
	fullname=trimstring(frmForm.txtFullname.value);
	if (fullname=="") 
	{
		alert("Vui long nhap ho ten.");
		frmForm.txtFullname.focus();
		return false;
	}
	if ((fullname.search("scrip")>=0)||(fullname.search("objec")>=0)||(fullname.search("apple")>=0)||(fullname.search("embe")>=0))
	{
		alert("Ho ten khong hop le.");
		frmForm.txtFullname.focus();
		return false; 
	}	
	
	content=trimstring(frmForm.txtContent.value);
	if (content=="") 
	{
		alert("Vui long nhap noi dung.");
		frmForm.txtContent.focus();
		return false;
	}
	if ((content.search("scrip")>=0)||(content.search("objec")>=0)||(content.search("apple")>=0)||(content.search("embe")>=0))
	{
		alert("Noi dung khong hop le.");
		frmForm.txtContent.focus();
		return false; 
	}
	return true;
}

function checkFeedbackForm()
{
	var frmForm=document.frmFeedback;
	var fullname;
	var content;
	
	fullname=trimstring(frmForm.txtFullname.value);
	if (fullname=="") 
	{
		alert("Vui long nhap ho ten.");
		frmForm.txtFullname.focus();
		return false;
	}
	if ((fullname.search("scrip")>=0)||(fullname.search("objec")>=0)||(fullname.search("apple")>=0)||(fullname.search("embe")>=0))
	{
		alert("Ho ten khong hop le.");
		frmForm.txtFullname.focus();
		return false; 
	}	
	
	content=trimstring(frmForm.txtContent.value);
	if (content=="") 
	{
		alert("Vui long nhap noi dung.");
		frmForm.txtContent.focus();
		return false;
	}
	if ((content.search("scrip")>=0)||(content.search("objec")>=0)||(content.search("apple")>=0)||(content.search("embe")>=0))
	{
		alert("Noi dung khong hop le.");
		frmForm.txtContent.focus();
		return false; 
	}
	return true;
}

function checkMagazineForm()
{
	var frmForm=document.frmMagazine;
	var txtFullname;
	var txtCompany;
	var txtAddress;
	var txtAddress1;
	var txtPhone;
	var txtContent;
		
	txtFullname=trimstring(frmForm.txtFullname.value);
	if (txtFullname=="") 
	{
		alert("Vui long nhap ho ten.");
		frmForm.txtFullname.focus();
		return false;
	}
	if ((txtFullname.search("scrip")>=0)||(txtFullname.search("objec")>=0)||(txtFullname.search("apple")>=0)||(txtFullname.search("embe")>=0))
	{
		alert("Ho ten khong hop le.");
		frmForm.txtFullname.focus();
		return false; 
	}	
	
	txtCompany=trimstring(frmForm.txtCompany.value);
	if (txtCompany=="") 
	{
		alert("Vui long nhap ten co quan (don vi).");
		frmForm.txtCompany.focus();
		return false;
	}
	if ((txtCompany.search("scrip")>=0)||(txtCompany.search("objec")>=0)||(txtCompany.search("apple")>=0)||(txtCompany.search("embe")>=0))
	{
		alert("Ten co quan (don vi) khong hop le.");
		frmForm.txtCompany.focus();
		return false; 
	}
	
	txtAddress=trimstring(frmForm.txtAddress.value);
	if (txtAddress=="") 
	{
		alert("Vui long nhap dia chi.");
		frmForm.txtAddress.focus();
		return false;
	}
	if ((txtAddress.search("scrip")>=0)||(txtAddress.search("objec")>=0)||(txtAddress.search("apple")>=0)||(txtAddress.search("embe")>=0))
	{
		alert("Dia chi khong hop le.");
		frmForm.txtAddress.focus();
		return false; 
	}
	
	txtPhone=trimstring(frmForm.txtPhone.value);
	if (txtPhone=="") 
	{
		alert("Vui long nhap so dien thoai.");
		frmForm.txtPhone.focus();
		return false;
	}
	if ((txtPhone.search("scrip")>=0)||(txtPhone.search("objec")>=0)||(txtPhone.search("apple")>=0)||(txtPhone.search("embe")>=0))
	{
		alert("So dien thoai khong hop le.");
		frmForm.txtPhone.focus();
		return false; 
	}
	
	txtAddress1=trimstring(frmForm.txtAddress1.value);
	if (txtAddress1=="") 
	{
		alert("Vui long nhap dia diem giao bao.");
		frmForm.txtAddress1.focus();
		return false;
	}
	if ((txtAddress1.search("scrip")>=0)||(txtAddress1.search("objec")>=0)||(txtAddress1.search("apple")>=0)||(txtAddress1.search("embe")>=0))
	{
		alert("Dia diem giao bao khong hop le.");
		frmForm.txtAddress1.focus();
		return false; 
	}
	
	txtContent=trimstring(frmForm.txtContent.value);
	if ((txtContent.search("scrip")>=0)||(txtContent.search("objec")>=0)||(txtContent.search("apple")>=0)||(txtContent.search("embe")>=0))
	{
		alert("Ghi chu khong hop le.");
		frmForm.txtContent.focus();
		return false; 
	}
	return true;
}

function checkAdForm()
{
	var frmForm=document.frmAd;
	var txtFullname;
	var txtCompany;
	var txtAddress;
	var txtPhone;
	var txtContent;
		
	txtFullname=trimstring(frmForm.txtFullname.value);
	if (txtFullname=="") 
	{
		alert("Vui long nhap ho ten.");
		frmForm.txtFullname.focus();
		return false;
	}
	if ((txtFullname.search("scrip")>=0)||(txtFullname.search("objec")>=0)||(txtFullname.search("apple")>=0)||(txtFullname.search("embe")>=0))
	{
		alert("Ho ten khong hop le.");
		frmForm.txtFullname.focus();
		return false; 
	}	
	
	txtCompany=trimstring(frmForm.txtCompany.value);
	if (txtCompany=="") 
	{
		alert("Vui long nhap ten co quan (don vi).");
		frmForm.txtCompany.focus();
		return false;
	}
	if ((txtCompany.search("scrip")>=0)||(txtCompany.search("objec")>=0)||(txtCompany.search("apple")>=0)||(txtCompany.search("embe")>=0))
	{
		alert("Ten co quan (don vi) khong hop le.");
		frmForm.txtCompany.focus();
		return false; 
	}
	
	txtAddress=trimstring(frmForm.txtAddress.value);
	if (txtAddress=="") 
	{
		alert("Vui long nhap dia chi.");
		frmForm.txtAddress.focus();
		return false;
	}
	if ((txtAddress.search("scrip")>=0)||(txtAddress.search("objec")>=0)||(txtAddress.search("apple")>=0)||(txtAddress.search("embe")>=0))
	{
		alert("Dia chi khong hop le.");
		frmForm.txtAddress.focus();
		return false; 
	}
	
	txtPhone=trimstring(frmForm.txtPhone.value);
	if (txtPhone=="") 
	{
		alert("Vui long nhap so dien thoai.");
		frmForm.txtPhone.focus();
		return false;
	}
	if ((txtPhone.search("scrip")>=0)||(txtPhone.search("objec")>=0)||(txtPhone.search("apple")>=0)||(txtPhone.search("embe")>=0))
	{
		alert("So dien thoai khong hop le.");
		frmForm.txtPhone.focus();
		return false; 
	}
		
	txtContent=trimstring(frmForm.txtContent.value);
	if ((txtContent.search("scrip")>=0)||(txtContent.search("objec")>=0)||(txtContent.search("apple")>=0)||(txtContent.search("embe")>=0))
	{
		alert("Ghi chu khong hop le.");
		frmForm.txtContent.focus();
		return false; 
	}
	return true;
}

function checkSendemailForm(MyForm)
{ 
	var txtFullname=trimstring(MyForm.txtFullname.value);
	var txtEmail=trimfullstring(MyForm.txtEmail.value); 
	var txtFullname1=trimstring(MyForm.txtFullname1.value);
	var txtEmail1=trimfullstring(MyForm.txtEmail1.value); 
	
	if (txtFullname=="") 
	{ 
		alert ("Vui long cung cap ho ten nguoi gui."); 
		MyForm.txtFullname.focus();
		return false; 
	}
	if (txtEmail=="") 
	{ 
		alert ("Vui long cung cap email cua nguoi gui."); 
		MyForm.txtEmail.focus(); 
		return false; 
	} 
	if (!isEmail(txtEmail))
	{ 
		alert ("Email cua nguoi gui khong hop le."); 
		MyForm.txtEmail.focus(); 
		return false; 
	} 
	if (txtFullname1=="") 
	{ 
		alert ("Vui long cung cap ho ten nguoi nhan."); 
		MyForm.txtFullname1.focus(); 
		return false; 
	} 
	if (txtEmail1=="") 
	{ 
		alert ("Vui long cung cap email cua nguoi nhan."); 
		MyForm.txtEmail1.focus(); 
		return false; 
	} 
	if (!isEmail(txtEmail1))
	{  
		alert ("Email cua nguoi nhan khong hop le."); 
		MyForm.txtEmail1.focus(); 
		return false; 
	} 
	return true; 
} 

function doLogin()
{ 	
	var frmSubmit=document.frmwebsite;
	var txtUN=trimstring(frmSubmit.txtUN.value);
	var txtPW=trimfullstring(frmSubmit.txtPW.value); 

	if (txtUN=="")
	{
		alert ("Vui long cung cap ten truy cap."); 
		frmSubmit.txtUN.focus(); 
		return false; 
	}	
	if (txtPW=="")
	{
		alert ("Vui long cung cap mat khau."); 
		frmSubmit.txtPW.focus(); 
		return false; 
	}
	
	frmSubmit.method="post";
	frmSubmit.action="login.aspx";
	frmSubmit.submit(); 
	return true;
}

function checkChangePWForm() 
{
	var frmSubmit=document.frmChangeUserInfo;
	var txtOldPW=trimstring(frmSubmit.txtOldPW.value);
	var txtNewPW=trimstring(frmSubmit.txtNewPW.value);
	var txtReNewPW=trimstring(frmSubmit.txtReNewPW.value);

	if (txtOldPW=="") 
	{ 
		alert("Vui long nhap mat khau cu."); 
		frmSubmit.txtOldPW.focus();
		return false; 
	}
	if (txtNewPW=="") 
	{ 
		alert("Vui long nhap mat khau moi."); 
		frmSubmit.txtNewPW.focus();
		return false; 
	}
	if (txtReNewPW=="") 
	{ 
		alert("Vui long nhap lai mat khau moi."); 
		frmSubmit.txtReNewPW.focus();
		return false; 
	}
	if (txtNewPW!=txtReNewPW)
	{
		alert("Mat khau nhap lai khong chinh xac.");
		frmSubmit.txtReNewPW.focus();
		return false; 
	}
	return true;
}

function window_init()
{
	window.resizeTo(window.screen.width, window.screen.height);
	window.screenLeft==0;
	window.screenTop==0
	window.focus();
}

function doMouseOverMenuLevel2(item,strBgcolor)
{
	for(i=0;i<item.children.length;i++) 
	{
		item.children(i).style.cursor='hand'; 
		item.children(i).style.backgroundColor=strBgcolor
	}
}
	
function doMouseOutMenuLevel2(item,strBgcolor)
{
	for(i=0;i<item.children.length;i++) 
		item.children(i).style.backgroundColor=strBgcolor
}
	
function doMouseClick(item)
{
	item.firstChild.firstChild.click();
}

function doVote()
{
	alert("Chan thanh cam on ban da quan tam");
	//window.document.frmVoteDetail.action="vote_detail.aspx?action=1";
	window.document.frmVoteDetail.submit();
	window.close();
	return true;
}

function submitVote(intVote_id)
{
	var strItemList;
	window.document.frmwebsite.VoteItem.value = '';
	for (i=0; i < frmwebsite.elements.length - 1; i++)
	{
		if (frmwebsite.elements[i].checked)
			window.document.frmwebsite.VoteItem.value=window.document.frmwebsite.VoteItem.value + ',' + frmwebsite.elements[i].value;
	}
	openpage_noresize('../tintuc/vote_detail.aspx?vote_id=' + intVote_id + '&action=1' + '&itemlist=' + window.document.frmwebsite.VoteItem.value ,'itemvote','520','310');
}