    $(document).ready(function(){
		
 $(".topmenu ul ul").each(function(){
	  $(this).find('li:first').css('border', "none");
	  	var count=0;
$("#thevids .overflow .youtube").each(function(){
	 count=count+1;
	 });
	count=(count)*286;
	window.count=count;
	window.totalcount=window.count;
if (count<=286*3)
$('.arrow-r,.arrow-l').css('visibility','hidden');

	 });
	
});


function getmargin(){
	var margin=$('#thevids .overflow').css('margin-right');
	margin=parseInt(margin.replace("px",""))+286;
	return margin;	
	
}
function slideleft(){
	var margin=getmargin();

	if (!$('#thevids .overflow').hasClass('animated')){
	if (window.totalcount<window.count){
			$('#thevids .overflow').addClass('animated');
$('#thevids .overflow').animate({'margin-right':'+=286'}, {queue:false, duration:300});
window.totalcount=window.totalcount+286;
 setTimeout(function() {
  $('#thevids .overflow').removeClass('animated');
}, 500);	
	}
	}
}
function slideright(){

	var margin=-1*getmargin()+1144;
	if (!$('#thevids .overflow').hasClass('animated')){
	if (margin<window.count){
		$('#thevids .overflow').addClass('animated');
$('#thevids .overflow').animate({'margin-right':'-=286'}, {queue:false, duration:300});

window.totalcount=window.totalcount-286;
 setTimeout(function() {
  $('#thevids .overflow').removeClass('animated');
}, 500);	
	}
	}

}
function getmarginleft(){
	var margin=$('#thevids .overflow').css('margin-left');
	margin=parseInt(margin.replace("px",""))+286;
	return margin;	
	
}
function sliderighten(){
	
	var margin=getmarginleft();
	if (!$('#thevids .overflow').hasClass('animated')){
	if (window.totalcount<window.count){
				$('#thevids .overflow').addClass('animated');
$('#thevids .overflow').animate({'margin-left':'+=286'}, {queue:false, duration:300});
window.totalcount=window.totalcount+286;
 setTimeout(function() {
  $('#thevids .overflow').removeClass('animated');
}, 500);

	}
	}

}
function slideleften(){
	var margin=getmarginleft();
	if (!$('#thevids .overflow').hasClass('animated')){
	if (-1*margin+1144<window.count){
		$('#thevids .overflow').addClass('animated');
$('#thevids .overflow').animate({'margin-left':'-=286'}, {queue:false, duration:300});
window.totalcount=window.totalcount-286;
 setTimeout(function() {
  $('#thevids .overflow').removeClass('animated');
}, 500);

	 }
	}

}
function opencomment(num){
$('.addcomment'+num).toggle();	
$('.commentnum'+num).toggle();	
	
}
function setpage(num){
	$('.bloghide').css('display','none');
	$('#blog'+num).css('display','block');
}
