	$(document).ready(function() {
		
	
		$(function () {
	        $('#js-news').ticker(
	        	
	        );
	    });
		
			$('#slider1').anythingSlider({
				width : 940,          // Override the default CSS width
				delay : 6000,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
				animationTime : 600,       // How long the slideshow transition takes (in milliseconds)
				//easing : "swing"    // Anything other than "linear" or "swing" requires the easing plugin
				easing: 'easeInOutExpo',
				navigationFormatter: null	
			});		
			
			//Set default open/close settings
			$('.acc_container').hide(); //Hide/close all containers
			$('.acc_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
			 
			//On Click
			$('.acc_trigger').click(function(){
				if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
					$('.acc_trigger').removeClass('active').next().slideUp(); //Remove all .acc_trigger classes and slide up the immediate next container
					$(this).toggleClass('active').next().slideDown(); //Add .acc_trigger class to clicked trigger and slide down the immediate next container
				}
				return false; //Prevent the browser jump to the link anchor
			});
		
		$(".tab_content").hide(); //Hide all content
		$("ul.tabs li:first").addClass("active").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
		$("ul.tabs li:first").corner('top 3px');
		//On Click Event
		$("ul.tabs li").click(function() {

			$("ul.tabs li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab
			$(".tab_content").hide(); //Hide all tab content

			var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).show(); //Fade in the active ID content
			$(this).corner('top 3px');
			return false;
		});
		$('#searchtext').Watermark('Search...');
		
		$("a.lightview").fancybox({'overlayShow': true, overlayOpacity:0.9,frameWidth:600,frameHeight:400,hideOnContentClick:false});
		
		$("a").focus(function () {
        	$(this).blur();
		});
		$("img.rollover").hover(function () {
			newsrc=$(this).attr('src').replace('.jpg','-over.jpg').replace('.png','-over.png');
        	$(this).attr('src',newsrc);
		},function () {
			newsrc=$(this).attr('src').replace('-over.jpg','.jpg').replace('-over.png','.png');
        	$(this).attr('src',newsrc);
		});
	});
	
	function clickSub(thediv,div,image){
        $.each($('.'+div),function(){
            if(this.id==thediv){
                if(this.style.display=='none')
                {
                    $('#'+this.id).slideDown(700);
                    $('#'+image).show(700);
                    $('#'+'plus-'+this.id).hide(700)
                }
                else
                {
                    $('#'+this.id).slideUp(700);
                    $('#'+image).show(700);
                    $('#'+'minus-'+this.id).hide(700)
                }
            }else
            {
                $('#'+this.id).slideUp(700);
                $('#'+'minus-'+this.id).hide(700);
                $('#'+'plus-'+this.id).show(700);
            }

        });
	}
	
	function sendEmail() {
		$.post('form-contactus.php?r='+Math.random(),{
			name: $('#name').val(),
			email: $('#email').val(),
			notes: $('#message2').val(),
			telephone: $('#telephone').val()
			},
			
			function (data) {
				$('#sendStatus').html("<br /><p>Your message has been sent, we will reply as soon as possible.<br /><br />Thank you,<br />ifs Malta</p>");
				$('#contactForm').html("");
			}
		);
		return false;
	}
