<?php
//Include the head file
require("../../inc/header.inc");
?>
<script language="JavaScript">
function updateStatus(flag)
{	

	var current_page_no=document.getElementById('current_page_no').value;
	var fixurl="./linksetStatus_deal.php?current_page_no="+current_page_no;
	var browserr = navigator.appName;
	if(browserr == "Microsoft Internet Explorer")
		request_oo = new ActiveXObject("Microsoft.XMLHTTP");
	else
		request_oo = new XMLHttpRequest();
		
	request_oo.open("GET",fixurl,"false");
	request_oo.onreadystatechange=function()
	{ 
		getRes(); 
	}
	request_oo.send(null);
	if(flag == 1)
		setTimeout("updateStatus("+flag+")", 10000);
}

function getRes()
{
	//not
	if(request_oo.readyState == 3)
	{
		//alert("not finish");
	}
	if(request_oo.readyState == 4)
	{
		var response = request_oo.responseText;
		
		//return;
		var module=response.split(';');
		
		//alert(document.getElementById('prev_page_count').value)
		// var items=module[0].split(',');
		// 	alert(items[1]);

		for(pos=0;pos<module.length;pos++)
		{

			var items=module[pos].split(',');
			var types=items[0].replace(/(^\s*)|(\s*$)/g, "");
			//alert(types);
			if(types == 'obj')
			{
				var item_id=items[1].replace(/(^\s*)|(\s*$)/g, "");
				var item_val=items[2].replace(/(^\s*)|(\s*$)/g, "");
				var item_col=items[3].replace(/(^\s*)|(\s*$)/g, "");
				if(document.getElementById(item_id) == null)
					continue;
				document.getElementById(item_id).style.color=item_col;
				document.getElementById(item_id).innerHTML=item_val;
			}
			else if(types == 'title')
			{
				var item_id=items[1].replace(/(^\s*)|(\s*$)/g, "");
				var item_val=items[2].replace(/(^\s*)|(\s*$)/g, "");
	
				document.getElementById(item_id).title=item_val;
			}
			else if(types == 'page_count')
			{

				var prev_page_count=document.getElementById('prev_page_count').value;

				if(prev_page_count != items[1])
				{

					var sel_obj=document.getElementById('page_select');
					for(i=sel_obj.length-1;i>=0;i--)
					{
						sel_obj[i]=null;
					}
					var opt_len=0;

					for(i=0;i<items[1];i++)
					{

						var nam="Linkset "+(i*16)+" - "+(i*16+15);
						sel_obj[opt_len]=new Option(nam,i);
						opt_len++;
					}
					document.getElementById('prev_page_count').value=items[1];
				}
			}
			else if(types == 'layer')
			{
				//alert('layer');
				var item_id=items[1].replace(/(^\s*)|(\s*$)/g, "");
				var item_val=items[2].replace(/(^\s*)|(\s*$)/g, "");
				if(item_val == 'hide')
					document.getElementById(item_id).style.display='none';
				else
					document.getElementById(item_id).style.display='';
			}
		}
	}
}
function changepage()
{
	document.getElementById('current_page_no').value=document.getElementById('page_select').value;
	updateStatus(0);
}
</script>

<body leftmargin="15" rightmargin="10" onload="javascript:adjust();" onresize="javascript:adjust();" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">

<?php

$maxRowPerPage=16;

adjust_head();	

adjust_title_head();
  echo "<form name=\"statusForm\" method=\"post\">";
  echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
	echo "<tr>";
		echo "<td width=\"50%\">";
		echo "Status > NSS > LinkSet";
		echo "</td>";
		echo "<td width=\"50%\" align=\"right\">";
		$helpId="1.2.4";
		showHelp($helpId);
		echo "</td>";
	echo "</tr>";
	echo "<tr>";
		echo "<td width=\"50%\">";
		
		echo "<select id=\"page_select\" onchange=\"javascript:changepage();\">";
		echo "</select>";
		echo "</td>";
		
		echo "<td width=\"50%\" align=right>";		
		echo "<a href=\"$PHP_SELF?clear=1\" target=\"_self\"><img style=\"vertical-align:middle;\" border=0 src=\"../../images/delete.gif\" width=\"14\" height=\"14\">$strClear</a>";
		echo "</td>";
	echo "</tr>";
	echo "</table>";

adjust_title_tail();
adjust_content_head();

	//echo "<center><font color=blue size=2>Linkset Status</font></center><p>";
	
	echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
	echo "<caption><center><font color=blue size=2>Linkset Status</font></center></caption>";
	echo "<tr bgcolor=\"#E6E6E6\">";
		echo "<td width=\"10%\" align=\"center\">Name</td>";
		echo "<td width=\"6%\" align=\"center\">Status</td>";
		echo "<td width=\"84%\" align=\"center\" colspan=\"16\">Links Status</td>";
	echo "</tr>";
	
	echo "<tr id=\"blank_row_id\"><td>--</td><td>--</td><td colspan=16>--</td></tr>";
	
	for($i=0;$i<$maxRowPerPage;$i++)
	{
		echo "<tr id=\"row_id_{$i}\">";
		echo "<td>";
		echo "<span id=\"ls_title_id_{$i}\">--</span>";
		echo "</td>";
		echo "<td align=\"center\">";
		echo "<span id=\"ls_status_id_{$i}\">--</span>";
		echo "</td>";
		for($j=0;$j<16;$j++)
		{
			echo "<td width=\"5%\" id=\"lk_title_id_{$i}_{$j}\">";
			echo "<span id=\"lk_status_id_{$i}_{$j}\">--</span>";
			echo "</td>";
		}
		
		echo "</tr>";
	}
	echo "</table>";
	echo "Remarks:  <font color=blue>Y</font> = Available,    <font color=red>N</font> = Unavailable,   <font color=#CCCCCC>I</font> = Inhibited.";

	echo "<input type=hidden value=\"0\" id=\"prev_page_count\">";
	echo "<input type=hidden value=\"0\" id=\"current_page_no\">";
	
	

	echo "</form>";
	
adjust_content_tail();
?>


<script language="JavaScript">
updateStatus(1);
</script>
