$(document).ready(function(){ 

	// MENU
	$("ul.sf-menu li:first-child").css('border-right','1px solid #FFFFFF');
	$("ul.sf-menu li.orange a").css('padding','6px 16px 0 15px');
	$("ul.sf-menu ul li:first-child").css('border-right','none'); 
	
	$("ul.sf-menu").supersubs({ 
		minWidth:    12,
		maxWidth:    30	
	})
	.superfish({ 
		autoArrows:  false,
		dropShadows: false 
	}); 
	
	// TWITTER
	$(".tweets").tweet({
		count: 20,
		template: "{user}: {text}",
		username: "VersioISP",
		favorites: true
	}).bind("loaded", function() {
		$(this).find("a").attr("target", "_blank");
		var ticker = $('.tweets ul');
		ticker.children('li:first').show().siblings().hide();
	});

	var ticker = $('.tweets ul');

	setInterval(function() {
		ticker.find('li:visible').fadeOut(function() {
			$(this).appendTo(ticker);
			ticker.children('li:first').show();
		});
	}, 7000);

	// MENU LEFT
	$(".main .split-left .mid ul li:first-child").css('border-top','none');
	$(".main .split-left .mid ul:last-child").css('background','none').css('border-bottom','none').css('padding','0');
	$(".main-vervolg .left ul li:first-child").css('border-top','none');

	// DOMAIN EXTENTIONS
	$(".main-vervolg .left table tr:last-child td").css('border-bottom','none');
	$(".main-vervolg .left table tr td:first-child ").css('padding','7px 3px');

	$('.main-vervolg.right .bottom .tabnav li a').click(function(){

        var thisNav = $(this);
        var thisNavIndex = thisNav.parent().index()+1;
        var getTabHeight = $('div#tab'+ thisNavIndex).height();
        var heightRemake = ( $('.top').height()+30 ) + getTabHeight;

        if($('#tab'+ thisNavIndex).is(':visible')) {
            return false;
        }
        $(".main-vervolg.right .left .domain").animate({ height: heightRemake+'px'}, 650).css('overflow-y','scroll');

    });

	// BOXEN RIGHT
	$(".main .split-right .mid div.box:nth-child(3)").css('border-right','none');
	$(".main .split-right .mid div.box:nth-child(6)").css('border-right','none');

	// PRODUCTEN TABS
	$('.tabs > ul').tabs({ event: 'click' });
	$('.main-vervolg .right table tr:not(.inactive) td:first-child:not([align="center"])').css('text-align','left').css('font-size','13px').css('width','150px');
	$(".main-vervolg .right table.text td:first-child").css('padding-left','10px').css('padding-right','10px').css('font-weight','normal').css('width','auto');
	$(".main-vervolg .right table.top-text td:first-child").css('padding-left','0').css('font-weight','normal').css('width','auto');
	$(".main-vervolg .right table td:last-child").css('border-right','none');

	$('.main-vervolg .right table.grey').each(function() {
	  $('tbody tr:odd', this).css("background-color", "#f8f8f8");
	});

	$('.main-vervolg .left table.grey').each(function() {
	  $('tbody tr:even', this).css("background-color", "#FFFFFF");
	});
	
	$(".starterlink").click(function() {
		$(".starterinfo").fadeToggle('fast');
	});

	$(".expertlink").click(function() {
		$(".expertinfo").fadeToggle('fast');
	});

	// DEDICATED SLIDE
	$('#slides').slides({
		autoHeight: true,
		generatePagination: false,
		generateNextPrev: true
	});

	// DEDICATED OVERLAY
	$('div.height').each(function() { 
		hParent = $(this).height();
		hChild = $(this).find('div.overlay').height();
		maxHeight = Math.max(hParent, hChild);    
		$(this).height(maxHeight);
		$(this).find('div.overlay').css("height",(maxHeight-72)+"px");  
	});

	// FANCYBOX
	$("a.fancybox").append('<div>')
	$("a.fancybox").fancybox({
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'hideOnOverlayClick' : true,
		'overlayOpacity' : '0.2',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});
	
	$("a.video").fancybox({
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'hideOnOverlayClick' : true,
		'overlayOpacity' : '0.2',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'width'			: '776px',
		'height'		: '442'
	});
	
	// NEWS	
	$(".main-vervolg .right .bottom div.news-box:first").css('margin','0');
	
	$('.message').hide();
	$('.respown').toggle(function() {
		$('.message').show();
	}, function() {
		$('.message').hide();
	});
	
	// TABLE OVER & KLANTBEHEER
	$(".main-vervolg .right table.over td:first-child").css('font-weight','').css('font-size','').css('width','');
	
	// FORMS	
	//$("form > table td:first-child").css('font-weight','bold').css('font-size','').css('width','285px');
	$(".main-vervolg .right table.kosten td:first-child").css('font-weight','').css('font-size','').css('width','');
	$("td:last-child").css('border-right','none');
	$("td.noborder").css('background-color','#FFFFFF');
	
	$("input[type=file]").filestyle({
	   imageheight : 27,
	   imagewidth : 69,
	   width : 276
	});
	
	$('select').sbCustomSelect();
	$('select.small').parent(".sb-custom").addClass("small");
	$('ul.sb-dropdown').wrap('<div class="sb-overlay"/>');
	
	$('input.datepicker').datePicker({clickInput:true});
	
	$('.bottom table.form.grey').each(function() {
	  $('tbody tr:odd', this).css("background-color", "#F2F2F2");
	});

	$('.bottom table.form.grey').each(function() {
	  $('tbody tr:even', this).css("background-color", "#FAFAFA");
	});
	
	$('.nameserver').show();
	$(':radio').change(function() {
		if ($('.show').attr('checked')) {
			$('.nameserver').show();
		} else {
			$('.nameserver').hide();
		}
	});
	
	$('tr.nameserver-all').hide();
	$('a.show-all').toggle(function() {
		$('tr.nameserver-all').show();
	}, function() {
		$('tr.nameserver-all').hide();
	});
	
	$('input , textarea').click( function() {
		if (this.value == this.defaultValue) {
			this.value = '';
		}
	});
	
	$('input , textarea').blur( function() {
		if (this.value == '') {
			this.value = this.defaultValue;
		}
	});

	// HEADER
	$('.header .overlay-text').after('<div class="overlay-bar"></div>').after('<div class="overlay-border"></div>');

	$('#multi').toggle(function() {
		$(".domein-check").css('background-image','url(gfx/header-domain-multi.png)').css('height','93px');
		$("#multi-content").html("<textarea name=\"domeinbulk\" onFocus=\"this.value=''; this.onfocus=null;\">domeinnaam.nl\ndomeinnaam.be\ndomeinnaam.eu</textarea><input type=\"submit\" value=\"\" class=\"btn\" />");
		$('#multi').addClass('active');
	}, function() {
		$('#multi').removeClass('active');
		$(".domein-check").css('background-image','url(gfx/header-domain.png)').css('height','30px');
		$("#multi-content").html("<input value=\"Uw gewenste domeinnaam controleren\" name=\"domein\" onfocus=\"this.value='';\" type=\"text\" /><input type=\"submit\" value=\"\" class=\"btn\" />");
	});

});
