var url = "ajax_votepoxies.jsp";
var jkplayer = null;

function openNews(location) {
	var windowprops = "height=680,width=570,location=no,"+ "scrollbars=no,menubars=no,toolbars=no,status=no,resizable=no";
	var openWindow = window.open(location,	"news",	windowprops);
}

function openNewsSport(location) {
	var windowprops = "height=650,width=794,location=no,"+ "scrollbars=yes,menubars=no,toolbars=no,status=no,resizable=no";
	var openWindow = window.open(location,	"news",	windowprops);
}

function showSM(guid){
	//window.open('http://www.trueworld.net/player/play/?type=streamings&ext=wmv&guid='+guid+'&theme=sport&bt=1111','SportPlayer','directories=no,scrollbars=no,width=460,height=550,left=0,top=0'); 
	window.open('http://my.trueworld.net/shopping/productDetail.jsp?world=sp&cid='+guid+'&type=streaming', 'SportPlayer', '');
}

function showTV(location){
	//window.open('http://www.trueworld.net/player/play/?pp='+location+'&theme=tv','TVPop','directories=no,scrollbars=no,width=460,height=550,left=200,top=120');
	window.open('http://my.trueworld.net/liveTV/liveTVViewer.jsp?channelAt=' + location,'TVPop','');
}

function ebookGoDetail(ref1, ref2)
{
	var frm = document.mainForm;
	frm.action = "http://ebook.trueworld.net/detail.php";
	frm.book.value = ref1;
	frm.pub.value = ref2;
	frm.catid.value = "";
	frm.submit();
}

function opennewwin(location) {
	var windowprops = "height=450,width=460,location=no,"+ "scrollbars=no,menubars=no,toolbars=no,status=no,resizable=no";
	window.open("http://astro.trueworld.net/"+location,"",windowprops);
}

function openMovie(location) {
	var windowprops = "height=550,width=460,location=no,"+ "scrollbars=no,menubars=no,toolbars=no,status=no,resizable=no";
	var openWindow = window.open(location,	"MovieTrailer",	windowprops);
}

function openWindows(guid){
	var windowprops = "height=680,width=570,location=no,scrollbars=yes,menubars=no,toolbars=no,status=no,resizable=no";
	var openWindow = window.open(""+guid,	"news",	windowprops);
}

function callSorry() {
	var windowprops = "height=280,width=485,location=no,scrollbars=no,menubars=no,toolbars=no,status=no,resizable=no";
	var openWindow = window.open("http://www.trueworld.net/home/sorry/sorry.html",	"news",	windowprops);
}

function openComment(VoteID) {
	var windowprops = "directories=no,scrollbars=yes,width=799,height=510,left=200,top=50,resizable=1";
	window.open("http://newsgroup.trueworld.net/voteComment.jsp?voteID="+VoteID+"&nPages=1","",windowprops);
}

function openComment2(VoteID) {
	//var windowprops = "directories=no,scrollbars=yes,width=799,height=510,left=200,top=50,resizable=1";
	//window.open("http://newsgroup.trueworld.net/voteComment4.jsp?voteID="+VoteID+"&nPages=1","",windowprops);
	var windowprops = "directories=no,scrollbars=yes,width=799,height=510,left=200,top=50,resizable=1";
	window.open("http://comment.truelife.com/commentservice/votecomment.jsp?voteID="+VoteID,"",windowprops);
}

function openReadNews(guid)
{
	var url = 'http://movie.trueworld.net/readNews/read.jsp?guid=' + guid;
	window.open(url,'','directories=no,scrollbars=no,width=572,height=675,left=200,top=50,resizable=1');
}
		
function voteMusic(formName) {
	var vcID = "";
	for(var i=0;i < document.forms[formName].vcIDM.length;i++) {
		if (document.forms[formName].vcIDM[i].checked) {
			//alert(document.forms[formName].vcIDM[i].value);
			vcID = document.forms[formName].vcIDM[i].value;			
			break;
		}
	}
	
	if (vcID == "") { alert("กรุณาเลือกตัวเลือกใดตัวเลือกหนึ่ง"); }
	else 
	{
		var pars = "vcID="+vcID;
		var myAjax = new Ajax.Request("ctrl/update_vote.php", {method: "get", parameters: pars, onComplete: showResponseMusic});  
		//var myAjax = new Ajax.Request("player/inc/inc_updatevote.php", {method: "get", parameters: pars, onComplete: showResponseMusic});  
		
	}
}

