	$(document).ready(function() { 
	
		$("ul.tabs").tabs("div.panes > div");
		
			$('ul#portfolio').innerfade({
				speed: 1000,
				timeout: 5000,
				type: 'sequence',
				containerheight: '308px'
			});
			
			
			  //Fixes an animation glitch caused by the
			  //div's dynamic height.  Need to set the
			  //height style so the slide functions work
			  //correctly.
			  $("div.slideBody").each(function(){
			    $(this).css("height", $(this).height() + "px");			   
			    });
			  $("div.slideBody").hide();

			  //hook the mouseup events to each header
			  $("div.slidePanel").children(
			    "div.slideHeader").mouseup(function(){
			 
			    //find the body whose header was clicked
			    var body = $(this).parent().children("div.slideBody");

			    //slide the panel
			    if(body.is(":hidden"))
			      body.slideDown();
			    else
			      body.slideUp();
			  });
			  
		
		$('.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:800,frameHeight:500,hideOnContentClick:false });
		$("a.lightview2").fancybox({'overlayShow': true, overlayOpacity:0.9,frameWidth:400,frameHeight:410,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);
		});
		
		
		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');
			
		});
		
		
	});
	
		
	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 sendEmail2() {
		var name=$('#name').val();
		if (name == "")
		{
			$('#name').css('border','1px solid red');
		}
		else
		{
			$('#submitbutton').val('Sending...');
			$('#submitbutton').attr("disabled","true");
			$.post('form-buying.php?r='+Math.random(),{
				visitor_name: $('#name').val(),
				visitor_surname: $('#surname').val(),
				visitor_email: $('#email').val(),
				visitor_mobile: $('#mobile').val(),
				visitor_lookingto: $('#lookingto').val(),
				visitor_budget: $('#budget').val()
				},
				function (data) {
					$('#sendStatus').html("<br /><p>Your message has been sent, we will reply as soon as possible.<br /><br />Thank you,<br />Exclusive Property Bureau Ltd</p>");
					$('#submitbutton').val('Send Message');
					$('#submitbutton').attr("disabled",false);
					$('#contactForm').html("");
				}
			);
		}
		return false;
	}	
	
	function sendEmailSell() {
		var name=$('#name1').val();
		if (name == "")
		{
			$('#name1').css('border','1px solid red');
		}
		else
		{
			$('#submitbutton1').val('Sending...');
			$('#submitbutton1').attr("disabled","true");
			$.post('form-selling.php?r='+Math.random(),{
				visitor_name: $('#name1').val(),
				visitor_surname: $('#surname1').val(),
				visitor_email: $('#email1').val(),
				visitor_mobile: $('#mobile1').val(),
				visitor_lookingto: $('#lookingto1').val()
				},
				function (data) {
					$('#sendStatus1').html("<br /><p>Your message has been sent, we will reply as soon as possible.<br /><br />Thank you,<br />Exclusive Property Bureau Ltd</p>");
					$('#submitbutton1').val('Send Message');
					$('#submitbutton1').attr("disabled",false);
					$('#contactForm1').html("");
				}
			);
		}
		return false;
	}
	
	function sendEmailRequestCall() {	
		var name=$('#name').val();
		var email=$('#email').val();
		var message=$('textarea#message').val();
		if (name == "")
		{
			$('#name').css('border','1px solid red');
		}
		else if (email== "")
		{
			$('#email').css('border','1px solid red');
		}
		else if (message== "")
		{
			$('#textarea#message').css('border','1px solid red');
		}
		else
		{
			$('#submitbutton2').val('Sending...');
			$('#submitbutton2').attr("disabled","true");
			$.post('form-requestcall.php?r='+Math.random(),{
				visitor_refno: $('#refno').val(),
				visitor_propname: $('#propname').val(),
				visitor_name: $('#name').val(),
				visitor_email: $('#email').val(),
				visitor_tel: $('#tel').val(),
				visitor_mobile: $('#mobile').val(),
				visitor_message: $('textarea#message').val()
				},
				function (data) {
					$('#sendStatus2').html("<br /><p>Your message has been sent, we will reply as soon as possible.<br /><br />Thank you,<br />Exclusive Property Bureau Ltd</p>");
					$('#submitbutton2').val('Send Message');
					$('#submitbutton2').attr("disabled",false);
					$('#contactForm2').html("");
				}
			);
		}
		return false;
	}	
	
	function sendEmail() {
		var name=$('#name3').val();
		if (name == "")
		{
			$('#name3').css('border','1px solid red');
		}
		else
		{
			$('#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 />Exclusive Property Bureau Ltd</p>");
					$('#submitbutton3').val('Send Message');
					$('#submitbutton3').attr("disabled",false);
					$('#contactForm3').html("");
				}
			);
		}
		return false;
	}
	
	
	
	

