function productlist() {
	if (document.getElementById) {
		this.ele = document.getElementById('productlist');
		this.tb = this.ele.getElementsByTagName('tbody');
		this.tb = this.tb[0];
		var i;
		i = this.tb.getElementsByTagName('input');
		for (this.count = 0; this.count < i.length; this.count ++) {
			i[this.count].onchange = this.inputhandler(this.count);
		}
	}
}
productlist.prototype.addanother = function() {
	this.count ++;
	var ele = document.createElement('tr');
	var td = document.createElement('td');
	td.innerHTML = this.count+':';
	ele.appendChild(td);
	td = document.createElement('td');
	var input = document.createElement('input');
	input.onchange=this.inputhandler(this.count);
	input.type='text';
	input.name='productlist[product_'+this.count+']';
	td.appendChild(input);
	ele.appendChild(td);
	td = document.createElement('td');
	td.innerHTML = '<select size="1" name="productlist[type_'+this.count+']"><option value="1">Self Made</option><option value="2">Hand Made</option><option value="3">Recycled</option><option value="4">Commercial</option></select>';
	ele.appendChild(td);
	td = document.createElement('td');
	td.innerHTML = '<select size="1" name="productlist[origin_'+this.count+']"><option value="1">Queensland</option><option value="2">Australia</option><option value="3">Overseas</option></select>';
	ele.appendChild(td);
	this.tb.appendChild(ele);
}
productlist.prototype.inputhandler = function(ind) {
	var obj = this;
	ind ++;
	return function() {
		if (ind >= obj.count) {
			obj.addanother();
		}
	}
}
function initmap(controltype) {
	var map = new GMap2(document.getElementById("map"));
	var willows = [-19.31543,0.72408,-19.31476,0.72592,-19.31463,0.72643,-19.31461,0.72704,-19.31467,0.72788,-19.31490,0.72787,-19.31500,0.72755,-19.31537,0.72771,-19.31541,0.72777,-19.31525,0.72830,-19.31527,0.72861,-19.31553,0.72851,-19.31655,0.72842,-19.31733,0.72783,-19.31736,0.72773,-19.31695,0.72756,-19.31741,0.72630,-19.31741,0.72618,-19.31749,0.72614,-19.31753,0.72602,-19.31762,0.72603,-19.31780,0.72548,-19.31774,0.72545,-19.31783,0.72510,-19.31543,0.72408];
	var x, locs = new Array(),t=0,g=0;
	for (x = 0; x < willows.length; x += 2) {
		locs[x/2] = new GLatLng(willows[x],willows[x+1] + 146);
		t += willows[x];
		g += (willows[x+1] + 146);
	}
	x = (x / 2);
	t /= x;
	g /= x;
	map.setCenter(new GLatLng(t,g), 14);
	map.enableDoubleClickZoom();
	map.enableContinuousZoom();
	var polyline = new GPolyline(locs, "#013e7d", 5);
	map.addOverlay(polyline);

	function textmarker(lat, lng, name) {
		this.latlng_ = new GLatLng(lat, lng);
		this.name_ = name;
	}
	textmarker.prototype = new GOverlay();
	textmarker.prototype.initialize = function(map) {
		this.map_ = map;
		this.shadow_ = document.createElement("div");
		if (controltype != 'print') {
			this.map_.getPane(G_MAP_MARKER_SHADOW_PANE).appendChild(this.shadow_);
		}
		this.info_ = document.createElement("div");
		this.map_.getPane(G_MAP_MARKER_PANE).appendChild(this.info_);

		this.shadow_.style.position = "absolute";
		if (navigator.userAgent.indexOf("MSIE") != -1) {
			this.shadow_.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale', src='/willowsmarkets/style/images/markershadow.png')";
			this.info_.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale', src='/willowsmarkets/style/images/textmarker.png')";
		} else {
			this.shadow_.style.background = "no-repeat top left url(/willowsmarkets/style/images/markershadow.png)";
			this.info_.style.background = "no-repeat top left url(/willowsmarkets/style/images/textmarker.png)";
		}
		this.shadow_.style.width = "124px";
		this.shadow_.style.height = "33px";

		this.info_.style.position = "absolute";
		this.info_.style.width = "120px";
		this.info_.style.lineHeight = "18px";
		this.info_.style.fontFamily = "arial,helvetica,sans-serif";
		this.info_.style.textAlign = "center";
		this.info_.style.height = "43px";
		this.info_.innerHTML=this.name_;
	}
	textmarker.prototype.remove = function() {
		if (controltype != 'print') {
			this.shadow_.parentNode.removeChild(this.shadow_);
		}
		this.info_.parentNode.removeChild(this.info_);
	}
	textmarker.prototype.copy = function() {
		return new textmarker(this.name_);
	}
	textmarker.prototype.redraw = function(force) {
		if (force) {
			var pix;
			pix = this.map_.fromLatLngToDivPixel(this.latlng_);
			this.shadow_.style.top = (pix.y - 33) + 'px';
			this.shadow_.style.left = (pix.x - 34) + 'px';
			this.info_.style.top = (pix.y - 43) + 'px';
			this.info_.style.left = (pix.x - 60) + 'px';
		}
	}

	function printcontrol() {
	}
	printcontrol.prototype = new GControl();

	printcontrol.prototype.initialize = function(map) {
		var container = document.createElement('div');

		var btn = document.createElement('div');
		container.appendChild(btn);
		btn.className="mapprint";
		btn.innerHTML='Print Map';
		GEvent.addDomListener(btn, "click", function() {
			window.open('/map_of_markets.nb?op=print', '', 'width=300,height=100,scrolling=n');
		});

		map.getContainer().appendChild(container);
		return container;
	}

	printcontrol.prototype.getDefaultPosition = function() {
		return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
	}

	if (controltype != 'print') {
		map.addControl(new printcontrol());
		map.addControl(new GSmallMapControl());
	}
	map.addOverlay(new textmarker(-19.3161,146.727325, 'Willows Markets'));
}
function fixobjects() {
	if (document.getElementById) {
		if (navigator.userAgent.indexOf("MSIE") != -1) { // ieonly
			var obj = document.getElementsByTagName('object');
			var x;
			for (x = 0; x < obj.length; x ++) {
				obj[x].outerHTML = obj[x].outerHTML;
			}
		}
	}
}
fixobjects();
