function selectShare(_name){
	if(_name == "url"){
		$('url_code').focus();
		$('url_code').select();
	}else if(_name == "media"){
		$('media_code').focus();
		$('media_code').select();
	}
}


function linkDisplay(){
	var linkObj = $("linking");
	if(linkObj.className == "linking hidden"){
		linkObj.className = "linking show";
	}else if(linkObj.className == "linking show"){
		linkObj.className = "linking hidden";
	}
}

function URLReplace(values) { values = values.replace(/([\`\~\!\@\#\$\%\^\&\*\(\)\_\+\|\-\=\\\{\}\[\]\;\'\:\"\,\.\/\<\>\?]+)/g, ""); values = values.replace(/^\s+|\s+$/g, ""); values = values.replace(" ", "_"); values = values.replace(/\_{2,}/g, ""); return values; }
function redirectChannel(obj) { var objIndex	= obj.selectedIndex; if (objIndex != -1) { var targetLink = "/" + URLReplace(obj[objIndex].text) + "_tv_" + obj[objIndex].value + "/"; document.location.href = targetLink; } }
function fullTV(idx) { window.open("/tv/full.html?" + idx, "gangesFullVideo", "fullscreen=yes"); }
function findChannel() { var inc; var favoriteIDX = parseInt(document.getElementById("favoriteIDX").value); var relateChannel = document.getElementById("relateChannel"); var favoriteChannel = document.getElementById("favoriteChannel"); for (inc = 0; inc < relateChannel.length; inc++) { if (relateChannel[inc].value == favoriteIDX) { relateChannel[inc].selected = true; } } for (inc = 0; inc < favoriteChannel.length; inc++) { if (favoriteChannel[inc].value == favoriteIDX) { favoriteChannel[inc].selected = true; } } }
function moveData(values) { var objIndex = -1; var relateChannel = document.getElementById("relateChannel"); var favoriteChannel = document.getElementById("favoriteChannel"); switch (values) { case "left": { objIndex = favoriteChannel.selectedIndex; if (objIndex != -1) { ajaxRequest("/tv/call_update_favorite.html?idx=" + favoriteChannel[objIndex].value, null, resultMove); } break; } case "right": { objIndex = relateChannel.selectedIndex; if (objIndex != -1) { ajaxRequest("/tv/call_update_favorite.html?idx=" + relateChannel[objIndex].value, null, resultMove); } break; } } }
function resultMove(values) {ajaxRequest("/tv/favorite.html?idx=" + document.getElementById("favoriteIDX").value, null, resultHTML); }
function resultHTML(values) {document.getElementById("tvbtm").innerHTML = values; findChannel(); }