// Custom JS for EE Insider
// Copyright 2009, Mijingo, LLC
// Sabotage!! Duh Duh duh duh duh!!

$(document).ready(function()
{	
	$("a")
		.filter(".clickme").click(function()
		{
			alert("You are now leaving the site");
		})
	.end();
});

// -------------------------
// Code for Tips homepage tab
// --------------------------
var currentTab = 0; // Set to a different number to start on a different tab.

function openTab(clickedTab) {
	var thisTab = $(".tab-mod-one .tabs a").index(clickedTab);
	$(".tab-mod-one .tabs li a").removeClass("active");
	$(".tab-mod-one .tabs li a:eq("+thisTab+")").addClass("active");
	$(".tab-mod-one .tab-content").hide();
	$(".tab-mod-one .tab-content:eq("+thisTab+")").show();
	currentTab = thisTab;
}

$(document).ready(function() {
	$(".tabs li:eq(0) a").css("border-left", "none");

	$(".tab-mod-one .tabs li a").click(function() { 
		openTab($(this)); return false; 
	});

	$(".tab-mod-one .tabs li a:eq("+currentTab+")").click()
});

function openTabTwo(clickedTab) {
	var thisTab = $(".tab-mod-two .tabs a").index(clickedTab);
	$(".tab-mod-two .tabs li a").removeClass("active");
	$(".tab-mod-two .tabs li a:eq("+thisTab+")").addClass("active");
	$(".tab-mod-two .tab-content").hide();
	$(".tab-mod-two .tab-content:eq("+thisTab+")").show();
	currentTab = thisTab;
}

$(document).ready(function() {
	$(".tabs li:eq(0) a").css("border-left", "none");

	$(".tab-mod-two .tabs li a").click(function() { 
		openTabTwo($(this)); return false; 
	});

	$(".tab-mod-two .tabs li a:eq("+currentTab+")").click()
});


// -------------------------
// Code for Tips Add Form
// --------------------------

// $(document).ready(function()
// { 
//  $('input:text').hint();
//  $('textarea').hint();
//  $('#add-tag').click(function() {
// 	//populate hidden text field of tags separated by space 
// 	var currentTag = $("#new-tags").val();
// 	var currentVal = $("input#tag_f").val();
// 	$("input#tag_f").val(currentTag + ' ' + currentVal);
// 	$("#tag-list").fadeIn("fast").prepend("<li class=\"" + currentTag + "\">" + currentTag + "</li>");
// 	$("#new-tags").val("");
// });
// 
// $(function() {
// 	$("a[rel]").overlay();
// });
// 
// // setGlobalTags(['tag1', 'tag2', 'tag3']);
// // $(function() {
// // 	$('#new-tags').tagSuggest();
// // }); 
// 
// var showText = "Show formatting help";
// var hideText = "Hide formatting help";
// 
// $(".formatting-buttons").hide(); 
// $('a#formatting-toggle').click(function(){
// 	$(this).html ($(this).html()==hideText ? showText : hideText);
// 	$(this).parent().next('.formatting-buttons').toggle("slow");
// 	return false;
// });                                                                                                        
// }); 