var g_auto_renew=0;
var g_add_user_flag=0;
function Get_Reseller_Credit_No()
{
		
	g_token=find_cookie_value("token");
	var cgi_url = "/server/get_reseller_profile?token="+escape(g_token)+"&name="+escape(g_user_id)+
	 "&flag="+Math.random();
	 //alert(cgi_url);
	
	 xmlHttp.open("GET", cgi_url, true);
	 xmlHttp.onreadystatechange = function()
	 {
		 if (xmlHttp.readyState == 4) {
			var response = xmlHttp.responseText.split("\r\n");
			//alert(response[4]);
			var strlength=response[4].length;
			g_total_credit_no=response[4].slice(7,strlength);
			//alert(g_reseller_credit);
			document.getElementById("credit_no").innerHTML='<p align="center" style="margin-left: 0; margin-top: 0; margin-bottom: 0"><font face="Arial" size="6" color="#ffffff">Credit Balance: <b>'+g_total_credit_no+'</b></font>';
			
		}
	 };
	 xmlHttp.send(null);

	
}	

function CloseSearch()
{
	if (g_start_search_option==1)
	{
		g_SearchInput.value='Search Users...';
 	}else 	if (g_start_search_option==2)
	{
		g_SearchInput.value='Search Channels...';
 	}else 	if (g_start_search_option==3)
	{
		g_SearchInput.value='Search Movies...';
  	}else 	if (g_start_search_option==4)
	{
		g_SearchInput.value='Search Series...';
  	}else 	if (g_start_search_option==5)
	{
		g_SearchInput.value='Search Players...';
 	}
}
function ClearSearchInput() {
	if (g_start_search_option==1)
	{
		if (g_SearchInput.value=="Search Users...")
		{
			g_SearchInput.value='';
		 	g_SearchInput.style.opacity=1;
	 	}
 	}else 	if (g_start_search_option==2)
	{
		if (g_SearchInput.value=="Search Channels...")
		{
			g_SearchInput.value='';
		 	g_SearchInput.style.opacity=1;
	 	}
 	}else 	if (g_start_search_option==3)
	{
		if (g_SearchInput.value=="Search Movies...")
		{
			g_SearchInput.value='';
		 	g_SearchInput.style.opacity=1;
	 	}
  	}else 	if (g_start_search_option==4)
	{
		if (g_SearchInput.value=="Search Series...")
		{
			g_SearchInput.value='';
		 	g_SearchInput.style.opacity=1;
	 	}
  	}else 	if (g_start_search_option==5)
	{
		if (g_SearchInput.value=="Search Players...")
		{
			g_SearchInput.value='';
		 	g_SearchInput.style.opacity=1;
	 	}
 	}
 }
function SearchInput()
{
	if (g_start_search_option==1)
	{
		callServer_search_user();
	}else if (g_start_search_option==2)
	{
		callServer_search_channel();
	}else if (g_start_search_option==3)
	{
		callServer_search_movie();
	}else if (g_start_search_option==4)
	{
		callServer_search_series();
	}else if (g_start_search_option==5)
	{
		callServer_search_player();
	}else if (g_start_search_option==6)
	{
	}
}
function callServer_search_user() {
	var cgi_url;
	var searchvalue = g_SearchInput.value;
	var position=g_user_found_position+1;
	g_search_text=searchvalue;
	
   	g_token=find_cookie_value("token");
	if (g_token!=0)
	{
		cgi_url = "/server/get_reseller_users?token="+escape(g_token)+"&position="+g_user_position+"&limit="+g_user_limit+ "&searchvalue=" +searchvalue+"&flag="+Math.random();

		xmlHttp.open("GET", cgi_url, true);
		
		xmlHttp.onreadystatechange = get_users;
		xmlHttp.send(null);
	}

}

