		var currentCombo = null;
		var currentIndex = null;
		
		var browserType = (document.all ? 'IE' : 'NS');
		
		function doNavigation( delta ) {
			var combo = (currentCombo != null ? currentCombo : document.all['navigationCombo0']);
			var index = (currentIndex != null ? currentIndex : -1);
			

			index += delta;

			if( delta > 0 && index >= getNavigationComboLength( combo ) ) {
				combo = document.all['navigationCombo' + (parseInt(combo.id.match( /([0-9]+)/ ).pop())+1)];
				index = 0;
			}

			if( delta < 0 && index < 0 ) {
				combo = document.all['navigationCombo' + (parseInt(combo.id.match( /([0-9]+)/ ).pop())-1)];
				index = getNavigationComboLength( combo )-1;
			}

			if( combo != null )
				doNavigationItem( combo, index );
		}
		
		function doNavigationItem( combo, index ) {
			currentCombo = combo;
			currentIndex = index;
			
			var tags = document.getElementsByTagName('SELECT');
			for( var i=0; i<tags.length; i++ )
				if( tags[i] != currentCombo )
					tags[i].selectedIndex = 0;

			var options = currentCombo.options;
			var counter = 0;
			for( var i=0; i<options.length; i++ )
				if( options[i].value != '' && counter++ == currentIndex ) {
					currentCombo.selectedIndex = i;
					break;
				}

			//parent.view.location.href = 'view.php?id=' + currentCombo.options[currentCombo.selectedIndex].value;
			//getWork(currentCombo.options[currentCombo.selectedIndex].value);
			window.location = '?id='+currentCombo.options[currentCombo.selectedIndex].value;

		}
		
		function getNavigationComboLength( combo ) {
			var counter = 0;
			var options = combo.options;
			
			for( var i=0; i<options.length; i++ )
				if( options[i].value != '' )
					counter++;
			
			return counter;
		}
		
		function navigationCombo_onChange(combo) {
//			var combo = event.srcElement;
			var index = 0;
			
			if( combo.options[combo.selectedIndex].value != '' ) {
				for( var i=0; i<combo.options.length; i++ ) {
					if( i == combo.selectedIndex )
						break;
						
					if( combo.options[i].value != '' )
						index++;
				}

				doNavigationItem( combo, index );
			}
		}

		function accessButton_onClick() {
			login();
		}

		function login() {
			var password = prompt( 'Please Enter Access Key', '' );
			if( password != null )
				window.location = '?password=' + password.toUpperCase();
		}
		
		function parseParams(str){
			
			//store the current window location
			var loc = str;
				
			//grab the query string from the location	
			var queriesB = loc.indexOf('?');
			var queries = loc.substring(queriesB +1, loc.length);
			
			//break up into array of pairs
			var query = queries.split('&');
			
			//init an array to hold the key/value pairs
			params = new Array();
			
			for(var i=0; i < query.length; i++){
				//split into key value pairs
				curVar = query[i].split('=');
				
				//make a new hash of those key/value pairs
				params[curVar[0]] = curVar[1];
			}
			return params;
		
		}
		
		function loadBlog(){
			
			hei = heightFix() - 55;
			
			$("#content").html('<iframe src="http://jimdarling.wordpress.com" id="blog" frameborder="0" marginwidth="0" marginheight="0" height="'+hei+'" width="100%"></iframe>');
			$("#body").css('background-color','#FFF');
		}
		
		
		function heightFix(){

	
			if(window.outerHeight){var OH = window.outerHeight;}else{var OH = document.body.offsetHeight;}
			if(window.innerHeight){var IH = window.innerHeight;}else{var IH = document.body.offsetHeight;}
		
			var actualH = IH;
			
			return IH;
		}
		
		function heightFixOnResize(){

	
			if(window.outerHeight){var OH = window.outerHeight;}else{var OH = document.body.offsetHeight;}
			if(window.innerHeight){var IH = window.innerHeight;}else{var IH = document.body.offsetHeight;}
		
			var actualH = IH - 55;
			
			$("#blog").attr('height',actualH);
			$("#body").css('background-color','#FFF');
		}
		
		
		
		/***********************************************************************************************************/
		//
		//	AJax helper for loading work
		//
		/***********************************************************************************************************/
		
		function getWork(id){
			
			$.ajax({
				type: "POST",
				url: "ajax.getwork.php",
				data: "id="+id,
				success: function(msg){
					params = parseParams(msg);
					$("#nav").css('backgroundColor','#'+params['nav']);
					$("#desc").css('backgroundColor','#'+params['desc']);
					$("#body").css('backgroundColor','#'+params['body']);
					if(params['description'] != ''){
						$("#desc").html('<p>'+params['description']+'</p>');
						$("#desc").show();
						$("#shade2").show();
					}else{
						$("#desc").hide();
						$("#shade2").hide();
					}
					$("#content").html('<img src="'+params['url']+'" alt="" />');
				}
		 	});
		
		}
		
		
		//inits
		window.onload = function(){}
		window.onresize = function(){ heightFixOnResize();}