	
	
	// used only on home page
	function admin()
	{
        //pw = prompt("Enter the password","here");
        //if (pw == "letmesee")
       // { 
       window.open("News/Editting.php","Editor","width=800,height=600");
       // }
	}


    //                      pop
    //display message and close button in popup window
    // used by Banners, and function loop() below
    
    function pop(txt,pic) { 
		x = 200; y = 120; w = 750; h = 600; // position and size
                                // html for pop window
		htmlHead = "<html><head><title>Picture</title></head>";
		htmlBody = "<body style='background-color: #ccccff' onload='self.focus()' onBlur='self.close()'>";
		htmlTable = "<div align='center'><table style='border: 3px solid blue'><tr>";
		htmlFoot = "</tr></table></div></body></html>";
		PopWin = window.open( "","Pop", "width="+w+",height="+h+",screenY="+y+",screenX="+x+",top="+y+",left="+x+",scrollbars=1,location=1,menubar=1,titlebar=1")
		PopWin.document.open(); // put html and mess in window
		PopWin.document.write(htmlHead + htmlBody + htmlTable);
		PopWin.document.write("<td align='center'>" + txt);
		PopWin.document.write("<div align='center'>");
		PopWin.document.write("<img src='"+pic+"' width='700px' />");
		PopWin.document.write("<br /><button onClick='window.close()'>Close</button>");
		PopWin.document.write("</div></td>" + htmlFoot);
		PopWin.document.close();
	}


    
    //              AddBkMark
    // used only on toplevel Menus
    
    function AddBkMark(called,url)
    {
        if (window.sidebar) // firefox
            window.sidebar.addPanel(called, url, "");
        else if(window.opera && window.print)
            { // opera
                var el = document.createElement('a');
                el.setAttribute('href',url);
                el.setAttribute('title',called);
                el.setAttribute('rel','sidebar');
                el.click();
            } 
            else if(document.all) // ie
                window.external.AddFavorite(url, called);
    }   
    
    
    // begining of slideshow sequence
var picTitle = new Array("","Home of Blessings","migrant workers' school","Shenyang hospice work","","Drs Ba Fang & Liu Da on the West Highland Way with Ann");

var PicNo = 1; // a global to be pased from slideit() to slidelink()
// preload the images
var NumOfPics = 5;
for (i = 1; i <= NumOfPics; i ++)
{
    var PicLoc = "images/pic" + i + ".jpg";
}

// and the work functions for changing images and links
var x = 1
function slideit()
{
    //if browser does not support the image object, exit.
    if (!document.images)
    {
        alert("no images");
        return
    }
    document.images.slide.src="images/pic" + x + ".jpg";
    PicNo = x;
    if (x < NumOfPics)
    {
        x++
    } else
    {
        x=1
    }
    //call function "slideit()" every 2.5 seconds
    setTimeout("slideit()",2500)
}
// and make each image clickable
function slidelink()
{
     n = PicNo;
    pop( picTitle[n],"images/pic" + n + ".jpg");
}



    //                  exhibit
    // used by projects to show details

    function exhibit(n) // to replace Headlines with NewsItems
    {
        but = document.getElementById('pause');
        if (n != 0)
        {
            but.value = "Back"
        }
    
        // hide or show the headLines
        obj = document.getElementById('news');
        if (obj.style.display == "none")
        {
            obj.style.display = "inherit";
        } else
        {
           obj.style.display = "none";
        }
        
        //hide all except required newsitems
        for (i=1; i < 10; i++)
        {
            obj = document.getElementById(i);
            if (i != n)
            {
                obj.style.display = "none";
            } else
            {
               obj.style.display = "inherit";
            }
        }
    }



    //              Changesize
    // not yet in use

    function Changesize(n)
    {
        document.body.style.fontSize = size;
    }



    //                  Jour
    // used by yourDate to name the day
    
    var DayNo = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

    function Jour(n)
    {
        return DayNo[n];
    }
    
    
    //                  yourDate
    // used by banner and subbanner to show date
    
    function yourDate(out)
    {
        
    var mon=new Array(12);
        mon[0]="January";
        mon[1]="February";
        mon[2]="March";
        mon[3]="April";
        mon[4]="May";
        mon[5]="June";
        mon[6]="July";
        mon[7]="August";
        mon[8]="September";
        mon[9]="October";
        mon[10]="November";
        mon[11]="December";
        
        var currentTime = new Date();
        var dayname = Jour(currentTime.getDay());
        var day = currentTime.getDate();
        var month = currentTime.getMonth();
        month = month;
        var themonth = mon[month];
        var year = currentTime.getFullYear();
        if (out=="print")
        {
            document.write("<b>" + dayname + "</b><br />" + day + " " + themonth + "<br />" + year + "<br />");
        } else
        {
            return day + "/" + month + "/" + year
        }
    }

    
    //              clock
    // used by banner to show the current time

    var int=window.setInterval("clock()",1000);
    
    function clock()
    {
        var d=new Date();
        var t=d.toLocaleTimeString();
        document.getElementById("clock").value=t;
    }






/*

                <!--a href='javascript:pop("Joan & Sally in Shenyang","Joan&Sally.jpg")'><img src="images/lge/Joan&Sally.jpg" width="150px" /></a-->
                
                
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
document.write(month + "/" + day + "/" + year)

var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
if (minutes < 10){
minutes = "0" + minutes
}
document.write(hours + ":" + minutes + " ")
if(hours > 11){
document.write("PM")
} else {
document.write("AM")
*/

