$(document).ready(function() {
	
	Cufon.replace("#nav li");
	Cufon.replace("#text h2");
	Cufon.replace("#text h3");
	Cufon.replace("#text p");
	Cufon.replace("#mobile_solutions_text");
	Cufon.replace("h1");
	Cufon.replace("#sidebar h5");
	Cufon.replace(".phone-info h4");
	Cufon.replace(".phone-info h5");
	Cufon.replace(".phone-info h6");
	Cufon.replace("#scroller_area p");
	Cufon.replace("#stalk p");
	Cufon.replace("#nextstep h5");
	Cufon.replace("#nextsteps h5");
	

	//dropdown menus
	$('.select > li').hover(function() {
		$(this).children('ul:not(".shown")').slideDown(300).addClass('shown');
		}, function() {
			var obj = $(this).children('ul.shown');
			$(obj).slideUp(300, function() {
			$(this).removeClass('shown');
		});
	});
	
	
	
	$('#coda-slider-1').codaSlider({dynamicArrows: false,autoSlide:true,autoSlideInterval:5000,autoSlideStopWhenClicked:true});
	$('#coda-slider-2').codaSlider({dynamicArrows: false,dynamicTabs: false,autoHeight:false});

	//ie7 z-index fix
	var zIndexNumber = 1000;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});
	
	//--==[ Homepage scroller - click to scroll ]==--//
	/*
	$("#scroller").jCarouselLite({
		btnNext: "#next",
		btnPrev: "#prev",
		visible: 5
	});
	*/
	
	//--==[ Homepage scroller - mouseover to scroll ]==--//
	$("#scroller").jMyCarousel({
		visible: '596px',
		speed : 1500,
		auto: true
	});
	
	//fix list style
	url_string = String(document.location);
	if(url_string.search('#') < 0){
		$('#round_corner').addClass('firstnavlist');
	}else if(url_string.match('#1')){
		$('#round_corner').addClass('firstnavlist');
	}
	
	$(".subpage .coda-nav li").click(
		function () {
			$('#round_corner').removeClass('firstnavlist');
			$('.subpage .coda-nav').css('backgroundPosition','13px 32px');
		}
	);
	
	$(".subpage .coda-nav li:first-child").click(
		function () {
			$('#round_corner').addClass('firstnavlist');
			$('.subpage .coda-nav').css('backgroundPosition','left 32px');
		}, 
		function () {
			$('#round_corner').removeClass('firstnavlist');
			$('.subpage .coda-nav').css('backgroundPosition','13px 32px');
		}
	);
	
	$(".global_list").each(function(){
		tmp = $(this).find('li:last');
		$('<li class="lilastelem"></li>').insertAfter(tmp);
	});
	
	
	//$("table tbody tr:last").addClass('bottomTr');
	
	
	//$("table thead tr td:last").addClass('nobg');
	
	
	$("table").each(function(){
		$(this).find("tr:last").addClass('bottomTr');
		$(this).find("tr:first").addClass('topTr');
		$(this).find("thead tr td:last").addClass('nobg');
	});

  $("thead tr th:last").addClass("nobg");
  	
	$("table tbody tr").each(function(){
		$(this).find("td:last").addClass('nobg');
	});
	
	/*
	$("table tbody tr td:first").each(function(){
		$('<td width="2"></td>').insertBefore($(this));
	});
	*/
	
	$('.global_list li:even').addClass('even');
    $('.global_list li:odd').addClass('odd');

	$('table').each(function(){
		$(this).wrap('<div class="table_wrap"></div>');
		$('<div class="table_gap"></div>').insertBefore($(this));
	});
	
	/*
	$('.subpage .coda-slider .global_list').each(function(){
		$(this).wrap('<div class="list_wrap"></div>');
		//$('<div class="table_gap"></div>').insertBefore($(this));
	});
	*/
	function rollover(selector){
		selector.hover(
			function(){this.src = this.src.replace(".jpg","_on.jpg");},
			function(){this.src = this.src.replace("_on.jpg",".jpg");}
		);
	}
	//rollover($("#right-col ul img"));
	rollover($(".subpage #nextsteps ul:first img"));
	
	/*
	$("#right-col ul img").hover(
		function(){
			this.src = this.src.replace(".jpg","_on.jpg");
		},
		function(){
		this.src = this.src.replace("_on.jpg",".jpg");
	});
	
	$(".subpage #nextsteps ul img").hover(
		function(){
			this.src = this.src.replace(".jpg","_on.jpg");
		},
		function(){
		this.src = this.src.replace("_on.jpg",".jpg");
	});
	*/
	
	
	/* Homepage Banner Rotation */
	if ($('#homepage').length > 0) {
  	$('#homepage #banners .banner:eq(0)').addClass('active'); // the first one is visible by default
    var numBanners = $('#homepage #banners .banner').length;
  	setInterval('rotateBanner('+numBanners+');', 5000);
  }

	
	
});

function rotateBanner(numBanners) {
  if (numBanners > 1) {
    var $next = $('#homepage #banners .banner.active').next('.banner');
    
    if (!$next.length) $next = $('#homepage #banners .banner:first');
    
    $('#homepage #banners .banner.active').removeClass('active');
    $next.addClass('active');
    
    $('#content #text')
      .hide()
      .html($next.children('.text').html())
      .fadeIn('slow');
      
    $('#home_bg')
      .hide()
      .html($next.children('.bg').html())
      .fadeIn('slow');
  }
}

<!--
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Lee Underwood :: http://javascript.internet.com/ */

function newWindow(link) {
  var bookWindow;
  bookWindow = window.open(link, "new1", "width=800,height=500,scrollbars,resizable");
  if (bookWindow.open) {
    bookWindow.close;
  }
  bookWindow.focus();
}
-->

