var default_value = {nbnaam:'', nbemailadres:''};
$(document).ready(function(){
    $('h1').labeleffect({effect: 'shadow', shadowOffset: 2});
    $('.sitemap strong').labeleffect({effect: 'shadow'});
    $('.sitemap a').labeleffect({effect: 'shadow'});
    
    $('.portfolio').hover(function(){
        $(this).children('.info').stop(true, true).animate({
            'top' : '111px', opacity : 1
        },500);
    },function(){
        $(this).children('.info').stop(true, true).animate({
            'top' : '149px', opacity : 0
        },500);
    }).click(function(){
        window.location = $(this).children('.info').attr('href');
    });
    

    $('.menu li').append('<div class="hover"></div>');
    $('.menu li').hover(function() {
        $(this).children('div').stop(true, true).animate({opacity:1},500);
    },function() {
        $(this).children('div').stop(true, true).animate({opacity:0},500);
    });
    
    var i = 0;
    $('.buttongroup a').each(function(){
        if($(this).is('.selected')){
            min = (54 - (i * 27));
            $(this).parent('.buttongroup').css('background-position','0 -'+min+'px')
        }
        i++;
    });
    
    $(document).ready(function(){
        $("a[rel=external]").each(function(i){
            this.target="_blank";
        });
    });
    
    $('input#telefoon').css('display', 'none');

    // binds form submission and fields to the validation engine
    $(".contact form").validationEngine();
    $(".qractie form").validationEngine();       

    default_value.nbnaam = $('#nb_naam').val();
    default_value.nbemailadres = $('#nb_emailadres').val();
    
    $('#nb_naam, #nb_emailadres').focus(function(){
        $(this).val('');
    });
    $('#nb_naam').blur(function(){
        if($(this).val() == ''){
            $(this).val(default_value.nbnaam);
        }
    });
    
    $('#nb_emailadres').blur(function(){
        if($(this).val() == ''){
            $(this).val(default_value.nbemailadres);
        }
    });
    
    $('#nieuwsbrief span').click(function(){
        $(this).parent('form').submit();
    });
    
    
    $('#slider').cycle({
        fx:     'scrollLeft',
        timeout: 5000,
        pager:  '#nav',
        speed: 250,
		slideExpr: 'a'
    });
    $("#calltoaction").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
        'autoDimensions': false,
        'width'         : 500,
        'height'        : 260
	});
    
    //$('a.button').wrapInner('<div class="buttoninner" />');
    
    
});





/* http://keith-wood.name/labeleffect.html
   Label Effects for jQuery v1.0.0.
   Written by Keith Wood (kbwood{at}iinet.com.au) July 2009.
   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
   Please attribute the author if you use it. */