function call_Add_User()
{
 var username_id="username"; 
 var password_id="password"; 
 var rating_password_id="rating_password"; 
 var group_id="group"; 
 var user_level_id="user_level"; 
 var subscription_peroid_id="subscription_peroid"
 var userip_id="userip";
 var macid_id="macid";
 var user_no_id="userno";
 var szpassword;
 var user_level;
 var szrating_password;
 var szgroup;
 var szsubscription_peroid;
 var expired_time;
 var expired_YY;
 var expired_MM;
 var expired_DD;
 //var paymodel;
 //var user_point;
 var userip;
 var macid;
 var username;
 var usern0;
 var d=new Date();
 var cur_year=d.getFullYear();
 var cur_month=d.getMonth()+1;
 var cur_date=d.getDate();
var usernoitem;
var usernameitem;


var confirm_msg;
 	var cgi_url;
	var cookieStr;
	var firstpos;
	var endpos;
	var pos;
	var expired_time_temp;
 	var pos;
	var expired_time_temp;
	var alert_message;

	g_item=document.getElementById(user_no_id);
	usernoitem=g_item;
	user_no=g_item.value;
	/*
	if (user_no>(g_total_user_no+1))
	{
		alert("User No. is invaild.");
		return;
	}
	*/

	g_item=document.getElementById(macid_id);
	macid=g_item.value;
	g_item=document.getElementById(username_id);
	usernameitem=g_item;
	username=g_item.value;
	if (username.length==0)
	{
		alert("User name is empty");
		return;
	}

	if ((g_user_authorization_mode==1) || (g_user_authorization_mode==0))
	{
		g_item=document.getElementById(password_id);
		szpassword=g_item.value;
		if (szpassword.length==0)
		{
			if (macid!="mag")
			{
				alert("Pawword is empty");
				return;
			}
		}
		if (szpassword==username)
		{
			alert("Password can not be same as Username");
			return;
			
		}

	}else if (g_user_authorization_mode==2)
	{
		szpassword=null;
	}

	//alert(szpassword);
	g_item=document.getElementById(group_id);
	//alert(g_item);
	szgroup=g_item.value;
	//alert(szgroup);
	
	g_item=document.getElementById(user_level_id);
	//alert(g_item);
	user_level=g_item.value;
	//alert(user_level);

	g_item=document.getElementById(subscription_peroid_id);
	szsubscription_peroid=g_item.value;
	//alert(szgroup);
//	g_item=document.getElementById(paymodel_id);
//	paymodel=g_item.value;
//	g_item=document.getElementById(user_point_id);
//	user_point=g_item.value;
	g_item=document.getElementById(userip_id);
	userip=g_item.value;

   	g_token=find_cookie_value("token");

g_cur_userno=user_no;
 //confirm_msg="Add User: "+username+" Information?";
 cgi_url = "/server/reseller_add_user?token="+escape(g_token)+"&userno="+escape(user_no)+"&username="+escape(username)+
  "&password="+szpassword+
  "&rating_password="+szrating_password+
  "&group="+szgroup+
  "&level="+user_level+
  "&subscription_peroid="+szsubscription_peroid+ 
   "&userip="+userip+
  "&macid="+macid+
   "&flag="+Math.random();
 //  alert(cgi_url);

	
	 xmlHttp.open("GET", cgi_url, true);
	 xmlHttp.onreadystatechange = function()
	 {
	 	if (xmlHttp.readyState == 4) {
		    var response = xmlHttp.responseText;
		    var item_add;
		    var item_save;
		    var item_del;
		    var item_more;
		    var item_top_total_no;
		    var add_new_user_button=document.getElementById("add_new_user_button");
		    var add_user_dialog_message=document.getElementById("add_user_dialog_message");
		  //  var item_bottom_total_no;
		    if (response==1)
		    {
		    //	alert("Add User Sucessfully");
		  	g_user_no++;
		  	if ((g_user_position+g_constant_limit)<=g_user_no)
			{
				if (((g_cur_userno)%g_constant_limit)==1)
				{
					g_user_position=parseInt(g_cur_userno);
				}
				g_user_limit=g_constant_limit;
			}else
			{
				g_user_limit=g_user_no%g_constant_limit;
				if (g_user_limit==0) 
				{
					if (g_user_no<g_user_position)
					{
						g_user_position=g_user_no-g_constant_limit+1;
					}
					g_user_limit=g_constant_limit;
				}
			}
			add_new_user_button.value="Add Next";
			var new_add_total_no=g_user_no+1;
			add_user_dialog_message.innerHTML='<font size=2 color=#000000 face="Arial">'+username+' Added</font>';
			//alert(new_add_total_no);
			usernoitem.value=new_add_total_no;
			usernameitem.value="";
			usernameitem.focus();
			//callServer_System_Inquery();
			//call_get_users(g_user_position,g_user_limit);
		 	
		    } else if (response==0)
		    {
		   	alert("Failed to Add User");
		   	//call_get_users();
		 	// 	call_get_users(g_user_position,g_user_limit);
		
		    } else if (response==2)
		    {
		    	alert("Disk is error(FULL), Please contact administrator");
		//	call_get_users();
		 	//call_get_users(g_user_position,g_user_limit);
		
		    }else if (response==3)
		    {
		   	//g_item.value=g_temp;
			//g_item.style.backgroundColor = "#ffffff";
		  	alert("The user is already in Database");
			//call_get_all_user();
		    }else if (response==4)
		    {
		   	//g_item.value=g_temp;
			//g_item.style.backgroundColor = "#ffffff";
		  	alert("Password does not allow the special character ':'");
		    }
		
		
		
			//alert(add_id_button.innerHTML);
		    }
	 };
	 xmlHttp.send(null);


}
function change_trial_date_format (sObj)
{
	var szid=document.getElementById("exipre_time_option");
	if (sObj.value=="5")
	{
		szid.innerHTML=' <font face="Arial"> <font size="2">'+
		' <select size="1" id=subscription_peroid>'+
		'<option style="background-color: white" value="1">1 hour</option>'+
		'<option style="background-color: white" value="2">2 hours</option>'+
		'<option style="background-color: white" value="3">3 hours</option>'+
		'<option style="background-color: white" value="4">4 hours</option>'+
		'<option style="background-color: white" value="5">5 hours</option>'+
		'<option style="background-color: white" value="6">6 hours</option>'+
		'<option style="background-color: white" value="7">7 hours</option>'+
		'<option style="background-color: white" value="8">8 hours</option>'+
		'<option style="background-color: white" value="9">9 hours</option>'+
		'<option style="background-color: white" value="10">10 hours</option>'+
		'<option style="background-color: white" value="11">11 hours</option>'+
		'<option style="background-color: white" value="12">12 hours</option>';
	}else
	{
		szid.innerHTML=' <font face="Arial"> <font size="2">'+
		' <select size="1" id=subscription_peroid>'+
		'<option style="background-color: white" value="30">1 month</option>'+
		'<option style="background-color: white" value="60">2 month</option>'+
		'<option style="background-color: white" value="90">3 month</option>'+
		'<option style="background-color: white" value="120">4 month</option>'+
		'<option style="background-color: white" value="150">5 month</option>'+
		'<option style="background-color: white" value="180">6 month</option>'+
		'<option style="background-color: white" value="210">7 month</option>'+
		'<option style="background-color: white" value="240">8 month</option>'+
		'<option style="background-color: white" value="270">9 month</option>'+
		'<option style="background-color: white" value="300">10 month</option>'+
		'<option style="background-color: white" value="330">11 month</option>'+
		'<option style="background-color: white" value="360">1 year</option>'+
		'<option style="background-color: white" value="720">2 year</option>'+
		'<option style="background-color: white" value="1080">3 year</option>'+
		'<option style="background-color: white" value="1440">4 year</option>'+
		'<option style="background-color: white" value="1800">5 year</option>';
	}
}
function open_more_user_modal(username)
{
	var modal = document.getElementById('PanelModalMoreUsers');
	//alert(g_total_user_no);
	//alert(g_checkedstring);
	g_username=username;
	
	call_Query_User_More();
	modal.style.display = "block";

}
function close_more_user_modal() {
   var modal = document.getElementById('PanelModalMoreUsers');
   modal.style.display = "none";
}	
function change_page_no()
{
	g_constant_limit=parseInt(document.getElementById("page_no").value);
	//alert(g_constant_limit);
	Button_get_all_user();
}
function get_users()
{
 
  if (xmlHttp.readyState == 4) {

    var response = xmlHttp.responseText.split("\r\n");
     var username;
    var szpassword;
    var szgroup;
    var expired_timel
   // var paymodel;
  //  var paymodel_option;
  //  var user_point;
    var userip;
    var macid;
    var reseller;
    var user_title="<p>"+"User List"+"</p>";
    var user_list;
    var i=0;
    var j=0;
    var k=0;
    var user_no=0
    var user_index=1;;
	var total_no=0;
	var HTML_str='';
	var strlength=0;
	var pos=0;
   var content;
   var ezcontent;
  //var detail = parent.document.getElementById("detail");
  var expired_YY;
  var expired_MM;
  var expired_DD;
  var d=new Date();
  	var cur_year=d.getFullYear();
  	var cur_month=d.getMonth()+1;
  	var cur_day=d.getDate();
  	var bexpired=0;
  	var pos;
  	var expired_time_temp;
  	var yearmsg;
  	var menustr1;
	var menustr2;
	var endposition;
	var position;
	var limit;
	var curren_sequence_no;
	var total_sequence;
	var start_sequence_no;
	var current_position=g_user_position;
	var total_count=0;
	var new_total_no;
	var ranpass;
	//detail.innerHTML="";
	var cellsize="10%";
	
	if (g_expired_user==0)
	{
		total_count=g_user_no;
	}else if (g_expired_user==1)
	{
		total_count=g_expired_user_no;
	}
	g_start_search_option=1;
	if(bMobileDevice){
		ezcontent= document.getElementById("content")
	}else
	{
		ezcontent= parent.document.getElementById("content")
	}
 
	ezcontent.innerHTML='<div id="ezmenucontent"></div>';
	var str='<table align="center" width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">';
	str+='<tr>'
	var action_width="40%";
	if (bMobileDevice)
	{
		action_width="10%";
	}
	
	str+='<td width="'+action_width+'"><font face="Arial" color="#000000" size="4"><b>User</b></font>';
	str+='</td>';
	
	str+='<td align=right>';
	if ((g_search_text.length==0)|| g_SearchInput.value=='Search Users...')
	{
	  	str+='<input type="text" id="search_field" onkeyup="SearchInput()" onblur="CloseSearch()" onclick="ClearSearchInput()"  size="20" value="Search Users..." style="opacity: 0.5;text-indent: 5;margin-left: 0;height:48;border-color: #c7c7c7; border-style: solid; border-width: 1">';
	}else
	{
	  	str+='<input type="text" id="search_field" onkeyup="SearchInput()" onblur="CloseSearch()" onclick="ClearSearchInput()" size="20" value="'+g_search_text+'" style="text-indent: 5;margin-left: 0;height:48;border-color: #c7c7c7; border-style: solid; border-width: 1">';
	}
	str+='</td>';
	
	/*str+='<td>';
	str+='<div class="navbar" style="background-color: #F5F6F8">';
		if (g_expired_user==0)
		{
			str+='<div class="menudropoption">';
			    str+='<button class="dropbtn">No Filter '; 
			    str+='<i class="fa fa-caret-down"></i>';
			    str+='</button>';
			    str+='<div class="menudropdown-content">';
			     // str+='<a href="javascript:()">Active</a>';
			      str+='<a href="javascript:callezserver_get_expired_user()">Expired</a>';
			    str+='</div>';
			str+='</div>'; 
		}else if (g_expired_user==1)
		{
			str+='<div class="menudropoption">';
			    str+='<button class="dropbtn">Expired '; 
			    str+='<i class="fa fa-caret-down"></i>';
			    str+='</button>';
			    str+='<div class="menudropdown-content">';
			      str+='<a href="javascript:callezserver_get_all_user()">No Filter</a>';
			    str+='</div>';
			str+='</div>'; 
		}
		
	str+='</td>';
	*/
	str+='<td>'+
		' <font face="Arial"> <font size="2">'+
		' <select style="text-indent: 5;width:100;height:48;" size="1" border-color: #c7c7c7; border-style: solid; border-width: 1" id=page_no onchange="change_page_no()">'+
		'<option value="10">10</option>'+
		'<option value="20">20</option>'+
		'<option value="50">50</option>'+
		'<option value="100">100</option>'+
		'<option value="1000">1000</option>';
		
	str+='</select></font></td>';	
	if(!bMobileDevice){
		str+='<td>';
		str+='<div class="navbar" style="background-color: #F5F6F8">';
			str+='<div class="menudropdown" style="background-color: #56C1D5">' ;
			    str+='<a href="javascript:open_modal()">Add User</a>';
			str+='</div>'; 
			str+='<div class="menudropdown"  style="background-color: #E26498">';
			 str+='<button class="dropbtn" onclick="callezserver_get_all_user()">'; 
			   
			    str+='<i class="fa fa-refresh"></i>';
			    str+='</button>';
			str+='</div>'; 
			/*str+='<div class="menudropdown">';
			    str+='<button class="dropbtn" style="background-color: #414D5F">'; 
			    str+='<i class="fa fa-caret-down"></i>';
			    str+='</button>';
			    str+='<div class="menudropdown-content">';
			      str+='<a href="javascript:open_mass_edit_user_modal()">Mass Edit</a>';
			      str+='<a href="javascript:callezserver_delete_selected_user()">Mass Delete</a>';
			      str+='<a id=user_cut_field href="javascript:callezserver_cut_selected_user()">Mass Cut</a>';
			    str+='</div>';
			str+='</div>'; 
			*/
			
		str+='</td>';
	}
	

	
	str+='</tr>';
	str+='</table>';
	//alert(str);
	
	//str='<font size=4>Users</font>';
	document.getElementById("ezhead").innerHTML=str;
	
	//alert(parent.document.getElementById("page_no"));

	//g_search_user_item.value=null;
	if(bMobileDevice){
		content = document.getElementById("ezmenucontent");
		
	   	document.getElementById("page_no").value=g_constant_limit;
	}else
	{
		content = parent.document.getElementById("ezmenucontent");
	   	parent.document.getElementById("page_no").value=g_constant_limit;
	}
   
	content.innerHTML="";
	
	 HTML_str= '<table border="0" style="margin-top: 20px;" width=90% align="center">'+
//	 HTML_str= '<table border="0" align="center">'+
	  '<tr>'+
	      '<td width="10" align="center"> <input type="checkbox" name="checkallbox" id=checkallbox  onclick=set_all_checked(g_user_no)></td>'+
	      '<td width="10" align="center"><font face="Arial" size="2"></font></td>';
	      if ((g_user_authorization_mode==1) || (g_user_authorization_mode==0))
	      {
		     HTML_str+='<td id="user_name_id" width="'+cellsize+'" align="center"><font face="Arial" size="2">User Name</font>';
		     
		      HTML_str+='</td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2">Password</font></td>';
		      HTML_str+='<td id="group_id" width="10%" align="center"><font face="Arial" size="2">Bouquet</font>';
		      
		      HTML_str+='</td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2">CH List</font></td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2">Movie List</font></td>'+
		      '<td id="time_expired_id" width="'+cellsize+'" align="center"><font face="Arial" size="2">Expired Time</font>';
		      
		      HTML_str+='</td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2"></font></td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2">IP</font></td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2">MAC ID</font></td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2">Reseller</font></td>'+
	 	 '</tr>'+'<tr><td  colspan="12"><hr size="1" color="#66FFFF"></td></tr>';
	      }else if (g_user_authorization_mode==2)
	      {
	      	     HTML_str+='<td id="user_name_id" width="'+cellsize+'" align="center"><font face="Arial" size="2">PIN No.';
		     
		      HTML_str+='<td id="group_id" width="'+cellsize+'" align="center"><font face="Arial" size="2">Bouquet';
		      
		      HTML_str+='</td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2">CH List</font></td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2">Movie List</font></td>'+
		      '<td  id="time_expired_id" width="10%" align="center"><font face="Arial" size="2">Expired Time</font>';
		     
		      HTML_str+='</td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2"></font></td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2">IP</font></td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2">MAC ID</font></td>'+
		      '<td width="'+cellsize+'" align="center"><font face="Arial" size="2">Reseller</font></td>'+
	 	 '</tr>'+'<tr><td  colspan="11"><hr size="1" color="#66FFFF"></td></tr>';
	      }
	      	
 	user_no=current_position;
 	
 	while (1)
	{
 	 	if (response[i]==0) break;
		//alert(response[i]);
	 	strlength=response[i].length;
   	    	username=response[i].slice(9,strlength);
     	 	strlength=response[i+1].length;
   	    	szpassword=response[i+1].slice(9,strlength);
    	 	strlength=response[i+2].length;
   	    	szgroup=response[i+2].slice(6,strlength);
	 	strlength=response[i+3].length;
   	    	expired_time=response[i+3].slice(13,strlength);

	   	bexpired=0;
	 	pos=expired_time.indexOf('/');
	 	if (pos>0)
	 	{
			expired_MM=expired_time.substring(0,pos);
			expired_time_temp=expired_time.substring(pos+1);
			pos=expired_time_temp.indexOf('/');	
			expired_DD=expired_time_temp.substring(0,pos);
			expired_YY=expired_time_temp.substring(pos+1);
			//yearmsg=cur_year+'/'+cur_month+'/'+cur_day+'--'+expired_YY+'/'+expired_MM+'/'+expired_DD;
	   	    	//alert(yearmsg);
	
	   	    	if (cur_year<expired_YY)
	   	    	{
	   	    		bexpired=0;
	   	    	}else if (cur_year==expired_YY)
	   	    	{
		   	    	if (cur_month<expired_MM)
		   	    	{
		   	    		bexpired=0;
		   	    	}else if (cur_month==expired_MM)
		   	    	{	
			   	    	if (cur_day>expired_DD)
			   	    	{
			   	    		bexpired=1;
			   	    	}else
		   	    		{
		   	    			bexpired=0;
		   	    		}
		   	    	}else if (cur_month>expired_MM)
		   	    	{
		   	    		bexpired=1;
		   	    	}
		   	    	
	   	    	}else if (cur_year>expired_YY)
	    		{
	    			bexpired=1;
	    		}
    		}else
    		{
    			bexpired=2;
    		}
    			
    	
   	    	
   	    	
     	 	//strlength=response[i+4].length;
     	 	
   	    	//paymodel=response[i+4].slice(9,strlength);
	 	//strlength=response[i+5].length;
   	    	//user_point=response[i+5].slice(11,strlength);
	 	strlength=response[i+4].length;
   	    	userip=response[i+4].slice(7,strlength);
	 	strlength=response[i+5].length;
   	    	macid=response[i+5].slice(6,strlength);
	 	strlength=response[i+6].length;
   	    	reseller=response[i+6].slice(9,strlength);
 
 		i=i+7;

		      HTML_str=HTML_str+'<tr onmouseover="ChangeBackgroundColor(this)" onmouseout="RestoreBackgroundColor(this)">'+
		      '<td width="20" align="center">';
		      if (g_user_found_position==user_no)
		      {
	 		HTML_str+=' <input type="checkbox" checked name=checkbox'+user_no;
	 	      }else
	 	      {
	 		HTML_str+=' <input type="checkbox" name=checkbox'+user_no;
	 	      }
	 		HTML_str+=' id=checkbox'+user_no+'></td>';
	 		
		//   if ((g_user_authorization_mode==1) || (g_user_authorization_mode==0))
		 //  {
		      HTML_str=HTML_str+'<td width="20" align="center"><font face="Arial"> <font size="2">'+user_no+'</font></td>'+
		      '<td width="'+cellsize+'%" align="center">'+
	 		' <font face="Arial" font size="2">'+
	 		' <input style="padding: 5px;height:30;" readonly type="text" name="username"'+
	 		' id=username'+user_no+' size="12" value="'+
	 		username+'"/></font></td>'+
	 		
		      '<td width="10%" align="center">'+
	 		' <font face="Arial" font size="2">'+
	 		' <input  style="padding: 5px;height:30;" type="text" name="password"'+
	 		' id=password'+user_no+' size="12" value="'+
	 		szpassword+'"/></font></td>';
		/*   }else if (g_user_authorization_mode==2)
	 		{
		 		HTML_str=HTML_str+'<td width="'+cellsize+'" align="center"><font face="Arial"> <font size="2">'+user_no+'</font></td>'+
			      '<td width="'+cellsize+'" align="center">'+
		 		' <font face="Arial" font size="2">'+
		 		' <input style="padding: 5px;height:30;" readonly ype="text" name="username"'+
		 		' id=username'+user_no+' size="36" value="'+
		 		username+'"/></font></td>';
		 	
	 	}
	 	*/
	 		

		      HTML_str=HTML_str+'<td width="'+cellsize+'" align="center">'+
	 		' <font face="Arial"> <font size="2">'+
			' <select style="text-indent: 5;width:152;height:26;" size="1" name="group" id=group'+user_no+'>';
	 		for (j=0;j<g_total_group_no;j++)
	 		{
	 			groupname=g_groupname_array[j];
	 			
	 			//if (szgroup.search(groupname)==-1)
	 			if (szgroup!=(groupname))
	 			{
	 				HTML_str+='<option value="'+groupname+'">'+groupname+'</option>';
	 			}
	 			else 
	 			{
	 				if (szgroup.length==groupname.length)
	 				{
	 					HTML_str+='<option selected="selected" value="'+groupname+'">'+groupname+'</option>';
	 				}else
	 				{
	 					HTML_str+='<option value="'+groupname+'">'+groupname+'</option>';
	 				}
	 			}	 			
	 		}
	  		HTML_str+='</select></font></td>';
	  	
	  		HTML_str=HTML_str+'<td width="'+cellsize+'" align="center">'+
	 		' <font face="Arial"> <font size="2">'+
			' <select style="text-indent: 5;width:152;height:26;" size="1" onchange="call_download_user_chlist('+user_no+','+'chlist'+user_no+')" name="ch_list" id=chlist'+user_no+'>'+
 			'<option value="-1">--</option>'+
			'<option value="enigma">Enigma</option>'+
			'<option value="enigma16">Enigma 1.6</option>'+
			'<option value="enigma(RTMP)">Enigma(RTMP)</option>'+
			'<option value="enigma16(RTMP)">Enigma 1.6(RTMP)</option>'+
			'<option value="enigma_no">Enigma(chno)</option>'+
			'<option value="enigma16_no">Enigma 1.6(chno)</option>'+
			'<option value="enigma_no(RTMP)">Enigma(RTMP/chno)</option>'+
			'<option value="enigma16_no(RTMP)">Enigma 1.6(RTMP/chno)</option>'+
			'<option value="m3u">m3u</option>'+
			'<option value="m3u_getlink">m3u(getlink API)</option>'+
			'<option value="m3u_getphp">m3u(getphp)</option>'+
			'<option value="m3u_pure_name">m3u (No Encoded)</option>'+
			'<option value="m3u_ts">m3u(MPEG TS)</option>'+
			'<option value="m3u_flv">m3u(FLV)</option>'+
			'<option value="m3u_no">m3u(chno)</option>'+
			'<option value="m3ue_no">m3u(chno with suffix)</option>'+
			'<option value="m3ue_name">m3u(chname with suffix)</option>'+
			'<option value="m3u_rtmp">m3u(RTMP)</option>'+
			'<option value="m3u8">m3u8</option>'+
			'<option value="m3u8_getlink">m3u8(getlink API)</option>'+
			'<option value="m3u8_pure_name">m3u8(No Encoded)</option>'+
			'<option value="octagon">octagon</option>'+
			'<option value="ariva">ariva</option>'+
 			'<option value="xbmc">XBMC</option>'+
 			'<option value="pure">Pure</option>'+
			'<option value="optumuss">Optumuss</option>'+
			'<option value="amiko">Amiko</option>'+
			'<option value="spark">Spark</option>'+
			'<option value="tiger">Tiger</option>'+
			'<option value="Bluestar">Bluestar</option>'+
			'<option value="nstreamvod">nStreamVOD</option>'+
 			'<option value="m3u_ott">OTT Player</option>'+
			'<option value="script_enigma">*Enigma Script*</option>'+
			'<option value="script_enigma16">*Enigma16 Script*</option>'+
			'<option value="script_mac_address">*MAC Address Script*</option>';
	  		HTML_str+='</select></font></td>';		
	  		                         
 			HTML_str=HTML_str+'<td width="'+cellsize+'" align="center">'+
	 		' <font face="Arial"> <font size="2">'+
			' <select style="text-indent: 5;width:152;height:26;" size="1" onchange="call_download_user_movielist('+user_no+','+'movielist'+user_no+')" name="movie_list" id=movielist'+user_no+'>'+
 			'<option value="-1">--</option>'+
			'<option value="m3u">m3u (Movie)</option>'+
			'<option value="m3u_getlink">m3u(Movie-getlink API)</option>'+
			'<option value="ch_movie_m3u">m3u (Channel/Movie)</option>'+
			'<option value="m3u_all_getlink">m3u(All-getlink API)</option>'+
			'<option value="Bluestar">Bluestar</option>'+
			'<option value="enigma">Enigma</option>'+
			'<option value="enigma16">Enigma 1.6</option>'+
 			'<option value="nstreamvod">nStreamVOD</option>'+
			'<option value="script_enigma">*Enigma Script*</option>'+
			'<option value="script_enigma16">*Enigma16 Script*</option>';
	  		HTML_str+='</select></font></td>';
	  		
	  		if (g_auto_renew==1)
	  		{
	  		
		  		 HTML_str+='<td id=expired_time'+user_no+' width="15%" align="center">';
				if (bexpired==0)
		  		{	 		 		
			 		HTML_str+=' <font face="Arial"> <font size="2">'+expired_time+'</font></td>';	
		 		}else if (bexpired==1)
		 		{
		 			
		 			HTML_str+=' <font face="Arial" color="#FF0000"> <font size="2"><b>'+expired_time+'</b></font></td>';		
	
		 		}else if (bexpired==2)
		 		{
		 			
		 			HTML_str+=' <font face="Arial"> <font size="2"><b>'+expired_time+'</b></font></td>';		
	
		 		}
	 		}else
	 		{
	 			
	 		
			if (bexpired==0)
	  		{	 		 		
			      HTML_str+='<td "'+cellsize+'" align="center">'+
		 		' <font face="Arial"> <font size="2">'+
		 		' <input style="text-indent: 5;height:26;" type="text" "'+
		 		+user_no+' size="10" value="'+
		 		expired_time+'"/></font></td>';		
	 		}else if (bexpired==1)
	 		{
	 			
	 			HTML_str+='<td "'+cellsize+'" align="center">'+
		 		' <font face="Arial"> <font size="2">'+
		 		' <input style="text-indent: 5;height:26;background:#ff0000;" type="text" '+
		 		+user_no+' size="10" value="'+
		 		expired_time+'"/></font></td>';		

	 		}else if (bexpired==2)
	 		{
	 			
	 			HTML_str+='<td "'+cellsize+'" align="center">'+
		 		' <font face="Arial"> <font size="2">'+
		 		' <input style="text-indent: 5;height:26;background:#ffff00;" type="text"'+
		 		user_no+' size="10" value="'+
		 		expired_time+'"/></font></td>';		

	 		}
			 	
			 	 if (bexpired==1)
			 	 {
			 	 	HTML_str=HTML_str+'<td width="'+cellsize+'" align="center">'+
			 		' <font face="Arial"> <font size="2">'+
					' <select style="text-indent: 5;width:152;height:26;" style="background-color: red" size="1" id=expired_time'+user_no+'>'+
		 			'<option selected="selected" style="background-color: white" value='+0+'>'+0+'</option>'+
		 			'<option style="background-color: white" value="30">+ 1 month</option>'+
					'<option style="background-color: white" value="60">+ 2 month</option>'+
					'<option style="background-color: white" value="90">+ 3 month</option>'+
					'<option style="background-color: white" value="120">+ 4 month</option>'+
					'<option style="background-color: white" value="150">+ 5 month</option>'+
					'<option style="background-color: white" value="180">+ 6 month</option>'+
					'<option style="background-color: white" value="210">+ 7 month</option>'+
					'<option style="background-color: white" value="240">+ 8 month</option>'+
					'<option style="background-color: white" value="270">+ 9 month</option>'+
					'<option style="background-color: white" value="300">+ 10 month</option>'+
					'<option style="background-color: white" value="330">+ 11 month</option>'+
					'<option style="background-color: white" value="360">+ 1 year</option>'+
					'<option style="background-color: white" value="-30">- 1 month</option>'+
					'<option style="background-color: white" value="-60">- 2 month</option>'+
					'<option style="background-color: white" value="-90">- 3 month</option>'+
					'<option style="background-color: white" value="-120">- 4 month</option>'+
					'<option style="background-color: white" value="-150">- 5 month</option>'+
					'<option style="background-color: white" value="-180">- 6 month</option>'+
					'<option style="background-color: white" value="-210">- 7 month</option>'+
					'<option style="background-color: white" value="-240">- 8 month</option>'+
					'<option style="background-color: white" value="-270">- 9 month</option>'+
					'<option style="background-color: white" value="-300">- 10 month</option>'+
					'<option style="background-color: white" value="-330">- 11 month</option>'+
					'<option style="background-color: white" value="-360">- 1 year</option>';
					HTML_str+='</select></font></td>';
		
			 	 }else
			 	 {
			 	
			 	
				 	HTML_str=HTML_str+'<td width="'+cellsize+'" align="center">'+
			 		' <font face="Arial"> <font size="2">'+
					' <select style="text-indent: 5;width:152;height:26;" size="1" id=expired_time'+user_no+'>'+
		 			'<option selected="selected"  value='+0+'>'+0+'</option>'+
		 			'<option value="30">+ 1 month</option>'+
					'<option value="60">+ 2 month</option>'+
					'<option value="90">+ 3 month</option>'+
					'<option value="120">+ 4 month</option>'+
					'<option value="150">+ 5 month</option>'+
					'<option value="180">+ 6 month</option>'+
					'<option value="210">+ 7 month</option>'+
					'<option value="240">+ 8 month</option>'+
					'<option value="270">+ 9 month</option>'+
					'<option value="300">+ 10 month</option>'+
					'<option value="330">+ 11 month</option>'+
					'<option value="360">+ 1 year</option>'+
					'<option value="-30">- 1 month</option>'+
					'<option value="-60">- 2 month</option>'+
					'<option value="-90">- 3 month</option>'+
					'<option value="-120">- 4 month</option>'+
					'<option value="-150">- 5 month</option>'+
					'<option value="-180">- 6 month</option>'+
					'<option value="-210">- 7 month</option>'+
					'<option value="-240">- 8 month</option>'+
					'<option value="-270">- 9 month</option>'+
					'<option value="-300">- 10 month</option>'+
					'<option value="-330">- 11 month</option>'+
					'<option value="-360">- 1 year</option>';
					HTML_str+='</select></font></td>';
				}
	 		}
	 	
	 		HTML_str+='<td width="'+cellsize+'" align="center">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input style="padding: 5px;height:30;" type="text" name="userip"'+
	 		' id=userip'+user_no+' size="12" value="'+
	 		userip+'"/></font></td>';	 			

	 		HTML_str+='<td width="'+cellsize+'" align="center">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input style="padding: 5px;height:30;" type="text" name="macid"'+
	 		' id=macid'+user_no+' size="12" value="'+
	 		macid+'"/></font></td>';	 			
   
	 		HTML_str+='<td id=reseller'+user_no+' width="10%" align="center">'+
	 		' <font face="Arial"> <font size="2">'+
	 		reseller+'</font></td>';
	 		
		      	 HTML_str+='<td width="'+cellsize+'" align="center">'+
	 		"<a href='javascript:void(0)'"+
			' onclick=call_Update_User("'+user_no+'")><img src="save.png"></img></a></td>';
			HTML_str+='<td>'+"<a href='javascript:void(0)'"+
			' onclick=open_more_user_modal("'+username+'")><img src="edit.png"></img></a>'+
	 		'</td>';
		   	HTML_str+='<td>'+"<a href='javascript:void(0)'"+
			' onclick=call_Del_User("'+username+'")><img src="/admin/del.png"></img></a></td>';

		      HTML_str+='</tr>';
		total_no++;
		user_no++;
		user_index++;
		//alert(HTML_str);
    }
    
        HTML_str=HTML_str+'</table>';
       
        new_total_no=Number(g_user_no)+1;
        //new_total_no=total_no+1;
       //  alert(user_list_info.innerHTML);
   	//total_count=total_no;
  // 	g_total_user_no=total_no;
// 	menustr1='<table width=100%><tr><td id=total_no_top_id>'+'<font face="Arial"> <font size="2">User Total: '+ total_count+'</td></tr><tr>';
 	menustr1='<table width=100%><tr>';
	
	/*menustr1+='<td align="left" style="margin-left: 50; margin-top: 20; margin-bottom: 0"><input style="text-indent: 5;height:26;" name="user_search_field" id="user_search_field" size="20" value="'+g_search_text+'"/></font><font face="Arial">';
	if (g_user_found_position>0)
	{
	   menustr1+='&nbsp<input style="height:26;" type="button" value="Find Next" onclick="javascript:callServer_search_user();" id="user_search_button" name="search_user" />';
	}else
	{
	   menustr1+='&nbsp<input style="height:26;" type="button" value="Search" onclick="javascript:callServer_search_user();" id="user_search_button" name="search_user" />';
	}
	*/
	  menustr1+='</td>';

	menustr1+='<td width="4%">';
		menustr1+='<div id="PanelModal" class="modal">'+
				'<div class="modal-content">';
    				menustr1+='<table  align="center"  cellpadding="5"  cellspacing="7">';
    				menustr1+='<tr>'+
				'<td  colspan=2 align=left><font face="Arial" size="6"><b>New User</b></font></td><td colspan=2 align=right id=add_user_dialog_message name=add_user_dialog_message></td></tr>';
	 		
		 		menustr1+='<tr><td  colspan="4"><hr size="1" color="#000000"></td></tr>';

    				menustr1+='<tr><td><font face="Arial"><font size="2">User at </font></td><td width=25% height="23">'+
				' <font face="Arial" size="2">'+
				' <input readonly style="text-indent: 5;height:26;" type="text" name="userno"'+
				' id="userno"'+
				' size="16" value="'+
				new_total_no+
				'"/></font></td>';
				
	 			if ((g_user_authorization_mode==1) || (g_user_authorization_mode==0))
	 			{
					menustr1+='<td width=25%><font face="Arial" font size="2">User Name</font></td><td  width=25%>'+
					 	' <font face="Arial" size="2">'+
					 	' <input style="text-indent: 5;height:26;" type="text" name="username"'+
					 	' id=username'+
					 	' size="16"/'+
					 	'</font></td></tr>';
					ranpass=Math.floor(Math.random() * 10000000000) + 1;
					menustr1+='<tr><td width=25%><font face="Arial" font size="2">Password</font></td><td width=25%>'+
					 		' <font face="Arial" size="2">'+
					 		' <input style="text-indent: 5;height:26;" type="text" name="password"'+
					 		' id=password'+
					 		' size="16"/ value="'+
					 		ranpass+
					 		'"/>'+
					 		'</font></td>';
					menustr1+='<td width=25%><font face="Arial" font size="2">Rating Password</font></td><td width=25%>'+
					 		' <font face="Arial" size="2">'+
					 		' <input style="text-indent: 5;height:26;" type="text" name="rating_password"'+
					 		' id=rating_password'+
					 		' size="16"/ value="'+
					 		ranpass+
					 		'"/>'+
					 		'</font></td></tr>';
				}else if (g_user_authorization_mode==2)
				{
					menustr1+='<td width=25%><font face="Arial" font size="2">User Name</font></td><td  width=25%>'+
					 	' <font face="Arial" size="2">'+
					 	' <input style="text-indent: 5;height:26;" type="text" name="username"'+
					 	' id=username'+
					 	' size="16"/'+
					 	'</font></td></tr>';			
				}		
				menustr1+='<tr><td width=25%><font face="Arial" font size="2">Bouquet</font></td><td width=25%>'+
				 	'<font face="Arial" size="2">'+
					'<select style="text-indent: 5;width:152;height:26;" size="1" name="group" id=group>';
				for (j=0;j<g_total_group_no;j++)
		 		{
		 			groupname=g_groupname_array[j];
	 				menustr1+='<option value="'+groupname+'">'+groupname+'</option>';
		 		}
	  			menustr1+='</select></font></td>';
	  			
				menustr1+='<td width=25%><font face="Arial"> <font size="2">Level</font></td><td  width=25% height="23">'+
		 		' <font face="Arial"> <font size="2">'+
				' <select style="text-indent: 5;width:152;height:26;" onchange="change_trial_date_format('+'user_level'+')" size="1" name="user_level" id="user_level">';
				menustr1+='<option selected="selected" value="0">'+"User"+'</option>'+
				'<option value="5">'+"Trial"+'</option>';
				menustr1+='</select></font></td></tr>';

				menustr1+='<tr><td width=25%><font face="Arial" size="2">Expired Time</font></td>';
				menustr1+='<td  width=25% id=exipre_time_option width="350">'+
			 		' <font face="Arial"> <font size="2">'+
					' <select style="text-indent: 5;width:152;height:26;" size="1" id=subscription_peroid>'+
		 			'<option style="background-color: white" value="30">1 month</option>'+
					'<option style="background-color: white" value="60">2 month</option>'+
					'<option style="background-color: white" value="90">3 month</option>'+
					'<option style="background-color: white" value="120">4 month</option>'+
					'<option style="background-color: white" value="150">5 month</option>'+
					'<option style="background-color: white" value="180">6 month</option>'+
					'<option style="background-color: white" value="210">7 month</option>'+
					'<option style="background-color: white" value="240">8 month</option>'+
					'<option style="background-color: white" value="270">9 month</option>'+
					'<option style="background-color: white" value="300">10 month</option>'+
					'<option style="background-color: white" value="330">11 month</option>'+
					'<option style="background-color: white" value="360">1 year</option>'+
					'<option style="background-color: white" value="720">2 year</option>'+
					'<option style="background-color: white" value="1080">3 year</option>'+
					'<option style="background-color: white" value="1440">4 year</option>'+
					'<option style="background-color: white" value="1800">5 year</option>';
				menustr1+='</select></font></td>';
				menustr1+='';

				menustr1+='<td width=25%><font face="Arial"></td><td  width=25% height="23">'+
		 		'</td></tr>';
		 		/*
		 		menustr1+='<td width=25%><font face="Arial"> <font size="2">Connection Limit</font></td><td  width=25% height="23">'+
		 		' <font face="Arial"> <font size="2">'+
		 		' <input style="text-indent: 5;height:26;" type="text" name="max_connection"'+
		 		' id="max_connection"'+
		 		' size="16" value="'+
		 		max_connection+
		 		'"/></font></td></tr>';
		 		*/
				
				menustr1+='<tr><td width=25%><font face="Arial" size="2">IP</font></td><td width=25%>'+
				 		' <font face="Arial" size="2">'+
				 		' <input style="text-indent: 5;height:26;" type="text" name="userip"'+
				 		' id=userip'+
				 		' size="16"/>'+
				 		'</font></td>';
				menustr1+='<td width=25%><font face="Arial" size="2">MAC ID</font></td><td width=25%>'+
				 		' <font face="Arial" size="2">'+
				 		' <input style="text-indent: 5;height:26;" type="text" name="macid"'+
				 		' id=macid'+
				 		' size="16"/>'+
				 		'</font></td></tr>';
				menustr1+='<tr><td colspan=2><input id=add_new_user_button style="margin-top:10px;width:100%;height:30;background-color: #ff0000;color: #ffffff;" type="button" value="Add" onclick=call_Add_User() name="Save" /></td>'+
				'<td align=right  colspan=2><input type="button" style="margin-top:10px;width:100%;height:30;background-color: #ff0000;color: #ffffff;" value="Cancel" onclick=close_user_modal() name="Cancel" /></td></tr>';
				menustr1+='</table></div>'+
			'</div></td>';

			menustr1+='<td width="4%">';
			menustr1+='<div id="PanelModalMoreUsers" class="modal">'+
				'<div class="modal-content">';
    				menustr1+='<table align="center"  cellpadding="5"  cellspacing="7">';
    				
			menustr1+='<tr>'+
			'<td  colspan=2 align=left id=more_username><font face="Arial" size="6"><b>'+username+'</b></font></td><td colspan=2 align=right id=save_user_dialog_message name=save_user_dialog_message></td></tr>';
	 		
	 		menustr1+='<tr><td  colspan="4"><hr size="1" color="#000000"></td></tr>';
	 		
	 		menustr1+='<tr><td width=25%><font face="Arial"> <font size="2">First Name</font></td><td width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_first_name"'+
	 		' id="more_first_name"'+
	 		' size="16" value=""/></font></td>';
	 		
	 		menustr1+='<td width=25%><font face="Arial"><font size="2">Last Name</font></td><td  align=right width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;;" type="text" name="more_last_name"'+
	 		' id="more_last_name"'+
	 		' size="16" value=""/></font></td></tr>';
	 		
	 		
	
			menustr1+='<tr><td width=25%><font face="Arial"> <font size="2">Rating Password</font></td><td  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_rating_password"'+
	 		' id="more_rating_password"'+
	 		' size="16" value=""/></font></td>';
	
	 		menustr1+='<td width=25%><font face="Arial"><font size="2">Level: </font></td><td  align=right  width=25% height="23">'+
		 		' <font face="Arial"> <font size="2">'+
				' <select style="text-indent: 5;width:150;height:26;" size="1" name="more_level" id="more_level">';
			menustr1+='<option selected="selected" value="0">'+"User"+'</option>'+
				'<option value="5">'+"Trial"+'</option>';
				menustr1+='</select></font></td></tr>';

			menustr1+='<tr><td width=25%><font face="Arial"> <font size="2">Connection Limit</font></td><td  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_max_connection"'+
	 		' id="more_max_connection"'+
	 		' size="16" value=""/></font></td>';
	
	 		menustr1+='<td width=25%><font face="Arial"> <font size="2">Connections</font></td><td  width=25% align=left style="text-indent: 10;height:26;" id=more_active_connection width="350" height="23">'+
	 		' <font face="Arial"> <font size="2"></font></td></tr>';

			menustr1+='<tr><td width=25%><font face="Arial"> <font size="2">IP 2</font></td><td  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input style="text-indent: 5;height:26;" type="text" name="more_user2ndip"'+
	 		' id="more_user2ndip"'+
	 		' size="16" value=""/></font></td>';
	
			menustr1+='<td width=25%><font face="Arial"><font size="2">IP 3</font></td><td  align=right  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input style="text-indent: 5;height:26;" type="text" name="more_user3rdip"'+
	 		' id="more_user3rdip"'+
	 		' size="16" value=""/></font></td></tr>';
	
			menustr1+='<tr><td width=25%><font face="Arial"> <font size="2">IP 4</font></td><td  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input style="text-indent: 5;height:26;"  type="text" name="more_user4thip"'+
	 		' id="more_user4thip"'+
	 		' size="16" value=""/></font></td>';
	
			menustr1+='<td width=25%><font face="Arial"><font size="2">IP 5</font></td><td  align=right  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_user5thip"'+
	 		' id="more_user5thip"'+
	 		' size="16" value=""/></font></td></tr>';
	 			
	  		
	 		/* menustr1+='<tr><td><font face="Arial"> <font size="2">Pay Model: </font></td><td width="350" height="23">'+
		 		' <font face="Arial"> <font size="2">'+
				' <select size="1" name="paymodel" id="paymodel">';
		 		for (j=0;j<3;j++)
		 		{
		 			paymodel_option=g_paymodel_array[j];
		 			if (paymodel.search(paymodel_option)==-1)
		 			{
		 				menustr1+='<option value="'+paymodel_option+'">'+paymodel_option+'</option>';
		 			}
		 			else
		 			{
		 				menustr1+='<option selected="selected" value="'+paymodel_option+'">'+paymodel_option+'</option>';
		 			}	 			
		 		}
	 		menustr1+='</select></font></td></tr>';
		 		*/
	
			
	
	 		menustr1+='<tr><td width=25%><font face="Arial"> <font size="2">ISP Lock</font></td><td  width=25% height="23">'+
		 		' <font face="Arial"> <font size="2">'+
				' <select style="text-indent: 5;width:152;height:26;" size="1" name="more_isp_lock" id="more_isp_lock">';
			menustr1+='<option selected="selected" value="OFF">'+"OFF"+'</option>'+
				'<option value="ON">'+"ON"+'</option>';
			menustr1+='</select></font></td>';
	  		menustr1+='<td width=25%><font face="Arial"><font size="2">Email: </font></td><td  align=right   width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_email"'+
	 		' id="more_email"'+
	 		' size="16" value=""/></font></td></tr>';
			
			/* menustr1+='<tr><td><font face="Arial"> <font size="2">User Point</font></td><td width="350" height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input type="text" name="user_point"'+
	 		' id="user_point"'+
	 		' size="16" value=""/></font></td></tr>';
	 		*/
	
	
	 		menustr1+='<tr><td width=25%><font face="Arial"> <font size="2">Mobile Phone</font></td><td  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_smart_phone"'+
	 		' id="more_smart_phone"'+
	 		' size="16" value=""/></font></td>';
	
	 		menustr1+='<td width=25%><font face="Arial"><font size="2">WhatsApp</font></td><td  align=right  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_tablet"'+
	 		' id="more_tablet"'+
	 		' size="16" value=""/></font></td></tr>';
	
			/* menustr1+='<tr><td><font face="Arial"> <font size="2">Desktop ID</font></td><td width="350" height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_desktop"'+
	 		' id="more_desktop"'+
	 		' size="16" value=""/></font></td>';
	
	 		menustr1+='<td width=25%><font face="Arial"><font size="2">TV ID</font></td><td  align=right  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_tv"'+
	 		' id="more_tv"'+
	 		' size="16" value=""/></font></td></tr>';
	 		*/
	 		
	 		menustr1+='<tr><td width=25%><font face="Arial"> <font size="2">Adress</font></td><td  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_address"'+
	 		' id="more_address"'+
	 		' size="16" value=""/></font></td>';
	 		
	 		menustr1+='<td width=25%><font face="Arial"><font size="2">City: </font></td><td  align=right   width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_city"'+
	 		' id="more_city"'+
	 		' size="16" value=""/></font></td></tr>';
	 		
	 		menustr1+='<tr><td width=25%><font face="Arial"> <font size="2">ZIP</font></td><td  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input style="text-indent: 5;height:26;"  type="text" name="more_zip"'+
	 		' id="more_zip"'+
	 		' size="16" value=""/></font></td>';
	 		
	 		menustr1+='<td width=25%><font face="Arial"><font size="2">Home Tel</font></td><td  align=right  width=25% height="23">'+
	 		' <font face="Arial"> <font size="2">'+
	 		' <input  style="text-indent: 5;height:26;" type="text" name="more_tel"'+
	 		' id="more_tel"'+
	 		' size="16" value=""/></font></td></tr>';
	  
	 	   	menustr1+='<tr ><td  width=25% colspan=2><font  face="Arial"><input type="button" style="width:100%;height:30;margin-top:10px;background-color: #ff0000;color: #ffffff;" value="Save" onclick=callServer_Save_More() name="Save" /></font></td>'+
	 	   	'<td align=right  width=25% colspan=2><input type="button" style="margin-top:10px;width:100%;height:30;background-color: #ff0000;color: #ffffff;" value="Cancel" onclick=close_more_user_modal() name="Cancel" /></td></tr>';
	 
		    	
				
		
				menustr1+='</table>'+
				'</div>'+
			'</div></td>';	

	
		

	  menustr1+='</tr>'+
	  '<tr><td colspan=4><hr size="1" color="#66FFFF"></td></tr>'+
		      '</table>';
	if (total_count==0)
	{
		current_position=0;
		endposition=0;
	}else
	{
		endposition=current_position+total_no-1;
	}
	menustr2='<table width=100%><tr><td width="13%" align="right">'+'<font face="Arial"> <font size="2">Showing '+ current_position+' to '+endposition+' of </td>';
	menustr2+='<td width="20%" id=total_no_top_id>'+'<font face="Arial"> <font size="2">'+total_count+' users</td>';
	position=1;
	limit=g_constant_limit;
	
	if (total_count>g_constant_limit)
	{
		menustr2+='<td width="67%"><font face="Arial" size="2"><input style="border: none;width:40;height:40;" type="button" value="&#x226A" onclick="javascript:call_get_first_user('+position+','+limit+')"; /> </font>';
	
		if (current_position-g_constant_limit<0)
		{
				
			menustr2+='<font face="Arial" size="2"><input style="border: none;width:40;height:40;" type="button" disabled value=&lt; onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
		}else
		{
			position=current_position-g_constant_limit;
			if ((position+g_constant_limit)<=total_count)
			{
				limit=g_constant_limit;
			}else
			{
				limit=total_count%g_constant_limit;
				if (limit==0) limit=g_constant_limit;
			}
			menustr2+='<font face="Arial" size="2"><input style="border: none;width:40;height:40;" type="button" value=&lt; onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
		}
		// user sequence
		total_sequence=Math.floor(total_count/g_constant_limit);
		//alert(total_sequence);
		if ((total_count%g_constant_limit) > 0)
		{
			total_sequence++;
		}
		
		curren_sequence_no=Math.floor(current_position/g_constant_limit)+1;
		//alert(curren_sequence_no);
		if ((total_sequence-curren_sequence_no)<g_sequence_constant_limit)
		{
			start_sequence_no=total_sequence-g_sequence_constant_limit;
		}else
		{
			start_sequence_no=curren_sequence_no-(g_sequence_constant_limit/2);
		}
		//alert(start_sequence_no);
		if (start_sequence_no<=0) start_sequence_no=1;
		//if (total_sequence<g_sequence_constant_limit)
		//{
		//	start_sequence_no=1;
		//}
		for (i=(start_sequence_no-1)*g_constant_limit+1,j=start_sequence_no,k=1;;j++,k++)
		{
			if (j>=total_sequence)
			{
				position=i;
				limit=total_count%g_constant_limit;
				
				if (limit==0) limit=g_constant_limit;
				if (j<10)
				{
					if (j==curren_sequence_no)
					{
						menustr2+='<font face="Arial" size="2"><input style="border: none;width:40;height:40;color:#ffffff;background-color:#1E90FF" type="button" value="0'+j+'" onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
					}else
					{
						menustr2+='<font face="Arial" size="2"><input style="border: none;width:40;height:40;" type="button" value="0'+j+'" onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
					}
				}else
				{
					if (j==curren_sequence_no)
					{
						menustr2+='<font face="Arial" size="2"><input style="border: none;width:40;height:40;color:#ffffff;background-color:#1E90FF" type="button" value="'+j+'" onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
					}else
					{
						menustr2+='<font face="Arial" size="2"><input style="border: none;width:40;height:40;" type="button" value="'+j+'" onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
					}
				}
				//menustr2+='</td>';
				break;
			}
			if (k<=g_sequence_constant_limit)
			{
				position=i;
				limit=g_constant_limit;
				if (j<10)
				{
					if (j==curren_sequence_no)
					{
						menustr2+='<font face="Arial" size="2"><input style="border: none;width:40;height:40;color:#ffffff;background-color:#1E90FF" type="button" value="0'+j+'" onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
					}else
					{
						menustr2+='<font face="Arial" size="2"><input style="border: none;width:40;height:40;" type="button" value="0'+j+'" onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
					}
				}else
				{
					if (j==curren_sequence_no)
					{
						menustr2+='<font face="Arial" size="2"><input style="border: none;width:40;height:40;color:#ffffff;background-color:#1E90FF" type="button" value="'+j+'" onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
					}else
					{
						menustr2+='<font face="Arial" size="2"><input style="border: none;width:40;height:40;" type="button" value="'+j+'" onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
					}
				}
				i+=g_constant_limit;
			}else
			{
				//menustr2+='</td>';
				break;
			}
			
			
		}
		if (endposition+1<=total_count)
		{
			position=endposition+1;
			if ((position+g_constant_limit)<=total_count)
			{
				limit=g_constant_limit;
			}else
			{
				limit=total_count%g_constant_limit;
				if (limit==0) limit=g_constant_limit;
			}
			menustr2+='<font face="Arial" size="2"><input type="button" style="border: none;width:40;height:40;" value=&gt; onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
		}else
		{
			menustr2+='<font face="Arial" size="2"><input  style="border: none;width:40;height:40;" type="button" disabled value=&gt; onclick="javascript:call_get_users('+position+','+limit+')"; /> </font>';
		}
		if ((total_count%g_constant_limit)==0)
		{
			position=total_count-g_constant_limit+1;
			limit=g_constant_limit;
		}else
		{
			position=total_count-(total_count%g_constant_limit)+1;
			limit=total_count%g_constant_limit;
			if (limit==0) limit=g_constant_limit;
		}
		menustr2+='<font face="Arial" size="2"><input style="border: none;width:40;height:40;" type="button" value="&#x226B" onclick="javascript:call_get_users('+position+','+limit+')"; /></font>';
	}else
	{
		menustr2+='<td>';
	}
	menustr2+='</td></tr></table>';
      	content.innerHTML=menustr1+HTML_str+menustr2;
      	
      	if (g_add_user_flag==1)
      	{
       		open_modal();
      	}
     	g_add_user_flag=0;
     	g_SearchInput = document.getElementById("search_field");
     	if (g_search_text.length>0)
     	{
     		g_SearchInput.setSelectionRange(g_SearchInput.value.length, g_SearchInput.value.length);
     		g_SearchInput.focus();
     	}
      	Get_Reseller_Credit_No();
 }

 
}
function get_reseller_auto_renew()
{
	var cgi_url;
  	
  	g_token=find_cookie_value("token");
	cgi_url = "/server/get_reseller_auto_renew?token="+escape(g_token)+"&flag="+Math.random();
	//alert(cgi_url);
	
	xmlHttp.open("GET", cgi_url, true);
	xmlHttp.onreadystatechange = xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState == 4) {
	    		var response = xmlHttp.responseText;
	    		g_auto_renew=response;
	    		//alert(g_auto_renew);
		    callServer_System_Inquery();
		    g_System_timer=setInterval(function(){callServer_System_Inquery_Timer()},60*1000);
	    		
		}
	};
	xmlHttp.send(null);
	
}
function call_get_user_level() {
 	var cgi_url;
	var cookieStr;
	var firstpos;
	var endpos;
 
  	
  	g_token=find_cookie_value("token");

	 cgi_url = "/server/get_user_level?token="+escape(g_token)+"&flag="+Math.random();
//	 alert(cgi_url);
	  xmlHttp.open("GET", cgi_url, true);
	 xmlHttp.onreadystatechange = xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState == 4) {
		    var response = xmlHttp.responseText;
		    var reseller_icon;
		    var add_reseller_icon;
			    g_user_level=response;
			   
		    		//reseller_icon=document.getElementById("reseller_icon");
	       			//add_reseller_icon=document.getElementById("add_reseller_icon");
			    if (response==2)
			    {
			    		//reseller_icon.innerHTML='<p align="center" style="margin-top: 5; margin-bottom: 0"><a href="javascript:void(0)" id="reseller_button" onclick="Button_get_reseller()" style="color: #CCCCCC; text-decoration:none"><font face="Arial" size="2"><b>RESELLER</b></font></a>';
		       			//reseller_icon.innerHTML='<p align="left" style="margin-left: 15; margin-top: 0; margin-bottom: 0"><img border="0" src="reseller.PNG" width="18" height="18" align="absmiddle"><font face="Arial" size="2"><b>Reseller</b></font>';
			    		//add_reseller_icon.innerHTML='<p align="left" style="margin-left: 15; margin-top: 0; margin-bottom: 0"><img border="0" src="reseller.PNG" width="18" height="18" align="absmiddle"><font face="Arial" size="2"><b>Add Reseller</b></font>';
		
			    }else
			    	{
			    		
			    		if(bMobileDevice){
			    			
				    		
			    		}else
			    		{
			    			reseller_icon=parent.document.getElementById("reseller_button");
			    			
				    		
				    		reseller_icon.style.display = "none";
			    		}
			    		//add_reseller_icon=document.getElementById("add_reseller_button");
			    		//add_reseller_icon.disabled=true;
		    		}
			    	
			    	get_reseller_auto_renew();
			
			  //  alert(g_user_authorization_mode);
			  //  show_uptime();
    		}
	};
	xmlHttp.send(null);
	 
