var i = 0;
var intval="";

function scrollblog()
{ 
  if(i <= 550){
     $('#blog').css('margin-top', i*(-1));
     i++;
  }else{
     $('#blog').css('margin-top', 0);
     i=0;
  }
};

$(document).ready(function(){
//DAVE!! FIX here to intercept calls from nav and strip out extra http://
/*
$('#Body_Middle_Body_Middle_Panel_Middle_Left ul li a').click(function (event) { 
	
this.href = this.href.replace("http://http//", "http://"); 

//event.preventDefault();
window.location.href = this.href;

});
*/


//$('#phpLive').fadeIn();
//$('#phpLive img').attr('width', '94').attr('height', '62');

//setup scrolling blog and news feeds

setUpInterval();

$('#blog').hover(handlerIn, handlerOut);

function handlerIn()
{
  window.clearInterval(intval);
}

function handlerOut()
{
  setUpInterval();
}

$('#blog').css('margin-top', 140);
$('#news').css('margin-top', 5);

function setUpInterval()
{
   intval=window.setInterval("scrollblog();",100);
};


$('#QuickLinks').appendTo('.left');
$('.left ul').fadeIn();
$("#Body_Middle_Body_Middle_Panel_Middle_Left ul").treeview({
		animated: 500,
		collapsed: true,
		unique: true,
		persist: "location"
	});


//now highlight the appropriate section
var pathname = window.location.toString();
//reset all box arrow graphics
$('#TopLayerNavigation li').each(function () { 
$(this).css("background-image", "url('http://www.professionalacademy.com/files/nodes/c9e9ea8f-3a51-4a2d-8dc5-f5f3d11847f4/files/cpa_BoxArrow.png')");
});




if(pathname.indexOf("the_delegate_experience")>0)
{
$('#TopNavDelegateExperience').css("background-image", "url('http://www.professionalacademy.com/files/nodes/c9e9ea8f-3a51-4a2d-8dc5-f5f3d11847f4/files/cpa_BoxArrow_highlight.png')");
}

if(pathname.indexOf("why_choose_us")>0)
{
$('#TopNavAboutUs').css("background-image", "url('http://www.professionalacademy.com/files/nodes/c9e9ea8f-3a51-4a2d-8dc5-f5f3d11847f4/files/cpa_BoxArrow_highlight.png')");
}

if(pathname.indexOf("our_courses")>0)
{
$('#TopNavOurCourses').css("background-image", "url('http://www.professionalacademy.com/files/nodes/c9e9ea8f-3a51-4a2d-8dc5-f5f3d11847f4/files/cpa_BoxArrow_highlight.png')");
}

if(pathname.indexOf("career_advice")>0)
{
$('#TopNavCareerAdvice').css("background-image", "url('http://www.professionalacademy.com/files/nodes/c9e9ea8f-3a51-4a2d-8dc5-f5f3d11847f4/files/cpa_BoxArrow_highlight.png')");
}

//now display leftHand info box on single level pages

if($('#Body_Middle_Body_Middle_Panel_Middle_Left ul').css('display')=="block")
{
$('#LeftHandContentBox').css('display', 'none');


}else{
$('#LeftHandContentBox').css('display', 'block');
$('#QuickLinks').css('margin-top', '230px');
}



});

