$(document).ready(function(){
	
	$("a[rel^='prettyPhoto']").prettyPhoto({
			animation_speed: 'fast', /* fast/slow/normal */
			slideshow: false, /* false OF interval tijd in miliseconde */
			autoplay_slideshow: false, /* true/false */
			opacity: 0.80, /* Waarde tussen 0 en 1 */
			show_title: true, /* true/false */
			allow_resize: true, /* true/false */
			default_width: 500,
			default_height: 344,
			counter_separator_label: '/', /* Scheidingsteken voor galerij counter 1 "of" 2 */
			theme: 'facebook', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
			modal: false, /* true, alleen de sluit knop werkt dan om de foto te sluiten */
			overlay_gallery: false, /* true, een thumbgalerij verschijnt in de foto om door te klikken */
			keyboard_shortcuts: false /* zet op false wanneer je een formulier gebruikt in de popup */
	});
	
	if ($('.fotowrapcontent').height()<100) {
			$('.fotowrapcontent').height(100);
	}
	if ($('.fotowrapcontent').height()>100) {
			if ($('.fotowrapcontent').height()<214) {
					$('.fotowrapcontent').height(214);
			}
	}
	if ($('.fotowrapcontent').height()>214) {
			if ($('.fotowrapcontent').height()<328) {
					$('.fotowrapcontent').height(328);
			}
	}
	if ($('.fotowrapcontent').height()>328) {
			if ($('.fotowrapcontent').height()<442) {
					$('.fotowrapcontent').height(442);
			}
	}
	
});

$(window).load(function() {
	$('#slider').nivoSlider();
	if ($('#submenu').height()>$('#content').height()-98) {
			$('#content').height($('#submenu').height()+98);
	}
	if ($('#content').height()>$('#submenu').height()+98) {
			$('#submenu').height($('#content').height()-98);
	}
});

function openLytebox(title,url) {
  var el=document.createElement('a');
  el.title=title
  el.rel="prettyPhoto"
  el.href=url;
}

function bpopenwindow(url,name,features){ 
  if (url.match("bimgdirect.asp"))
  {
    url=url.replace(/bimgdirect/,"img").replace(/html/,"jpg");
	title=$("a").attr("title");
	alt=$("img").attr("alt");
    $.prettyPhoto.open(url,title,alt);
  }
  else
  {
    window.open(url,name,features);
  }
}

function resizetoright(afb,br,ho) {
 if ((afb.width>br)||(afb.height>ho))
 {
  if (afb.width>afb.height)
  {
    afb.height=(afb.height/afb.width)*ho;
    afb.width=br;
  } else{
    afb.width=(afb.width/afb.height)*br;
    afb.height=ho;  
  }
 }
}
