jQuery.fn.nodeIndex=function(){return $(this).prevAll().length};

function returnTop(){
	if(navigator.appName!='Opera'){$('html, body').animate({ scrollTop: 0 }, 1000);}
	else{$('html').animate({ scrollTop: 0 }, 1000);}
}

$(function(){
	if($(".contact_info").length>0){
		
		$("#contactpage .report").html($(".contact_info").html());
	}
	
	var partner = $(".partner").html();
	$(".partner").html('<div class="inner"><marquee onmouseover="this.stop()" onmouseout="this.start()" scrolldelay="100">'+partner+'</marquee></div>');
	
	
	$(".box_slider .tab_content").each(function(){
		var title = $("h3 a",this).html();
		
		if(!title){title = $("h3",this).html()}
		
		if($(this).hasClass("active")){
			$(".box_slider .tab_menu").append('<a href="javascript:void(0)" class="active"><span>'+title+'</span></a>');
		}else{
			$(".box_slider .tab_menu").append('<a href="javascript:void(0)"><span>'+title+'</span></a>');
		}
	});
	
	$(".box_slider .tab_menu a").live("click",function(){
		$(".box_slider .tab_menu a").removeClass("active");
		$(this).addClass("active");
		$(".box_slider .tab_content").removeClass("active");
		var t_num = $(this).nodeIndex();
		$(".box_slider .tab_content:eq("+t_num+")").addClass("active");
	});
	
	if($('#ad_slider object').length<1){
		$('#ad_slider').nivoSlider({effect:'fade',slices:1,controlNav:false,animSpeed:800,pauseTime:5000,pauseOnHover:true});
	}
	
	$(".tab_menu_home_1 a").live("click",function(){
		$(".tab_menu_home_1 a").removeClass("active");
		$(this).addClass("active");
		$(".tab_content_home_1").removeClass("active");
		var t_num = $(this).nodeIndex();
		$(".tab_content_home_1:eq("+t_num+")").addClass("active");
	});
	
	$(".tab_menu_home_2 a").live("click",function(){
		$(".tab_menu_home_2 a").removeClass("active");
		$(this).addClass("active");
		$(".tab_content_home_2").removeClass("active");
		var t_num = $(this).nodeIndex();
		$(".tab_content_home_2:eq("+t_num+")").addClass("active");
	});
	
	
	
})
