/* 	Custom Javascript for Project 						*/
/*											*/
/* 	The include function is available here to attach libraries .	*/
/* 	Example:									*/
/* 	include('js/widget.js'); 							*/	



/* JQuery Example */

/*
$(document).ready(function() {
	
	//JQuery Magic Goes Here
	
});
*/


/* Traditional JavaScript Example */
/* 
function myFunctionHere(){

}

*/

$(document).ready(function() {
	
	lavalamp_init();
	
	divClick_init();
	
//	form_init();

	formtwo_init();
	
    codaShowHide_init();
	
//	codaSlider_init();


	
});

function form_init(){

	 // hides the element as soon as the DOM is ready
	  $("#hidden-input").hide();
	  
	 // shows the element
	  $("#show-hidden-input").click(function() {
		$("#hidden-input").show('fast');
		return false;
	  });
	
	// hides element again
	$("#hide-hidden-input").click(function() {
	    $("#hidden-input").hide('fast');
	    return false;
	  });
}

function codaShowHide_init(){

	 // hides the element as soon as the DOM is ready
	  $("#panel2").hide();
	  $("#panel3").hide();
	  $("#panel4").hide();
	  $("#panel5").hide();
	  
	 // shows the element
	  $("#showpanel2").click(function() {
		$("#panel2").show('fast');
		return false;
	  });

	 // shows the element
	  $("#backtopanel1").click(function() {
		$("#panel1").show('fast');
		return false;
	  });

	 // shows the element
	  $("#showpanel3").click(function() {
		$("#panel3").show('fast');
		return false;
	  });

	 // shows the element
	  $("#backtopanel2").click(function() {
		$("#panel2").show('fast');
		return false;
	  });

	 // shows the element
	  $("#showpanel4").click(function() {
		$("#panel4").show('fast');
		return false;
	  });

	 // shows the element
	  $("#backtopanel3").click(function() {
		$("#panel3").show('fast');
		return false;
	  });

	 // shows the element
	  $("#showpanel5").click(function() {
		$("#panel5").show('fast');
		return false;
	  });

	 // shows the element
	  $("#backtopanel4").click(function() {
		$("#panel4").show('fast');
		return false;
	  });
	
	// hides element again
	$("#showpanel2").click(function() {
	    $("#panel1").hide('fast');
	    return false;
	  });

	// hides element again
	$("#backtopanel1").click(function() {
	    $("#panel2").hide('fast');
	    return false;
	  });

	// hides element again
	$("#showpanel3").click(function() {
	    $("#panel2").hide('fast');
	    return false;
	  });

	// hides element again
	$("#backtopanel2").click(function() {
	    $("#panel3").hide('fast');
	    return false;
	  });

	// hides element again
	$("#showpanel4").click(function() {
	    $("#panel3").hide('fast');
	    return false;
	  });

	// hides element again
	$("#backtopanel3").click(function() {
	    $("#panel4").hide('fast');
	    return false;
	  });

	// hides element again
	$("#showpanel5").click(function() {
	    $("#panel4").hide('fast');
	    return false;
	  });

	// hides element again
	$("#backtopanel4").click(function() {
	    $("#panel5").hide('fast');
	    return false;
	  });
}

function formtwo_init(){
	  
	 // shows the element
	  $("#show-hidden-input").click(function() {
		$("#hidden-input").show('fast');

	  });
	  $("#rent-building").click(function() {
		$("#landlord-information").show('fast');
	  });

	  $("#billed").click(function() {
		$("#panel-4-right").show('fast');
	  });

	
	// hides element again
	$("#hide-hidden-input").click(function() {
	    $("#hidden-input").hide('fast');
	  });
	$("#own-building").click(function() {
	    $("#landlord-information").hide('fast');
	  });

	$("#prepay").click(function() {
		$("#panel-4-right").hide('fast');
	  });

	 // toggles the element
	  $("#mailing-address-checkbox").click(function() {
		$("#panel-2-right").toggle('fast');
	  });
	
	  $("#appliance-other").click(function() {
		$("#appliance-other-explanation").toggle('fast');
	  });
	
}



function lavalamp_init(){
	//LavaLamp Menu Navigation
	$(function() { $(".lavaLamp").lavaLamp({ fx: "backout", speed: 700 })});
}


function divClick_init(){
	//Adds class .pretty-hover to div-click for styling, such as adding a link cursor
	$('div.div-click').hover(function() {
		$(this).addClass('pretty-hover');
			}, function() {
		$(this).removeClass('pretty-hover');
	});
	
	//Turns a DIV into a clickable link
	$("div.div-click").click(function(){
	  window.location=$(this).find("a").attr("href"); return false;
	});	
	

}