// Show/Hide PLanet details section

function infobox(s)
{
 	var x=document.getElementById('ib').rows[0].cells
	x[0].innerHTML=s
}

function showPlanet()
{
 	document.getElementById('planet_d').style.display='';
 	document.getElementById('planet_a').style.display='';	  
	createCookie('showplanetdet',0,100);
}

function hidePlanet()
{
 	document.getElementById('planet_d').style.display='none';
 	document.getElementById('planet_a').style.display='none';	  
	createCookie('showplanetdet',1,100);
}


// Submit calculator form
function submitform()
{
  document.cfrm.a.value="Refresh";
	document.cfrm.submit();
}

// The following function are for highlighting the ships that are targetted by the mous-over-ed ship 

function SetC(id,col) 
{ 
	if (ns4) 
	{
	 	document.tags[id].color=col;
	}	else 
		if (ie4)
		{
		 	if (document.all[id]) document.all[id].style['color']=col;
		} else 
			if (ns6)
			{
		 	 	var doc=document.getElementById(id);
				if(doc) doc.style['color']=col;
			} 
} 

function h(s,col) { genHi(0,s,col); } 
function u(s) { genHi(0,s,''); } 
function H(s,col) { genHi(1,s,col); } 
function U(s) { genHi(1,s,''); }

function mOv(a) { document.cfrm.i.value=a; }
function mOu() { document.cfrm.i.value=''; }
function Col(elem) { elem.style.color='red'; }
function NoCol(elem) { elem.style.color='#ffffff'; }

// Prevent <ENTER> form submitting the form using default button

function noenter() { return !(window.event && window.event.keyCode == 13); }

// Row hiding/showing
// id = the row
// s  = side
// t  = checkbox of the race
// v  = number of ships in the row

function toggleRow(id, s, t, v)
{
 	if (s=='a') { os='d'} else {os='a'};
	var tr=document.all(id+s);
	var tr2=document.all(id + s + '2');
	var otr=document.all(id + os);
	var otr2=document.all(id + os + '2');
	
	if (t.checked==true) // we just checked the box, so the race WAS hidden
	{
	 	if (otr.style.display=='none') 
		{
		 	// The other side was hidden too
  	 	tr.style.display='';
  		otr2.style.display='';
		} else
		{
		 	// The other side was visible
   	 	tr.style.display='';
   		tr2.style.display='none';
		}
	} else
	{
	 	if (v.value==0)
		{
  	 	if (otr.style.display=='none')
  		{
  		 	// this side was visible, the other side not
   	 	  tr.style.display='none';
   		  otr2.style.display='none';
  		} else
  		{
  		 	// both sides were visible
     	 	tr.style.display='none';
     		tr2.style.display='';
  		}
		}
	}	
}

function toggleRace(race, side, box)
{
 	var ckiname='cki_' + race + '_' + side;
	if (box.checked==true)
	{
 	  createCookie(ckiname,1,1000);
	} else
	{
	 	createCookie(ckiname,0,1000);
	}
}

// Set a race CHECKBOX to on or off and save thecookie
function onoffRace(race, side, box, v)
{
 	var ckiname='cki_' + race + '_' + side;
	box.checked=v;
  createCookie(ckiname,0,1000);
}


