
$(document).ready(function(){   
	
	/** PNGFIX **/
	// $('#slideshow').pngFix();
	
	
	/** Code voor Gallery Slider **/
	$('#gallery-list-block ul#gallery-list li div.boxgrid.captionfull').hover(function(){
			$('.cover', this).stop().animate({top:'0px'},{queue:false,duration:260});
						$('.cover > h3 + p', this).stop().css({opacity: 1.0});
	}, function() {
			$('.cover', this).stop().animate({top:'84px'},{queue:false,duration:260});
	});
	
	
	/** Tabel odd & even kleuren **/
	$('table.table-data-list tbody tr:not([th]):odd td').addClass('odd');
	$('table.table-data-list tbody tr:not([th]):even td').addClass('even');
				
				
	/** @SIDERBAR SLIDESHOW **/
	$('#slideshow DIV').css({opacity: 0.0});
	$('#slideshow DIV:first').css({opacity: 1.0});
	
	$('button.searchBtn').hover(function() {
	  $(this).find('img').css({left:0, top:-23});
	 
	}, function() {
	  $(this).find('img').css({left:0, top:0});
	});
	
	  	
	 /*	
	 * DELETES BORDERS FROM HYPERLINKS
	 */
	$('a img ').each(function() {var cssObj = {'border' : 'none','outline' : 'none'};$(this).parent('a').css(cssObj);});
	
	
	/*
	* Checkt of img aanwezig is, neemt de value van alt tag om in title tag te injecteren.
	  Indien geen img, gebruikt de text van de ahref om in de title tag te injecteren.
	*/
	$('a').each(function() {
		var $copyText; 
		if($(this).is(":has('img')")) 
		$copyText = $(this).find('img').attr('alt');
		else $copyText = $(this).text();$(this).attr('title',$copyText);});
	
	
		
	/** Hover A href Images **/
	$('img.rollover').hover(function(){
	 this.src = this.src.replace(/\.gif/, '_active.gif');
	},function(){this.src = this.src.replace(/_active\.gif/, '.gif');});
	
	
	/** Rollover voor <button> **/
	$('button.btn-rollover').hover(
            function () { 
                var srcHolder = $(this).find('img').attr("src").replace( ".gif", "_active.gif"); 
                $(this).find('img').attr("src", srcHolder); 
      },function () { 
                var srcHolder = $(this).find('img').attr("src").replace( "_active.gif", ".gif" ); 
                $(this).find('img').attr("src", srcHolder); 
            } 
        );
        
        
    	
	/** @SIDERBAR SLIDESHOW LATEST PICTURES **/
	// initialize scrollable  
    $("#sidebarBU #sidebar-picturesBU div.scrollableBU").scrollable({ 
         // one configuration property 
    	size: 3,
    	vertical:false,
        // items are auto-scrolled in 2 secnod interval 
        interval: 3000, 
         
        // when last item is encountered go back to first item 
       loop: true,  
         
        // make animation a little slower than the default 
       speed: 700, 
         
        // when seek starts make items little transparent 
        onBeforeSeek: function() { 
            this.getItems().fadeTo(300, 0.2);         
        }, 
         
        // when seek ends resume items to full transparency 
        onSeek: function() { 
            this.getItems().fadeTo(300, 1); 
        } 
        
       });
       

     /** @SIDERBAR SLIDESHOW LATEST NEWS **/       
       // initialize scrollable  
    $("#sidebarBU #sidebar-newsBU div.scrollableBU").scrollable({ 
         // one configuration property 
    	size: 1,
    	vertical:false,
    	items: ".thumbs",
    	navi: ".thumbs-navi",
        // items are auto-scrolled in 2 secnod interval 
        interval: 3000, 
         
        // when last item is encountered go back to first item 
       loop: true,  
         
        // make animation a little slower than the default 
       speed: 1000, 
         
        // when seek starts make items little transparent 
        onBeforeSeek: function() { 
            this.getItems().fadeTo(300, 0.2);         
        }, 
         
        // when seek ends resume items to full transparency 
        onSeek: function() { 
            this.getItems().fadeTo(300, 1); 
        } 
        
       });
   
   
   
	/** AUTO COMPELTE CITIES **/
	$("#new-user-country").autocomplete(cities, {
		minChars: 1,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 100
	});
	
	/** AUTO COMPELTE COMPANY SECTOR **/
	$("#new-user-company-sector").autocomplete(sector, {
		minChars: 1,
		autoFill: true,
		mustMatch: true,
		matchContains: false,
		scrollHeight: 100
	});



   
   
   
   
   /** QUICK SEARCH IN FaQ **/
  	/*
	$('ul#faq-listing li').quicksearch({
  		attached: '#faq-form',
  		position: 'append',
		loaderText: '',
		
  		formId : 'form-faq',
  		inputClass: 'faq-search-input',
  		delay: 100
	}) 
    */
    
   
    
	/** @ FAQ LIST **/
	/*
	$('li.faq-list-content').hide();	
	var headings = $('li.faq-list-heading'); // refference headings 
	var contents = $('li.faq-list-content'); // refference contents 
	var index = 0; // set which one is open first 0 = first item 
	contents.slideUp(0); // hide all content 
	contents.eq(index).slideDown(); // show first content item 
	headings.eq(index).addClass('active'); // add class to respective heading 
		
	headings.live('click', function(e) { // click function 
		e.preventDefault(); 
		var current = headings.index($(this)); // get the current eq clicked 
		
		if(index != current)  // prevent redundancy 
			contents.eq(index).slideUp(500); // hide old 
			headings.eq(index).removeClass("active"); // remove old 
			headings.eq(current).addClass("active"); // add new 
			contents.eq(current).slideDown(500);  // show new 
			index = current; // reset index 
	});  	
	*/
	var headings = $('li.faq-list-heading'); // refference headings 
	var contents = $('li.faq-list-content'); // refference contents 
	var index = 0; // set which one is open first 0 = first item 
	contents.slideUp(0); // hide all content 
	contents.eq(index).slideDown(); // show first content item 
	headings.eq(index).addClass('active'); // add class to respective heading 
		
	headings.bind("click", function(e){ // click function 
		e.preventDefault(); 
		var current = headings.index($(this)); // get the current eq clicked 
		
		if(index != current)  // prevent redundancy 
			contents.eq(index).slideUp(500); // hide old 
			headings.eq(index).removeClass("active"); // remove old 
			headings.eq(current).addClass("active"); // add new 
			contents.eq(current).slideDown(500);  // show new 
			index = current; // reset index 
	}); 
 	
	//HIDE THE DIVS ON PAGE LOAD	
	$('li.faq-list-content').hide();





	/** @HEADER SLIDESHOW **/
	function slideSwitch() {
    var $active = $('#slideshow DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow DIV:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow DIV:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
	}	 
	 
	 var playSlideShow; 
	 playSlideShow = setInterval(slideSwitch, 3500);	
	
	
	
	
	
	
	
	
	
	
	
		
	
	/** HACK FOR SHADOW REPEAT **/
	var cssObj = {
       'background-image' : 'url(uploads/style/img/global/bg_body_shadow.png)',
       'background-repeat' : 'repeat-y',
       'background-positon' : 'top left'
       }
       
       //kleine hack voor IE6 omwille van background repeat van de shadow
       $("#wrap-content-blok").css(cssObj);
       
	
	
		/** SHOW THE BODY AFTER ALL THE CSS IMAGES ARE LOADED **/
		$('body').show();
	
		
});



function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=800,height=600,scrollbars=yes');
return false;
}