function showResponseMusic(originalRequest) {
	var items = null;
	items = originalRequest.responseXML.selectSingleNode("ajax-response/response");
	alert(items.childNodes[1].firstChild.nodeValue);
}

function voteNews() {
	var vcID = "";
	for(var i=0;i < document.voteFormNews.vcIDN.length;i++) {
		if (document.voteFormNews.vcIDN[i].checked) {
			vcID = document.voteFormNews.vcIDN[i].value;
			break;
		}
	}
	
	if (vcID == "") { alert("เธเธฃเธธเธ“เธฒเน€เธฅเธทเธญเธเธ•เธฑเธงเน€เธฅเธทเธญเธเนเธ”เธ•เธฑเธงเน€เธฅเธทเธญเธเธซเธเธถเนเธ"); }
	else 
	{
		var pars = "vcID="+vcID;
		var myAjax = new Ajax.Request("Transform/XML/ajaxProxy_updateVote.jsp", {method: "post", parameters: pars, onComplete: showResponseNews});  
	}
}

function showResponseNews(originalRequest) {
	var items = null;
	items = originalRequest.responseXML.selectSingleNode("ajax-response/response");
	alert(items.childNodes[1].firstChild.nodeValue);
}

function voteTV() {
	var vcID = "";
	for(var i=0;i < document.voteFormTV.vcIDT.length;i++) {
		if (document.voteFormTV.vcIDT[i].checked) {
			vcID = document.voteFormTV.vcIDT[i].value;
			break;
		}
	}
	
	if (vcID == "") { alert("เธเธฃเธธเธ“เธฒเน€เธฅเธทเธญเธเธ•เธฑเธงเน€เธฅเธทเธญเธเนเธ”เธ•เธฑเธงเน€เธฅเธทเธญเธเธซเธเธถเนเธ"); }
	else 
	{
		var pars = "vcID="+vcID;
		var myAjax = new Ajax.Request("Transform/XML/ajaxProxy_updateVote.jsp", {method: "post", parameters: pars, onComplete: showResponseTV});  
	}
}

function showResponseTV(originalRequest) {
	var items = null;
	items = originalRequest.responseXML.selectSingleNode("ajax-response/response");
	alert(items.childNodes[1].firstChild.nodeValue);
}

function voteSport() {
	var vcID = "";
	for(var i=0;i < document.voteFormSport.vcIDS.length;i++) {
		if (document.voteFormSport.vcIDS[i].checked) {
			vcID = document.voteFormSport.vcIDS[i].value;
			break;
		}
	}
	
	if (vcID == "") { alert("เธเธฃเธธเธ“เธฒเน€เธฅเธทเธญเธเธ•เธฑเธงเน€เธฅเธทเธญเธเนเธ”เธ•เธฑเธงเน€เธฅเธทเธญเธเธซเธเธถเนเธ"); }
	else 
	{
		var pars = "vcID="+vcID;
		var myAjax = new Ajax.Request("Transform/XML/ajaxProxy_updateVote.jsp", {method: "post", parameters: pars, onComplete: showResponseSport});  
	}
}

function showResponseSport(originalRequest) {
	var items = null;
	items = originalRequest.responseXML.selectSingleNode("ajax-response/response");
	alert(items.childNodes[1].firstChild.nodeValue);
}

function voteMovie() {
	var vcID = "";
	for(var i=0;i < document.voteFormMovie.vcIDMovie.length;i++) {
		if (document.voteFormMovie.vcIDMovie[i].checked) {
			vcID = document.voteFormMovie.vcIDMovie[i].value;
			break;
		}
	}
	
	if (vcID == "") { alert("เธเธฃเธธเธ“เธฒเน€เธฅเธทเธญเธเธ•เธฑเธงเน€เธฅเธทเธญเธเนเธ”เธ•เธฑเธงเน€เธฅเธทเธญเธเธซเธเธถเนเธ"); }
	else 
	{
		var pars = "vcID="+vcID;
		var myAjax = new Ajax.Request("Transform/XML/ajaxProxy_updateVote.jsp", {method: "post", parameters: pars, onComplete: showResponseMovie});  
	}
}

function showResponseMovie(originalRequest) {
	var items = null;
	items = originalRequest.responseXML.selectSingleNode("ajax-response/response");
	alert(items.childNodes[1].firstChild.nodeValue);
}
