image_folder = "/wp-content/themes/vitrum/images";//path to image folder from the root folder

jQuery(document).ready(function(){

	highlight = jQuery("h1 span").css('color');
	
	//setup search field
	jQuery("#searchForm input#search").focus(function(){
	
		jQuery(this).css({'border-color': highlight});	
	
	}).blur(function(){
	
		jQuery(this).css({'border-color': '#dbdbdb'});
		
	})
	
	//setup new comments effects 
	if(jQuery("#newComment").length) {
		
		highlight = jQuery("h1 span").css('color');
		
		jQuery("#newComment input, #newComment textarea").focus(function(){
		
			jQuery(this).css({'border-color': highlight});
			
		}).blur(function(){
		
			jQuery(this).css({'border-color': '#dbdbdb'});
		
		});
		
	}
	
	//setup contact form effects
	if(jQuery("#contactForm").length) {
		
		highlight = jQuery("h1 span").css('color');
		
		jQuery("#contactForm input, #contactForm textarea").focus(function(){
		
			jQuery(this).css({'border-color': highlight});
			
		}).blur(function(){
		
			jQuery(this).css({'border-color': '#dbdbdb'});
		
		});
		
	}
	
	
	//setup navigation hover (not for IE)
	jQuery('#navigation li:not(.active)').hover(function(){
	
		//append hover li
		tID = jQuery(this).find('a').attr('title');
			
		newHover = jQuery("<li class='hover'</li>").attr('id', tID);
		
		newHover.appendTo("ul#navigation");
		
		//set the right position
		liWidth = jQuery(this).width();//add 50 pixels for the left+right padding
	
		pos = jQuery(this).position();
		
		toAdd = (liWidth-105)/2;
		
		newHover.css({'left': pos.left+toAdd});
		
		newHover.stop().fadeIn(500);
	
	}, function(){
	
		jQuery("ul#navigation .hover").stop().fadeOut(500);
		
	});
	
	//remove last spacer from main navigation
	jQuery("#navigation li a:last").css({'background': 'none'});
	
	//activate the first tabs
	if(jQuery("div.sidebarTabs").length) {
				
		
		//setup sidebar tabs
		jQuery("div.sidebarTabs ul.tabs li a").click(function(){
		
			//remove active class
			jQuery(this).parent().parent().find('a').removeClass("active");
			
			//set clicked active
			jQuery(this).addClass("active");
		
			nextID = jQuery(this).attr("title");
		
			//slide all up
			jQuery("div.sidebarTabs #"+nextID).parent().find("ul").slideUp(1000, function(){
			
				//slide new one down
				setTimeout("jQuery('div.sidebarTabs #'+nextID).slideDown(1000);", 1000);
				
			});
			
			return false;
		
		})
		
		
	};
	
	
	
   	
   	//set the same hight for all LI's in the footer
   	if(jQuery("ul.footer").length) {
   		   		
   		theHeight = 0;
   		
   		jQuery("ul.footer > li").each(function(){
   			
   			if(jQuery(this).height() > theHeight) {
   				
   				theHeight = jQuery(this).height();
   				
   			}
   		
   		});
   		
   		jQuery("ul.footer > li").css({'height': theHeight+"px"})
   		
   	} 
	
	
	//setup accordion
	if(jQuery("div#accordion").length) {
		
		$("#accordion").accordion({header: 'h2', animated: 'bounceslide'});
		
	}
	
	//setup thumbs scroll
	if(jQuery("div.horScroller").length) {
		$("div.horScroller div.viewPort").scrollable({size:2});
		
		
		//setup the links... the url should be in the alt attribute
		jQuery("div.horScroller div.viewPort ul li img").each(function(){
		
			jQuery(this).parent().attr('href', jQuery(this).attr('alt'));
			
		})
	}
	
	
	//help images in scroller to align vertically centered
	if(jQuery(".viewPort ul").length) {
		
		jQuery(".viewPort ul li img").each(function(){
		
			
			marginTop = (98-jQuery(this).height())/2
			
			jQuery(this).css({'margin-top': marginTop+"px"})
			
		})
		
	}
})