$(document).ready(function(){

<!-- For Expand Effect-->
   $(".ex_box .ex_box_title").click(function(){
 	   $(".ex_box .ex_box_text").slideUp("slow");
	   $(this).parent().find(".ex_box_text").slideToggle("fast");
   });
	
   $(".ex_box .ex_close_button").click(function(){
       $(this).parent().slideUp();
   });
   
<!-- For Content Shed height-->
   sidebarH=parseInt($("#sidebar").height());
   contentH=parseInt($("#left_side_block").height());
   if(sidebarH>contentH){
	   $("#left_side_block").css({"min-height":sidebarH});
   }
   
});

$(document).ready(function(){

    $(".opengallery").click(function(){
	  $("a[rel='"+this.rel+"']").colorbox({opacity:0.70,scalePhotos:true,fixed:true,maxHeight:"98%"});
    });
  
    $(".colorbox").click(function(){
	  $(".colorbox").colorbox({opacity:0.70,scalePhotos:true,fixed:true,maxHeight:"98%"});   
    });

    $(".colorbox-video").click(function(){
	  $(".colorbox-video").colorbox({opacity:0.70,fixed:true,iframe:true,innerWidth:640,innerHeight:390});
    });
	$(".colorbox-print").click(function(){
	  $(".colorbox-print").colorbox({opacity:0.70,fixed:true,iframe:true,innerWidth:730,innerHeight:500});
    });
 
});

$(document).ready(function(){

    $("li.faq .underline").click(function(){
		 $('li.faq .hidebox').slideUp("slow");
		 $(this).closest('li.faq').find('.hidebox').slideDown("fast");
	});
	
});


<!--For Property Tab And Map load------------------------------------->
$(document).ready(function(){
    
    $("#property_tab_menu li a").click(function(){
		divclass=$(this).attr('class');
		$("#property_tab .property_tab_content").css({"display":"none"});
		$("#property_tab_menu li").removeClass("current_tab");
		$("."+divclass+"_content").css({"display":"block"});
		$(this).parent().addClass("current_tab");
        if($(this).attr('title')=="Map"){loadMap();}
        if($(this).attr('title')=="Street view"){loadStreetView();}		
	});
});
function change_property_type(ad_type){
	
  $.ajax({url:"http://www.glendaleproperties.ie/wp-content/plugins/daft_property/property_type.php?ad_type="+ad_type,
		  success:function(result){
              $("#property_type").html(result);
          },
		  beforeSend:function(){
			  $("#property_type").html("<option value=''>&nbsp;&nbsp;Loading......&nbsp;&nbsp;&nbsp;</option>");
		  }
		 });
}


<!--------Banner----------------------------------------------------->

var i1=100,j=0,flg1=1,ft=2,bannerNo=1;
var banner=new Array(); 
banner[0]="<img src='http://www.glendaleproperties.ie/wp-content/themes/glendaleproperties/images/banner/banner3.jpg' alt=''>";
banner[1]="<img src='http://www.glendaleproperties.ie/wp-content/themes/glendaleproperties/images/banner/banner2.jpg' alt=''>";
banner[2]="<img src='http://www.glendaleproperties.ie/wp-content/themes/glendaleproperties/images/banner/banner3.jpg' alt=''>";
banner[3]="<img src='http://www.glendaleproperties.ie/wp-content/themes/glendaleproperties/images/banner/banner4.jpg' alt=''>";
var next=null;
function swap()
{
	$('#top_banner').fadeToggle(2000);
	$('#down_banner').fadeToggle(2000,function(){	
	  if(flg1){
		   flg1=0;
		   document.getElementById("top_banner").innerHTML=next;
  		   document.getElementById('down_banner').style.zIndex =1;
		   document.getElementById('top_banner').style.zIndex =0;
	   }
	  else{
		  flg1=1;
		  document.getElementById("down_banner").innerHTML=next;
		  document.getElementById('down_banner').style.zIndex =0;
		  document.getElementById('top_banner').style.zIndex =1;
	  }
   });    
}
function changeBanner(){

    next=banner[ft];
	swap();
    if(ft==3){ft=0;}else{ft++;}
	
	if(bannerNo==0){
	   $("#rent-a-house-id").fadeOut(1000);
	   $("#buy-a-house-id").fadeOut(1000);
	}	
	if(bannerNo==1){
		$("#rent-a-house-id").fadeOut(1000);
        $("#buy-a-house-id").fadeOut(1000,function(){
		  $(this).attr({"class":"view-property-sale-banner"});
		  $(this).attr({"href":"./properties?ad_type=sale"});
		  $("#rent-a-house-id").fadeIn(2000);
		  $(this).fadeIn(2000);
		});
	}
	if(bannerNo==2){
		$("#rent-a-house-id").fadeOut(1000);
        $("#buy-a-house-id").fadeOut(1000,function(){
		  $(this).attr({"class":"get-in-touch-banner"});
          $(this).attr({"href":"./contact-us"});
		  $(this).fadeIn("slow");
		});
	}
	if(bannerNo==3){
		$("#rent-a-house-id").fadeOut(1000);
        $("#buy-a-house-id").fadeOut(1000,function(){
		  $(this).attr({"class":"get-in-touch-banner"});
		  $(this).attr({"href":"./contact-us"});
		  $(this).fadeIn("slow");
		});
	}

    if(bannerNo==3){bannerNo=0;}else{bannerNo++;}	
	ss=setTimeout("changeBanner()",6000); 
}
function loadBanner()
{
  imageObj1=new Image();
  imageObj1.src='http://www.glendaleproperties.ie/wp-content/themes/glendaleproperties/images/banner/banner3.jpg';
  imageObj1.src='http://www.glendaleproperties.ie/wp-content/themes/glendaleproperties/images/banner/banner4.jpg';
  ss=setTimeout("changeBanner()",3000); 
}
$(window).load(function(){
   loadBanner();
});
