$(document).ready(function(){

	// add clearBoth and top corner to rounded corners
	$("div.sidebarBox").before('<div class="sidebarBoxTop"></div>');
	$("div.contentBox").before('<div class="contentBoxTop"></div>');
	$("div.sidebarBox, div.contentBox").append('<div class="clearBoth"></div>'); // adds clearBoth at the end of <div>
	$("div.faq .answer").after('<div class="answerBottom"></div>');
	
	$("div.contentElement, .element").append('<div class="clearBoth"></div>'); // adds clearBoth at the end of <div>

		
	// centering button in the sidebar
	$('.btnCenter').each(function() {
		parentWidth = $(this).parent().width();						
		btnWidth = $(this).width();
		btnWidth +=18;
		totalWidth = (parentWidth - btnWidth) / 2;
		$(this).css('margin-left',totalWidth);					
	});
			
	// faq link
	jQuery('.faqList a, a.top').bind('click',function(){
	    var element = jQuery(this).attr('href');
	    var offsetpx = jQuery(element).offset().top;
	    jQuery('html,body').animate({scrollTop: offsetpx}, 1000);    
	    return false;
	});		
	
	// fancybox
	$("a.fancy").fancybox();
	$("a.videoPopup").fancybox({
	    'padding'           : 0,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});	

	// scroll to screenshots
	jQuery('#scrollToScreenshots').bind('click',function(){
	    var offsetpx = jQuery('#screenshotsDiv').offset().top;
	    jQuery('html,body').animate({scrollTop: offsetpx}, 1000);    
	    return false;
	});	
	

    // terms and conditions
    $("a#terms").fancybox({
        'hideOnContentClick': false,
        'width': 960,
        'height': '85%',
        'autoScale': false,
        'transitionIn': 'none',
        'transitionOut': 'none',
        'centerOnScroll': true,
        'type': 'iframe'
    });


 
});  









