Cufon.replace('.postDate strong', {fontFamily: 'helb', textShadow: '#151f2a -1px -1px'});
Cufon.replace('.postDate span', {fontFamily: 'heading'});
jQuery(document).ready (function(){	
	$("table#company th:last, table#company td:last, ul#sidebar li:last, ul#submenu li:last, ul.processList li:last-child").addClass("last");
	$(".menu ul li:last, #ebpteam_list_management dd:last, ul#testimonials li:last, .servicePortfolio .port_thumb:last, #tabContents table tr:last").addClass("last");
	$("#tabContents table thead th:first").addClass("first");
	$("#tabContents table tbody tr:even").addClass("even");
	$("#tabContents table tbody tr:odd, .intPartner li:odd").addClass("odd");
	jQuery('.menu li:last-child').addClass('lastItem');
	$('img.alignleft').parent().addClass('lImg');
	$('img.alignright').parent().addClass('rImg');
	$('.port_thumb').each(function(j)
	{									   
	if(++j % 3 == 0 ){
	$(this).addClass('last'); 
	}
	});
	var _i;
	var _ii;
	var _display;
	jQuery(".topBarContent li").click(function () {
	_i = jQuery(this).find('span').attr("id");
	_ii= 1+_i;
	jQuery('.sd').slideUp();
	jQuery(".topBarContent li").removeClass("down" );
	var _display = jQuery("#"+_ii).css('display');  
		  if ( _display == 'block' ) 
		  { 	
				jQuery("#"+_ii).slideUp("slow"); 
				jQuery("#"+_i).parent().removeClass("down");
		  } 
		  else 
		  { 
				jQuery("#"+_ii).slideDown("slow"); 
				jQuery("#"+_i).parent().addClass("down"); 											
	      }
    });
	var config = {   
		sensitivity: 3, 
		interval: 0,  
		over: doOpen, 
		timeout: 100, 
		out: doClose  
	};
	function doOpen() {			
		jQuery('ul:first',this).stop(true, true).slideDown('fast');	
		jQuery(this).addClass('hover');					
	}
	function doClose() {		
		jQuery('ul:first',this).stop(true, true).slideUp('fast');	
		jQuery(this).removeClass('hover');					
	}
	jQuery('.menu > ul > li').hoverIntent(config);
	
	jQuery('hr').wrap('<div class="hr" />');
	//jQuery('#requestQuote').stop().animate({'marginRight':'-151px'},1000);

    /*jQuery('#requestQuote').hover(
        function () {
            jQuery(this).stop().animate({'marginRight':'-2px'},200);
        },
            function () {
                jQuery(this).stop().animate({'marginRight':'-151px'},200);
            }
    );*/
	$('#slider ul') 
	.before('<div id="slideNav">').cycle({
        fx:     'scrollHorz',
        speed:  'slow',
        timeout: 5000,
        pager:  '#slideNav',
		pause: 1
    });		
	$('#slider2 ul').cycle({ 
		fx:     'scrollHorz', 
		speed:  'slow', 
		timeout: 5000,
		slideExpr: 'li'
	});	
	$('#testimonials dl').cycle({ 
		fx:     'scrollHorz', 
		speed:  'slow', 
		timeout: 5000,
		slideExpr: 'dd'
	});	
	/*jQuery("#slider").easySlider({
    auto: true,
    continuous: true,    
    numeric: true,
	pause : 5000
    });*/
	/*$("#slider2").easySlider({ 
	auto: true,
	continuous: true,
	nextId: "slider1next",
	prevId: "slider1prev",
	numeric: false,
	pause:5000
	});*/
	
	jQuery('input[type="text"], textarea').each(function() {
	var default_value = this.value;	
	jQuery(this).focus(function() {
	if(this.value == default_value) {
	this.value = '';
	}
	});
	jQuery(this).blur(function() {
	if(this.value == '') {
	this.value = default_value;
	}
	});
	});	
		jQuery('a[rel="external"]').click(function(){
	    this.target = "_blank";
	});
	var _dh;
		jQuery('#xhtmlSec li, #postThumbs li, .thumbWrap').hover(function(){
		jQuery(this).stop(true, true).find('dl').fadeIn('2000');
		//_dh = jQuery(this).find('dd').height();
		//jQuery(this).find('dd').css("height", _dh+"px").vAlign();
		//jQuery(this).find('dl').animate({opacity: 0.6}, 0);
		jQuery(this).find('dd').animate({opacity: 1}, 0);
		},
	function(){
		jQuery(this).find('dl').fadeOut('2000');
		});
		
		/*jQuery('#xhtmlSec li dl dd, #postThumbs li dl dd').hover(function(){
			jQuery(this).animate({opacity: 1}, 200);
			},
	function(){	
	jQuery(this).animate({opacity: 0.6}, 200);
	});	*/
	
	});


function slideSwitch() {
    var $active = $('#slideshow img.active');
    if ( $active.length == 0 ) $active = $('#slideshow img:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow img:first');
    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
        $active.removeClass('active last-active');
    });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});
(function ($) {
$.fn.vAlign = function() {
	return this.each(function(i){
	var h = $(this).height();
	var oh = $(this).outerHeight();
	var mt = (h + (oh - h)) / 2;
	$(this).css("margin-top", "-" + mt + "px");	
	$(this).css("top", "50%");
	$(this).css("position", "absolute");
	});	
};
})(jQuery);
(function ($) {

$.fn.hAlign = function() {
	return this.each(function(i){
	var w = $(this).width();
	var ow = $(this).outerWidth();	
	var ml = (w + (ow - w)) / 2;	
	$(this).css("margin-left", "-" + ml + "px");
	$(this).css("left", "50%");
	$(this).css("position", "absolute");
	});
};
})(jQuery);