/*	cgi_url = "/server/get_reseller_auto_renew?token="+escape(g_token)+"&flag="+Math.random();
	xmlHttp.open("GET", cgi_url, true);
	xmlHttp.onreadystatechange = xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState == 4) {
	    		var response = xmlHttp.responseText;
	    		g_auto_renew=response;
	    		//alert(g_auto_renew);
		    callServer_System_Inquery();
		    g_System_timer=setInterval(function(){callServer_System_Inquery_Timer()},60*1000);
	    		
		}
	};
	xmlHttp.send(null);
*/	

}  

function user_authorization_mode()
{
if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	    g_user_authorization_mode=response;
	    //alert(g_user_authorization_mode);
	    call_get_user_level();
    }
}
function call_get_users_detail() {
 	var cgi_url;
	var cookieStr;
	var firstpos;
	var endpos;
 
   var content;
   if(bMobileDevice){
   	content = document.getElementById("content");
   }else
   {
   	content = parent.document.getElementById("content");
   }
 // var detail = parent.document.getElementById("detail");
	

//	content.innerHTML="";
//	detail.innerHTML="";

  	
  	g_token=find_cookie_value("token");

 cgi_url = "/server/get_reseller_users?token="+escape(g_token)+"&position="+g_user_position+"&limit="+g_user_limit+"&flag="+Math.random();

 //content.innerHTML='<p align="center"><font face="Arial" color="#FF0000" size="4">User Information Loading...<p>';

 xmlHttp.open("GET", cgi_url, true);
 xmlHttp.onreadystatechange = get_users;
 xmlHttp.send(null);

}
function system_info_inquery()
{
    
	if (xmlHttp.readyState == 4) 
	{
    		var response = xmlHttp.responseText.split("\r\n");
		var str;
		var i=0;
  		var content = parent.document.getElementById("content");
  		var static_mac_address;
  		var static_network_interface;
  		var static_pagination_limit_number;
  		var static_movie_number;
 		var static_series_number;
  		var static_channel_number
  		var mac_address=null;
  		var network_interface=null;
  		var content;
  		var ez_button;
  		var main_button;
  		var add_cuet_at;
  		var add_cuet;
  		var free_version_flag=0;
  		var static_user_number=0;
  		var active_connection_no=0;
  		var active_channel_no=0;
  		var uptime;
  		var act_str1;
  		var act_str2;
  		var act_str3;
  		var act_str4;
  		var version_date;
  		var field_object;
		var filter_flag=0;
		var balancer_flag=0;
		var mac_flag=0;
		var start_time;
		var group_no=0;
 		var download_bw;
		var upload_bw;
		var total_memory="N/A";
		var free_memory="N/A";;
		var disk_use="N/A";;
		var load_average="N/A";;
		var blacklist_no;
		var g_total_credit_no=0;
		var static_credit_number;
		
   		if (response[0].search("ezhometech")==0)
  		{
  			
 			
  			
  			str='<table align="center" border="1" cellpadding="0" cellspacing="20" width="100%" height="100%" bordercolor="#E1E1E1">'+
			    
			    '<tr>'+
			      '<td valign="top" id="system_id">'+
			        '</td>'+
			      '<td valign="top" id="subscriber_id">'+
			       '</td>'+
			      //'<td valign="top" id="channel_movie_id">'+
			      //'</td>'+
			    '</tr>'+
			  '</table>';
		//	str+='</td></tr></table>';
	  		while(1)
	  		{
				if (response[i]==0) break;
				//alert(response[i]);
				if (response[i].search("Start at: ")==0)
				{
					static_channel_number="Start at: <b>";
					
					start_time=response[i].substring(static_channel_number.length,response[i].length-4);
					
				}else
				if (response[i].search("Channels: ")==0)
				{
					static_channel_number="Channels: <b>";
					
					g_total_ch_no=response[i].substring(static_channel_number.length,response[i].length-4);
					//alert(g_total_ch_no);
					
					
				}else
				if (response[i].search("Credit: ")==0)
				{
					static_credit_number="Credit: <b>";
					//alert(static_credit_number);
					g_total_credit_no=response[i].substring(static_credit_number.length,response[i].length-4);
					//alert(g_total_credit_no);
					
					
				}else
				if (response[i].search("Movies: ")==0)
				{
					static_movie_number="Movies: <b>";
					
					g_total_movie_no=response[i].substring(static_movie_number.length,response[i].length-4);
					//alert(g_total_movie_no);
					
					
				}else
				if (response[i].search("Groups: ")==0)
				{
					static_user_number="Groups: <b>"
					group_no=response[i].substring(static_user_number.length,response[i].length-4);
				}else
				if (response[i].search("Subscribers: ")==0)
				{
					static_user_number="Subscribers: <b>"
					g_user_no=response[i].substring(static_user_number.length,response[i].length-4);
				}else
				if (response[i].search("Active Channels: ")==0)
				{
					static_user_number="Active Channels: <b>"
					active_channel_no=response[i].substring(static_user_number.length,response[i].length-4);
					//alert(active_channel_no);
				}else
				if (response[i].search("Uptime: ")==0)
				{
					static_user_number="Uptime: <b>"
					uptime=response[i].substring(static_user_number.length,response[i].length-4);
					
				}else
				if (response[i].search("Version: ")==0)
				{
					static_user_number="Version: <b>"
					version_date=response[i].substring(static_user_number.length,response[i].length-4);
					
				}else if (response[i].search("Pagination Limit No.:")==0)
				{	
					
					static_pagination_limit_number="Pagination Limit No.: <b>";
					//g_constant_limit=parseInt(response[i].substring(static_pagination_limit_number.length,response[i].length-4));
					//g_sequence_constant_limit=g_constant_limit;
				}
				
				i++;
			}
			//alert(act_str);
			//alert(str);
			//content.innerHTML=str;	
			//alert(document.getElementById("credit_no"));
			document.getElementById("credit_no").innerHTML='<p align="center" style="margin-left: 0; margin-top: 0; margin-bottom: 0"><font face="Arial" size="6" color="#0000bb">Credit Balance: <b>'+g_total_credit_no+'</b></font>';
			//alert(g_total_credit_no);
			
			
			
			
			/*field_object=document.getElementById("system_id");
			field_object.innerHTML='<p style="margin-left: 22; margin-right: 10;margin-top: 25;margin-bottom: 25"><font face="Arial" size="4" color="#000000">System</font></p>'+
			        '<p style="margin-left: 22; margin-right: 10;margin-bottom: 0"><font face="Arial" size="2" color="#000000">Uptime</font><br>'+
			        '<p style="margin-left: 22; margin-right: 10;margin-top: 5"><font face="Arial" size="6" color="#000000">'+uptime+'</font></p>'+
			        '<table width="100%" style="margin-left: 22;">'+
			        '<tr>'+
			        '<td width=65%>'+
			        '<font face="Arial" size="2" color="#000000">Start at </font>'+
			        '</td>'+
			        '<td>'+
			        '<font face="Arial" size="2" color="#000000">'+start_time+'</font>'+
			        '</td>'+
			        '</tr>'+
			        '<tr>'+
			        '<td width=65%>'+
			        '<font face="Arial" size="2" color="#000000">Total Credit </font>'+
			        '</td>'+
			        '<td>'+
			        '<font face="Arial" size="2" color="#000000">'+g_total_credit_no+'</font>'+
			        '</td>'+
			        '</tr>'+
			        
			        '</table>';
			 */
			
			/*
			field_object=document.getElementById("channel_movie_id");
			field_object.innerHTML='<p style="margin-left: 22; margin-right: 10;margin-top: 25;margin-bottom: 25"><font face="Arial" size="4" color="#000000">Channels</font></p>'+
				'<p style="margin-left: 22; margin-right: 10;margin-bottom: 0"><font face="Arial" size="2" color="#000000">Active channels</font><br>'+
			        '<p style="margin-left: 22; margin-right: 10;margin-top: 5"><font face="Arial" size="6" color="#000000">'+active_channel_no+'</font></p>'+
			        '<table width="100%" style="margin-left: 22;">'+
			        '<tr>'+
			        '<td width=65%>'+
			        '<font face="Arial" size="2" color="#000000">Current channels</font>'+
			        '</td>'+
			        '<td>'+
			        '<font face="Arial" size="2" color="#000000">'+g_total_ch_no+'</font>'+
			        '</td>'+
			        '</tr>'+
			        '</table>'+
			        '<hr size="1" color="#CCFFFF">'+
			        '<p style="margin-left: 22; margin-right: 10;margin-top: 25;margin-bottom: 25"><font face="Arial" size="4" color="#000000">Movies</font></p>'+
				'<p style="margin-left: 22; margin-right: 10;margin-bottom: 0"><font face="Arial" size="2" color="#000000">Current movies</font><br>'+
				'<p style="margin-left: 22; margin-right: 10;margin-top: 5"><font face="Arial" size="6" color="#000000">'+g_total_movie_no+'</font></p>';
			        
			*/
			/*
			field_object=document.getElementById("subscriber_id");
			//alert(field_object);
			field_object.innerHTML='<p style="margin-left: 22; margin-right: 10;margin-top: 25;margin-bottom: 25"><font face="Arial" size="4" color="#000000">Users</font></p>'+
			        '<p style="margin-left: 22; margin-right: 10;margin-bottom: 0"><font face="Arial" size="2" color="#000000">Current users</font><br>'+
			        '<p style="margin-left: 22; margin-right: 10;margin-top: 5"><font face="Arial" size="6" color="#000000">'+g_user_no+'</font></p>'+
			        '<table width="100%" style="margin-left: 22;">'+
			        '<tr>'+
       			        '<td width=65%>'+
				'<font face="Arial" size="2" color="#000000">Groups</font>'+
			        '</td>'+
			        '<td>'+
			        '<font face="Arial" size="2" color="#000000">'+group_no+'</font>'+
			        '</td>'+
			        '</tr>'+
			        '</table>';
			       
			  */  
			
			/*
			field_object=document.getElementById("movie_id");
			field_object.innerHTML='<p style="margin-left: 22; margin-right: 10;margin-top: 25;margin-bottom: 25"><font face="Arial" size="4" color="#000000">Movies</font></p>'+
				'<p style="margin-left: 22; margin-right: 10;margin-bottom: 0"><font face="Arial" size="2" color="#000000">Current movies</font><br>'+
				'<p style="margin-left: 22; margin-right: 10;margin-top: 5"><font face="Arial" size="6" color="#000000">'+g_total_movie_no+'</font></p>';
				*/
			
		}else
		{
  			bSystem_Inquery_Panel=0;
  			clearInterval(g_System_timer);			
		    	g_token=find_cookie_value("token");
		  	g_user_id=find_cookie_value("userid");
		  	g_password=find_cookie_value("password");
		 	 cgi_url = "/token/destroytoken?token="+escape(g_token)+"&flag="+Math.random();
			 xmlHttp.open("GET", cgi_url, true);
			 xmlHttp.onreadystatechange = login_out_return;
			 xmlHttp.send(null);
		}
		if ((free_version_flag==1)&&(g_show_free_version==0))
		{
			g_show_free_version=1;
			alert("Free Trial is for 5 channels, 2 users and some Addons only.")
		}
		g_active_channel_no=active_channel_no;
		
		Button_get_all_user();
		
		//alert(g_active_channel_no);
			

	}

}
function calllist_active_player_info(position,limit){

	var cgi_url;
	var cookieStr;
	var firstpos;
	var endpos;

   	g_token=find_cookie_value("token");
   	bSystem_Inquery_Panel=0;
 	bQuery_Channel_Status=0;
 	g_active_connection_position=position;
	g_active_connection_limit=limit;
	var content = parent.document.getElementById("content");

	if (g_token!=0)
	{
		if (g_search__player_text==null)
		{
			cgi_url= "/player/get_reseller_player_list?token="+escape(g_token)+"&position="+position+"&limit="+limit+"&flag="+Math.random();
		}else
		{
			cgi_url= "/player/get_reseller_player_list?token="+escape(g_token)+"&position="+position+"&limit="+limit+"&searchvalue=" +g_search__player_text+"&flag="+Math.random();
		}
		content.innerHTML='<p align="center"><font face="Arial" color="#FF0000" size="4">Player Information Loading...<p>';
		
		xmlHttp.open("GET", cgi_url, true);
		xmlHttp.onreadystatechange = list_active_player_info;
		xmlHttp.send(null);
	}
 
 

}
function call_Update_User(user_no)
{
 var username_id="username"+user_no; 
 var password_id="password"+user_no; 
 var group_id="group"+user_no; 
 var expired_time_id="expired_time"+user_no; 
 //var paymodel_id="paymodel"+user_no; 
 //var user_point_id="user_point"+user_no;
 var userip_id="userip"+user_no;
 var macid_id="macid"+user_no;

 var szpassword;
 var szgroup;
 var expired_time;
 //var paymodel;
 //var user_point;
 var username;
 var userip;
 var macid;

var confirm_msg;
 	var cgi_url;
	var cookieStr;
	var firstpos;
	var endpos;
 var d=new Date();
 var cur_year=d.getFullYear();
 var cur_month=d.getMonth()+1;
 var cur_date=d.getDate();
 var alert_message;
 
	g_item=document.getElementById(macid_id);
	macid=g_item.value;
	g_item=document.getElementById(username_id);
	username=g_item.value;
	if (username.length==0)
	{
		alert("User name is empty");
		return;
	}
	//alert(username);	
	g_item=document.getElementById(expired_time_id);
	//alert(g_item);
	if (g_auto_renew==1)
	{
		expired_time=g_item.innerText;
	}else
	{
		expired_time=g_item.value;
	}
	//alert(expired_time);
	if (expired_time.length==0)
	{
		alert("Expired Time is empty");
		return;
	}else if (expired_time.length>10)
	{
		alert("Date Length is too long(>10)");
		return;
	}
	
	if ((g_user_authorization_mode==1) || (g_user_authorization_mode==0))
	 {
		g_item=document.getElementById(password_id);
		szpassword=g_item.value;
		if (szpassword.length==0)
		{
			if (macid!="mag")
			{
				alert("Pawword is empty");
				return;
			}
		}

		pos=expired_time.indexOf('/');
		if (pos>0)
		{
			expired_MM=expired_time.substring(0,pos);
			expired_time_temp=expired_time.substring(pos+1);
			pos=expired_time_temp.indexOf('/');	
			expired_DD=expired_time_temp.substring(0,pos);
			expired_YY=expired_time_temp.substring(pos+1);
			
				//	alert_message=cur_year+'/'+cur_month+'/'+cur_date+'--'+expired_YY+'/'+expired_MM+'/'+expired_DD;
		   	    	//alert(alert_message);
		
			if (expired_YY<cur_year)
			{
				alert_message="Expired Year should be >="+cur_year;
				alert(alert_message);
				return;
			}
			if ((expired_MM<1)||(expired_MM>12))
			{
				alert("Exipred Month should be between 1 and 12");
				return;
			}
			if ((expired_YY==cur_year)&&(expired_MM<cur_month))
			{
				alert_message="Expired Month should be >"+cur_month;
				alert(alert_message);
				return;
				
			}
			if ((expired_DD<1)||(expired_DD>31))
			{
				alert("Exipred Date should be between 1 and 30");
				return;
			}
			if ((expired_YY==cur_year)&&(expired_MM==cur_month)&&(expired_DD<cur_date))
			{
				alert_message="Expired Date should be >"+cur_date;
				alert(alert_message);
				return;
			}
		}		
		
	}else if (g_user_authorization_mode==2)
	{
		szpassword=null;
	}
		


	
	g_item=document.getElementById(group_id);
	szgroup=g_item.value;
//	g_item=document.getElementById(paymodel_id);
//	paymodel=g_item.value;
//	g_item=document.getElementById(user_point_id);
//	user_point=g_item.value;
	g_item=document.getElementById(userip_id);
	userip=g_item.value;
	
   	g_token=find_cookie_value("token");

 confirm_msg="Update User: "+username+" Information?";
// cgi_url = "/server/update_user?token="+escape(g_token)+"&user_no="+escape(user_no)+"&username="+escape(username)+
 cgi_url = "/server/update_user?token="+escape(g_token)+"&username="+escape(username)+
  "&password="+szpassword+
  "&group="+szgroup+
  "&expired_time="+expired_time+
//  "&paymodel="+paymodel+
//  "&user_point="+user_point+
  "&userip="+userip+
  "&macid="+macid+
   "&flag="+Math.random();
 // alert(cgi_url);
 //if (confirm(confirm_msg))
 //{
	 document.getElementById(username_id).style.backgroundColor = "#ff0000";
	
	 xmlHttp.open("GET", cgi_url, true);
	 xmlHttp.onreadystatechange = function()
	 {
	 	if (xmlHttp.readyState == 4) {
		    var response = xmlHttp.responseText;
		    document.getElementById(username_id).style.backgroundColor = "#ffffff";
		    if (response==1)
		    {
		    	//alert("Update User Sucessfully");
		    	
		 	//callServer_System_Inquery();	
		 	call_get_users(g_user_position,g_user_limit);
		   } else if (response==2)
		    {
		    	alert("Disk is error(FULL), Please contact administrator");
		    } else if (response==0)
		    {
		   	alert("Failed to Update User");
		   	call_get_users(g_user_position,g_user_limit);
		    }else if (response==3)
		    {
		   	alert("Primay Key can not be changed");
		    } else if (response==4)
		    {
		  	alert("Password does not allow the special character ':'");
		    }
		    
		 }
	};
	 xmlHttp.send(null); 

 //}
 

}
/*
function Query_User_More() {
	
   var str;
   var i;
   var username;
   var user2ndip;
   var user3rdip;
   var user4thip;
   var user5thip;
   var level;
   var max_connection;
   var cur_connection;
   var rating_password;
   var paymodel;
   var paymodel_option;
   var user_point;
   var isp_lock;
   var isp_name;
   var smart_phone;
   var tablet;
   var desktop;
   var tv;
   var first_name;
   var last_name;
   var address;
   var city;
   var zip;
   var tel;
   var email;
   var UserDetailWindow
   	var prev_user_no;
	var next_user_no;
	var total_user_no;
	var nObj;

   // var detail = parent.document.getElementById("detail");
	

	// detail.innerHTML="";

  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText.split("\r\n");
     str="<head><title>EZserver Subscriber</title><link rel='stylesheet' type='text/css' href='menu.css'/>"+'<script src="menu.js"></script></head><body><table align="center">';
  //   str='';
 //		alert(response[0]);
 		i=0;
	 	strlength=response[i].length;
   	    	username=response[i].slice(9,strlength);
   	    	
  	    	i++;
    	 	strlength=response[i].length;
   	    	user2ndip=response[i].slice(10,strlength);
  	    	
  	    	i++;
  	    	//alert(response[i]);
    	 	strlength=response[i].length;
   	    	user3rdip=response[i].slice(10,strlength);
  	    	
  	    	i++;
    	 	strlength=response[i].length;
   	    	user4thip=response[i].slice(10,strlength);
   	    	
  	    	i++;
  	    	//alert(response[i]);
    	 	strlength=response[i].length;
   	    	user5thip=response[i].slice(10,strlength);

  	    	i++;
    	 	strlength=response[i].length;
   	    	rating_password=response[i].slice(16,strlength);

  	    	i++;
    	 	strlength=response[i].length;
   	    	level=response[i].slice(6,strlength);

 	    	i++;
    	 	strlength=response[i].length;
   	    	max_connection=response[i].slice(14,strlength);

 	    	i++;
    	 	strlength=response[i].length;
   	    	cur_connection=response[i].slice(14,strlength);

   	    	i++;
    	 	strlength=response[i].length;
   	    	paymodel=response[i].slice(9,strlength);
   	    	
   	    	i++;
	 	strlength=response[i].length;
   	    	user_point=response[i].slice(11,strlength);
 	    	
   	    	i++;
	 	strlength=response[i].length;
   	    	isp_lock=response[i].slice(9,strlength);

   	    	i++;
	 	strlength=response[i].length;
   	    	isp_name=response[i].slice(9,strlength);
 
 
  	    	i++;
	 	strlength=response[i].length;
   	    	smart_phone=response[i].slice(12,strlength);
   	    	
   	    	i++;
     	 	strlength=response[i].length;
   	    	tablet=response[i].slice(7,strlength);
   	    	
   	    	i++;
     	 	strlength=response[i].length;
   	    	desktop=response[i].slice(8,strlength);
   	    	
   	    	i++;
     	 	strlength=response[i].length;
   	    	tv=response[i].slice(3,strlength);
   	    	
   	    	i++;
    	 	strlength=response[i].length;
   	    	first_name=response[i].slice(11,strlength);
   	    	
   	    	i++;
    	 	strlength=response[i].length;
   	    	last_name=response[i].slice(10,strlength);
   	    	
   	    	i++;
    	 	strlength=response[i].length;
   	    	address=response[i].slice(8,strlength);
   	    	
   	    	i++;
    	 	strlength=response[i].length;
   	    	city=response[i].slice(5,strlength);
   	    	
   	    	i++;
    	 	strlength=response[i].length;
   	    	zip=response[i].slice(4,strlength);
   	    	 	    	
   	    	i++;
   	 	strlength=response[i].length;
   	    	tel=response[i].slice(4,strlength);
   	    	
   	    	i++;
   	 	strlength=response[i].length;
   	    	email=response[i].slice(6,strlength);
 
  		
  		if (window.self.name=="UserDetailWindow")
   		{
   			nObj=window.self.document.getElementById("total_user_no");
   			//alert(nObj);
   			//alert(nObj.innerText);
   			
   			total_user_no=parseInt(nObj.innerText);
   			//alert(total_user_no);
   		}else
   		{
   			total_user_no=g_user_no;
   		}
//  		str+='<tr><td><font face="Arial"> <font size="2">User : </font></td><td width="350" height="23"><table><tr><td><font face="Arial"> <font size="2"><b>'+username+'</b> - '+g_cur_userno+' /</font></td><td id=total_user_no> <font size="2">'+total_user_no+'</font></td></tr></table></td></tr>';
 		str+='<tr><td><table><tr><td><font face="Arial"> <font size="2">User : </font></td><td><font size="2"><b>'+g_cur_userno+'</b> / </font></td><td id=total_user_no><font size="2">'+total_user_no+'</font></td></tr></table></td><td width="350" height="23"><font face="Arial"> <font size="2"><b>'+username+'</b></font></td></tr>';
 		
 		
 		
		str+='<tr><td><font face="Arial"> <font size="2">IP 2: </font></td><td width="16" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="user2ndip"'+
 		' id="user2ndip"'+
 		' size="16" value="'+
 		user2ndip+
 		'"/></font></td></tr>';

		str+='<tr><td><font face="Arial"> <font size="2">IP 3: </font></td><td width="16" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="user3rdip"'+
 		' id="user3rdip"'+
 		' size="16" value="'+
 		user3rdip+
 		'"/></font></td></tr>';

		str+='<tr><td><font face="Arial"> <font size="2">IP 4: </font></td><td width="16" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="user4thip"'+
 		' id="user4thip"'+
 		' size="16" value="'+
 		user4thip+
 		'"/></font></td></tr>';

		str+='<tr><td><font face="Arial"> <font size="2">IP 5: </font></td><td width="16" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="user5thip"'+
 		' id="user5thip"'+
 		' size="16" value="'+
 		user5thip+
 		'"/></font></td></tr>';

		str+='<tr><td><font face="Arial"> <font size="2">Rating Password: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="rating_password"'+
 		' id="rating_password"'+
 		' size="16" value="'+
 		rating_password+
 		'"/></font></td></tr>';

  		
 		 str+='<tr><td><font face="Arial"> <font size="2">Pay Model: </font></td><td width="350" height="23">'+
	 		' <font face="Arial"> <font size="2">'+
			' <select size="1" name="paymodel" id="paymodel">';
	 		for (j=0;j<3;j++)
	 		{
	 			paymodel_option=g_paymodel_array[j];
	 			if (paymodel.search(paymodel_option)==-1)
	 			{
	 				str+='<option value="'+paymodel_option+'">'+paymodel_option+'</option>';
	 			}
	 			else
	 			{
	 				str+='<option selected="selected" value="'+paymodel_option+'">'+paymodel_option+'</option>';
	 			}	 			
	 		}
 		str+='</select></font></td></tr>';
		
		
		str+='<tr><td><font face="Arial"> <font size="2">Max. Connections: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="max_connection"'+
 		' id="max_connection"'+
 		' size="16" value="'+
 		max_connection+
 		'"/></font></td></tr>';
 
 		str+='<tr><td><font face="Arial"> <font size="2">Active Connections: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		cur_connection+'</font></td></tr>';

		str+='<tr><td><font face="Arial"> <font size="2">User Point: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="user_point"'+
 		' id="user_point"'+
 		' size="16" value="'+
 		user_point+
 		'"/></font></td></tr>';


 		str+='<tr><td><font face="Arial"> <font size="2">Smart Phone No.: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="smart_phone"'+
 		' id="smart_phone"'+
 		' size="16" value="'+
 		smart_phone+
 		'"/></font></td></tr>';

 		str+='<tr><td><font face="Arial"> <font size="2">Tablet ID: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="tablet"'+
 		' id="tablet"'+
 		' size="16" value="'+
 		tablet+
 		'"/></font></td></tr>';

		str+='<tr><td><font face="Arial"> <font size="2">Desktop ID: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="desktop"'+
 		' id="desktop"'+
 		' size="16" value="'+
 		desktop+
 		'"/></font></td></tr>';

 		str+='<tr><td><font face="Arial"> <font size="2">TV ID: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="tv"'+
 		' id="tv"'+
 		' size="16" value="'+
 		tv+
 		'"/></font></td></tr>';
 		
 		str+='<tr><td><font face="Arial"> <font size="2">First Name: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="first_name"'+
 		' id="first_name"'+
 		' size="16" value="'+
 		first_name+
 		'"/></font></td></tr>';
 		
 		str+='<tr><td><font face="Arial"> <font size="2">Last Name: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="last_name"'+
 		' id="last_name"'+
 		' size="16" value="'+
 		last_name+
 		'"/></font></td></tr>';
 		
 		str+='<tr><td><font face="Arial"> <font size="2">Adress: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="address"'+
 		' id="address"'+
 		' size="50" value="'+
 		address+
 		'"/></font></td></tr>';
 		
 		str+='<tr><td><font face="Arial"> <font size="2">City: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="city"'+
 		' id="city"'+
 		' size="16" value="'+
 		city+
 		'"/></font></td></tr>';
 		
 		str+='<tr><td><font face="Arial"> <font size="2">ZIP: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="zip"'+
 		' id="zip"'+
 		' size="16" value="'+
 		zip+
 		'"/></font></td></tr>';
 		
 		str+='<tr><td><font face="Arial"> <font size="2">Tel: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="tel"'+
 		' id="tel"'+
 		' size="16" value="'+
 		tel+
 		'"/></font></td></tr>';
  
  		str+='<tr><td><font face="Arial"> <font size="2">Email: </font></td><td width="350" height="23">'+
 		' <font face="Arial"> <font size="2">'+
 		' <input type="text" name="email"'+
 		' id="email"'+
 		' size="30" value="'+
 		email+
 		'"/></font></td></tr>';
 	    str+='<tr><td><input type="button" value="Save" onclick=callServer_Save_More("'+g_cur_userno+'"'+','+'"'+username+'") name="B2" /></td>';
 
	   
	     str+='&nbsp&nbsp&nbsp<input type="button" value="Stop connections" onclick=call_stop_user_connections("'+g_username+'"'+','+'"'+cur_connection+'") name="B1" />';  
	     
	    //str+='&nbsp&nbsp&nbsp<input type="button" value="Stop connections" onclick=call_stop_user_connections("'+g_username+'"'+','+'"'+cur_connection+'") name="B1" />';  
	    str+='</td></tr>';
	    	
	    str+='</table></body>';  
   	if (window.self.name=="UserDetailWindow")
   	{
   		window.self.document.body.innerHTML=str;
   	}else
   	{
   		if (g_UserDetailWindow && !g_UserDetailWindow.closed)
   		{
   			g_UserDetailWindow.focus();
   		}else
   		{
	  		UserDetailWindow= window.open("", "UserDetailWindow", "top=100, left=200, width=600, height=650"); 
	 		UserDetailWindow.document.write(str);
	 		g_UserDetailWindow=UserDetailWindow;
 		}
   	}
  			

  }
}
*/
function Query_User_More() {
   var str;
   var i;
   var username;
   var user2ndip;
   var user3rdip;
   var user4thip;
   var user5thip;
   var level;
   var max_connection;
   var cur_connection;
   var rating_password;
   var paymodel;
   var paymodel_option;
   var user_point;
   var isp_lock;
   var isp_name;
   var smart_phone;
   var tablet;
   var desktop;
   var tv;
   var first_name;
   var last_name;
   var address;
   var city;
   var zip;
   var tel;
   var email;
   var UserDetailWindow
   	var prev_user_no;
	var next_user_no;
	var total_user_no;
	var nObj;

   // var detail = parent.document.getElementById("detail");
	

	// detail.innerHTML="";

  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText.split("\r\n");
     str="<head><title>EZserver Subscriber</title><link rel='stylesheet' type='text/css' href='menu.css'/>"+'<script src="menu.js"></script></head><body><table align="center">';
  //   str='';
 //		alert(response[0]);
 		i=0;
	 	strlength=response[i].length;
   	    	username=response[i].slice(9,strlength);
   	    	
   	    	document.getElementById("more_username").innerHTML='<font face="Arial" size="5"><b>'+username+'</b></font>';
  	    	//document.getElementById("more_username").value=username;
   	    	i++;
    	 	strlength=response[i].length;
   	    	user2ndip=response[i].slice(10,strlength);
  	    	document.getElementById("more_user2ndip").value=user2ndip;
  	    	i++;
  	    	//alert(response[i]);
    	 	strlength=response[i].length;
   	    	user3rdip=response[i].slice(10,strlength);
  	    	document.getElementById("more_user3rdip").value=user3rdip;
  	    	
  	    	i++;
    	 	strlength=response[i].length;
   	    	user4thip=response[i].slice(10,strlength);
     	    	document.getElementById("more_user4thip").value=user4thip;
	    	
  	    	i++;
  	    	//alert(response[i]);
    	 	strlength=response[i].length;
   	    	user5thip=response[i].slice(10,strlength);
     	    	document.getElementById("more_user5thip").value=user5thip;

  	    	i++;
    	 	strlength=response[i].length;
   	    	rating_password=response[i].slice(16,strlength);
    	    	document.getElementById("more_rating_password").value=rating_password;

  	    	i++;
    	 	strlength=response[i].length;
   	    	level=response[i].slice(6,strlength);
    	    	document.getElementById("more_level").value=level;

 	    	i++;
    	 	strlength=response[i].length;
   	    	max_connection=response[i].slice(14,strlength);
   	    	document.getElementById("more_max_connection").value=max_connection;
  
 	    	i++;
    	 	strlength=response[i].length;
   	    	cur_connection=response[i].slice(14,strlength);
   	    	document.getElementById("more_active_connection").innerText=cur_connection;
 
		i++;

	    	
   	    	i++;
   	    	i++;
  	    	strlength=response[i].length;
   	    	isp_lock=response[i].slice(9,strlength);
   	    	i++;
 
		if (isp_lock=="OFF")
 		{
  	    		document.getElementById("more_isp_lock").value=isp_lock;
		}else if (isp_lock=="ON")
 		{
	 	 	strlength=response[i].length;
	   	    	isp_name=response[i].slice(9,strlength);
	   	    	document.getElementById("more_isp_lock").value=isp_name;
	   	    	
		}
     	    	i++;
     	    	//alert(response[i]);
	 	strlength=response[i].length;
 	    	smart_phone=response[i].slice(12,strlength);
  	    	document.getElementById("more_smart_phone").value=smart_phone;
  	    	
   	    	i++;
     	 	strlength=response[i].length;
   	    	tablet=response[i].slice(7,strlength);
  	    	document.getElementById("more_tablet").value=tablet;
   	    	
   	    	i++;
     	 	strlength=response[i].length;
   	    	desktop=response[i].slice(8,strlength);
  	    //	document.getElementById("more_desktop").value=desktop;
   	    	
   	    	i++;
     	 	strlength=response[i].length;
   	    	tv=response[i].slice(3,strlength);
  	    //	document.getElementById("more_tv").value=tv;
   	    	
   	    	i++;
    	 	strlength=response[i].length;
   	    	first_name=response[i].slice(11,strlength);
  	    	document.getElementById("more_first_name").value=first_name;
   	    	
   	    	i++;
    	 	strlength=response[i].length;
   	    	last_name=response[i].slice(10,strlength);
  	    	document.getElementById("more_last_name").value=last_name;
   	    	
   	    	i++;
    	 	strlength=response[i].length;
   	    	address=response[i].slice(8,strlength);
  	    	document.getElementById("more_address").value=address;
   	    	
   	    	i++;
    	 	strlength=response[i].length;
   	    	city=response[i].slice(5,strlength);
  	    	document.getElementById("more_city").value=city;
   	    	
   	    	i++;
    	 	strlength=response[i].length;
   	    	zip=response[i].slice(4,strlength);
  	    	document.getElementById("more_zip").value=zip;
   	    	 	    	
   	    	i++;
   	 	strlength=response[i].length;
   	    	tel=response[i].slice(4,strlength);
  	    	document.getElementById("more_tel").value=tel;
   	    	
   	    	i++;
   	 	strlength=response[i].length;
   	    	email=response[i].slice(6,strlength);
  	    	document.getElementById("more_email").value=email;
 
  		
  	/*	if (window.self.name=="UserDetailWindow")
   		{
   			nObj=window.self.document.getElementById("total_user_no");
   			//alert(nObj);
   			//alert(nObj.innerText);
   			
   			total_user_no=parseInt(nObj.innerText);
   			//alert(total_user_no);
   		}else
   		{
   			total_user_no=g_user_no;
   		}
   		*/
   		total_user_no=g_user_no;
//  		str+='<tr><td><font face="Arial"> <font size="2">User : </font></td><td width="350" height="23"><table><tr><td><font face="Arial"> <font size="2"><b>'+username+'</b> - '+g_cur_userno+' /</font></td><td id=total_user_no> <font size="2">'+total_user_no+'</font></td></tr></table></td></tr>';
 		
   	/*if (window.self.name=="UserDetailWindow")
   	{
   		window.self.document.body.innerHTML=str;
   	}else
   	{
   		if (g_UserDetailWindow && !g_UserDetailWindow.closed)
   		{
   			g_UserDetailWindow.focus();
   		}else
   		{
	  		UserDetailWindow= window.open("", "UserDetailWindow", "top=100, left=200, width=600, height=650"); 
	 		UserDetailWindow.document.write(str);
	 		g_UserDetailWindow=UserDetailWindow;
 		}
   	}
   	*/
  			

  }
}

