$(document).ready(function(){

		var original_image = 'url(http://clientviewer.com/crp/img/arrow_close.gif)';
   		var second_image = 'url(http://clientviewer.com/crp/img/arrow_open.gif)';
	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	/*$("ul.topnav li span").hover(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});*/
	
	$("ul.topnav li span").parent().hover(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});

	//ACCORDION BUTTON ACTION	
		$('div.accordionButton').click(function() {
			$('div.accordionContent').slideUp('normal');	
			$('div.accordionButton').css('background-image', original_image);
			
			$(this).next().slideDown('normal');
			if ($(this).css('background-image').replace(/"/g, '') == original_image) {
    		        $(this).css('background-image', second_image);
    		    } else {
    		        $(this).css('background-image', original_image);
    		    }

		});
	
	
	//HIDE THE DIVS ON PAGE LOAD	
	$("div.accordionContent").hide();
	//$(".videolink").colorbox();
	//$(".videolink").colorbox({width:"405", height:"400", iframe:true});

	//Sort any tables
	  //$("table.rounded-corner").tablesorter(); 
	//	$('.rounded').corners("15px");

});
