/**
 * Custom javascript for www.ambieerzoetermeer.nl
 * Created by Hans Dubois for Intermax Interactive B.V. 2009
 * www.intermaxinteractive.nl
 * www.redmax.nl 
 */

var zoetermeerJs = Class.create({
	containerWidth : 974,
	containerId : 'siteContainer',
	siteHeight : 0,
	
	initialize: function(height) {
		this.siteHeight = height;
	},

	fixContainer : function(){
		// Position siteContainer
		var dimensions = document.viewport.getDimensions();
		
		// Calculate the position left
		if(this.containerWidth < dimensions.width){
			var spareWidth = (dimensions.width - this.containerWidth);
			var newWidth = Math.ceil((spareWidth / 2));
			
			// Change left position of the element.
			$(this.containerId).style.left = newWidth+'px';
		}
	}, 
	
	fixFlash : function(){
		var dimensions = document.viewport.getDimensions();
		
		if(this.siteHeight > dimensions.height){
			$('flash').style.height = this.siteHeight+'px';
		}else{
            $('flash').style.height = dimensions.height+'px';
        }
	},
	
	resize : function(){
		zoetermeerJs.fixContainer();
		zoetermeerJs.fixFlash();
	},
	
	printPage : function(vacancyId) {
		//open new window
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open('/vacatures/print?id="+vacancyId+"', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800, height=530');");
		
	}
	

});


