var preloadFlag = false;
var newWindow = null;


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function preloadImages() {
	if (document.images) {
		home_over = newImage("images/menu/home_over.gif");
		artists_over = newImage("images/menu/artists_over.gif");
		venues_over = newImage("images/menu/venues_over.gif");
		calendar_over = newImage("images/menu/calendar_over.gif");
		forum_over = newImage("images/menu/forum_over.gif");
		classifieds_over = newImage("images/menu/classifieds_over.gif");
		info_over = newImage("images/menu/info_over.gif");
		join_over = newImage("images/menu/join_over.gif");
		login_over = newImage("images/menu/login_over.gif");
		preloadFlag = true;
	}
}

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight){
	
	closeWin();
	
	if (type == "fullScreen"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 30;
	}
	if (type == "fullScreenScroll"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 30;
	}
	
	var tools="";
	if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=no,location=no,scrollbars=no,menubar=no,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "fullScreenScroll") tools = "resizable,toolbar=no,location=no,scrollbars=yes,menubar=no,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "console") tools = "resizable=no,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
	if (type == "consolescroll") tools = "resizable=no,toolbar=no,location=no,scrollbars=yes,width="+strWidth+",height="+strHeight+",left=0,top=0";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}

function popUpWinF(url, type){

	closeWin();
	
	if (type == "fullScreenScroll"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 30;
	}
	var tools="";
	if (type == "fullScreenScroll") tools = "resizable,toolbar=no,location=no,scrollbars=yes,menubar=no,width="+strWidth+",height="+strHeight+",top=0,left=0";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}	