function menu(currentURL) {
    var compare = "";
    var copy = false;
    var stop = false;
    
    for (i = currentURL.length; !stop ;i--){
    	if (currentURL.charAt(i) == '/' && !copy){
    		stop = true;
    		compare = "index";
    	}
        else if (currentURL.charAt(i) == '.' && !copy) {
            copy = true;
        }
        else if (currentURL.charAt(i) == '/' && copy) {
            stop = true;
        }
        else if (copy) {
            compare = currentURL.charAt(i) + compare;
        }
    }
    switch(compare){
    }
}function bread(currentURL) {

    var crumb = new Array();
    var index = 0;
    var compare = "";
    var copy = false;
    var stop = false;
    var trail = "";
    var skip = false;
    
    for (i = currentURL.length; !stop ;i--){
        if (currentURL.charAt(i) == '/' && !copy){
            compare = "index";
            crumb[index] = compare;
            index++;
            compare = "";
            copy = true;
        }
      else if (currentURL.charAt(i) == '/' && copy) {
          crumb[index] = compare;
            index++;
            if (compare == "env") {stop = true;}
            else {compare = "";}
      }
      else if (currentURL.charAt(i) == '.' && !copy) {
            copy = true;
      }
      else if (copy) {
            compare = currentURL.charAt(i) + compare;
      }
    }
    for (i = crumb.length; i >= 0; i--) {
            switch(crumb[i]){
                    case "env": trail += "<a href=\"/env/\" class=\"env-crumb\">LI-COR Environmental</a>"; skip = true; break;
                    case "index": trail += "Home"; break;
                    }
            if (i == crumb.length) {trail += " ";}
            else if (i != 0 && !skip) {trail += " &gt; ";}
						else if (skip) {skip = false;}
        }
        document.getElementById("crumb").innerHTML = trail;
}


/*sort function via dropdown*/
function sortSel(SelSort, appDivID) {
	$(SelSort).css('outline','none');  
	$('select.filter .current_app').removeClass('current_app');  
	$(SelSort).parent().addClass('current_app');  
		
	var filterVal = $(SelSort).val();
	
	var whichOne = $(SelSort).attr("id");
	if(whichOne == "drop1") { 
		document.getElementById('drop2').selectedIndex = 1; 
		$('#select2').addClass('markfade');
		$('#select1').removeClass('markfade');}
	else { 
		document.getElementById('drop1').selectedIndex = 1; 
		$('#select1').addClass('markfade');
		$('#select2').removeClass('markfade');}
	
	if(filterVal == 'all') {  
			$("div#" + appDivID + " a.hidden").removeClass('hidden');  
	} else {  
			$("div#" + appDivID + " a.app").each(function() {  
					if(!$(this).hasClass(filterVal)) {  
							$(this).addClass('hidden');  
					} else {  
							$(this).removeClass('hidden');  
					}  
			});  
	}  
	return false;  
}

/*sorting funtion via url*/
function setSel (valueApp, appDivID) {
	var selobj1 = document.getElementById('drop1');
	var selobj2 = document.getElementById('drop2');
	var found = 0;
	var index = 0;
	while(!found && index < selobj1.length) {
		if(selobj1.options[index].value == valueApp ) {
			selobj1.selectedIndex = index;
			found = 1; 
			var filterVal = selobj1.options[index].value; 
			$('#select2').addClass('markfade');
			document.getElementById('drop2').selectedIndex = 1;
			$('#select1').removeClass('markfade');
			$("div#" + appDivID + "  a.app").each(function() {  
					if(!$(this).hasClass(filterVal)) {  
							 $(this).addClass('hidden');  
					} else {  
							$(this).removeClass('hidden');  
					}  
			}); 
		}
		index += 1;
	}
	index = 0;
	while(!found && index < selobj2.length) {
		if(selobj2.options[index].value == valueApp ) {
			selobj2.selectedIndex = index;
			found = 1; 
			var filterVal = selobj2.options[index].value; 
			document.getElementById('drop1').selectedIndex = 1; 
      $('#select1').addClass('markfade');
      $('#select2').removeClass('markfade');
			$("div#" + appDivID + "  a.app").each(function() {  
					if(!$(this).hasClass(filterVal)) {  
							 $(this).addClass('hidden');  
					} else {  
							$(this).removeClass('hidden');  
					}  
			}); 
		}
		index += 1;
	}
}

/*parameter url get*/
function getUrlParametersVals()  
{  
		var vars = [], hash;  
		var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');  
		for(var i = 0; i < hashes.length; i++)  
		{  
				hash = hashes[i].split('=');  
				vars.push(hash[0]);  
				vars[hash[0]] = hash[1];  
		}  
		return vars;  
} 
/*sort function via dropdown with scrolling*/
function sortSel2(SelSort, appDivID, all) {
	$(SelSort).css('outline','none');  
	$('select.filter .current_app').removeClass('current_app');  
	$(SelSort).parent().addClass('current_app'); 
	var filterVal = $(SelSort).val();
	var p = 0, p2 = $("#" + appDivID + " li").size(),
			o = true,
			d = 0;
	
	var whichOne = $(SelSort).attr("id");
	if(whichOne == "drop1") { 
		document.getElementById('drop2').selectedIndex = 1; 
		$('#select2').addClass('markfade');
		$('#select1').removeClass('markfade');}
	else { 
		document.getElementById('drop1').selectedIndex = 1; 
		$('#select1').addClass('markfade');
		$('#select2').removeClass('markfade');}
	
		$("#" + appDivID).trigger("slideTo", 0);
 
		$("#" + appDivID).html(all);
		if (filterVal == "all") {
			p = "end";
			i = "<li></li>";
			arr = [i, p, o, d];
			$("#" + appDivID).trigger("insertItem", arr);
			arr = [p2, o, d];
			$("#" + appDivID).trigger("removeItem", arr);
		}
		$("#" + appDivID + " li").each(function(){
			if(!$(this).children().hasClass(filterVal)){ //delete
				p = $(this).index("#" + appDivID + " li");
				arr = [p, o, d];
				$("#" + appDivID).trigger("removeItem", arr);
			}
		});
	return false;  
}
