// JavaScript of William Stallwood....all JS created by William Stallwood. You may use any of these scripts aslong as you give credit.
var item_back;
var item_on;
var menu = "none";	//init my menu
var title;
var _cur;


ns4 = (document.layers) ? true:false 
ie4 = (document.all) ? true:false 
ng5 = (document.getElementById) ? true:false 

//alert(ns4+" "+ie4+" "+ng5); 
function show(id,state) {

if ((id != "back")&&(id != "services")&&(id != "resume")&&(id != "contact")&&(id != "portfolio")&&(id != "home")&&(id != "top")&&(id != "default")){
	item_on = id;
}

if (ie4) { 
	document.all[id].style.display = state;
} 
if (ng5) { 
	document.getElementById([id]).style.display = state; 
} 
return false; 
} 

function go_back(){
	if(menu == "none"){
		show(item_on,'none');
		show('back','none');
		show('dandd','inline');
		vis(item_back,'hidden');
		show("default","inline");
	}else{
		show(_cur,"none");
		show(title + "_title","inline");
		show(title + "_menu","inline");
		menu = "none";
	}
}

function port_item(kind){
	show("default","none");
	show("dandd","none");
	show("back","inline");
	vis(kind,"visible");
	show(kind +"_title","inline");
	show(kind +"_menu","inline");
	title = kind;
}

function menu_on(kind,num){
	show(title + '_title','none');
	show(kind + '_menu','none');
	show(kind + '_title','none');
	show(kind + '_' + num,'inline');
	_cur = kind + '_' + num;
	menu = "on";
}
	
function vis(id,state) {

	item_back = id;

if (ie4) { 
	document.all[id].style.visibility = state;
} 
if (ng5) { 
	document.getElementById([id]).style.visibility = state;
} 
return false; 
} 



var increase = 1;
var timer;

function bounce(id) {
	

		if (ie4) { 
			var n = document.all[id].style;
		} 
		if (ng5) {
			var n = document.getElementById([id]).style;
		}
			
				clearTimeout(timer);
				n.visibility = "visible";

				if(parseInt(n.top) > -(160 - increase)){
					n.top = parseInt(n.top) - increase + "px";
					n.height = parseInt(n.height) + increase + "px";
					increase = increase * 1.3;
					timer=setTimeout("bounce('"+id+"')",30);
				}
				
		return false; 

} 

function simple_off(){
	clearTimeout(timer);
	increase = 1;
	
	
	for(var y = 1; y <= 5; y++){
	
	
			if (ie4) { 
				var n = document.all["L"+y+"b"].style;
			} 
			if (ng5) {
				var n = document.getElementById(["L"+y+"b"]).style;
			}
		
	n.visibility = "hidden";
	n.top = "-12px";
	n.height = "12px";
	
	}

}

var url,w,h;

function window_pop(url,w,h){
newwindow = window.open ("http://www.willstall.com/preview.php?img="+url,"newwindow","'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=" + w + ",height=" + h);
newwindow.moveTo(0,0);
}

function win_pop(url,w,h){
newwindow = window.open (url,"newwindow","'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=" + w + ",height=" + h);
newwindow.moveTo(0,0);
}
