function clickSearch(){
	var location = document.getElementById('location').value;
	var type = document.getElementById('type').value;
	//alert(location+type);
	searchTrendProgram(location,type,0);
}

function searchTrendProgram(location,type, page){
	var options = {asynchronous:true,
				   evalScripts:true};
	new Ajax.Updater('search_box','/ajax/search_trend_program/'+location+'/'+type+'/'+page,options);
}

function changeEpisodeArchive(page,totalEpisode){
	var options = {asynchronous:true,
				   evalScripts:true};
	new Ajax.Updater('episode_archive','/ajax/change_episode_archive/'+page+'/'+totalEpisode,options);
}


function showTrendDetail(id){
	popup("/util/show_trend_detail/"+id , 520,600,'yes','no');
}

function popupMagazine(section,eid){
	if (section == "main_sub"){
		section = "main_sub_1";
	}
	popup("/magazine/direct/section/" + section + "/" + eid , 620,768,'yes','no');
}

function popupNewestMagazine(section){
	popupMagazine(section, newestEpisodeId);
}

function changeCoverFlash(eid,enumber,file){
	newestEpisodeId = eid;
	document.getElementById("episode_div").innerHTML = enumber;
	var options = {asynchronous:true,
				   evalScripts:true};
	new Ajax.Updater('magazine_front_swf_div','/ajax/change_cover_flash/'+file,options);
	window.location.hash="cover_swf";
	
	// for rtf
	rtfUrl = "/magazine/magazine_front?eid="+eid+"_"+enumber+"_"+file;
}