var $j = jQuery.noConflict();

// runs at load and on resize to hide ads that will clutter display
function hideDiv(){
	var y = $j(window).scrollTop();

	if( y > 1600 && ($j(window).width() > 800) ){
	// if we are show hidden ads
		$j("#rcivip-fixed-bottom-bar").fadeIn("slow");
		$j("#rcivip-fixed-side-bar").fadeIn("slow");
	} else {
		$j('#rcivip-fixed-bottom-bar').fadeOut('slow');
		$j('#rcivip-fixed-side-bar').fadeOut('slow');
	}
}

function checkScroll(){
}


$j(function(){

	$j("#rcivip-fixed-bottom-bar").hide();
	$j("#rcivip-fixed-side-bar").hide();
	

	$j(window).scroll(function(){
		// get the height of #wrap
		var h = $j('#wrap').height();
		var y = $j(window).scrollTop();
		if( y > 1600 && ($j(window).width() > 800) ){
		// if we are show hidden ads
			$j("#rcivip-fixed-bottom-bar").fadeIn("slow");
			$j("#rcivip-fixed-side-bar").fadeIn("slow");
		} else {
			$j('#rcivip-fixed-bottom-bar').fadeOut('slow');
			$j('#rcivip-fixed-side-bar').fadeOut('slow');
		}
	});



	// user clicked remove ad so remove and show smaller box
    $j('.close-ad').click(function(){
    	$j(this).parent().hide();
        $j('#closed-ad').fadeIn('medium');
    });

	// user clicked smaller box text remove and show full center ad box
    $j('.closed-ad-text, #recommended-by').click(function(){
        $j(this).parent().hide();
        $j('#center-follow-scroll').fadeIn('slow');
    });



    // on load check and hide ads if screen is too small
    hideDiv();

    // on resize check and hide ads if screen is too small
    $j(window).resize(function(){
        hideDiv();
    });

});


