/*
generic functions for theAA sitewide
Original version : Thomas Grey, Jann Herlihy, Jerermy Wray
Updated for phase2 : Martin Allen
*/


function popUpWindow(theURL,winName,features) {
	/* Behaves just like window.open() but ensures visible child windows */
	closePopUpWindow();
	openedWindow = open(theURL,winName,features+",left=0,top=0,screenX=0,screenY=0");
	openedWindow.onunload = confirmClosed;
	onunload = closePopUpWindow;
	windowOpen = true;
	return (openedWindow);
}
function closePopUpWindow(){
	/*  Closes a window's child window */
	if (window.windowOpen){
		openedWindow.close();
		confirmClosed();
	}
}
function confirmClosed(){
	/*  Used to confirm when the child window is closed */
	windowOpen = false;
}

function popUpMap(){
	/*  Pops up a Map in Route Planner */
	popUpWindow('planner_popupmap.html','Map','width=400,height=490,scrollbars=no,');
}

//this pop-up doesn't have left=,screex= etc. for positioning, to allow these to be set from the calling page
function popUpWindow2(theURL,winName,features) {
	window.onunload = closePopUpWindow2;
	closePopUpWindow2();
	window.openedWindow2 = window.open(theURL,winName,features);
	return (window.openedWindow2);
}

function closePopUpWindow2(){
	if (window.openedWindow2 && !window.openedWindow2.closed){
		window.openedWindow2.close();
	}
}

function changeBg(id)
/* used by yourcar/valuation_home for rollovers */
    {if (window.divs) eval("divs."+id+".setBackgroundColor('#ffcc00')")}
 
 function changeBack(id)
 /* used by yourcar/valuation_home for rollovers */
    {if (window.divs) eval("divs."+id+".setBackgroundColor('#ccccff')")}
	
 function whatMonth()
	{
		/* used in yourtravel/events 
		 get the month and display in the select box */
		var new_date = new Date();
		var the_month = new_date.getMonth();
		document.getMonth.months.selectedIndex= the_month;
	}
	

function doNothing()
/* called when we want nothing to be done - it'll make sense don't worry */
{}

function goPage(place)
/* called by dropdown that sends a ULR as a value and causes that URL to load */
{
	var item=place.options[place.selectedIndex].value;
	if (item != "nowhere") {
		top.location=item;
	}
}

function notYet()
/*called by links that have not yet been implemented*/
{
	alert('Sorry. This functionality has not yet been implemented.');
}

