function flipOn(div) {
	pntAddToClassName(div, 'active');
}

function flipOut(div) {
	pntRemoveFromClassName(div, 'active');
}

function activateImg(img) {
	img.src =  img.src.replace(".gif", "-actief.gif");
}

function deActivateImg(img) {
	img.src =  img.src.replace("-actief.gif", ".gif");
	img.src =  img.src.replace("-active.gif", ".gif");
}



function pntAddToClassName(elem, strClassName)
{
	if (!elem) return;
	var classNames = elem.className.split(' ');
	classNames[classNames.length] = strClassName;
	elem.className = classNames.join(' ');	
}

function pntRemoveFromClassName(elem, strClassName)
{
	if (!elem) return;
	var classNames = elem.className.split(' ');
	var newClassNames = new Array();
	for (var i in classNames)
	{
		var className = classNames[i];
		if (className!=strClassName) newClassNames[newClassNames.length] = className;
	}	
	elem.className = newClassNames.join(' ');	
}

// excursies, tabblad kaart
function toggleDiv(divId) {
	var els = document.getElementsByClassName('excursiePopup');
	for (var i in els) {
		if (els[i] && els[i].tagName && els[i].tagName.toLowerCase() == 'div' && els[i].id != divId) {
			els[i].style.display = "none";
		}
	}
	
	var el = document.getElementById(divId);
	el.style.display = (el.style.display == "none") ? "block" : "none";
	
	var googleMapsDiv = document.getElementById('googleMaps');	
	if(pntIsDefined(googleMapsDiv)){
		var googleMapsDiv = document.getElementById('googleMaps');
		
		if(googleMapsDiv.style.display == "none" && el.style.display=="none"){
			googleMapsDiv.style.display = "block";
		} else {
			googleMapsDiv.style.display = "none";
		}
	}
	
	reloadGoogleMapContent(divId);
}



//function showTweet(){
//	var strUrl = pntAppUrl+"index.php?pntType=JdTwitter&pntHandler=ShowAction";
//	ajax2 = new BfMojoAjax();
//	ajax2.requestURI = strUrl;
//	ajax2.onCompletion = showTweetCallBack;
//	ajax2.run();
//}
//
//function showTweetCallBack(){	
//	if (ajax2.response == 'error') return;
//	var tweet = JSON.parse(ajax2.response);
//	var tweetDiv = document.getElementById('tweetText');
//	var str = tweet.text+'<br />'+tweet.created;
//	tweetDiv.innerHTML = str;
//}

function addLightboxes(){
	$('a.fancybox').fancybox({
		'speedIn'		:	200, 
		'speedOut'		:	200
	});
}
function addYoutubeboxes(){
  $("a.youtube").click(function() {
      $.fancybox({
          'autoScale'     : false,
          'transitionIn'  : 'none',
          'transitionOut' : 'none',
          'title'         : this.title,
          'width'         : 640,
          'height'        : 385,
          'href'          : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
          'type'          : 'swf',
          'swf'           : {
          'wmode'             : 'transparent',
          'allowfullscreen'   : 'true'
          }
      });

      return false;
  });
}
$(document).ready(addLightboxes);
$(document).ready(addYoutubeboxes);

