// SidNet common Javascript routines
//
//
// RETURN DAY OF MONTH

	function day(){
		
		var thisDay=new Date().getDate();

		if(thisDay==1){return(thisDay + "st")}
		if(thisDay==21){return(thisDay + "st")}
		if(thisDay==31){return(thisDay + "st")}

		if(thisDay==2|thisDay==22){return(thisDay + "nd")}
		if(thisDay==22){return(thisDay + "nd")}

		if(thisDay==3){return(thisDay + "rd")}
		if(thisDay==23){return(thisDay + "rd")}
		else{
		return(thisDay +"th");
		}	
}
// RETURN DAY OF WEEK

	function dayOfWeek(){
		var today=new Date();
		dayList=new Array("Sunday","Monday","Tueday","Wednesday","Thurday","Friday","Saturday");
		return dayList[today.getDay()];
	}

// RETURN CURRENT MONTH
	
	function month(){
		var today=new Date();
		monthList=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
		return monthList[today.getMonth()];
	}

// RETURN CURRENT YEAR

	function year(){
		var today=new Date();
		return (today.getYear());
	}

// RETURN COMPLETE DATE

	function returnDate(){
		return (dayOfWeek()+' '+day()+' '+month()+' '+year());
	}

// REDIRECT CURRECT PAGE TO VALUE OF SELECTED ITEM
	
	function RedirectMe(control, target){
		// Control item passed to routine from ONCLICK and ONKEYPRESS (this.form.ulist)
		var item=control.selectedIndex;
		//find selected item in list
		if(item!= -1){
		// If no item selected value= -1 Item 0 is selected by default
		var value=control.options[item].value;
		//Find the selection value
		control.selectedIndex=0;
		// Reset to first item
		target.location=value;
		// Load new page
		}
		else{
			alert("Please select an item from the list");
			// message if no item selected
			}	
	}

// MAKE CURRENT WINDOW TOP WINDOW

	function MakeMeTop(){
		if(parent.frames.length!=0){
		parent.location = window.location;		
		}
	}

// RETURN COPYRIGHT NOTICE

	function ShowCopyright(SendTo){
	document.write("<BR>Copyright&nbsp;&copy;&nbsp;<A HREF='MAILTO:"+SendTo+"'CLASS='copyright'>Chris Sidney</A>&nbsp;1997&nbsp;-&nbsp;"+year());
	}

// CHECK CORRECT MENU

// This Javascript routine checks the menu frame document and
// changes it if different. The menu document checks the head frame!

	function CheckMenu(NewDocument){
		
		if(parent.frames("menu").location.href.lastIndexOf(NewDocument)==-1){
			parent.frames("menu").location=NewDocument;
		}
	}

// CHECK CORRECT HEAD

//check if the head document is correct

	function CheckHead(NewDocument){
		
		if(parent.frames("head").location.href.lastIndexOf(NewDocument)==-1){
			parent.frames("head").location=NewDocument;
		}
	}
	


// CHECK CORRECT PAGE IN FRAME

	function DocumentInFrame(NewDocument, FrameName){
		
		if(name=="main"){
			if(parent.frames(FrameName).location.href.lastIndexOf(NewDocument)==-1){
				parent.frames(FrameName).location=NewDocument;
			}
		}
	}	


	
// END
// copyright Chris Sidney