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) {
		about_button_over = newImage("images/about_button-over.gif");
		services_button_over = newImage("images/services_button-over.gif");
		portfolio_button_over = newImage("images/portfolio_button-over.gif");
		contact_button_over = newImage("images/contact_button-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();
}	