

function background(){
	$("div#bg_image").append("<img src=\"http://127.0.0.1/luchtreclame/gfx/bck_body2.jpg\" alt=\"\" id=\"bgimg\" />");
	//Configuration Options
	var selector = 'div#bg_image img'; 	//Sets the syntax for finding the images.  Defaults to all images.
				//For images inside of a particular element (id="abc") or class (class="abc"),
				//use '.abc img' or '#abc img' respectively.  Don't leave off the img tag!!!
	//End configuration options.  You don't need to change anything below here.
	
	$(selector).each(function(){
		var width = 1216;
		var height = 632;
			//Set variables	for manipulation
			var ratio = (height / width );
			var new_width =  $("#container").width();
			var containerHeight =  $("#container").height();
			var windowHeight = $(window).height();
			
			//firefox fix
			if(containerHeight<windowHeight){
				//new_width =  $("#container").width()-17;
			}
			//alert(windowHeight);

			var new_height = (new_width * ratio);

			//Shrink the image and add link to full-sized image
			$(this).height(new_height).width(new_width);
			
	} //ends each function
	);
}

function home(){
	window.location.href = 'http://www.luchtreclame.nu/';
}

function resetbackground(){
//	$("div#bg_image").empty());	
	document.getElementById("bg_image").innerHTML = '';
}

function newbackground(){
	resetbackground();
	background();
}

function addEvent( obj, type, fn ) {
  if ( obj.attachEvent ) {
    obj["e"+type+fn] = fn;
    obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
    obj.attachEvent( "on"+type, obj[type+fn] );
  } else
    obj.addEventListener( type, fn, false );
}
function removeEvent( obj, type, fn ) {
  if ( obj.detachEvent ) {
    obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
  } else
    obj.removeEventListener( type, fn, false );
}

//addEvent(window,"resize",newbackground);
