/*
 * InGoedeBanen.nl VacatureModule
 * Ook eenvoudig uw vacatures op uw eigen website en ruim 100 jobboards?
 * Maak uw eigen demo-account aan op www.ingoedebanen.nl
 */
var igbvacaturemodule = {
	constructor: function() {
		if (igbvacaturemodule.browser.IE) {
			if (navigator.userAgent.indexOf('MSIE 6.0') > -1) {
				igbvacaturemodule.browser.IE6 = true;
			}
			if (igbvacaturemodule.browser.IE6) {
				igbvacaturemodule.options.scrolling = 'yes';
			}
		}
	},

	browser: {
    	IE: !!(window.attachEvent && navigator.userAgent.indexOf('Opera') === -1),
    	IE6: false,
    	Opera: navigator.userAgent.indexOf('Opera') > -1,
    	WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
    	Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') === -1,
    	MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
	},

	options: {
		// De hoogte van de iframe
		height: 500,

		// De breedte van de iframe
		width: 800,

		// Moet de iframe een rand krijgen?
		frameborder: 'no',

		// Scolling opties voor de iframe (vooral voor IE6)
		scrolling: 'auto',
		horizontalscrolling: 'no',
		verticalscrolling: 'yes',

		// Keuze uit: list, search, latest
		// Hiermee kan de beginpagina gekozen worden. Er wordt nog wel gekeken naar de url.
		default_page: 'list',

		// Keuze uit: '', list, search, latest
		// Het verschil met "default_page" is dat deze optie voorrang heeft op de url, er wordt dus altijd dezelfde pagina getoond.
		// Vooral handig indien er zowel een lijst met nieuwste vacatures als de normale vacaturemodule in beeld staan
		force_page: '',

		// Standaard worden de nieuwste vacatures eerst getoond
		order_by: '',

		// Hoeveel vacatures worden in 1 lijst getoond?
		limit: 20
	},

	setOption: function(key, value) {
		this.options[key] = value;
	},

	moduleserver: 'vacaturemodule.ingoedebanen.nl',

	start: function(code) {
		if (this.options['server']) {
			this.moduleserver = this.options['server'];
		}
		var moduleaddress = 'http://'+this.moduleserver;
		if (typeof(code) == 'undefined' || code == '') {
			alert('De start functie moet aangeroepen worden met de code welke u van InGoedeBanen.nl heeft gekregen.');
			return;
		}

		var optionsString = 'code='+code;
		for (i in this.options) {
			optionsString += '&'+i+'='+this.options[i];
		}

		if (window.location.search) {
			optionsString += '&'+window.location.search.substring(1);
		}

		document.write('<iframe src="'+moduleaddress+'/?'+optionsString+'" height="'+this.options.height+'" width="'+this.options.width+'" frameborder="'+this.options.frameborder+'" scrolling="'+this.options.scrolling+'" horizontalscrolling="'+this.options.horizontalscrolling+'" verticalscrolling="'+this.options.verticalscrolling+'" allowtransparency="true"></iframe>');
	}
};

// Roep de constructor aan
igbvacaturemodule.constructor();
