
/* Some variables */
var vars = {
 'GMap': {
  'txt': '<strong>FrenzyMedia b.v.</strong><br />Wateringweg 131<br />2031 EG  Haarlem<br />Tel: 023 - 54 27 111',
  'map': null,
  'marker': null,
  'gdir': null
 }
};



$(function(initial) {
	
	//We have turned on Javascript
	$('body').addClass('js');	    
		 
	 		    	
	//workaround for IE6 multi classes button bug
	if( jQuery.browser.msie && (jQuery.browser.version <= 6) ){					
		 //nothing		
	}else{				
		//fixes many ie6 bugs and pollutes DOM ;-)		
		$('a.button').wrapInner('<span></span>');
		$('a.button span').after('<i> </i>');	
	}
	
	if($('.photoLarge img').length == 0){
    	$(".photoLarge").hide();
    }
    
     GoogleMapsLoader('01');
	 GoogleMapsLoader('02');
	 GoogleMapsLoader('03');
	
});	
	
	
	
 $(function(viewSelector) {  
      
       $('select#viewSelector').change(function () {
       
        	var QueryString = document.location.search;
			var QueryMatch = new RegExp("collectionType=(text|image)", "gi");
		
			QueryString = QueryString.substr(1, QueryString.length);
			QueryString = QueryString.replace(QueryMatch, '');
				
			var DocLocation = String(document.location);
			DocLocation = DocLocation.split('?');
			DocLocation = DocLocation[0];
		
			
			var DocumentURL = DocLocation + '?collectionType=' + $('#viewSelector').val();
			
			if (QueryString != '') {
				DocumentURL += '&' + QueryString;
			}
		
		document.location = DocumentURL;    	

	})
	
});	



 $(function(paginationList) {  	
	var SelPagination = document.getElementsByName('paginationList');
	
	for (var i = 0; i < SelPagination.length; i++) {
		
		if (typeof attachEvent != 'undefined') {
			//ie only	
			SelPagination[i].onchange = function() {
				document.location = this.value;
			}
		} else {
			SelPagination[i].addEventListener('change', function() {
				document.location = String(this.value);
			}, true);
		}
		
		
	}
	
});	

	
	


 $(function(contact) { 
	//DYNAMIC CONTENT FOR PRODUCTLAYOUT				
	//hide all message_body the first one
	$(".dynamicContent_list .dynamicContent_body").hide();		
	$(".dynamicContent_head").append('<div class="read_more">Lees meer</div>');			
	
	//toggle message_body
	
	$(".dynamicContent_head").click(function(){						
		if ($(this).find(".read_more").is(":hidden")) {					   
			$(this).find(".read_more").show();			
				$(this).next(".dynamicContent_body").slideToggle(400,function(){					
					$.scrollTo('.dynamicContent_head', {offset: {top: 0}, duration: 400})					
				});			
		
		} else {		
			
				$(this).next(".dynamicContent_body").slideToggle(400,function(){					
					$.scrollTo('.dynamicContent_head', {offset: {top: 0}, duration: 400})
				});
			
			$(this).find(".read_more").hide();
		
		}	
					
	});		  

	//CONTACT FORM	
	//scroll to and open contactContainer
   $("#contactContainer").hide();		   
   
   $(".openContact_form").click(function(){
     
		$("#contactContainer").show();
		$.scrollTo("#contactContainer", {offset: {top: 0}, duration: 600});				
		$(this).hide();
		return false;
	});

});
		
		
 $(function(collections) {  
	//SCROLLCOLLECTION
	//makes the whole div clickable 
	$(".productScrollCollection").click(function() {
		window.location = $(this).find("h2:first a:first").attr("href");  				  				
	});
		
	//COLLECTION
	//makes the whole div clickable
	$(".productCollection").click(function() {
		window.location = $(this).find("h2:first a:first").attr("href");
			
	});
});	


$(function(searchBar){

	$('#sliderWrap').hide();

	$('#searchBtn').click(function() {
		$('#sliderWrap').toggle(400);
		return false;
		});
		
	$('#sliderWrap .close').click(function() {
			$('#sliderWrap').hide(400);
		});
		
	$('#searchbarSubmit').click(function(){
			$('#sliderWrap').hide(400);
	});		
		
	 
});



