function changeNavArrows(navNo, totalNavs)
{
    if (navNo > 0)
        navNo = navNo / 10;
        
        navNo += 1;
        
        totalNavs /= 10;

        if(parseInt(totalNavs) < totalNavs)
	        totalNavs = parseInt(totalNavs) + 1;
        else
	        totalNavs = parseInt(totalNavs);
        
	//reset all allows
	for(x=1; x <= totalNavs; x++ ){
		document.getElementById('navArrow' + x).style.background = "url('graphics/newsarrowdown.jpg') no-repeat";
		document.getElementById('navArrow' + x).style.color = "#212f60";
	}
	document.getElementById('navArrow' + navNo).style.background = "url('graphics/newsarrowup.jpg') no-repeat";
	document.getElementById('navArrow' + navNo).style.color = "#fff";
}

function changeNavArrowsCal(navNo, totalNavs)
{
	//reset all allows
	for(x=0; x < totalNavs; x++ )
	    document.getElementById('navArrow' + x).style.background = "url('graphics/calarrowdown.jpg') no-repeat";

    //Turn the relivent van arrow to down
	document.getElementById('navArrow' + navNo).style.background = "url('graphics/calarrowup.jpg') no-repeat";
}

function setArrow()
{
    if (document.getElementById('h0'))
        document.getElementById('h0').style.background = "url('graphics/newsarrowdown.jpg') no-repeat";
    if (document.getElementById('h10'))
        document.getElementById('h10').style.background = "url('graphics/newsarrowdown.jpg') no-repeat";
    if (document.getElementById('h20'))
        document.getElementById('h20').style.background = "url('graphics/newsarrowdown.jpg') no-repeat";
    if (document.getElementById('h30'))
        document.getElementById('h30').style.background = "url('graphics/newsarrowdown.jpg') no-repeat";
    if (document.getElementById('h40'))
        document.getElementById('h40').style.background = "url('graphics/newsarrowdown.jpg') no-repeat";
    if (document.getElementById('h50'))
        document.getElementById('h50').style.background = "url('graphics/newsarrowdown.jpg') no-repeat";
}

//Open a popup window for the editor
function openPopup(url)
{
	width=520;
	height=550;
	x=parseInt(screen.width/ 2.0) - (width /2.0);
	y=parseInt(screen.height/ 2.0) - (height /2.0);
	
	var win=window.open(url,"editorPopup","top="+y+",left="+x+",scrollbars=no,dialog=yes,minimizable=no,modal=yes,width="+width+",height="+height+",resizable=no");
}

function openPopup2(url)
{
	width=800;
	height=550;
	x=parseInt(screen.width/ 2.0) - (width /2.0);
	y=parseInt(screen.height/ 2.0) - (height /2.0);
	
	var win=window.open(url,"editorPopup","top="+y+",left="+x+",scrollbars=no,dialog=yes,minimizable=no,modal=yes,width="+width+",height="+height+",resizable=no");
}

function openPopup3(url)
{
	width=950;
	height=550;
	x=parseInt(screen.width/ 2.0) - (width /2.0);
	y=parseInt(screen.height/ 2.0) - (height /2.0);
	
	var win=window.open(url,"editorPopup","top="+y+",left="+x+",scrollbars=yes,dialog=yes,minimizable=no,modal=yes,width="+width+",height="+height+",resizable=no");
}

function setupXmlHttp()
{
	var xmlHttp;
  
  	try
    {    
		// Firefox, Opera 8.0+, Safari    
		xmlHttp=new XMLHttpRequest();    
	}
  	catch (e)
    {   
		// Internet Explorer    
		try
      	{      
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		}
    	catch (e)
      	{      
			try
        	{        
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			}
      		catch (e)
        	{        
				alert("Your browser does not support AJAX!");        
				return false;        
			}      
		}    
	}
	
	return xmlHttp;
}


function getContent(val1, val2)
{
    var xmlHttp = setupXmlHttp();
	
	try
    {
		xmlHttp.onreadystatechange=function()
		{	
			if(xmlHttp.readyState==4)
    		{
				//Get the ajax response
				var passedString = xmlHttp.responseText.substring(xmlHttp.responseText.indexOf('ajaxResults[')+12,xmlHttp.responseText.indexOf(']ajaxResults'));
			
				//Apply it to the page
				document.getElementById('content' + val2).innerHTML = passedString;
    		}
		}
	}
    catch (e)
    {        
		alert("Your browser does not support AJAX!");        
	}
	
	var url = "ajax/getContentBlockData.aspx?pageId=" + val1 + "&area=" + val2;
    
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function getContentClub(val1, val2, val3)
{
    var xmlHttp = setupXmlHttp();
	
	try
    {
		xmlHttp.onreadystatechange=function()
		{	
			if(xmlHttp.readyState==4)
    		{
				//Get the ajax response
				var passedString = xmlHttp.responseText.substring(xmlHttp.responseText.indexOf('ajaxResults[')+12,xmlHttp.responseText.indexOf(']ajaxResults'));
			
				//Apply it to the page
				document.getElementById('content' + val2).innerHTML = passedString;
    		}
		}
	}
    catch (e)
    {        
		alert("Your browser does not support AJAX!");        
	}
	
	var url = "ajax/getContentBlockDataClub.aspx?ClubPageID=" + val1 + "&area=" + val2 + "&ClubID=" + val3;
    
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}