// JavaScript Document


function toTheTop(){
  if(location.protocol != "https:"){
    path = (location.path)?location.path:"";
    top.location = "https://" + location.host + path;
  }
  else if(top != self){
    top.location = "./";
  }
}
		
		
//use this function for the top parking locator---copied below for the locator page.  Could be combined.
sfHover = function() {
	var sfEls = document.getElementById("subnav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

    function industry_about_dropdown(){

	jQuery('#subnav a:contains("About Us")').hover(function(){

          var specialSub = "<ul>";
	  specialSub += "<li><a href='http://www.ecolonial.com/home/executive-team/'>Executive Team</a></li>";
	  specialSub += "<li><a href='http://www.ecolonial.com/home/latest-news/'>Latest News</a></li>";
	  specialSub += "<li><a href='http://www.ecolonial.com/home/contact-us/'>Contact Us</a></li>";
	  
	  specialSub += "</ul>";
	  jQuery('#subnav a:contains("About Us")').parent().append(specialSub);
	});
  
    }

jQuery(document).ready(function(){
  /*************************************************BEGIN CUSTOM CODE************************************************************/	

    
    function industry_custom_dropdown(){

	jQuery('#subnav a:contains("Industries Served")').hover(function(){

          var specialSub = "<ul>";
	  specialSub += "<li><a href='http://www.ecolonial.com/clients/industries-served/?&indTab=8'>Government</a></li>";
	  specialSub += "<li><a href='http://www.ecolonial.com/clients/industries-served/?&indTab=1'>Hospitals</a></li>";
	  specialSub += "<li><a href='http://www.ecolonial.com/clients/industries-served/?&indTab=2'>Hotels</a></li>";
	  specialSub += "<li><a href='http://www.ecolonial.com/clients/industries-served/?&indTab=3'>Office Buildings</a></li>";
	  specialSub += "<li><a href='http://www.ecolonial.com/clients/industries-served/?&indTab=4'>Mixed Use</a></li>";
	  specialSub += "<li><a href='http://www.ecolonial.com/clients/industries-served/?&indTab=6'>Retail</a></li>";
	  specialSub += "<li><a href='http://www.ecolonial.com/clients/industries-served/?&indTab=7'>Sports Venues</a></li>";
	  specialSub += "</ul>";
	  jQuery('#subnav a:contains("Industries Served")').parent().append(specialSub);
	});
    

    }
    
       industry_custom_dropdown();
       

   
    

       /*****************************Industries Viewer**********************************/
      function init_tabs(){
      if(!jQuery('ul#indViewerTabs').length){
        return;
      }
      }
      
      jQuery('div.tab_content_wrap').each(function(){
      jQuery(this).find('div.current').show();
      });
      
      jQuery('ul#indViewerTabs li').click(function(){
      if(!jQuery(this).hasClass('current')){
	  jQuery(this).siblings('li').parent().find('li.current').removeClass('current');
	  jQuery(this).addClass('current');
	  jQuery(jQuery(this).find('a').attr('href')).show().siblings('div.tab_content').hide();
	}
  
      this.blur();
      return false;
      });
      
      jQuery('#nav3 li').hover(function(){
      if(!jQuery(this).hasClass('current')){
	  jQuery(this).parent().find('a.current').removeClass('current');
	  jQuery(this).children().addClass('current');
      };
       });


      jQuery('#nav3 li').click(function(){
      if(!jQuery(this).hasClass('current')){
	  jQuery(this).parent().find('a.current').removeClass('current');
	  jQuery(this).children().addClass('current');
	  jQuery(jQuery(this).find('a').attr('href')).show().siblings('div.tab_content').hide();
      };
       });
					   
	jQuery('ul.tabNav a').mouseover(function() {
	
	if ( $('ul.tabNav').hasClass('open') )	{
		
				var curChildIndex = jQuery(this).parent().prevAll().length + 1;
				
				jQuery('div.formBlock').css('display', 'none');			
				jQuery(this).parent().parent().children('.current').removeClass('current');
			
				jQuery(this).parent().addClass('current');

				jQuery(this).parent().parent().next('#tabContainer').children('.current').slideUp(0,function() {
				jQuery(this).removeClass('current');
			
				jQuery(this).parent().children('div:nth-child('+curChildIndex+')').slideDown(0,function() {
				jQuery(this).addClass('current');
				jQuery('div.formBlock').css('display', 'block');			
			});
		});
		return false;
	}
	
	else	{
	jQuery('div.formBlock').slideDown('fast',function() {
		$(this).parent().parent().siblings('.tabNav').addClass('open')
	});	


		var curChildIndex = jQuery(this).parent().prevAll().length + 1;
			jQuery('div.formBlock').hide();			
		jQuery(this).parent().parent().children('.current').removeClass('current');
	
		jQuery(this).parent().addClass('current');

		jQuery(this).parent().parent().next('#tabContainer').children('.current').slideUp('fast',function() {
			jQuery(this).removeClass('current');
	
			jQuery(this).parent().children('div:nth-child('+curChildIndex+')').slideDown('normal',function() {
				jQuery(this).addClass('current');
			jQuery('div.formBlock').slideDown();	
			});
		});
		return false;

		}
	});
	
	jQuery('a#closediv1').click(function(){
		jQuery('div.tab.current').hide();
		jQuery('ul.tabNav').children().removeClass('current');
		jQuery('ul.tabNav').removeClass('open');
	 });

	jQuery('a#closediv2').click(function(){
		jQuery('div.tab.current').hide();
		jQuery('ul.tabNav').children().removeClass('current');
		jQuery('ul.tabNav').removeClass('open');
	 });
	
	jQuery('a#closediv3').click(function(){
		jQuery('div.tab.current').hide();
		jQuery('ul.tabNav').children().removeClass('current');
		jQuery('ul.tabNav').removeClass('open');
	});	
	
	  /*****************************Case Studies**********************************/


function init_rollover(){
	  //add classes and id's where image rollovers are required
	  // Preload all rollovers
	  // Navigation rollovers

	   
	 jQuery("#cs_gov").mouseover(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_gov_on.jpg");
	 });
	 jQuery("#cs_gov").mouseout(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_gov.jpg");
	 });
	 
	jQuery("#cs_hos").mouseover(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_hos_on.jpg");
	 });
	 jQuery("#cs_hos").mouseout(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_hos.jpg");
	 });
	 
	jQuery("#cs_hot").mouseover(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_hot_on.jpg");
	 });
	 jQuery("#cs_hot").mouseout(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_hot.jpg");
	 });
	 
	jQuery("#cs_off").mouseover(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_off_on.jpg");
	 });
	 jQuery("#cs_off").mouseout(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_off.jpg");
	 });
	 
	 jQuery("#cs_mix").mouseover(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_mix_on.jpg");
	 });
	 jQuery("#cs_mix").mouseout(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_mix.jpg");
	 });
	 
	 
	jQuery("#cs_res").mouseover(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_res_on.jpg");
	 });
	 jQuery("#cs_res").mouseout(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_res.jpg");
	 });
	 
	 
	jQuery("#cs_ret").mouseover(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_ret_on.jpg");
	 });
	 jQuery("#cs_ret").mouseout(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_ret.jpg");
	 });
	 
	 
	jQuery("#cs_sport").mouseover(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_sport_on.jpg");
	 });
	 jQuery("#cs_sport").mouseout(function(){
			 jQuery(this).attr('src', "http://www.ecolonial.com/wp-content/themes/ecolonial/images/pic_cs_sport.jpg");
	 });
	

}


    init_rollover();

	function case_tabs(){
	if(!jQuery('ul#caseStudyTabs').length){
	  return;
	}
	}

	 jQuery('ul#caseStudyTabs li').click(function(event){
	 //jQuery.load("http://www.google.com");
	 //alert("test");
	 window.location = jQuery(this).find('a').attr('href');
	 return false;
	 });
	 




 $('li[title]').qtip({

	position: { adjust: { x: -50, y: 0 } },
	style: { 
	   padding: 5,
	   background: '#295a54',
	   color: '#fff',
	       fontWeight: 'bold',
	   textAlign: 'center',
	       left:'-10',
	   border: {
	      width: 1,
	      radius: 5,
	      color: '#295a54'
	   },
	   tip: 'topLeft',
	   name: 'dark' // Inherit the rest of the attributes from the preset dark style
	}
     });


//**************************FOR DOCUMENT BROWSING************************/
	$('.hidehandle').click(function(){
	  if($(this).hasClass('hidehandleicon_off')){
	    $(this).removeClass('hidehandleicon_off').addClass('hidehandleicon_on');
	    
	  }else{
	    $(this).removeClass('hidehandleicon_on').addClass('hidehandleicon_off');
	  }
	  
		$(this).next().slideToggle();
	});
//*************************************************************************/






/*************************************************BEGIN CUSTOM CODE************************************************************/
});//end doc ready
	