//RVDM NEED TO BE PLUGITIZED
$(function(simpleGallery){
	
	i=0;	
	$('.imageGalleryNav li a:first').addClass('active');
		
	$(".imageGalleryNav a").each(
		function(index){
			i++;				
	if ($(this).attr("href").length == 0 ) {
					$(this).hide(); 
					i--;		     
				}else{		  	
					$(this).text(i);
				}
			}		
		);

	
	
  $(".imageGalleryNav a").click(function(event) {										
		event.preventDefault();
		var image = $(this).attr("href");
		$("#imageGalleryHolder").attr("src", image);
		
		var description = $(this).attr("title");
						
		$('.imageGalleryNav li a').removeClass('active');
		
		$('.photoCaption').text(description);	
		$(this).addClass('active');			
					
		return false;
        
	});	
			
	if (i == 0){ 
		$("#imageGalleryContainer").hide();
	}	
	if (i == 1){ //remove the pagination
		$('.imageGalleryNav li a').remove();
	}


});




 $(function() {  	
	//FORM AND SUBMITS	
	$("#contactformSubmit").click(function(){
		document.forms['contactform'].submit(); return false;
	});
	
	$("#gmapSubmit").click(function(){		
		$('#show-directions').submit();
	});
	
	$("#newsletterSubmit").click(function(){	
		document.forms['nieuwsform'].submit(); return false;
	});
});	

/*
 $(function(gmap) {  	
	//ROUTEPLANNER
	// Google Maps and directions
	$('#directionsContainer').hide();
	if ($('#google-maps').length && typeof(GBrowserIsCompatible) == 'function' && GBrowserIsCompatible()) {
		var element = $('#google-maps').addClass('google-maps-styled');
		vars.GMap.map = new GMap2(element[0]);
		vars.GMap.map.addControl(new GLargeMapControl());
		vars.GMap.map.addControl(new GMapTypeControl());
		vars.GMap.map.setCenter(new GLatLng(52.397174, 4.657098), 13);
		vars.GMap.marker = new GMarker(vars.GMap.map.getCenter());
		
		GEvent.addListener(vars.GMap.marker, 'click', function() {
			vars.GMap.marker.openInfoWindowHtml(vars.GMap.txt)
		});
		
		vars.GMap.map.addOverlay(vars.GMap.marker);
		vars.GMap.marker.openInfoWindowHtml(vars.GMap.txt);
		vars.GMap.gdir = new GDirections(vars.GMap.map, $('#directions')[0]);
		
		GEvent.addListener(vars.GMap.gdir, 'error', function() {
			var msg = 'Uw opdracht kon niet worden uitgevoerd.';
			switch (vars.GMap.gdir.getStatus().code) {
			case G_GEO_UNKNOWN_ADDRESS:
			msg = 'Geen adresgegevens gevonden.';
			break;
			case G_GEO_MISSING_QUERY:
			msg = 'Geen adresgegevens opgegeven.';
			break;
			case G_GEO_SERVER_ERROR:
			case G_GEO_BAD_KEY:
			case G_GEO_BAD_REQUEST:
			msg = 'Algemene fout bij ophalen van routebeschrijving. Excuses voor het ongemak.';
			break;
		}
		
		 $('#directions').html('<div class="top"></div><p><strong class="error">' + msg + '</strong></p>');
		 });
		 
		$('#show-directions').submit(function() {
			if (!vars.GMap.gdir) return false;
			var from = $('#street').val() + ' ' + $('#house').val() + ' ' + $('#place').val() + ' ' + $('#country').val();
			if ($.trim(from) != '') {
				$('#formulier:visible').slideUp();    					
				vars.GMap.gdir.load('from:' + from + ' to: Wateringweg 131, 2031 EG, Haarlem, Nederland', {locale: 'nl'});
				$.scrollTo($('#directionsContainer').slideDown(), {duration: 1000});
			};
		return false;
		});
	}
	
	
});

*/



	/* ###	SIFR	##################################################################################### */


  var font_h1= {
    src: 'js/sifr3.swf'
    
  };
  
   var font_h2= {
    src: 'js/sifr3.swf'
    
  };
	

  sIFR.useStyleCheck = true;
  sIFR.activate(font_h1);

  sIFR.replace(font_h1, {
    selector: 'h1'
	,wmode: 'transparent'
    ,css: [
      '.sIFR-root { color:#FF7F00; }'
    ]
  });

