(function($, undefined)
{
    $(function()
	{
		
		//All JS functions to be included in here, not the template files!
		
		//Home Page slideshow
		if ($('#slideshow').length)
        {	/*
			$('#slideshow').coinslider({
				width: 960,
				effect: 'rain',
				navigation: false,
				delay: 10000
			});
			/*/
			$('#slideshow').nivoSlider({
				effect:'fade',
				animSpeed:500,
				pauseTime:10000,
				controlNav:false,
				directionNav:false,
				keyboardNav:true
			});//*/
		}
		
		//Search placeholder text
		$('input#search').inlineFieldLabel({label:'SEARCH RAD...'});
		$('input#email').inlineFieldLabel({label:'Email Address...'});
		
		//Video pop up
		$(".video").fancybox({
			'width'				: 560,
			'height'			: 410,
			'autoScale'			: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe',
			'titleShow'			: false
		});
		
		//Login Popups
		$(".register").fancybox({
			'width'				: 560,
			'height'			: 410,
			'autoScale'			: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe',
			'titleShow'			: false
		});
		
		$(".password").fancybox({
			'width'				: 560,
			'height'			: 305,
			'autoScale'			: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe',
			'titleShow'			: false
		});
		
		//Callback Popup
		$(".callrequest").fancybox({
			'width'				: 560,
			'height'			: 510,
			'autoScale'			: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe',
			'titleShow'			: false
		});
		
		// Log In Box	
		$('.login').hide();
		
		//Hide/Show
		$('a#signin').click(function() {
			$('.login').toggle(700);			
			return false;
		 });
		 
		 
		
		
		//Social Loop
		
		$("#scroller").simplyScroll({
			autoMode: 'loop'
		});
		
		//Expanding Menus
		$(".section-nav li ul").hide();
		//toggle the component with class msg_body
		$(".section-nav ul li a").click(function()
		{
			$(this).next(".section-nav li ul").slideToggle(600);
		});
		//Show the current menu section
		if(section_name != ''){
			$('#'+section_name).show();
		}
		
		//Google Map
	if ($('#map').length)
        {
			var myLatlng = new google.maps.LatLng(55.934464,-4.158094);
			var myOptions = 
			{
				zoom: 14,
				center: myLatlng,
				mapTypeId: google.maps.MapTypeId.ROADMAP
			}
			
			var map = new google.maps.Map(document.getElementById("map"), myOptions);
			
			var marker = new google.maps.Marker(
			{
				position: myLatlng, 
				map: map,
				title:"RAD IT Solutions"
			});   
		}
		
	});
	
})(jQuery);
	
