                                     
$(document).ready(function() {	  
	
	$("a[rel='sg-home']").colorbox({transition:"fade"});

	$("ul.schagrin-parent-menu li").click(function(){
		$(this).children("ul").slideDown('fast');
	});
	
	$('ul.schagrin-parent-menu li a, #service-plans-link-header, #green-energy').each(function(){
		$(this).click(function(event){    
			
			// event.preventDefault();
			if( $(this).hasClass('normal-link') ){
				//
			}
			else{   
				$(this).parent().children("ul").slideDown('slow');
				
				if($(this).attr('href').indexOf("#") === -1){   
				   
				 	var protocol = (("https:" == document.location.protocol) ? "https://"+window.location.hostname : "http://"+window.location.hostname);
					// console.log($(this).attr('href'));
					// console.log(window.location.hostname);
					if(window.location.hostname == '192.168.5.10')
						$('#sg-content').load( protocol + '/~sam/CLIENTS/schagringas.com/' + $(this).attr('href'), function(){});
					else
					   $('#sg-content').load( protocol + '/' + $(this).attr('href'), function(){});   
					
					$('#sg-billboard, #sg-truck').hide();
				}
				return false;
			}
			
		});
	});
	
	var random_num = Math.floor(Math.random() * 6) + 0; 
	var billboards = ['images/billboards/Schagrin-billboard-1.png',
					  'images/billboards/Schagrin-billboard-2.png',
					  'images/billboards/Schagrin-billboard-3.png',
					  'images/billboards/Schagrin-billboard-4.png',
					  'images/billboards/Schagrin-billboard-5.png'];
					
	$('#sg-billboard img').attr("src", billboards[random_num]);
	
	 
});



