﻿
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 doVoteVN()
{
	alert("Chân thành cám ơn sự quan tâm của bạn!");
	//window.document.frmVoteDetail.action="vote_detail.aspx?action=1";
	//window.document.frmVoteDetail.submit();
	//window.close();
	//return true;
}

function submitVoteVN(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 doVoteEN()
{
	alert("Thanks for your care!");
	//window.document.frmVoteDetail.action="vote_detail.aspx?action=1";
	//window.document.frmVoteDetail.submit();
	//window.close();
	//return true;
}

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 doVoteCN()
{
	alert("Thanks for your care!");
	//window.document.frmVoteDetail.action="vote_detail.aspx?action=1";
	//window.document.frmVoteDetail.submit();
	//window.close();
	//return true;
}

function submitVoteCN(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('../cn/vote_detail.aspx?vote_id=' + intVote_id + '&action=1' + '&itemlist=' + window.document.frmWebsite.VoteItem.value ,'itemvote','520','310');
}

// Cross-browser get element 
	function cbGetElement(eName)
	{
		if (document.all)
			return document.all[eName]; 
		else
			return document.getElementById(eName); 
	}
	var tFormAttribute;
	// Changes the form background image 
    function changeFormAttribute(iForm,aForm)
    {	
		var td1;
		var td2;
		var td3;
		var td4;
		var td5;
		var td6;
		
		td1='tdL_' + iForm;
		td2='tdM_' + iForm;	
		td3='tdR_' + iForm;			
		cbGetElement(td1).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_AL.gif' + ')';		
		cbGetElement(td2).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_AM.gif' + ')';	
		cbGetElement(td3).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_AR.gif' + ')';	
		if (tFormAttribute)
		{ 
			tFormAttribute = clearTimeout(tFormAttribute);
		}														
		
		if(aForm!='0')
		{
			if (aForm!=iForm)
			{	
				
				td4='tdL_' + aForm;
				td5='tdM_' + aForm;	
				td6='tdR_' + aForm;			
				cbGetElement(td4).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_L.gif' + ')';		
				cbGetElement(td5).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_M.gif' + ')';	
				cbGetElement(td6).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_R.gif' + ')';
				
			}	
		}
    }
    
    // UnChanges the form background image 
    function restoreFormAttribute(iForm,aForm)
    {	
		var td1;
		var td2;
		var td3;
		
		td1='tdL_' + iForm;
		td2='tdM_' + iForm;	
		td3='tdR_' + iForm;	
		cbGetElement(td1).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_L.gif' + ')';		
		cbGetElement(td2).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_M.gif' + ')';	
		cbGetElement(td3).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_R.gif' + ')';	
		
		if(aForm!='0')
		{
			tFormAttribute=setTimeout("restoreFormActive(" + aForm + ")",1000);
				
		}
				
    }
    
     // UnChanges the form background image 
    function restoreFormActive(aForm)
    {			
		var td4;
		var td5;
		var td6;		
				
		td4='tdL_' + aForm;
		td5='tdM_' + aForm;	
		td6='tdR_' + aForm;			
		cbGetElement(td4).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_AL.gif' + ')';		
		cbGetElement(td5).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_AM.gif' + ')';	
		cbGetElement(td6).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_AR.gif' + ')';		
    }
			
