function Items() { // Items Object
	this.length = 0;
	this.type = new Array();
	this.veld = new Array();
	this.titel = new Array();
	this.alias = new Array();
	this.lengtegraad = new Array();
	this.breedtegraad = new Array();
	this.foto = new Array();
	this.omschrijving = new Array();
	this.marker = new Array();
	this.Add = Add;
	this.ShowAll = ShowAll;
	this.ShowItem = ShowItem;
	this.GetInfo = GetInfo;
	this.ShowAlias = ShowAlias;
	this.map = '';
}
function Add(type, veld, titel, alias, lengtegraad, breedtegraad, foto, omschrijving) { // add item
	this.type[this.length] = type;
	this.veld[this.length] = veld;
	this.titel[this.length] = titel;
	this.alias[this.length] = alias;
	this.lengtegraad[this.length] = lengtegraad;
	this.breedtegraad[this.length] = breedtegraad;
	this.foto[this.length] = foto;
	this.omschrijving[this.length] = omschrijving;
	this.marker[this.length] = '';
	this.length++;
}
function ShowAll() {
	for(var i=0;i<this.length;i++) {
		this.ShowItem(i);
	}
}
function ShowItem(i) {
	var icon = new GIcon();

	switch(this.type[i])
	{
	case 'newsdetail':
		icon.image = "http://www.atelierfryslan.nl/uploads/images/css/marker2.gif";
	  break;    
	case 'agendadetail':
		icon.image = "http://www.atelierfryslan.nl/uploads/images/css/marker3.gif";
	  break;
	case 'detail':
		icon.image = "http://www.atelierfryslan.nl/uploads/images/css/marker4.gif";
	  break;
	case 'observatieJa':
		icon.image = "http://www.atelierfryslan.nl/uploads/images/css/marker5.gif";
	  break;
	case 'observatieVandaag':
		icon.image = "http://www.atelierfryslan.nl/uploads/images/css/marker6.gif";
	  break;
	default:
		icon.image = "http://www.atelierfryslan.nl/uploads/images/css/marker1.gif";
	}
	icon.shadow = "";
	icon.iconSize = new GSize(9, 9);
	icon.shadowSize = new GSize(9, 9);
	icon.iconAnchor = new GPoint(6, 9);
	icon.infoWindowAnchor = new GPoint(5, 1);

	var point = new GLatLng(this.breedtegraad[i], this.lengtegraad[i]);
	itms.marker[i] = new GMarker(point, icon);
	this.map.addOverlay(itms.marker[i]);
	GEvent.addListener(itms.marker[i], "click", function() {
		itms.marker[i].openInfoWindowHtml(itms.GetInfo(i));
	});
}
function GetInfo(i) {
    var txt = '<div style="width: 250px; min-height: 150px;">';
    var re = /src=\"(([^\"])+)\"/;
    var url = re.exec(itms.foto[i]);
	if (url != null) {
		txt += '<img src="/img.ashx?width=150&height=150&path=' + url[1] + '" alt="" width="150" height="100" border="0"><br />';
	}
	if (itms.omschrijving[i] != '') {
		txt += '<div style="font-size: 90%; margin-top: 5px;">' + itms.omschrijving[i] + '<br /></div>';
	}
	txt += '<span style="font-size: 90%; font-weight: bold;margin-top: 5px;margin-bottom: 5px;">' + itms.titel[i] + '<br /></span>';
	if (this.type[i] == 'newsdetail' || this.type[i] == 'newsdetailimg') {
		txt += '<a href="index.php?mact=News,cntnt01,detail,0&cntnt01articleid=' + itms.alias[i] + '&cntnt01origid=18&cntnt01returnid=29">detail pagina &raquo;</a><br />';
	} else {
		txt += '<a href="index.php?page=' + itms.alias[i] + '">detail pagina &raquo;</a><br />';
	}
    return txt;
}
function ShowAlias(alias, veld) {
    var ret = '';
	for(var i=0;i<this.length;i++) {
		if (this.alias[i] == alias && this.veld[i] == veld) {
		    ret = i+1;
		}
	}
	return ret;
}
itms = new Items();

