			/* guild.js: javascript for Lace Guild Website 06.09.2010 */
	
	// Prevent being framed
	if (top.frames.length!=0)
	{
		top.location=self.document.location;
	}
	
		
// Open resizable popUp window (width w, height h) in centre of existing window

	function openSample(url, w, h) 
	{ 
		openSample(url, w, h, 0)
	}


// Variant allowing setting of toolbar (t) for printing
	
	function openSample(url, w, h, t) 
	{ 
	   var args = 'width=' + w + ','
	   + 'height=' + h + ','
	   + 'toolbar=' + t + ','
	   + 'location=0,'
	   + 'directories=0,'
	   + 'status=yes,'
	   + 'menubar=0,'
	   + 'scrollbars=0,'
	   + 'resizable=yes';
	 
	   if (parseInt(navigator.appVersion) >= 4)
	   {
	      xposition = (screen.width - w)/2;
	      yposition = (screen.height - h)/2;
	  
	     args += ','
	              + 'screenx=' + xposition + ',' //NN
	              +  'screeny=' + yposition + ',' //NN
	              +  'left=' + xposition + ',' //IE
	              +  'top=' + yposition; //IE
	    }
	
	   window.open(url,"Sample", args);
	}


	// This version allows the name to be set (html overrides)
	function openDetail(url, name, w, h) 
	{ 
	   var args = 'width=' + w + ','
	   + 'height=' + h + ','
	   + 'toolbar=0,'
	   + 'location=0,'
	   + 'directories=0,'
	   + 'status=yes,'
	   + 'menubar=0,'
	   + 'scrollbars=0,'
	   + 'resizable=yes';
	 
	   if (parseInt(navigator.appVersion) >= 4)
	   {
	      xposition = (screen.width - w)/2;
	      yposition = (screen.height - h)/2;
	  
	     args += ','
	              + 'screenx=' + xposition + ',' //NN
	              +  'screeny=' + yposition + ',' //NN
	              +  'left=' + xposition + ',' //IE
	              +  'top=' + yposition; //IE
	    }
	
		window.open(url, name, args);
	}
	
	
	// Close popUp window
	function closeIt() 
	{
  		parent.close();
	}

	// (http://www.alistapart.com/articles/zebratables/)
	// This version ignores the tbody complication and requires colour arguments

  	// Workaround for an IE bug related to element attributes
	function hasClass(obj) 
	{
		 var result = false;
		 if (obj.getAttributeNode("class") != null) 
		 {
		     result = obj.getAttributeNode("class").value;
		 }
		 return result;
	} 
	
	// 'stripeTable' function taking table id as argument and even and odd hex colours
	function stripeTable(id, evenColor, oddColor) 
	{
		// flag to keep track of whether the current row is odd or even
		var even = false;
		
		// obtain a reference to the desired table 
		var table = document.getElementById(id);
		if (! table) 							// if no table of this id, abort
		{ 
			return; 
		}					
		
		var trs = table.getElementsByTagName("tr");		// find all <tr>s in table...
		for (var i = 0; i < trs.length; i++)	      	// ... and iterate through them
		{
			// avoid rows that have a class attribute or backgroundColor style
			if (! hasClass(trs[i]) && ! trs[i].style.backgroundColor) 
			{     
				var tds = trs[i].getElementsByTagName("td");	 // get all cells in this row...
				for (var j = 0; j < tds.length; j++)  			 // and iterate through them...
				{
					var mytd = tds[j];
					// set appropriate colour, avoiding cells with a class attribute or backgroundColor
					if (! hasClass(mytd) && ! mytd.style.backgroundColor) 
					{
						if(even)
						{
							mytd.style.backgroundColor = evenColor;
						}
						else
						{
							mytd.style.backgroundColor = oddColor;							
						}
					}
				}
			}
			// flip from odd to even, or vice-versa
		    even =  ! even;
		}
	}
