
function GeoPortalSyndication() 
{
};

GeoPortalSyndication.prototype = 
{
	hostURL : "http://www.geoportaal.be",
	
	getDispatcherURL : function()
	{
		return this.hostURL+"/portalfiles/linkdispatcher.swf";
	},
	
	getPortalURL : function()
	{
		var gp_location = location.href;
		if (gp_location=="") loc = parent.location.href;
		var gp_type = window.geoportaal_type;
		var gp_code = window.geoportaal_id
		var gp_lang = window.geoportaal_language;
		var gp_bgcolor = window.geoportaal_bgcolor;
		var gp_startupmod = window.geoportaal_startupmodule;
		var gp_startupreq_name = window.geoportaal_request_name;
		var gp_startupreq_params = encodeURIComponent(window.geoportaal_request_parameters);
		var theme_tint = window.geoportaal_theme_tint;
		
		if (gp_startupmod=="ruimtelijkeordening")
		    gp_startupmod = "stedenbouw";
		
		// set default values
		if (theme_tint==undefined) theme_tint = "";
		if (gp_type==undefined) gp_type = "gemeente";
		// allow some depricated parameters
		if (gp_code==undefined && window.geoportaal_niscode) gp_code = window.geoportaal_niscode;
		
		return this.hostURL+"/portal/viewexternal?"
					+"gptype="+ gp_type
					+"&gpcode="+ gp_code
					+"&gplocation="+ escape(gp_location)
					+"&gptype="+ gp_type
					+"&gpstartupmod="+ gp_startupmod
					+"&gpstartupreqname="+ gp_startupreq_name
					+"&gpstartupreqparams="+ gp_startupreq_params
					+"&gpbgcolor="+ gp_bgcolor
					+"&themetint="+ theme_tint
					+"&gplang="+ gp_lang;
	},
	
	getMarkup : function()
	{
		return "<embed type=\"application/x-shockwave-flash\" AllowScriptAccess=\"always\" src=\""+ this.getDispatcherURL() +"\" height=\"0\" width=\"0\"><param name=\"movie\" value=\""+ this.getDispatcherURL() +"\"/><param name=\"width\" value=\"0\"/><param name=\"height\" value=\"0\"/><param name=\"AllowScriptAccess\" value=\"always\"/></embed>" 
		     + "<iframe name=\"geoportaal\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" width=\"760\" height=\"600\" scrolling=\"no\" src=\""+ this.getPortalURL() +"\"></iframe>";
		
	},
	
	writeInpage : function() 
	{
		if (document.geoportaal_location_id)
		{
			var ell = document.getElementById(document.geoportaal_location_id);
			ell.innerHTML = this.getMarkup();
		}
		else
		{
		    try
		    {
		        document.write(this.getMarkup());
		    }
		    catch(error)
		    {
		    }
		}
	}  
};

new GeoPortalSyndication().writeInpage();

