var Site = {

	Init : function($) {
	},

	Behaviour: function($) {
		function collaspseAction() {
			$('#jl01').click(
				function(e){
					e.preventDefault();
					$('.list').hide();
					animatedcollapse.show('approach');
					dosIFR();
				}
			);
			$('#jl02').click(
				function(e){
					e.preventDefault();
					$('.list').hide();
					animatedcollapse.show('download');
					dosIFR();
				}
			);
			$('#jl03').click(
				function(e){
					e.preventDefault();
					$('.list').hide();
					animatedcollapse.show('news');
					dosIFR();
				}
			);
			$('#jl04').click(
				function(e){
					e.preventDefault();
					$('.list').hide();				
					animatedcollapse.show('contact');
					dosIFR();
				}
			);
		}

		if ($('body.home .list').size() > 1){
			Site.Effects($);
			collaspseAction();
		} else {
			$('body.base div.list').show();
		}

		Site.CntForm($);

	},

	Effects: function($) {
		function collapseInit() {
			animatedcollapse.addDiv('approach', 'fade=1,speed=800,group=listing,hide=1');
			animatedcollapse.addDiv('download', 'fade=1,speed=800,group=listing,hide=1');
			animatedcollapse.addDiv('news', 'fade=1,speed=800,group=listing,hide=1');
			animatedcollapse.addDiv('contact', 'fade=1,speed=800,group=listing,hide=1');
			animatedcollapse.init();
		}
		collapseInit();
	},

	CntForm: function($) {
		function checkForm(){
			var container = $('div.error');
			$("form#cntForm").validate({
					errorContainer: container,
					errorPlacement: function(error, element) {
					$('.valid').parent().find('p.validation').hide();
					element.parent().find('p.validation').show();
			},
			submitHandler: function(form) {
					jQuery("form#cntForm").fadeOut();
					jQuery(form).ajaxSubmit({
					success: function(responseText) {
							jQuery("div.error").after("<div class=\"success\"></div>");
							jQuery("div.success").html("<h4>Thanks</h4><p>Your message has been successfully sent over to us</p>");
							}
						});
					}
		        });
		}
		function CntForminit() {
			$('#contact .error').hide();
			$('.validation').hide();
			checkForm();		
		}
		CntForminit();
	},

	Settings: function($) {
		jQuery("a.popup").click(
			function(event) {
				event.preventDefault();
				window.open($(this).attr("href"));
			}
		);
	}

};


jQuery.noConflict();
jQuery(document).ready(function($){
	Site.Init($);
	Site.Behaviour($);
	Site.Settings($);
});