// JavaScript Document
var buttonindex=1;
var fname;
var fvalue;
var tocstr="";
rendertype=0;
rendertext=0;
function switchbutton(index)
		 {
		 	var winstr='';
			switch(index)
			{
			case 1:
						//alert(t.dataArray[0]);
						winstr='<div id="leftpanel_top"><img src="images/leftpanel_top.jpg" /></div>';
						winstr+='<table>';
						winstr+='<tr>';
						winstr+='<td width="12%" valign="top">';
						winstr+='<div id="leftpanel_button">';
						winstr+='<img src="images/leftpanel_button_1.jpg" width="28" height="215" hspace="0" vspace="0" border="0" usemap="#Map"/></div>';
						winstr+='</td>';
						winstr+='<td width="88%" valign="top">';
						winstr+='<div id="seealsohead">Class Type</div><br />';

						winstr+='<select id ="districtrender"   name="select3" style="HEIGHT: 300px; WIDTH:180px"   onChange="changedisrender()">';
						winstr+='<option value="0">District Type</option>';
						winstr+='<option value="1">Natural Breaks</option>';
						winstr+='<option value="2">Equal Interval</option>';
						winstr+='</select><br/><br/>';

						winstr+='<div id="seealsohead">Class Type</div><br />';		

						winstr+='<select id ="districtpop"   name="select3" style="HEIGHT: 300px; WIDTH:180px"   onChange="changePop()">';
						winstr+='<option value="4">Total Rural</option>';
						winstr+='<option value="9">Percent Rural</option>   ';
						winstr+='<option value="0">Total Rural Town</option>';
						winstr+='<option value="5">Percent Rural Town</option>     ';
						winstr+='<option value="1">Total Large Market Town</option>';
						winstr+='<option value="6">Percent Large Market Town</option>        ';
						winstr+='<option value="2">Total Village</option>';
						winstr+='<option value="7">Percent Village</option>		  ';  
						winstr+='<option value="3">Total Dispersed</option>';
						winstr+='<option value="8">Percent Dispersed</option>       ';
						winstr+='</select>';

						winstr+='<div id="tochtm"></div>';
					
						winstr+='</td>';
						winstr+='</tr>';
						winstr+='</table>';
						
					break;
			case 2:
					winstr='<div id="leftpanel_top"><img src="images/leftpanel_top.jpg" /></div>';
						winstr+='<table>';
						winstr+='<tr>';
						winstr+='<td width="12%" valign="top">';
							winstr+='<div id="leftpanel_button">';
							winstr+='<img src="images/leftpanel_button_2.jpg" width="28" height="215" hspace="0" vspace="0" border="0" usemap="#Map"/></div>';
						winstr+='</td>';
						winstr+='<td width="88%" valign="top">';
						
									winstr+='<img id="legendimage" src="'+document.frames["mapframe"].MapFrame.legendImage+'"/>';	
						winstr+='</td>';
						winstr+='</tr>';
						winstr+='</table>';					
					break;
			case 3:
	var pMap = document.frames["mapframe"].MapFrame;
					winstr='<div id="leftpanel_top"><img src="images/leftpanel_top.jpg" /></div>';
						winstr+='<table>';
						winstr+='<tr>';
						winstr+='<td width="12%" valign="top">';
							winstr+='<div id="leftpanel_button">';
							winstr+='<img src="images/leftpanel_button_3.jpg" width="28" height="215" hspace="0" vspace="0" border="0" usemap="#Map"/></div>';
						winstr+='</td>';
						winstr+='<td width="88%" valign="top">';
						winstr+='<div id="tochtm"></div>';
						if(pMap.ActiveLayerIndex==2)
							winstr+='<div id="seealsohead">District</div>';
						else	
						winstr+='<div id="seealsohead">'+pMap.LayerName[pMap.ActiveLayerIndex]+'</div>';
						winstr+='<hr color="#cccccc" size="1" class="navbreak">';
						if (typeof fname!="undefined")
						{
							for (var i=0;i<fname.length-1;i++)
							{
								winstr+='<div id="seealso">'+fname[i]+' :'+fvalue[i]+'</div></div>';
							}

						}
						else
						{
							winstr+='<div id="seealso">No info .please select the icon,and click on the map.';
winstr+='<br/><img style="cursor:hand"  src="images/info_info.gif" width="22" height="22" border="0" alt=" ' + pMap.buttonList[27] + '"  vspace="1"  hspace="2" name="Identify" onmousedown="t.clickFunction(\'identify\'); setToolPic(\'Identify\');" onmouseover="window.status=\' ' + pMap.buttonList[27] + '\'"></div>';
						}
						winstr+='</td>';
						winstr+='</tr>';
						winstr+='</table>';		
					break;
			}	
			document.getElementById("leftpanel").innerHTML = winstr;	
				if(index==1)
				{
			
					document.getElementById("districtrender").options[rendertype].selected=true;
					document.getElementById("districtpop").options[rendertext].selected=true;	
					document.getElementById("tochtm").innerHTML = tocstr;
				//document.select3="xuwei";	
				}
				if(index==3)
				{
					document.getElementById("tochtm").innerHTML = tocstr;
				}
			buttonindex=index;
			
		 }
		 

