function loaddynamic()
{
	/* Nav */
	if (document.all&&document.getElementById)
	{

		/* var navs = new Array("item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8"); */
		var navs = new Array("item2", "item3", "item4", "item5", "item6", "item7", "item8");

		for(i=0;i<navs.length;i++)
		{
			var node = document.getElementById(navs[i]);
			
			if(node)
			{
				node.onmouseover=function() 
				{
					if(this.className != "current selected")
						this.className="selected";
				}
				node.onmouseout=function()
				{
					if(this.className == "selected")
						this.className="";
				}
			}


		}
	}
	
	/* Tabs */
	var nodes = document.getElementsByTagName("ul");
	for(i=0;i<nodes.length;i++)
	{	
		if(nodes[i].className == "tabs")
		{
			var tabs = nodes[i].getElementsByTagName("a");

			for(j=0;j<tabs.length;j++)
			{
				// Move href link (for javascript-off state) int select-tab attribute
				var href = tabs[j].getAttribute("href");
				href = href.substring(href.indexOf('#'), href.length);
				tabs[j].setAttribute("select-tab", href.replace("#",""));
				//tabs[j].removeAttribute("href");
				tabs[j].setAttribute("href", "javascript:void(0);");
			
				// Tab mousedown handler
				tabs[j].onmousedown=function()
				{
					// Deselect other tabs
					others = this.parentNode.parentNode.getElementsByTagName("li");
					for(k=0;k<others.length;k++)
					{
						others[k].className="";
					}					

					// Set clicked tab as current
					
					this.parentNode.className="current";

					// Set associated tab page as current
					others = this.parentNode.parentNode.parentNode.getElementsByTagName("div");

					for(k=0;k<others.length;k++)
					{

						if(others[k].className.indexOf("page-module ") != -1 )
						{	
							others[k].className = others[k].className.replace("current ","");
						}
						
					}	
					
					page = document.getElementById(this.getAttribute("select-tab"));
					
					page.className = "current " + page.className

				}

				
			}
		}
	}
	
	/* Polls */
	var nodes = document.getElementsByTagName("div");
	for(i=0;i<nodes.length;i++)
	{	
		if(nodes[i].className.match("poll-module"))
		{	
			
			var forms = nodes[i].getElementsByTagName("form");
			for(j=0;j<forms.length;j++)
			{			
				var inputs = forms[j].getElementsByTagName("input");
					
				for(k=0;k<inputs.length;k++)
				{
					// Replace buttons with links
					if(inputs[k].type == "submit")
					{
						inputlink = document.createElement("a");
						inputlink.className = "button";
						
						linktext = document.createTextNode(inputs[k].value);
						inputlink.appendChild(linktext);
						
						inputlink.setAttribute("href","#");

						inputs[k].parentNode.appendChild(inputlink);

						inputs[k].parentNode.removeChild(inputs[k]);

						inputlink.onclick=function()
						{
	
							var s = this.parentNode.action;

							var inputs = this.parentNode.getElementsByTagName("input");

							for(k=0;k<inputs.length;k++)
							{
								s += "&" + inputs[k].name + "=" + inputs[k].value;
							}

							var iframe = this.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByTagName("iframe")[0];

							iframe.src=s;
							iframe.className="poll-results-frame";
							
							return false;

						}
					}

				}					
				
			}
			
		
			

		}
	}

	/* Slideshow */
	var anchors = document.getElementsByTagName("a");
	for(i=0;i<anchors.length;i++)
	{	
		if(anchors[i].className.match("slideshowlink"))
		{	
			
			
				anchors[i].onclick=function()
				{		
					
					popupurl = this.href;
					
					window.open(popupurl, 'popupsupersize', 'toolbar=0,scrollbars,location=0,menubar=0,width=828,height=600');
					
					return false;
					
				}
				
		
			}
			
		
			

		}
	

}

//DOM-ready watcher
function domReady()
{
	//start or increment the counter
	this.n = typeof this.n == 'undefined' ? 0 : this.n + 1;
	
	//if DOM methods are supported, and the body element exists
	//(using a double-check including document.body, for the benefit of older moz builds [eg ns7.1] 
	//in which getElementsByTagName('body')[0] is undefined, unless this script is in the body section)
	//>>> and any elements the script is going to manipulate exist
	if
	(
		typeof document.getElementsByTagName != 'undefined' 
		&& (document.getElementsByTagName('body')[0] != null || document.body != null)
			&& document.getElementById('item8') != null 
	)
	{
	//>>>-- DOM SCRIPTING GOES HERE --<<<
	
	
		loaddynamic();


	//>>>-----------------------------<<<
	}

	//otherwise if we haven't reached 60 (so timeout after 15 seconds)
	//in practise, I've never seen this take longer than 7 iterations [in kde 3.2.2 
	//in second place was IE6, which takes 2 or 3 iterations roughly 5% of the time]
	else if(this.n < 60)
	{
		//restart the watcher
		//using the syntax ('domReady()', n) rather than (domReady, n)
		//because the latter doesn't work in Safari 1.0
		setTimeout('domReady()', 250);
	}
};
//start the watcher
domReady();



function validate_form(thisform)
{
with (thisform)
{


if (validate_search(query,"The search field must be filled out!")==false)
  {query.focus();return false}
}



}



function validate_search(field,alerttxt)
{



with (field)
{
if (value==null||value=="")
{
  alert(alerttxt);
  return false
}

else if (value.match(/^\s+$/)) {
  alert(alerttxt);
  return false
}

else {
   return true
}
  
}
}

var rhapPlayer;
var theScreenWidth = screen.width;
var theScreenHeight = screen.height;
var openFromLeftAt = (theScreenWidth-290);

function openRhapPlayer(url,id,type,title,page,pageRegion,guid) {
	if(!title || title == "" || title == null){
		title = null;
	}
	if(!page || page == "" || page == null){
		page = 'null';
	}
	if(!pageRegion || pageRegion == "" || pageRegion == null){
		pageRegion = 'null';
	}
	if(!guid || guid == "" || guid == null){
		guid = 'null';
	}
	openRhapPlayerWindow(url,id,type,title,"false",page,pageRegion,guid);
}



function openRhapPlayerWindow(url, id, type, title, remote, page, pageRegion, guid) {
		var playerLocation = url + '/player';
		if (window.opener && !window.opener.closed){
		   if (window.opener.name == 'rhapPlayer') {
			   rhapPlayer = window.opener;
		   }
		}
		if (!rhapPlayer || rhapPlayer.closed) {
			wname="rhapPlayer";
			width=270;
			height=570;
			rhapPlayer =  window.open("",wname,"width="+width+",height="+height+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,top=20,left="+openFromLeftAt+"");
		}
		
		if (title) {
			rhapPlayer.location.href = playerLocation + "?type=" + type + "&id="+id +"&title="+title +"&remote="+remote + "&page=" + page + "&pageregion=" + pageRegion + "&guid=" + guid + "&from=guide&cobrand=rs&pcode=rs";
		} else {
			rhapPlayer.location.href = playerLocation + "?type=" + type + "&id="+id +"&remote="+remote + "&page=" + page + "&pageregion=" + pageRegion + "&guid=" + guid + "&from=guide&cobrand=rs&pcode=rs";
		}
		if (!rhapPlayer.opener)
			rhapPlayer.opener = self;

	   rhapPlayer.focus();
}



