// JavaScript Document
function showContent(id){
	if(document.getElementById(id).style.display!=''){
		document.getElementById(id).style.display="";
	}else{
		document.getElementById(id).style.display="none";
	}
}

	var typeSearch = new Array();
	typeSearch[0] = 'vtours';
	typeSearch[1] = 'hotres';
	typeSearch[2] = 'tickets';
	
	function changTypeSearch(info)
	{
		document.getElementById(info).className='select_tab';
		for (i=0;i<typeSearch.length;i++) if (typeSearch[i] != info) document.getElementById(typeSearch[i]).className='';
	}
	function searchTM()
	{	
		var txtSearch;
		txtSearch = document.getElementById('mod_search_searchword').value;
		txtWeb	=	document.getElementById('idWhere').value
		
		if (txtSearch)
		{
			var tempAction;

			switch (document.getElementById('tempSearch').value) 
			{
			//	case 'vtours'   : tempAction = 'http://search.timnhanh.com/?timnhanh=' + encodeURIComponent(txtSearch) + '&meta='+txtWeb;break;
			//	case 'hotres' : tempAction = 'http://search.timnhanh.com/image/?timnhanh='+encodeURIComponent(txtSearch) + '&meta='+txtWeb;break;
			//	case 'tickets' : tempAction = 'http://search.timnhanh.com/video/?timnhanh='+encodeURIComponent(txtSearch) + '&meta='+txtWeb;break;
			}
			document.getElementById('form1').action = tempAction;
			document.getElementById('form1').submit();
			return true;
		}
		else
		{
			alert('Invalid keyword.');
			document.getElementById('mod_search_searchword').focus();
			return false;
		}
	}
	
	function searchTM2()
	{	
		var txtSearch;
		txtSearch = trimString(document.getElementById('txtSearch2').value);
		if (txtSearch)
		{
			//document.getElementById('form2').action = 'http://search.timnhanh.com/?timnhanh='+encodeURIComponent(txtSearch);
			document.getElementById('form2').submit();
			return true;
		}
		else
		{
			alert('Invalid keyword.');
			document.getElementById('txtSearch2').focus();
			return false;
		}
	}
	
function GetCookie(namecookie){ 
	var re=new RegExp(namecookie+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1]; //return its value
	return "";
}

function SetCookie(namecookie, valuecookie, days){
	if (typeof days!="undefined"){ //if set persistent cookie
		var expireDate = new Date();
		var expstring=expireDate.setDate(expireDate.getDate()+days);
		document.cookie = namecookie+"="+valuecookie+"; expires="+expireDate.toGMTString();
	}
	else //else if this is a session only cookie
		document.cookie = namecookie+"="+valuecookie;
}