function menu(item,w)
{
var h=screen.height-300;
document.getElementById('content').style.visibility="hidden";
document.getElementById('content').innerHTML='<iframe frameborder="0" style="width: ' + w + '%; height: 100%;" src="' + item +'.htm" style="background-image: url(images/bg.gif); background-repeat: repeat;" />';
document.getElementById('mnuImage').innerHTML='<img  src="images/' + item + '.jpg" />';
window.setTimeout('showContent()',500);
return false;
}

function menuphp(item,w)
{
var h=screen.height-300;
document.getElementById('content').style.visibility="hidden";	
document.getElementById('content').innerHTML='<iframe frameborder="0" style="width: ' + w + '%; height: 100%;" src="' + item +'.php" style="background-image: url(images/bg.gif); background-repeat: repeat;" />';
document.getElementById('mnuImage').innerHTML='<img  src="images/' + item + '.jpg" />';
window.setTimeout('showContent()',80);
return false;
}

function showContent()
{
document.getElementById('content').style.visibility="visible";	
}

function wEnd(ver)
{
var now = new Date();
var y=now.getFullYear();
var mnthDays = getMonthDays(y);
var m=now.getMonth();
var day=now.getDay();
var t=now.getHours();
var d=now.getDate();
var sun=d;
var url="servicesNorm.htm";
var mnth=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
if(day!=0)
	{sun=d+7-day;}
else if (t>12)
	{sun=d+7;}
		
if(sun > mnthDays[m])
	{
	sun = sun-mnthDays[m]
	if (m==12)
		{
		y=y+1;
		m=0;
		}
	m=m+1;
	}
//m=m+1
var we= sun + " " + mnth[m] + " " + y;
url=url
if(sun > 7 && sun < 15)
	{url = "services" + "Word.htm";}

if (sun >21 && sun <29)
	{ url ="services" + "Joint.htm";}

	
if(ver=="date")
	{
		return(we);
	}
else
	{location.href=url;}

}

// utility function 
// this function will return the lengths of every month in a given year 
// accounts for leap years 


function getMonthDays(year) 
{ 
var leap = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); 


 return [31, (leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 

} 

//add date to services page
function showDate()
{
var x=wEnd('date');
var obj=document.getElementById("date");
var y = obj.outerText;
obj.innerHTML="<font size='2'>(to " + x + ") </font>";
}

function mapWindow()
{
myRef = window.open("map.htm",'mapwin','left=20,top=20,width=640, height=500,toolbar=0, menubar =0,resizable=1');
}
function calWindow()
{
myRef = window.open("calendar.htm",'calwin','left=20,top=20,width=640, height=470,location=0,status=0,toolbar=0, menubar =0,resizable=1');
return true;
}


function smWind(url)
{
myRef = window.open(url,'smTest','left=20,top=20,width=800, height=600, toolbar=1, menubar=1,scrollbar=1, resizable=0');
}
function midWind(url)
{
myRef = window.open(url,'midTest','left=20,top=20,width=1024, height=768,  toolbar=1, menubar=1,scrollbar=1, resizable=0');
}

function test()
{
alert("Test");
}
function selectCSS()
{
    if(document.body.clientWidth<1000)
    {
        document.getElementById("lnk1").href = 'as800.css'; 
    }
}
function startOptions()
{
//*setion for data change on date

     

//*show special page menu item
// if(document.getElementById("mnuXtra")!=null)
//    {
//    document.getElementById("mnuXtra").className = 'menuXtra';
//    document.getElementById("lnkXtra").href = 'spec.htm';
//    document.getElementById("lnkXtra").innerHTML = '<img src="images\\agm.jpg" style="border:none" title="Ecumenical AGM - all welcome"/>';
//    } 

    
    
if(document.body.clientWidth<1000)
    {
        document.getElementById("lnk1").href = 'as800.css'; 
    }

}

function showMethWord()
{
var d = new Date();
//if((d.getMonth()==0 && d.getDate()>6) || (d.getMonth()==11 && d.getDate()<14))return;
var y = d.getFullYear();
var m =d.getMonth() + 1;
if(m<10)
{
m = '0' + m;
}
var d =d.getDate();
if(d<10)
{
d = '0' + d;
}
var url ='http://www.methodist.org.uk/index.cfm?fuseaction=opentogod.bibleStudy&studydate=' + y + '-' + m + '-' + d

myRef = window.open(url,'wordwin','left=20,top=20,width=780, height=800,location=0,status=0,toolbar=0, menubar =0,resizable=1,scrollbars=1');

}

function showImager(href)
{
	//alert(href);
	windowOpener(href,'image','Left=20px;Top: 20px; Height: 905px; Width: 385px; help: no; status: no; scroll: no;');

}

function showDialog(href)
{
if (navigator.userAgent.indexOf("Opera")!=-1)
{
deliberatebugforOpera
}
else
{
imgWindow=window.open(href,'image',"left=10,top=0,height=800,width=320,status=0,resizable=0");
imgWindow.focus();
}
}

function closeNewsWin()
{    
var o = opener.
alert("W");
if(!newsWin.closed)
    {
    newsWin.close();
    }
}

function showNews(href)
{

var url="news.php?item=" + href
newsWin=window.open(url,'news',"left=10,top=10,height=950,width=900,status=0,resizable=1");
newsWin.focus();

}

function popup(href,w,h)
{
var layout ="left=10,top=0,status=0,resizable=0 ,width=" + w + ",height=" + h;
imgWindow=window.open(href,'image',layout);

imgWindow.focus();
//alert(w + ", " + h);
}
