﻿// JavaScript Document

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function howtoX(theURL,winName,features) { //v2.0
  window.open(theURL,'sms','scrollbars=no,width=465,height=255');
}

function howto(theURL,winName,features) { //v2.0
    //alert(theURL);
    //return false;
    window.open(theURL,'howto','scrollbars=no,width=465,height=280');
}

function help(theURL,winName,features) { //v2.0
  window.open(theURL,'help','scrollbars=no,width=615,height=340');
}

<!--  Radio And Live TV List
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}
//-->

/*	
function openRadioLink(){
	var ob = document.myForm.radiochannel.options[document.myForm.radiochannel.selectedIndex].value;
	window.open(ob);	
}			

function openTVLink(){
	var ob = document.myForm.tvchannel.options[document.myForm.tvchannel.selectedIndex].value;
	window.open(ob);	
}*/

function freeZoneDownloadCheckPhoneNumber(obj) { //v2.0

	if (obj.msisdn.value == "")
	{
		alert("กรุณาระบุเบอร์โทรศัพท์ค่ะ");
		return false;
	}
	
	if (obj.msisdn.value != '')
	{
	  	//window.open('/phoneSetting/freezone_activate_code.aspx?msisdn=' + obj.msisdn.value + '&starDownloadCode=' +  obj.starDownloadCode.value + '&command=' + obj.command.value,'popup','scrollbars=no,width=465,height=385');
	  	window.location = "../phoneSetting/freezone_activate_code.aspx?msisdn=" + obj.msisdn.value + "&starDownloadCode=" +  obj.starDownloadCode.value + "&command=" + obj.command.value;
		return false;
	}
	else
	{
		alert("กรุณาระบุเบอร์โทรศัพท์ค่ะ");
		return false;
	}
	
}

function colorRingDownloadCheckPhoneNumber(obj) { //v2.0
    
	if (obj.msisdn.value == "")
	{
		alert("กรุณาระบุเบอร์โทรศัพท์ค่ะ");
		return false;
	}
	
	if (obj.msisdn.value != '')
	{
	  	//window.open('/phoneSetting/freezone_activate_code.aspx?msisdn=' + obj.msisdn.value + '&starDownloadCode=' +  obj.starDownloadCode.value + '&command=' + obj.command.value,'popup','scrollbars=no,width=465,height=385');
	  	window.location = "../phoneSetting/colorring_activate_code.aspx?msisdn=" + obj.msisdn.value + "&tonecode=" +  obj.tonecode.value + "&command=" + obj.command.value;
		return false;
	}
	else
	{
		alert("กรุณาระบุเบอร์โทรศัพท์ค่ะ");
		return false;
	}
	
	return false;
}

function colorRingSearch(obj) { //v2.0
    
	if (obj.keyword.value == "")
	{
		alert("กรุณาระบุชื่อเพลง หรือ ศิลปิน ที่ต้องการค่ะ");
		return false;
	}
	else
	{
	    //alert("colorring_search.aspx?keyword=" + obj.keyword.value + "&criteria=" +  obj.criteria.value);
	    
	    var _keyword = obj.keyword.value;
	    //alert(_keyword);
	    
	    var y = encodeURI(_keyword);
	    //alert(y);
	    
	    //var x= y;
	    try
	    {
	        var x = Base64.encode(y);
	        //alert(x);
	    }
	    catch(e)
	    {
	        alert(e.message);
	    }
	    
	    
	    window.location = "colorring_search_template.aspx?keyword=" + x + "&criteria=" +  obj.criteria.value;
	    return false;
	}
	return false;
}

//-------------------------------------------------------------
