	function createMarker(point, i, id, name, type) {
	        var marker = new GMarker(point);
		//alert(i);
		//alert(id);
                if(type=="child"){
                        childhtmls[i] = "Go to <a class='map' href='company.php?CompanyID=" + id + "'>" + name + "</a> company page";
                        GEvent.addListener(marker, "click", function() {
                                //alert(htmls[i]);
                                marker.openInfoWindowHtml(childhtmls[i]);
                        });
                        childgmarkers[i] = marker;
                } else if (type=="parent"){
                        parenthtmls[i] = "Go to <a class='map' href='company.php?CompanyID=" + id + "'>" + name + "</a> company page";
                        GEvent.addListener(marker, "click", function() {
                                //alert(htmls[i]);
                                marker.openInfoWindowHtml(parenthtmls[i]);
                        });
                        parentgmarkers[i] = marker;
                } else if (type=="HQ") {
                        //alert(i);
                        parenthtmls[i] = "You are already at this company"
                        GEvent.addListener(marker, "click", function() {
                                //alert(htmls[i]);
                                marker.openInfoWindowHtml(parenthtmls[i]);
                        });
                        parentgmarkers[i] = marker;
                }

                
	        // save the info we need to use later for the side_bar
	        gmarkers[i] = marker;
                //alert(i + gmarkers[i]);
	        //htmls[i] = html[i];
		
	        // add a line to the side_bar html
	        //side_bar_html += '<a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
	        //i++;
                map.addOverlay(marker);
	        //return marker;

	}
	  
	// This function picks up the click and opens the corresponding info window
	function myclickChild(i) {
		childgmarkers[i].openInfoWindowHtml(childhtmls[i]);
	}
        
        function myclickParent(i) {
		parentgmarkers[i].openInfoWindowHtml(parenthtmls[i]);
	}
	
	function addCompanies(array, arrayHQ, arrayID, list){
		for(i=0; i<array.length; i++){
                        if(list==document.getElementById('ingredients_list')){
                                list.innerHTML += "<li><a href='javascript:myclickChild(" + i + ")'>" + array[i] + "</a></li>";
                                createMarker(arrayHQ[i], i, arrayID[i], array[i], "child");
                        } else if (list==document.getElementById('path_list')){
                                list.innerHTML += "<li><a href='javascript:myclickParent(" + i + ")'>" + array[i] + "</a></li>";
                                createMarker(arrayHQ[i], i, arrayID[i], array[i], "parent");
                        }
			//list.innerHTML += "<li><a href='javascript:myclick(" + i + ")'>" + array[i] + "</a></li>";
			//createMarker(arrayHQ[i], i, arrayID[i], array[i]);
			//map.addOverlay(marker);
                        bounds.extend(arrayHQ[i]);
		}
	}
	
	
	function disclaimer(){
	window.open('disclaimer.html','The_Food_Map_Disclaimer','height=400,width=500,toolbars=no,location=no,directories=no,status=no,menubar=no,copyhistory=no,resizable=yes,scrollbars=yes');
}

var n=0;
function bigMap(){
		button = document.getElementById("toggle");
		container = document.getElementById("outContainer");
		div = document.getElementById("map");
		if(n==0){
			container.style.width = "1040px"
			div.style.width = "655px";
			div.style.height = "540px";
			button.innerHTML = "Small Map";
			n=1;
		} else if(n==1){
			button.innerHTML = "Large Map";
			n=0;
			container.style.width = "800px"
			div.style.width = "415px";
			div.style.height = "300px";
		}

	}
