/**
 * @author abezulski @ continuum
 */

 var scripts = {
 	
 	
	isIE : function (ver) {
		if($.browser.msie && $.browser.version == ver){
			return true;
		}
	},
	
 	/* make dropdown */
	makeDropdown : function() {
		
		$("#mainNav li").hover(
			
			function(){
				
				$(this).find(".ddMenu").parent().addClass("ddHover");
				$(this).find(".ddMenu").show();
				
			},
			function(){
				
				$(this).removeClass("ddHover");
				$(this).find(".ddMenu").hide();
				
			}
			
		);
		
	},
	
	/* sub nav fading */
	fadeMenuItems : function(id){
		
		if (!this.isIE(6) || !this.isIE(7) ) {
		
			$(id).hover(function(){
				
				$(this).siblings().stop().fadeTo(300, 0.50);
				
			}, function(){
				
				$(this).siblings().stop().fadeTo(300, 1)
				
			});
		}
	},
	
    equalHeights : function() {
	    
	    var currentHeight;
	    var tallestCol = 0;

	    for(var i=0; i < arguments.length; i++) {
	    
            currentHeight = $(arguments[i]).height();
            
            if(currentHeight > tallestCol) {
                tallestCol = currentHeight;
            }
            
            $(arguments[i]).height(tallestCol);
            
	    }
    },
    
    displayHomeFlash : function(file, target) {
	    var so = new SWFObject(file, "flashAnim", "950", "285", "9.0.0", "#ffffff");
	    so.addParam("menu", "false");
	    so.addParam("wmode", "transparent");
	    so.write(target);
    },

	/* init function */
	init : function(){
		
		this.makeDropdown();
		
	}
	
 }
  /**************************************/
 /* execute function when DOM is ready */
 $(document).ready(function(){
	
	scripts.init();
	
	if($("#subNav").length > 0) {
		scripts.fadeMenuItems("#subNav li");
	}
	
	if($("#treatmentsList").length > 0) {
		scripts.fadeMenuItems("#treatmentsList li");
	}
	
    if($("a.lightbox").length > 0)
    {
        $("a.lightbox").fancybox();
    }
    
    if($("#flashContainer").length > 0) {
    
        scripts.displayHomeFlash("/flash/urbana_home_flash_final.swf", "flashContainer");
    }

	
 });

$(window).load(function(){
   scripts.equalHeights("#columnLeft", "#columnRight");
});