(function($){var p='labelEffect';function LabelEffects(){this._defaults={color:'',hiColor:'silver',hiDir:this.NONE,hiOffset:0,hiFill:false,hiBlend:false,shadowColor:'silver',shadowDir:this.DOWNRIGHT,shadowOffset:5,shadowFill:false,shadowBlend:false,effect:''};this._effects={echoed:{color:'',hiColor:'white',hiDir:this.DOWNRIGHT,hiOffset:2,hiFill:false,hiBlend:false,shadowColor:'gray',shadowDir:this.DOWNRIGHT,shadowOffset:4,shadowFill:false,shadowBlend:false},floating:{color:'',hiColor:'silver',hiDir:this.NONE,hiOffset:0,hiFill:false,hiBlend:false,shadowColor:'silver',shadowDir:this.DOWNRIGHT,shadowOffset:5,shadowFill:false,shadowBlend:false},raised:{color:'white',hiColor:'silver',hiDir:this.UPLEFT,hiOffset:1,hiFill:false,hiBlend:false,shadowColor:'black',shadowDir:this.DOWNRIGHT,shadowOffset:1,shadowFill:false,shadowBlend:false},shadow:{color:'white',hiColor:'white',hiDir:this.NONE,hiOffset:0,hiFill:false,hiBlend:false,shadowColor:'black',shadowDir:this.DOWNRIGHT,shadowOffset:1,shadowFill:false,shadowBlend:false},sunken:{color:'white',hiColor:'silver',hiDir:this.DOWNRIGHT,hiOffset:1,hiFill:false,hiBlend:false,shadowColor:'black',shadowDir:this.UPLEFT,shadowOffset:1,shadowFill:false,shadowBlend:false}}}var q=[[-1,-1],[0,-1],[+1,-1],[-1,0],[0,0],[+1,0],[-1,+1],[0,+1],[+1,+1]];$.extend(LabelEffects.prototype,{markerClassName:'hasLabelEffect',UPLEFT:0,UP:1,UPRIGHT:2,LEFT:3,NONE:4,RIGHT:5,DOWNLEFT:6,DOWN:7,DOWNRIGHT:8,setDefaults:function(a){extendRemove(this._defaults,a||{});return this},addEffect:function(a,b){this._effects[a]=b;return this},getEffects:function(){return this._effects},_attachEffect:function(a,b){a=$(a);if(a.hasClass(this.markerClassName)){return}a.addClass(this.markerClassName);var c={settings:$.extend({},this._defaults),saveCSS:{position:a.css('position'),color:a.css('color')}};$.data(a[0],p,c);this._updateEffect(a,b)},_changeEffect:function(a,b,c){a=$(a);if(!a.hasClass(this.markerClassName)){return}if(typeof b=='string'){var d=b;b={};b[d]=c}this._updateEffect(a,b)},_updateEffect:function(a,b){b=b||{};var c=$.data(a[0],p);b=extendRemove(extendRemove(c.settings,this._effects[b.effect]||{}),b);this._removeEffect(a);a.css({position:'relative',color:'transparent'});var d=$('<span></span>').html(a.html());this._createEffect(a,d,'shadow',b.color,b.shadowColor,b.shadowDir,b.shadowOffset,b.shadowFill,b.shadowBlend);this._createEffect(a,d,'highlight',b.color,b.hiColor,b.hiDir,b.hiOffset,b.hiFill,b.hiBlend);this._createEffect(a,d,'orig',b.color,b.color||c.saveCSS.color,this.UP,0,false,false)},_createEffect:function(a,b,c,d,e,f,g,h,j){if(f==this.NONE){return}var k=[0,0,0];var l=getRGB(j&&g>1?d:e);if(j&&g>1){var m=getRGB(e);k=[(m[0]-l[0])/g,(m[1]-l[1])/g,(m[2]-l[2])/g]}var n=function(i){return'rgb('+Math.round(l[0]+i*k[0])+','+Math.round(l[1]+i*k[1])+','+Math.round(l[2]+i*k[2])+')'};var o=($.browser.opera?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[0,0]);for(var i=g;i>=(h?1:g);i--){b.clone().addClass('labelEffect-'+c).css({color:n(i),left:i*q[f][0]+o[0],top:i*q[f][1]+o[1]}).appendTo(a)}},_destroyEffect:function(a){a=$(a);if(!a.hasClass(this.markerClassName)){return}a.removeClass(this.markerClassName);this._removeEffect(a);var b=$.data(a[0],p);a.css(b.saveCSS);$.removeData(a[0],p)},_removeEffect:function(a){var b=a.find('.labelEffect-orig').html();a.find('.labelEffect-highlight,.labelEffect-shadow,'+'.labelEffect-orig').remove().html(b)}});function getRGB(a){var b;if(a&&a.constructor==Array&&(a.length==3||a.length==4)){return a}if(b=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(a)){return[parseInt(b[1],10),parseInt(b[2],10),parseInt(b[3],10)]}if(b=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(a)){return[parseFloat(b[1])*2.55,parseFloat(b[2])*2.55,parseFloat(b[3])*2.55]}if(b=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(a)){return[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]}if(b=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(a)){return[parseInt(b[1]+b[1],16),parseInt(b[2]+b[2],16),parseInt(b[3]+b[3],16)]}return r[$.trim(a||'').toLowerCase()]||r['none']}var r={'':[255,255,255,1],none:[255,255,255,1],transparent:[255,255,255,0],aqua:[0,255,255],black:[0,0,0],blue:[0,0,255],fuchsia:[255,0,255],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],lime:[0,255,0],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],purple:[128,0,128],red:[255,0,0],silver:[192,192,192],teal:[0,128,128],white:[255,255,255],yellow:[255,255,0]};function extendRemove(a,b){$.extend(a,b);for(var c in b){if(b[c]==null){a[c]=null}}return a}$.fn.labeleffect=function(a){var b=Array.prototype.slice.call(arguments,1);return this.each(function(){if(typeof a=='string'){$.labeleffect['_'+a+'Effect'].apply($.labeleffect,[this].concat(b))}else{$.labeleffect._attachEffect(this,a||{})}})};$.labeleffect=new LabelEffects();if($.browser.opera){$(document).scroll(function(){$('.'+$.labeleffect.markerClassName).each(function(){if(!this.nodeName.toLowerCase().match(/^div$|^p$|^h[1-6]$/)){$(this).labeleffect('change',{})}})})}})(jQuery);

var IE6 = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;
if(IE6){

	$(function(){
		
		$("<div>")
			.css({
				'position': 'absolute',
				'top': '0px',
				'left': '0px',
				backgroundColor: 'black',
				'opacity': '0.75',
				'width': '100%',
				'height': $(window).height(),
				zIndex: 5000
			})
			.appendTo("body");
			
		$("<div><img src='tp_images/no-ie6.png' alt='' style='float: left;'/><p><br /><strong>Sorry! Deze website is niet te bekijken met Internet Explorer 6.</strong><br /><br />Als u onze content wilt bekijken <a href='http://getfirefox.org'>upgrade uw browser</a>.</p>")
			.css({
				backgroundColor: 'white',
				'top': '50%',
				'left': '50%',
				marginLeft: -210,
				marginTop: -100,
				width: 410,
				paddingRight: 10,
				height: 200,
				'position': 'absolute',
				zIndex: 6000
			})
			.appendTo("body");
	});		
}
