// ROLLOVERS

//Create new image in the DOM
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
//Toggle images
function toggleImage(imageID, filenamePrefix){
	if(!filenamePrefix){
		filenamePrefix = imageID;
	}
	if((document.getElementById(imageID).src).indexOf('.gif') != -1){
		filenameSuffix = '.gif';
	}else{
		filenameSuffix = '.jpg';
	};
	if((document.getElementById(imageID).src).indexOf(filenamePrefix + '_up' + filenameSuffix) != -1){
		document.getElementById(imageID).src = (document.getElementById(imageID).src).replace('_up' + filenameSuffix, '_on' + filenameSuffix);
	} else if((document.getElementById(imageID).src).indexOf(filenamePrefix + '_on' + filenameSuffix) != -1){
		document.getElementById(imageID).src = (document.getElementById(imageID).src).replace('_on' + filenameSuffix, '_up' + filenameSuffix);
	}
}

function preload() {
	var toPreload=new Array()
	for (i=0;i<preload.arguments.length;i++){
		toPreload[i]=new Image()
		toPreload[i].src=preload.arguments[i]
	}
}

function openGamesWin(url, name, w, h)
{
  // Fudge factors for window decoration space.
  // In my tests these work well on all platforms & browsers.
  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=no, resizable=no');
  // Just in case width and height are ignored
  win.resizeTo(w, h);
  // Just in case left and top are ignored
  win.moveTo(wleft, wtop);
  win.focus();
}


 var prevSelect=0;
function showDivSelect(divID) {
	if(document.getElementById(divID))
	{
		if( prevSelect && prevSelect != divID)
			toggle(prevSelect); 
		document.getElementById(divID).style.display = 'block';
		prevSelect = divID;
	}
}
function toggle(divID) {
document.getElementById(divID).style.display = (document.getElementById(divID).style.display=='none'?'block':"none");
}
