// Afbeeldingen verwisselen
<!--
function zetA(a)
{
	$("#foto_groot_a").attr("href", ""+a+"");
}

function verwissel(foto)
{
	$(".grotefoto").attr("style", "display: none;");
	$("#"+foto).attr("style", "display: visible;");
}
// Adobe functies
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

// Lightbox functie
$(function() {
			$('#grote_foto a').lightBox({fixedNavigation:true});
		});


//Paging
var CurrentURL;

function Laad(href_b) {
	var href_e = href_b;
	href_e = href_e.split(ext);
	href_e = href_e[1];
	if(href_e == '')
	{
		href_e = 'page/home.php?i=1';
	}
	if(href_e.match('='))
	{
		href_e = href_e+'&i=1';
	}
	else
	{
		href_e = href_e+'?i=1';
	}
	window.location.hash = '/'+href_e;
	$("#printheader").empty();
	href_p = href_e.split('page/');
	href_g = href_p[1].replace('?','&');
	has = location.href.replace('&','%26');
	$("#printheader").append('<a class="print" href="page/print.php?page='+href_g+'">Print <img src="images/print.jpg" alt="Print !" /></a><br /><a class="print" href="mailto:?body=Kijk%20eens%20op%20deze%20pagina%3A%20'+has+'"> E-mail <img src="images/link.jpg" alt="Email !" /></a>');
	CurrentURL = href_e;
	$("#pagina").load(href_e);
}
function ReadyURL() {
	url_b = window.location.hash;
	url_e = url_b.split('#/');
	if(empty(url_e[1]))
	{
		url_e[1] = 'page/home.php?i=1';
		window.location.hash = '/page/home.php?i=1';
		$("#printheader").empty();
		has = location.href.replace('&','%26');
		$("#printheader").append('<a class="print" href="page/print.php?page=home.php?i=1">Print <img src="images/print.jpg" alt="Print !" /><br /></a><a class="print" href="mailto:?body=Kijk%20eens%20op%20deze%20pagina%3A%20'+has+'"> E-mail <img src="images/link.jpg" alt="Email !" /></a>');
	}
	CurrentURL = url_e[1];
	$("#pagina").load(url_e[1]);
	$("#printheader").empty();
	href_p = url_e[1].split('page/');
	href_g = href_p[1].replace('?','&');
	has = location.href.replace('&','%26');
	$("#printheader").append('<a class="print" href="page/print.php?page='+href_g+'">Print <img src="images/print.jpg" alt="Print !" /></a><br /><a class="print" href="mailto:?body=Kijk%20eens%20op%20deze%20pagina%3A%20'+has+'"> E-mail <img src="images/link.jpg" alt="Email !" /></a>');
}

function Timer()
{
	var t=setTimeout("Timer()",1000);
	url = window.location.hash;
	urlNieuw = url.split('#/');
	if(CurrentURL !== urlNieuw[1])
	{
		Laad(window.location.hash);
	}
}

//Admin Paging
var CurrentURL;

function adminLaad(href_b) {
	var href_e = href_b.split('#/');
	if(href_e == '')
	{
		href_e[1] = 'admin_home.php';
	}
	CurrentURL = href_e[1];
	$("#admin_pagina").load('page/'+href_e[1]);
}
function adminReadyURL() {
	url_b = window.location.href;
	url_e = url_b.split('#/');
	if(empty(url_e[1]))
	{
		url_e[1] = 'admin_home.php';
		window.location.hash = '/admin_home.php';
	}
	CurrentURL = url_e[1];
	$("#admin_pagina").load('page/'+url_e[1]);
}
function adminTimer()
{
	var t=setTimeout("adminTimer()",1000);
	url = window.location.href;
	urlNieuw = url.split('#/');
	if(CurrentURL !== urlNieuw[1])
	{
		adminLaad(window.location.href);
	}
}

//Banner
var current;
var next
		
function banner(x)
{
	if(x <= 3)
	{
		current = x;
		$("#banner").load("includes/fotos.php #fotos"+x+"");
	}
	else
	{
		current = 0;
		$("#banner").load("includes/fotos.php #fotos0");
	}
		next = current +1;
	
	var t=setTimeout("banner(next)",10000);
}

function checkUrl()
{
	url = window.location.href;
                rest = location.search;
	url = url.split(ext);
	url = url[1].split('.php');
	if(url[0] !== '')
	{
		url = url[0];
	}
	if(url.match('#'))
	{
		return false;
	}
	else if(!rest.match('lang'))
	{
                                url = url+'.php';
                                if(rest == '')
                                 {
                                        rest = '?i=1';
                                  }
                                else
                                {
                                       rest = rest+'&i=1';
                                  }
		window.location = 'http://svbrenate.nl/#/'+url+rest;
	}
}

function zoek()
{
	var q = $("#q").val();
	$.ajax({
	   type: "GET",
	   url: "page/zoeken.php",
	   data: "q="+q+"",
	   success: function(msg){
		 $("#pagina").empty();
		 $("#pagina").append(msg);
		 window.location = 'http://svbrenate.nl/#/page/zoeken.php?q='+q;
		 CurrentURL = 'zoeken.php?q='+q;
	   }
	 });
}
//-->



