//---------------- Settings -----------------

  var _Size= "_b";     //_b is the big size (1024), _t is the thumbnail, _s is the 75×75 pixels square, _m is the medium size, _o is original
   
var _Cat;
  
  var sig;

  
   
  
$.fn.getSet = function getSet(_photoSet) {


var app = new Object({
'key': '0d000f9b9acec45c99fd170668241bad',
'secret': 'accefbd6266cab94',
'def_params': ['format=json', 'api_key=0d000f9b9acec45c99fd170668241bad']
});
var auth = new Object({
'token':'72157625777012735-08439ef2ef890274'
});




// The actuall call

params = app.def_params.concat(['extras=url_o', 'method=flickr.photosets.getPhotos', 'photoset_id=' + _photoSet, 'auth_token=' + auth.token ]);

// Include the extra parameter which jQuery adds later on:
sig=$.md5(app.secret+params.concat(['jsoncallback=displaySet']).sort().join('').replace(/=/g,''));




url = 'http://api.flickr.com/services/rest/?' + params.sort().join('&') + '&api_sig=' + sig;




// include cache:true to prevent signature-breaking cache buster
jQuery.ajax({
dataType: 'jsonp',
url: url,
cache: true,
jsonp: 'jsoncallback',
jsonpCallback: 'displaySet'
});

 
 };
 
 
 
 
 // functie voor het op de pagina zetten van de kleine afbeeldingen _s + links naar _b, _o in title
 
function displaySet(data) {
   
   var theHtml = "";
$.each(data.photoset.photo, function(i,photo){

	var source = 'http://farm'+photo.farm+'.static.flickr.com/'+photo.server+'/'+photo.id+'_'+photo.secret+'_s.jpg';
	
	
	
   theHtml+= '<a   rel="' + _Cat + '" title="'+photo.url_o+'"  href="' + 'http://farm' + photo.farm + '.static.flickr.com/'+photo.server+'/'+photo.id+'_'+photo.secret+ _Size +'.jpg'+'">';
	


    theHtml+= '<span>&nbsp;</span><img alt=' +  photo.title.replace('.jpg','') +  ' src="'+source+'"   />';
    theHtml+= photo.title.replace('.jpg',''); + '</a>'  ;

   });
     $('.Images.' + _Cat).html(theHtml);
	 
//setDocHeight();
posFoot(0); 

  };


   //docheight functie
  
//function setDocHeight() {



// var bodyHeight = document.body,
  //  htmlHeight = document.documentElement,
	//headerHeight = $('#HeaderContainer').height();

	
	
//var pageHeight = Math.max( bodyHeight.scrollHeight, bodyHeight.offsetHeight, 
  //                     htmlHeight.clientHeight, htmlHeight.scrollHeight, htmlHeight.offsetHeight );
 


 



 //pageHeight = pageHeight - 274; 


//$('#ContentContainer').css('height' , pageHeight);
//end docheight


 //};


function posFoot(correction) {
var footer = $("#FooterContainer");
     var pos = footer.position();
     var height = $(window).height();
     height = height - pos.top;
     height = height - footer.height();
	 
    if (height > 0) {
           footer.css({'margin-top' : (height - correction ) +'px'});
       }
      
}
















 
 
 
 
 
 
 
 
 
 $(document).ready(function() {
 



	 
	 // routine voor opvangen van url in urlbalk
	 
	 
$.urlParam = function(name){
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (!results) { return 0; }
return results[1] || 0;}



//var skey = $.urlParam('skey');
//var _skey = "accefbd6266cab94";
var _set = $.urlParam('set');
var _user = $.urlParam('user');


	 


	

// routine voor plaatsen van platen
 
 if (_set !== null  )  {
 
  if ($('#BodyPortfolio .Gallery').length ) {
    _Cat = 'Custom';  $('#BodyPortfolio').getSet(_set);

}

 
 
 var output = "<h2>";
     output += _user;
     output += "</h2>" ;
	 
	 var _output = output.replace("%20", " ")

     $("#gebruiker").append(_output);
	 
  }; 
	 
	 
	 
	 
	 
	 // afvangen portfolio pagina's
	 


 if ($('#BodyPortfolio .Sport').length ) {
   _Cat = 'Sport'; $('#BodyPortfolio').getSet('72157625540489204') ; 
   
}
	

  if ($('#BodyPortfolio .Industrieel').length ) {
    _Cat = 'Industrieel'; $('#BodyPortfolio').getSet('72157626345476598') ; 
}
 
 if ($('#BodyPortfolio .Architectuur').length ) {
   
   _Cat = 'Architectuur'; $('#BodyPortfolio').getSet('72157625540515998') ; 
}

 if ($('#BodyPortfolio .Zakelijk').length ) {
    _Cat = 'Zakelijk'; $('#BodyPortfolio').getSet('72157625414978719');
}


 if ($('#BodyPortfolio .Particulier').length ) {
    _Cat = 'Particulier'; $('#BodyPortfolio').getSet('72157625415138381') ; 
}




 if ($('#BodyPortfolio .Referenties').length ) {
    _Cat = 'Referenties'; $('#BodyPortfolio').getSet('72157626345494344') ; 
}






// fancybox
//fancybox over alle images met size small (_s)
//in de href staat de link naar grote image (_b)
//in de title staat de link naar het originele image (_o)





// voor portfolio


$(".Images a").live('hover', function(event) { 



    $(".Images a").fancybox(
	
	{
	'type' : 'image',
	'cyclic' : 'true',
	
	//'animation' : 'elastic',
	'titlePosition'	:	'over'
		,	'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Afbeelding ' + (currentIndex + 1) + ' / ' + currentArray.length ;
				}
	});
    return false;       
});


//

// voor gallery

$(".Images.Custom a").live('hover', function(event) { 



    $(".Images a").fancybox(
	
	{
	'type' : 'image',
	'cyclic' : 'true',
	
	//'animation' : 'elastic',
	'titlePosition'	:	'over'
		,	'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Afbeelding ' + (currentIndex + 1) + ' / ' + currentArray.length + '&nbsp;&nbsp;<a  target="_blank" href=' + currentOpts.title + '>Download hoge resolutie bestand</a>'  + ' ' + currentOpts.title +  '</span>';
				}
	});
    return false;       
});





//



// verplaats footer
	
//setDocHeight();
//position footer:
 $(window).bind("load", function() {     posFoot(0);     });$(window).bind("resize", function() { posFoot(0);     });


// email obfuscator
$('.Email').safermailto();  // email cloaking



	


 });
