$(document).ready(function(){
		megaNav();
		accordionHome();
		accordion();
		accordionFaq();
		autoFill($(".sf_searchText"), "Search");

		$(".print").click (function(){
			window.print() ;
		});
		
		$(".homeWidgetNews .sf_newsList li:last-child").addClass("lastLi");
		$('tr.trHeader td').not('tr.trHeader td:eq(0)').parent().prev().prev().children().css('border-bottom','none');
		if($.browser.msie){
		    $('tr.trHeader td').not('tr.trHeader td:eq(0)').parent().prev().prev().prev().prev().children().css('border-bottom','none');
		}
		$('tr.trHeader td').not('tr.trHeader td:eq(0)').css('border-top', '1px solid #f4a313');
		$('tr.trDetail:last td').css('border-bottom', '1px solid #f4a313');
		
});

// Mega Navigation Starts here 
function megaNav(){
navId();

$('#TopNavContainer ul li .mega_nav').hide();
$("#TopNavContainer li a").hover(
	function() {
		var ulcount = $(this).parent().find(".megaNavBG").children('ul').length;
		if($.browser.msie && $.browser.version == '6.0')
			{
				$(this).parent().find(".mega_nav").show();
				$(this).parent().addClass("mouseOver");
				if(ulcount==1){
					$(this).parent().find(".mega_nav").css('width', '150px');
				}
			}
			else
			{
				$(this).parent().find(".mega_nav").show();	
				$(this).parent().addClass("mouseOver");
				if(ulcount==1){
					$(this).parent().find(".mega_nav").css('width', '150px');
				}
			}
		$(this).parent().find(".mega_nav").css('z-index','99');
		$(this).parent().hover(
		function() {
		}, 
		function(){	
			if($.browser.msie && $.browser.version == '6')
				{
					$(this).parent().find(".mega_nav").hide();
					$(this).parent().find(".mouseOver").removeClass("mouseOver");
				}
				else
				{
					$(this).parent().find(".mega_nav").hide();
					$(this).parent().find(".mouseOver").removeClass("mouseOver");
				}
			});
		},
		function(){
				$(this).parent().find(".mega_nav").slideDown(300).show();
				});
}
// Mega Navigation Ends here*
	 
// Mega Navigation Adding id Stats Here
function navId(){
$("#TopNavContainer ul.rootLevel").children('li').each(function(i){ //pass the root element id and particular element
	var nodePosition=$(this).attr('id');
		if(i>=0) {
			$(this).attr('id','nav_position'+i) //add your class
	}
});
}
// Mega Navigation Adding id Ends Here

//Start Accordion
function accordion(){
	$(".accordion div").hide();
	
	$(".accordion h2.active").next().each(function(i){
        $(this).show();
    });
	
	$(".accordion h2").click(function(){
	  $(this).next("div").slideToggle("slow")
	  .siblings("div:visible").slideUp("slow");
	  $(this).toggleClass("active");
	  $(this).siblings("h2").removeClass("active");
	});
}
//End Accordion

//Start Accordion Home
function accordionHome(){
	$(".accordionHome div").hide();

    $(".accordionHome h2.active").next().each(function(i){
        $(this).show();
    });

	$(".accordionHome h2").click(function(){
	  $(this).next("div").slideToggle("slow")
	  .siblings("div:visible").slideUp("slow");
	  $(this).toggleClass("active");
	  $(this).siblings("h2").removeClass("active");
	});
}
//End Accordion

//Start Accordion FAQ
function accordionFaq(){
$(".accordionFaq h3").eq(0).addClass("active");	
	$(".accordionFaq div").hide();
	
	$(".accordionFaq h2.active").next().each(function(i){
        $(this).show();
    });
	
	$(".accordionFaq h3").click(function(){
	  $(this).next("div").slideToggle("slow")
	  .siblings("div:visible").slideUp("slow");
	  $(this).toggleClass("active");
	  $(this).siblings("h3").removeClass("active");
	});
}
//End Accordion FAQ

//Start Search Text autofill
function autoFill(el, v){ 
	$(el).css({ color: "" }).attr({ value: v }).focus(function(){
		if($(this).val()==v){
			$(this).val("").css({ color: "" });
		}
	}).blur(function(){
		if($(this).val()==""){
			$(this).css({ color: "" }).val(v);
		}
	});
}
//End Search Text autofill
