function generateIframe(resultType) {
    var mapGenLanguage = document.getElementById('mapGenLanguage').value;
	var mapGenWidth = document.getElementById('mapGenWidth').value;
	var mapGenHeight = document.getElementById('mapGenHeight').value;
	var mapGenBg1 = document.getElementById('mapGenBg1').value;
	var mapGenBg2 = document.getElementById('mapGenBg2').value;
	var mapGenText = document.getElementById('mapGenText').value;
	var mapGenA = document.getElementById('mapGenA').value;
	var mapGenButton = document.getElementById('mapGenButton').value;
	var mapGenCoord = document.getElementById('mapGenCoord').value;
	var mapGenZoom = document.getElementById('mapGenZoom').value;
	var mapGenArea = document.getElementById('mapGenArea').value;
	var mapGenCategories = document.getElementById('mapGenCategories').value;
	var mapGenShowSearch = document.getElementById('mapGenShowSearch').checked;
	var mapGenShowCategories = document.getElementById('mapGenShowCategories').checked;
	var mapGenShowExport = document.getElementById('mapGenShowExport').checked;

	var iframeurlparams = "";
	var iframeparams = "";


	// language
	if (mapGenLanguage != '') {
	    iframeurlparams += '?languageid=' + mapGenLanguage;	    
	}

	// width
	if(mapGenWidth != '') {
	  iframeurlparams += '&width='+mapGenWidth;
	  iframeparams += 'width="'+mapGenWidth+'"';
	} else {
	  // default
	  iframeurlparams += '&width=600';
	  iframeparams += 'width=600';
	}

	// height
	if(mapGenHeight != '') {
	  iframeurlparams += '&height='+mapGenHeight;
	  iframeparams += ' height="'+mapGenHeight+'"';
	} else {
	  // default
	  iframeurlparams += '&height=600';
	  iframeparams += ' height=600';
	}

	// mapGenBg1
	if(mapGenBg1 != '') {
	  iframeurlparams += '&colorbg1='+mapGenBg1;
	}

	// mapGenBg2
	if(mapGenBg2 != '') {
	  iframeurlparams += '&colorbg2='+mapGenBg2;
	}

	// mapGenText
	if(mapGenText != '') {
	  iframeurlparams += '&colortext='+mapGenText;
	}

	// mapGenA
	if(mapGenA != '') {
	  iframeurlparams += '&colora='+mapGenA;
	}

	// mapGenButton
	if(mapGenButton != '') {
	  iframeurlparams += '&colorbutton='+mapGenButton;
	}

	// mapGenCoord
	if(mapGenCoord != '') {
	  iframeurlparams += '&defaultcoordinate='+mapGenCoord;
	}

	// mapGenZoom
	if(mapGenZoom != '') {
	  iframeurlparams += '&defaultzoomlevel='+mapGenZoom;
	}

	// mapGenArea
	if(mapGenArea != '') {
	  iframeurlparams += '&kommune='+mapGenArea;
	} else {
	  // default
	  iframeurlparams += '&kommune=';
	}

	// mapGenCategories
	if(mapGenCategories != '') {
	  iframeurlparams += '&selectedcategories='+mapGenCategories;
	} else {
	  // default
	  iframeurlparams += '&selectedcategories=';
	}

	// mapGenShowSearch
	if(mapGenShowSearch == true) {
	  iframeurlparams += '&showsearch=1';
	} else {
	  // default
	  iframeurlparams += '&showsearch=';
	}

	// mapGenShowCategories
	if(mapGenShowCategories == true) {
	  iframeurlparams += '&showcategories=1';
	} else {
	  // default
	  iframeurlparams += '&showcategories=';
	}

	// mapGenShowExport
	if(mapGenShowExport == true) {
	  iframeurlparams += '&showpdfgenerator=1';
	} else {
	  // default
	  iframeurlparams += '&showpdfgenerator=';
	}

	iframeurlparams += "&styleid=1&selectedroute=";

	var embed = '<iframe scrolling="no" '+iframeparams+' src="http://vps302.vpswin.dk/mapEngine/mapEngine.aspx'+iframeurlparams+'">&nbsp;</iframe>';

	if(resultType == 0) {
	    document.getElementById('embedresult').value = embed;
	    document.getElementById('embedresult').style.display = 'inline';
	    setTimeout(function () { document.getElementById('embedresult').focus(); }, 10);
	    document.getElementById('embedresult').select();
	}

	if(resultType == 1) {
		var url =  'http://vps302.vpswin.dk/mapEngine/mapEngine.aspx'+ iframeurlparams;
		window.open(url, "Preview",'width='+mapGenWidth+', height='+mapGenHeight+', status=0');  
	}
}
