function popUp(url){
	var width = 760;
	var height = 760;
	var win_left = (screen.width-width)/2;
	var win_top = (screen.height-height)/2;
	new_window = window.open(url,'TAIslim','width='+width+',height='+height+',top='+win_top+',left='+win_left+',toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes');
	if (window.focus){
		new_window.focus()
		}
	}
	
function swapStory(storyName){
	$('div.currentStory').hide();
	$('div.currentStory').removeClass('currentStory');
	$('div [id = ' + storyName + ']').addClass('currentStory');
	$('div [id = ' + storyName + ']').fadeIn("slow");
}

$(function() {
	$("a.popup").attr("href", function() { return "javascript:popUp('"+this.href+"');" });
	var currentTab = jQuery.url.attr("path");
	if (currentTab == "/share-your-story.cfm"){
		$('ul#tabs li a[href = "/product.cfm"]').parent().stop().css('top', '-2px');
		$('ul#tabs li a[href = "/product.cfm"]').addClass('current');
	}
	$('ul#tabs li a[href = ' + currentTab + ']').parent().stop().css('top', '-2px');
	$('ul#tabs li a[href = ' + currentTab + ']').addClass('current');
	$('ul#tabs li a').hover(
		function(){ 
			$('ul#tabs').css('z-index', '1100');
			$(this).parent().stop().animate({'top' : '-2px'}, 500, function(){$('ul#tabs').css('z-index', '1100');}); },
		function(){ 
			if ($(this).attr("class") == 'current'){
				$(this).parent().stop().css('top', '-2px');
			} else {
				$(this).parent().stop().animate({'top' : '-110px'}, 500, function(){$('ul#tabs').css('z-index', '900');});
			}
		}
	);
	$('div#success_story_column > div:not(".currentStory")').hide();
	$('a.success_thumb_link').click(function(){
		swapStory($(this).attr("id"));
		return(false);
	});
	$('ul#tabs li a').click(function(){
		$('ul#tabs li a[class = current]').parent().stop().animate({'top' : '-110px'}, 500);
		$('ul#tabs li a').removeClass('current');
		$(this).addClass('current');
		$('ul#tabs li a[class = current]').parent().stop().animate({'top' : '-2px'}, 500);
	});
	$('dl#plan_list dd').hide();
	$('dl#plan_list dt').hover(
		function(){
			$(this).css({'color' : '#67B162', 'cursor' : 'pointer'});
		},
		function(){
			$(this).css({'color' : '#555555'});
		});
	$('dl#plan_list dt').click(function(){
		$('dl#plan_list dd').slideUp();
		$(this).next().slideToggle();
	});
});

/*
$(function() {
  $("#menu img").hover(function() {
    $(this).attr("src", $(this).attr("src").split(".").join("-hover."));
  }, function() {
    $(this).attr("src", $(this).attr("src").split("-hover.").join("."));
  });
});*/

function popURL(strURL,strType,strHeight,strWidth) 
	{
		var strOptions="";

		if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
		if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
		if (strType=="elastic") strOptions="scrollbars,resizable,height="+strHeight+",width="+strWidth;

		newWin = window.open(strURL, 'newWin', strOptions);

		newWin.focus();
}