function call_Query_User_More(user_no)
{
 //var username_id="username";
 var username;

var confirm_msg;
 	var cgi_url;
	var cookieStr;

    	var save_user_dialog_message=document.getElementById("save_user_dialog_message");
	save_user_dialog_message.innerHTML='';


	//g_item=document.getElementById(username_id);
	username=g_username;
	//g_username=username;
	g_cur_userno=user_no;
	//alert(g_cur_userno);
	//g_user_no=user_no;
	
   	g_token=find_cookie_value("token");

// confirm_msg="Get User: "+username+" more Information?";
 cgi_url = "/server/query_user_more?token="+escape(g_token)+"&username="+escape(username)+"&flag="+Math.random();
  // alert(cgi_url);
// if (confirm(confirm_msg))
// {
	
	 xmlHttp.open("GET", cgi_url, true);
	 xmlHttp.onreadystatechange = Query_User_More;
	 xmlHttp.send(null);
 //}
 

}
/*
function callServer_search_user() {
	var cgi_url;
	var searchvalue = document.getElementById("user_search_field").value;
	var position=g_user_found_position+1;
	g_search_text=searchvalue;
	
   	g_token=find_cookie_value("token");
	if (g_token!=0)
	{
//		g_user_found_position=0;
//		cgi_url = "/server/search_reseller_user?token="+escape(g_token)+ "&position=" +g_user_position+ "&searchvalue=" +searchvalue+"&flag="+Math.random();
		cgi_url = "/server/search_reseller_user?token="+escape(g_token)+ "&position=" +position+ "&searchvalue=" +searchvalue+"&flag="+Math.random();
		xmlHttp.open("GET", cgi_url, true);
		// alert(position);
		xmlHttp.onreadystatechange = search_user_response;
		xmlHttp.send(null);
	}

}
*/