function changeStyle(element, style) {
	element.className=style;
}

function changeBackground(element, background) {
	back="url("+background+")";
	element.style.backgroundImage=back;
}

function goTo(url) {
	window.location.href=url;
	return true;
}

// Opens a window in the centre of the screen. 
// Pass the php function, the id to work from, window width and height. For windowId, just pass a random string.
// for resize pass yes or no. Scrollbars are automatic if image is too big for screen.

function doPopup(url, windowWidth, windowHeight, windowId, resize, returnType) {

	if(resize=='yes') {
		scrollbars='yes';
		windowWidth=windowWidth+20;
	}
	else if(windowWidth>screen.availWidth || windowHeight>screen.availHeight) {
		scrollbars='yes';
		windowWidth=windowWidth+20;
	}
	else scrollbars='no';
	
	// reduce size so it doesn't fill the screen. also allows space for windows toolbar
	if(windowWidth>screen.availWidth) windowWidth=screen.availWidth-20;
	if(windowHeight>screen.availHeight) windowHeight=screen.availHeight-55;
	
	// Calculate the position to centre on screen
	xPos = ((screen.availWidth/2)-(windowWidth/2));
	yPos = ((screen.availHeight/2)-(windowHeight/2));
			
	window.open(url,windowId,'left='+xPos+',top='+yPos+',width='+windowWidth+',height='+windowHeight+',scrollbars=auto,resizable='+resize+',location=no,directories=no,status=no');

	if(returnType=='false') return false;
	else return true;
}


function localDate() {
	d=new Date();
	months=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	hours=d.getHours();
	if(hours<10) hours='0'+hours;
	min=d.getMinutes();
	if(min<10) min='0'+min;
	document.write(d.getDate()+' '+months[d.getMonth()]+' '+d.getFullYear()+' '+hours+':'+min);
}