// JavaScript Document

// 		vBox({html :'Test bericht'});
//		vBox({load :'page.html'});
//		closefunction: remove_vBox();


function init_vBox(content) {	
	if ($("#vBox").attr('id') == undefined) {
		$('body').prepend('<div id="vBoxBackground"></div><div id="vBoxContainer"><div id="vBox"><div id="vBoxClose" onClick="remove_vBox()">Sluit venster <b>X</b></a></div><div id="vBoxContent">'+content.html+'</div></div></div>');
		}

		$('#vBoxContainer').hide();
		$('#vBoxBackground').css({'opacity' :0}).animate({'opacity' :0.5},500,function(){
			$('#vBoxContainer').show();
			if (content.load != undefined) { $('#vBoxContent').load(content.load);};
			if (content.div != undefined) { $('#vBoxContent').html($(content.div).html());};
	});
	
	// custom hack for cufon
	$('h1, h2').css({visibility:'visible'});
}

function vBox(content) {
	$.vBox = true;

	if (content.html != 'undefined' || content.load != 'undefined') {
		init_vBox(content);
	}else {
		content.html  ='no content given.';
		init_vBox(content);
	}
}

function remove_vBox(){
	$('#vBoxBackground').fadeOut();
	$.vBox = false;
	$('#vBoxContainer').fadeOut(function(){
		$(this).remove();$('#vBoxContainer').remove();
	})
}

