// JavaScript Document

/* Portfolio Pages 

	$(document).ready(function() {  
      
        // Check for hash value in URL  
        var hash = window.location.hash.substr(1);  
        var href = $('#sideBarNav li a').each(function(){  
            var href = $(this).attr('href');  
            if(hash==href.substr(0,href.length-5)){  
                var toLoad = hash+'.html #slideshow';  
                $('#slideshow').load(toLoad)  
            }  
        });  
      
        $('#sideBarNav li a').click(function(){  
      
        var toLoad = $(this).attr('href')+'#slideshow';  
        $('#slideshow').fadeOut('1000',loadContent);  
		 
        window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5); 
        function loadContent() {  
            $('#slideshow').load(toLoad,'',showNewContent())  
        }  
        function showNewContent() {  
            $('#slideshow').fadeIn('10000');  
        }  
          
        return false;  
      
        });  
    }); */
	




$(document).ready(function() {
						   
	var hash = window.location.hash.substr(1);
	var href = $('#sideBarNav li a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-5)){
			var toLoad = hash+'.html #slideshow';
			$('#slideshow').load(toLoad)
		}											
	});

	$('#sideBarNav li a').click(function(){
								  
		var toLoad = $(this).attr('href')+'#slideshow';
		$('#slideshow').fadeOut('normal',loadContent);
		$('#load').remove();
		$('#content').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
		window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
		function loadContent() {
			$('#slideshow').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#slideshow').fadeIn('slow',hideLoader());
		}
		function hideLoader() {
			$('#load').fadeOut('slow');
		}
		return false;
		
	});

});






	
/* Portfolio Menu Toggle */

$(function() {
		$("#subNav1").hide();
		$("#slivingBtn").click(function() {
			$("#subNav1").toggle("slow");
			$("#subNav2, #subNav3, #subNav4, #subNav5, #subNav6, #subNav7").hide("slow");
		});
	});





$(function() {
		$("#subNav2").hide();
		$("#kitchenBtn").click(function() {
			$("#subNav2").toggle("slow");
			$("#subNav1, #subNav3, #subNav4, #subNav5, #subNav6, #subNav7").hide("slow");
		});
	});





$(function() {
		$("#subNav3").hide();
		$("#renovationBtn").click(function() {
			$("#subNav3").toggle("slow");
			$("#subNav1, #subNav2, #subNav4, #subNav5, #subNav6, #subNav7").hide("slow");
		});
	});




$(function() {
		$("#subNav4").hide();
		$("#outdoorBtn").click(function() {
			$("#subNav4").toggle("slow");
			$("#subNav1, #subNav2, #subNav3, #subNav5, #subNav6, #subNav7").hide("slow");
		});
	});





$(function() {
		$("#subNav5").hide();
		$("#historicBtn").click(function() {
			$("#subNav5").toggle("slow");
			$("#subNav1, #subNav2, #subNav3, #subNav4, #subNav6, #subNav7").hide("slow");
		});
	});





$(function() {
		$("#subNav6").hide();
		$("#featuredBtn").click(function() {
			$("#subNav6").toggle("slow");
			$("#subNav1, #subNav2, #subNav3, #subNav4, #subNav5, #subNav7").hide("slow");
		});
	});





$(function() {
		$("#subNav7").hide();
		$("#performanceBtn").click(function() {
			$("#subNav7").toggle("slow");
			$("#subNav1, #subNav2, #subNav3, #subNav4, #subNav5, #subNav6").hide("slow");
		});
	});
	
	
	


/* Rollover Script*/

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
	
	
	
/* SWF Loader */

$(document).ready(
	function() {
		$('#flash1').flash(
				{
					swf: 'flash/IntroPortfolio.swf',
					height: 425,
					width: 925,
					wmode: 'transparent',
				}
			);
	}
);
	

/* $(document).ready(
	function() {
		$('#flash2').flash(
				{
					swf: 'flash/HomeFeatures.swf',
					height: 135,
					width: 300,
					wmode: 'transparent',
				}
			);
	}
);


$(document).ready(
	function() {
		$('#flash3').flash(
				{
					swf: 'flash/HomeFeaturedProp.swf',
					height: 135,
					width: 300,
					wmode: 'transparent',
				}
			);
	}
);


$(document).ready(
	function() {
		$('#flash4').flash(
				{
					swf: 'flash/HomeVideos.swf',
					height: 135,
					width: 300,
					wmode: 'transparent',
				}
			);
	}
); */


$(document).ready(
	function() {
		$('#videopanel').flash(
				{
					swf: 'flash/MrFixIt_VideoPanel.swf',
					height: 300,
					width: 564,
					wmode: 'transparent',
				}
			);
	}
);


$(document).ready(
	function() {
		$('#portfoliopanel').flash(
				{
					swf: 'flash/PrepareYourHome.swf',
					height: 300,
					width: 564,
					wmode: 'transparent',
				}
			);
	}
);


	
/* Scroll Pane */

$(function() {

		$('.scroll-pane').jScrollPane(
						{
							verticalDragMinHeight: 100,
							verticalDragMaxHeight: 100,
							hijackInternalLinks: true,
							animateScroll: true,
							autoReinitialise: true
						}
				);
	});



/* iPane */

$(function() {

		$('#iPane').jScrollPane(
						{
							showArrows: true,
							verticalArrowPositions: 'split',
							horizontalArrowPositions: 'split',
							verticalDragMinHeight: 40,
							verticalDragMaxHeight: 100,
							hijackInternalLinks: true,
							animateScroll: true,
							autoReinitialise: true
						}
				);
	});




/* Design Build Call*/

	$(document).ready(function() {  
      
        // Check for hash value in URL  
        var hash = window.location.hash.substr(1);  
        var href = $('#sideBarNav #dbCall a').each(function(){  
            var href = $(this).attr('href');  
            if(hash==href.substr(0,href.length-5)){  
                var toLoad = hash+'.html #pagecontent';  
                $('#pagecontent').load(toLoad)  
            }  
        });  
      
        $('#sideBarNav #dbCall a').click(function(){  
      
        var toLoad = $(this).attr('href')+'#pagecontent';  
        $('#pagecontent').hide('fast',loadContent);  
		 
        window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5); 
        function loadContent() {  
            $('#pagecontent').load(toLoad,'',showNewContent())  
        }  
        function showNewContent() {  
            $('#pagecontent').show('fast',hideLoader());  
        }  
        function hideLoader() {  
            $('#load').fadeOut('normal');  
        }
        return false;  
      
        });
		
    });



