	$(document).ready(function() { 
		//$('#date').datepicker({ dateFormat: 'yy-mm-dd',changeMonth: true,changeYear: true});
		(function($) {
			$(function() { //on DOM ready
				$("#scroller").simplyScroll({
					className: 'custom',
					autoMode: 'loop',
					pauseOnHover: false,
					frameRate: 35,
					speed: 1
				});
			});
		})(jQuery);
		$(function() {
			$( "#sliderprice" ).slider({
				value:0,
				min: 0,
				max: 1000,
				step: 50,
				slide: function( event, ui ) {
					$( "#minprice" ).val( ui.value );
				}
			});
			
			$( "#minprice" ).val( $( "#sliderprice" ).slider( "value" ) );
		});
		$(function() {
			$( "#sliderprice2" ).slider({
				value:0,
				min: 0,
				max: 4000,
				step: 50,
				slide: function( event, ui ) {
					$( "#maxprice" ).val( ui.value );
				}
			});
			
			$( "#maxprice" ).val( $( "#sliderprice" ).slider( "value" ) );
		});
		 $(function () {

             var date = new Date();
             var currentMonth = date.getMonth();
             var currentDate = date.getDate();
             var currentYear = date.getFullYear();

             $('#date').datepicker({
                 minDate: new Date(currentYear, currentMonth, currentDate),dateFormat: 'yy-mm-dd',changeMonth: true,changeYear: true
             });
         });
		   $('#slider').nivoSlider({captionOpacity:0.85});		   
		$('.tabs .tab-active').show(); // show default content
		$('.tabs .header ul a').click(function(){
			$('.tabs .header ul li').removeClass('active');
			$(this).parent().addClass('active'); // make clicked tab active
			$('.tabs .tab').hide(); // hide all content
			$('.tabs').find('#' + $(this).attr('rel')).show(); // and show content related to clicked tab
			return false;
		});
		
		$("a.lightview").fancybox({'overlayShow': true, overlayOpacity:0.9,frameWidth:600,frameHeight:400 });
		
		$("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);
		});
		
		var config = {
				toolbar:
					[
						['Format','TextColor','Bold','Italic','Underline','Strike'],
						['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
						['Link','Unlink'],['Maximize'],
						['NumberedList','BulletedList','Outdent','Indent'],
						['Undo','Redo','-','RemoveFormat'],
						['Cut','Copy','Paste','PasteText','PasteFromWord'],
					    ['Table','HorizontalRule','SpecialChar']
					],
				uiColor: '#dddddd'
				};
		$('.wysiwyg').each(function(index) {
			config.width=$(this).css('width');
			config.height=$(this).css('height');
			$(this).ckeditor(config);
		});
		
		
	});
	
	
	function testing(test, which) {
		$.post('en/comments/adverts/click/'+test+'.htm?',{
			bannerid: test,
			which:which
			},
			function (data) {
				
			}
		);
		return false;
	}
	
	function sendEmail() {
		$('#submitbutton3').val('Sending...');
		$('#submitbutton3').attr("disabled","true");
		$.post('form-contact.php?r='+Math.random(),{
			visitor_name: $('#name3').val(),
			visitor_email: $('#email3').val(),
			visitor_subject: $('#subject3').val(),
			visitor_lookingto: $('#lookingto3').val()
			},
			function (data) {
				$('#sendStatus3').html("<br /><p>Your message has been sent, we will reply as soon as possible.<br /><br />Thank you,<br />101 Dublin</p>");
				$('#submitbutton3').val('Send Message');
				$('#submitbutton3').attr("disabled",false);
				$('#contactForm3').html("");
			}
		);
		return false;
	}
	
	
	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);
            }

        });
	}
