var cs = function(){
	
	//initialize lavalamp navigation effect 
	$(function() { $(".lavaLamp").lavaLamp({ fx: "backout", speed: 700 })});
	 
	//initialize contact drop down
	 $("#contactLink").click(function(){
         if ($("#contactForm").is(":hidden")){
             $("#contactForm").slideDown("slow");
         }
         else{
             $("#contactForm").slideUp("slow");
         }
     });
	 
	 //initializes subPage navigation
	$(document).ready(function(){ 
        $("ul.sf-menu").superfish({ 
            animation: {height:'show'},   // slide-down effect without fade-in 
            delay:     1200               // 1.2 second delay on mouseout 
        }); 
    }); 
	 
	 this.initEvents();
}

cs.prototype.initEvents = function(){
	
	 //on-click event for map on sidebar
	 $(".mapClick").click(function(){ window.location = "index.php?page=about&subPage=coverageMap" });
	 
	 //onclick event for contactUs form submission
	 $("#sendMail").click(this.contactUsSubmit);
	 
	 //footer site map 
	 $('.footerNav').mouseover(function(evt){
		$(this).css("background-color", "#86B6EF");
	 })
	  $('.footerNav').mouseout(function(evt){
		$(this).css("background-color", "#3E8FF8");
	 })
	
}

cs.prototype.contactUsSubmit = function(evt){
	
	var name = $('#formName').val();
	var email = $('#formEmail').val();
	var message = $('#formMessage').val();
	
	if (name == '' || email == '' || message == '') {
		alert("Form not complete.  Please enter in information for all fields and re-submit.");
	}
	else {
		$.post("common/buffer/email.php", {
			name: name,
			email: email,
			message: message
		}, function(response){
			if (response == "1") {
				alert("Your message has been sent!");
			}
			else {
				alert("There was an error sending the message, please contact us at info@CircServ.com");
			}
			setTimeout('$("#messageSent").hide();$("#contactForm").slideUp("slow")', 2000);
		});
	}
	
}


$(document).ready(function(){
	var csJS = new cs();		   
	});