
function checkSearch(MyForm) 
{
	var keyword=trimstring(MyForm.keyword.value);
	if (keyword=="") 
	{ 
		alert("Vui long nhap thong tin de tim kiem"); 
		MyForm.keyword.focus();
		return false; 
	}
	if ((keyword.search("scrip")>=0)||(keyword.search("objec")>=0)||(keyword.search("apple")>=0)||(keyword.search("embe")>=0))
	{
		alert("Thong tin tim kiem khong hop le.");
		MyForm.keyword.focus();
		return false; 
	}
	return true;
}

function checkSearchEN(MyForm) 
{
	var keyword=trimstring(MyForm.keyword.value);
	if (keyword=="") 
	{ 
		alert("Please input your keyword"); 
		MyForm.keyword.focus();
		return false; 
	}
	if ((keyword.search("scrip")>=0)||(keyword.search("objec")>=0)||(keyword.search("apple")>=0)||(keyword.search("embe")>=0))
	{
		alert("Your keyword is not valid.");
		MyForm.keyword.focus();
		return false; 
	}
	return true;
}

function checkSearch_Detail(MyForm) 
{
	var keyword=trimstring(MyForm.keyword.value);
	
	if ((keyword.search("scrip")>=0)||(keyword.search("objec")>=0)||(keyword.search("apple")>=0)||(keyword.search("embe")>=0))
	{
		alert("Thong tin tim kiem khong hop le.");
		MyForm.keyword.focus();
		return false; 
	}
	return true;
}

function doMouseOverMenuLevel2(item)
{
	for(i=0;i<item.children.length;i++) 
	{
		item.children(i).style.cursor='hand'; 
		item.children(i).style.backgroundColor='#FCF8D4'
	}
}
	
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 checkFeedbackForm(frmForm)
{
	var fullname;
	var content;
	fullname=trimstring(frmForm.fullname.value);
	if (fullname=="") {
		alert("Vui long nhap ho ten.");
		frmForm.fullname.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.fullname.focus();
		return false; 
	}
	content=trimstring(frmForm.content.value);
	if (content=="") {
		alert("Vui long nhap noi dung.");
		frmForm.content.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.content.focus();
		return false; 
	}
		
	return true;
}

function checkFeedbackFormEN(frmForm)
{
	var fullname;
	var content;
	fullname=trimstring(frmForm.fullname.value);
	if (fullname=="") {
		alert("Please input your fullname.");
		frmForm.fullname.focus();
		return false;
	}
	if ((fullname.search("scrip")>=0)||(fullname.search("objec")>=0)||(fullname.search("apple")>=0)||(fullname.search("embe")>=0))
	{
		alert("Your fullname is not valid.");
		frmForm.fullname.focus();
		return false; 
	}
	content=trimstring(frmForm.content.value);
	if (content=="") {
		alert("Please input your content.");
		frmForm.content.focus();
		return false;
	}
	if ((content.search("scrip")>=0)||(content.search("objec")>=0)||(content.search("apple")>=0)||(content.search("embe")>=0))
	{
		alert("Your content is not valid.");
		frmForm.content.focus();
		return false; 
	}
		
	return true;
}

function Submit_onclick(MyForm)
{ 
	var txtfullname_sender=trimstring(MyForm.fullname_sender.value);
	var txtemail_sender=trimfullstring(MyForm.email_sender.value); 
	var txtfullname_receiver=trimstring(MyForm.fullname_receiver.value); 
	var txtemail_receiver=trimfullstring(MyForm.email_receiver.value); 
	if (txtfullname_sender=="") 
	{ 
		alert ("Vui long cung cap ho ten nguoi gui."); 
		MyForm.fullname_sender.value="";
		MyForm.fullname_sender.focus();
		return false; 
	}
	if (txtemail_sender=="") 
	{ 
		alert ("Vui long cung cap email cua nguoi gui."); 
		MyForm.email_sender.value="";
		MyForm.email_sender.focus(); 
		return false; 
	} 
	if (!isEmail(txtemail_sender))
	{ 
		alert ("Email cua nguoi gui khong hop le."); 
		MyForm.email_sender.focus(); 
		return false; 
	} 
	if (txtfullname_receiver=="") 
	{ 
		alert ("Vui long cung cap ho ten nguoi nhan."); 
		MyForm.fullname_receiver.value="";
		MyForm.fullname_receiver.focus(); 
		return false; 
	} 
	if (txtemail_receiver=="") 
	{ 
		alert ("Vui long cung cap email cua nguoi nhan."); 
		MyForm.email_receiver.value="";
		MyForm.email_receiver.focus(); 
		return false; 
	} 
	if (!isEmail(txtemail_receiver))
	{  
		alert ("Email cua nguoi nhan khong hop le."); 
		MyForm.email_receiver.focus(); 
		return false; 
	} 
	return true; 
} 

function doVote(intVote_id)
{
//	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 false;
	
//	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;
//	}
//	var strLink = "'../vn/vote_detail.aspx?vote_id='" + intVote_id + "'&action=1'" + "'&itemlist='" + window.document.frmWebsite.VoteItem.value;
//	alert(strLink);
//	var tempWindow = window.open(strLink,,'itemvote','520','310');
//	tempWindow.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('../vn/vote_detail.aspx?vote_id=' + intVote_id + '&action=1' + '&itemlist=' + window.document.frmWebsite.VoteItem.value ,'itemvote','520','310');
}

function submitVoteEn(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('../en/vote_detail.aspx?vote_id=' + intVote_id + '&action=1' + '&itemlist=' + window.document.frmWebsite.VoteItem.value ,'itemvote','520','310');
}

function checkChangePWForm(MyForm)
{
	var strOldPassword=trimstring(MyForm.txtOldPW.value);
	var strNewPassword=trimstring(MyForm.txtNewPW.value);
	var strRNewPassword=trimstring(MyForm.txtReNewPW.value);
	
	if (strOldPassword=="") 
	{ 
		alert("Vui long nhap thong tin de tim kiem"); 
		MyForm.strOldPassword.focus();
		return false; 
	}
	
	if (strNewPassword=="") 
	{ 
		alert("Vui long nhap thong tin de tim kiem"); 
		MyForm.strNewPassword.focus();
		return false; 
	}
	if (strRNewPassword=="") 
	{ 
		alert("Vui long nhap thong tin de tim kiem"); 
		MyForm.strRNewPassword.focus();
		return false; 
	}
	
	return true;
}


/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
document.onmousemove=positiontip

