// JavaScript Document

$(document).ready(function () {

    $('.primaryNav .item').hover(
	 
	 function() {
	     $('.submenu').hide();

	     if ($(this).find('.submenu').length > 0) {
	         $(this).find('.submenu').fadeIn('fast');
	     }
	 },
	 function() {
	     $('.submenu').hide();
	 });

});


// ACCORDION NAV
	function initMenu() {	
		$('ul.accordion').show();
		$('ul.accordion ul.sub').hide();
		//$('ul.accordion ul.sub#on').show();
	
		
		$('ul.accordion li div.trigger').click(								
		function() {
			$('div.trigger').removeClass('selected');
			Cufon.refresh();
			var checkElement = $(this).next();
			
			if((checkElement.is('ul.sub')) && (!checkElement.is(':visible')) ) {
			$('ul.accordion ul.sub:visible').slideUp('fast');
			checkElement.slideDown('fast');
			checkElement.siblings('div.trigger').addClass('selected');
				//if(checkElement.is('ul.forminput')) {
				//	$('input#askaquestion').focus();
				//	return false;
				//}
			return false;
		}
		
		$('ul.accordion ul.sub:visible').slideUp('fast');
		/*	if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
			$('ul.myaccountsummary ul:visible').slideUp('normal');
			checkElement.slideDown('normal');
			checkElement.siblings('a').addClass('selected');
			return false;
		}*/
		return false;
		});
		
		$('a.closeit').click(								
		function() {
			$(this).closest('ul.sub').fadeOut("fast");
			return false;
		});
		
	}
	
$(document).ready(function()
{initMenu();}
);
// END ACCORDION NAV


// SHOW OPTION CONTENT ON BUTTON HOVER
$(document).ready(function() {
	$('div.hideoption span.styleoption').hide();
	$('div.hideoption div.revealoption').mouseover(function () {
		$(this).children('span.styleoption').stop(true, true).show();
		return false;
	});
	
	$('div.hideoption div.revealoption').mouseout(function () {
		$(this).children('span.styleoption').stop(true, true).fadeOut('fast');
		return false;
	});
	
	
});


/*
// SLIDE swap CONTENT ON CLICK of button or associated text link
$(document).ready(function() {
	$('div.tobeshown').hide();
	$('a.triggershow').click(function () {
		$(this).parent().siblings('div.tobeshown').stop(true, true).fadeIn('fast');
		$('a.triggershow').stop(true, true).hide();
		return false;
	});
	$('a.triggershowtext').click(function () {
		$(this).parent().siblings('div.tobeshown').stop(true, true).fadeIn('fast');
		$('a.triggershow').stop(true, true).hide();
		return false;
	});
	$('li a.accordionlink').click(function () {
		$('div.tobeshown').stop(true, true).hide();
		$('a.triggershow').stop(true, true).show();
	return false;
	});
});
*/




// change input texts
/*$(document).ready(function () {
    $('input.username').click(function () {
        $(this).val('');
    });

    $('input.username').blur(function () {
        if ($(this).val() == '') {
            $(this).val('Username')
        }
    });

    $('input.password').click(function () {
        $(this).val('');
    });

    $('input.password').blur(function () {
        if ($(this).val() == '') {
            $(this).val('Password')
        }
    });

});*/


// table styling function
	  $(function(){
		// $(".standardtable tr").mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
		// $(".standardtable tr").mouseover(function(){$(this).children("td").addClass("over");}).mouseout(function(){$(this).children("td").removeClass("over");});
		
		$("table.simple3 tr").mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
		$("table.simple3 tr").mouseover(function(){$(this).children("td").addClass("over");}).mouseout(function(){$(this).children("td").removeClass("over");});

		
		$(".simple tr").find("td:last").addClass("lastcell");

		 $(".standardtable tr:even").addClass("even");
		 $(".standardtable tr:odd").addClass("odd");
		 $(".standardtable tr").find("td:first").addClass("firstcell");
		 $(".standardtable tr").find("td:last").addClass("lastcell");
		 $(".standardtable").find("tr:last").addClass("lastrow");
		$(".standardtable thead").has("span.positionIcon").addClass("hasIcon");
		 Cufon.refresh();
	   });
	  
	   $(function(){
		 $("tbody.toreveal").hide();
		
		$('a.takealook').click(function () {
        	$("tbody.toreveal").fadeIn("slow");
			Cufon.refresh();
			return false;
    	});
		
	   });
	   
	   
	   
$(document).ready(function(){
		$("div.productbenefits ul ul").hide();
		$("div.productbenefits ul ul").parent("li").addClass("removebackground");
			
		$(".showmore").toggle(function() {
		    $(this).parent().find("ul.hidden").fadeIn("slow");
			$(this).text('Close');
        }, function() {
			$(this).parent().find("ul.hidden").hide();
			$(this).text("But wait- there\'s more!");
		});
});
	 

$(document).ready(function(){
		$("div.hideatable table tbody").hide();
		$("div.hideatable a.close").hide();
		
		$("div.hideatable a.simpleshow").click(function() {
		    $(this).parent().parent().parent().parent().find("div.show").show();
			$("a.close").show();
			Cufon.refresh("a.showmore h6");
			return false;
        });
		
			
		$("div.hideatable .showmore").click(function() {
		    $(this).parent().parent().parent().parent().find("tbody").show();
			$(this).html('<h6>All Other Calling Rates</h6>');
			$("a.close").show();
			Cufon.refresh("a.showmore h6");
			return false;
        });
		
		$("div.hideatable a.close").click(function() {
		    $(this).parent().find("tbody").hide();
			$("div.hideatable a.showmore").html('<h6>All Other Calling Rates - <span class="altcolor">Click Here</span></h6>');
			Cufon.refresh("a.showmore h6");
			$("div.hideatable a.close").hide();
			return false;
		});
});


$(document).ready(function(){
		$("div.toshow").hide();
		$("div.toshow a.close").hide();
		
		$("div.pricepoint a.simpleshow").toggle(function() {
		    $(this).parent().parent().find("div.toshow").show();
			$(this).html('<h5 class="emphasis">Close</h5>');
			return false;
        }, function() {
			$(this).parent().parent().find("div.toshow").hide();
			$(this).html('<h5 class="emphasis">Add</h5>');
			Cufon.refresh();
			return false;
		});
});






