// JavaScript Document
$(document).ready(function () {
	if($(".get_loan").children("ul").children("li").eq(2).children().length==3)
	{
		$(".get_loan").children("ul").children("li").eq(2).addClass("hide");
	}
							
	/*$(".get_loan").children("ul").children("li").each(function(){
		if($(this).children("span").html()!=null)
		{
			var emailObj=$(this).children("span").html().replace(/ /gi,'');
			if(emailObj=="NetBanking:" || emailObj=="Email")
			{
				//$(this).children("span").addClass("hide");
				//$(this).children("a").addClass("hide");
				$(this).children("span").remove();
				$(this).children("a").remove();
				if($(this).children().length==1)
				{
					$(this).addClass("hide");
				}
			}			
		}		
	});
		*/					
							
    if ($(window).width() <= 1024) {
        $('.particle').hide();
    }

    if ($(".detail_container").length != 0) {
        if ($(".detail_container").children(".left").children(".feature_bnft").children("ul").length != 0) {
            var paramURL = location.href;

            if (paramURL.match(/features/gi))
            {

            }
            else {
                $("html,body").animate({
                    scrollTop: $(".inner_container").offset().top
                }, 1000);
            }
        }
    }
    /* Accordion Start */
    $('.accord-contain:first').show().siblings('.accord-contain').hide();
    $('.accordion h4').click(function () {
        $(this).next('.accord-contain').slideDown().siblings('.accord-contain').slideUp();
        $(this).addClass('sel').siblings('.accordion h4').removeClass('sel');
    });
    /* Accordion End */
    /* Banner Start */
	if ($(".banner .slidebanner").children("ul").children("li").length == 1) {
        $(".banner .prevBtn").hide();
        $(".banner .nextBtn").hide();
    }

    $('.banner .prevBtn').click(function () {
		if (parseInt($('.slidebanner ul#slideContainer').css("marginLeft")) % 978 == 0) {
            if (parseInt($('.slidebanner ul#slideContainer').css("marginLeft")) < 0) {
                $('.slidebanner ul#slideContainer').stop(true, false).animate({ marginLeft: '+=978' }, 1000);
				$('.banner .nextBtn').removeClass("nextBtnDisable");
            }
        }
		
		if(parseInt($('.slidebanner ul#slideContainer').css("marginLeft"))==-978)
		{
			$('.banner .prevBtn').addClass("prevBtnDisable");
			$('.banner .nextBtn').removeClass("nextBtnDisable");
		}
		clearTimeout(alertTimerId);
		bannerLooping();
    });
    $('.banner .nextBtn').click(function () {
        var width = parseInt($('.slidebanner ul#slideContainer li').length - 1) * 978;
        if (parseInt($('.slidebanner ul#slideContainer').css("marginLeft")) % 978 == 0) {
            if (parseInt($('.slidebanner ul#slideContainer').css("marginLeft")) > -(width)) {
                $('.slidebanner ul#slideContainer').stop(true, false).animate({ marginLeft: '-=978' }, 1000);
            }
        }
		$('.banner .prevBtn').removeClass("prevBtnDisable");
		
		if(width-978==Math.abs(parseInt($('.slidebanner ul#slideContainer').css("marginLeft"))))
		{
			$('.banner .nextBtn').addClass("nextBtnDisable");
		}
		clearTimeout(alertTimerId);
		bannerLooping();
    });
    /* Banner End */

    /* Money Mantra Banner Start */
    if ($(".banner_wrapper .slidebanner").children("ul").children("li").length == 1) {
        $(".banner_wrapper .prevBtn").hide();
        $(".banner_wrapper .nextBtn").hide();
    }

    $('.banner_wrapper .prevBtn').click(function () {
		counter-=1;
		
        if (parseInt($('.slidebanner ul#slideContainer').css("marginLeft")) % 641 == 0) {
            if (parseInt($('.slidebanner ul#slideContainer').css("marginLeft")) < 0) {
                $('.slidebanner ul#slideContainer').stop(true, false).animate({ marginLeft: '+=641' }, 1000);
				$('.banner_wrapper .nextBtn').removeClass("nextBtnDisable");
            }
			$(".feauturedArticle").children("span").html(counter);
        }
		if(parseInt($('.slidebanner ul#slideContainer').css("marginLeft"))==-641)
		{
			$('.banner_wrapper .prevBtn').addClass("prevBtnDisable");
			$('.banner .nextBtn').removeClass("nextBtnDisable");
			$(".feauturedArticle").children("span").html("1");
		}
		clearTimeout(clearTimerId);
		mantraBannerLooping();
    });
    $('.banner_wrapper .nextBtn').click(function () {
		if($(".feauturedArticle").children("span").html()<=4)
		{
			counter+=1;
		}
		$(".feauturedArticle").children("span").html(counter);
		
        var width = parseInt($('.slidebanner ul#slideContainer li').length - 1) * 641;
        if (parseInt($('.slidebanner ul#slideContainer').css("marginLeft")) % 641 == 0) {
            if (parseInt($('.slidebanner ul#slideContainer').css("marginLeft")) > -(width)) {
                $('.slidebanner ul#slideContainer').stop(true, false).animate({ marginLeft: '-=641' }, 1000);
            }
        }
		$('.banner_wrapper .prevBtn').removeClass("prevBtnDisable");
		if(width-641==Math.abs(parseInt($('.slidebanner ul#slideContainer').css("marginLeft"))))
		{
			$('.banner_wrapper .nextBtn').addClass("nextBtnDisable");
		}
		clearTimeout(clearTimerId);
		mantraBannerLooping();
    });
    /* Money Mantra Banner End */
	$('.button').click(function () {
       themebanner();
    });
	
	$('.banner ul li').click(function(){
		if ($(this).children('a').attr('href')=='javascript:;')
		{
			themebanner();
		}
	});
	
	
    if ($("ul#myRoundabout").length != 0) {
        $('ul#myRoundabout').roundabout({ minScale: 0.7, maxScale: 1 });
    }
    /* List Menu */
    /*Select code*/

    $("select").each(function () {
        $(this).find("option").each(function () {
            if ($(this).attr("selected")) {
                //alert($(this).html());
                $(this).parent().prev(".selectedvalue").html($(this).html());
            }
        });
    });
    $("select").change(function () {
        $(this).prev().html($(this).children("option:selected").text());
    });


    /* */
    /* Accordion for Inner pages Bottom Starts */
    $('.accordion h3').click(function () {
        $(this).next('.toggleContent').slideToggle();
        $(this).toggleClass('sel');
    });
    /* Accordion for Inner pages Bottom Ends */

    $('li.sel').prev("li").addClass("last")

    /* Left Menu start */
	$(".contentDiv").children("ul").children("li").each(function() {
		if ($(this).find('ul.sub-level').length != 0)
		{
			$(this).children("a").addClass("sub-level-arrow");
		}
		$(this).find('ul.sub-level-box li:last').addClass('last');
	});
	
	
    $('.contentDiv ul li').hover(
				function () {
				    if ($(".contentDiv ul li").find('ul.sub-level').length != 0)
					{
				        $(this).find('ul.sub-level').show();
					}
				},
				function () {
				    $(this).find("ul.sub-level").hide();
				}
			);
    /* Left Menu End */
    /* Product Menu Start */
    var currLinkHover;
    $('.navigation ul.main-nav li').hover(
					function () {
					    currLinkHover = "#" + $(this).attr("id") + "-menu";
					    $(currLinkHover).show();
					    //$(this).css("background-color","red");
						$(this).addClass("sel");
					},
					function () {
					    $("#" + $(this).attr("id") + "-menu").hide();
					    if ($("#" + $(this).attr("id") + "-menu").css("display") == "none") {
					        //$(this).css("background-color","");
					        $(this).removeClass("sel");
					    }
						if($("#" + $(this).attr("id") + "-menu").length==0)
						{
							$(this).removeClass("sel");
						}
					}
			);

    var currMenuLinkId;
    $('.menu').hover(
				function () {
				    $(this).show();
				    currMenuLinkId = $(this).attr("id");
				    currMenuLinkId = currMenuLinkId.split("-");
				    $(".main-nav").find("#" + currMenuLinkId).addClass("sel"); ;
				},
				function () {
				    $(this).hide();
				    currMenuLinkId = $(this).attr("id");
				    currMenuLinkId = currMenuLinkId.split("-");
				    $(".main-nav").find("#" + currMenuLinkId).removeClass("sel");
				    $(".menu-mid ul.sub-menu").hide();
				    $(".menu-mid ul.main-menu li").removeClass("sel");
				}
			);


    var index;
    var currParentId;
    $('.menu .menu-mid ul.main-menu li').hover(
				  function () {
				      currParentId = $(this).parents(".menu").attr("id");
				      index = $(this).index();
				      $("#" + currParentId + " .menu-mid ul.sub-menu").eq(index).show().siblings(".sub-menu").hide();
				      $(this).addClass('sel').siblings().removeClass("sel");
				      if ($("#" + currParentId + " .menu-mid ul.sub-menu").eq(index).length == 0 || $("#" + currParentId + " .menu-mid ul.sub-menu").eq(index).hasClass("hide")) {
				          $(this).addClass("submenuWithoutMenu");
				      }
				  },
					function () {
					    //$(".menu .menu-mid ul.sub-menu").hide();
					    if ($("#" + currParentId + " .menu-mid ul.sub-menu").eq(index).length == 0 || $("#" + currParentId + " .menu-mid ul.sub-menu").eq(index).hasClass("hide")) {
					        $(this).removeClass("sel submenuWithoutMenu");
					    }
					}
			);


    /* Product Menu End */
    /* Live Rates Start */
    var slideCount = $(".live-rate-slides").find(".slide").length;
    var slideWidth = $(".live-rate-slides").find(".slide").width();
    var slideCtr = 1;

    $("#next-live-rate").click(function () {
		if (parseInt($('.live-rate-slides-content').css("marginLeft")) % 191 == 0)
		{
			if (slideCtr < slideCount) {
				slideCtr += 1;
				$("#prev-live-rate").removeClass("underline_prev");
				var currContainerMrg = parseInt($(".live-rate-slides-content").css("margin-left"));
	
				$(".live-rate-slides-content").animate({ "margin-left": currContainerMrg - slideWidth + "px" });
				if (slideCtr == slideCount) {
					$(this).addClass("underline_next");
				}
			}
		}
    });

    $("#prev-live-rate").click(function () {
		if (parseInt($('.live-rate-slides-content').css("marginLeft")) % 191 == 0)
		{
			if (slideCtr > 1) {
				slideCtr -= 1;
				$("#next-live-rate").removeClass("underline_next");
				var currContainerMrg = parseInt($(".live-rate-slides-content").css("margin-left"));
	
				$(".live-rate-slides-content").animate({ "margin-left": currContainerMrg + slideWidth + "px" });
				if (slideCtr == 1) {
					$(this).addClass("underline_prev");
				}
			}
		}        
    });
    /* Live Rates End */

    $('.get_loan ul li, .detail_container ul.hta-links li, .toggleContent ul li').click(function () {
        var showPopup = $(this).attr('id');
        $('.' + showPopup).fadeIn().siblings('.popup').fadeOut();
        var popupHeight = $('.main-container-inner').height() - 190;
        $("#overlay").css('height', popupHeight + 'px');
        $("#overlay").fadeIn();
        if ($(this).parent().attr('class') == 'hta-links') {
            $('.' + showPopup).css({ "left": $(this).offset().left + "px", "top": $(this).offset().top + 50 + "px" });
        }
        else if ($(this).parents('div').attr('class') == 'get_loan') {
            if ($(this).position().left >= 500) {
                //$('.' + showPopup).css({ "left": "454px", "top": "-50px" });
				$('.' + showPopup).css({ "left": $(this).offset().left - 110 + "px", "top": $(this).offset().top + 50 + "px" });
                $($('.' + showPopup).find(".tlc").addClass("tlc-notch-right"));
            }
            else {
                $('.' + showPopup).css({ "left": $(this).offset().left + "px", "top": $(this).offset().top + 50 + "px" });
            }
        }
       
        $('.thankyou, .error, .divDND').hide();
        $('.popupform').show();
        $('form').clearForm();
        $("html,body").animate({
            scrollTop: $('.' + showPopup).offset().top
        }, 1000);
    });
    $('.close').click(function () {
        $('.popup, #overlay').fadeOut();
        $('form').clearForm();
		$(".fixedBand .container").children("ul").children("li").removeClass("selected");
		$(".fixedBand .container .socialMedia").children("ul").children("li").removeClass("selected");
    });

    /* Form Clear start */
    $.fn.clearForm = function () {
        return this.each(function () {
            var type = this.type, tag = this.tagName.toLowerCase();
            if (tag == 'form')
                return $(':input', this).clearForm();
            if (type == 'text' || type == 'password' || tag == 'textarea')
                this.value = '';
            else if (type == 'checkbox' || type == 'radio')
                this.checked = false;
            else if (tag == 'select')
                this.selectedIndex = -1;
        });
    };
    /* Form Clear end */

    /*** Fixed Footer Popup Functionality starts ***/
    $(".fixedBand .container").children("ul").children("li").find("a").click(function () {
		if($("." + $(this).attr("id")).css("display")=="none")
		{
			//$("." + $(this).attr("id")).slideToggle().css("left", $(this).position().left + "px").siblings("div").not(".socialMedia").not(".footerShowHide").fadeOut();
			$("." + $(this).attr("id")).slideToggle().css("left", $(this).position().left + "px").siblings("div").not(".socialMedia").not(".footerShowHide").hide(500);
			//if($(".socialMedia").children("div").css("display")=="block")
			//{
				$(".socialMedia").children("div").hide();
			//}
			overlay();
			$(this).parents(".container").children("ul").children("li").removeClass("selected");
			$(this).parents(".container").children(".socialMedia").children("ul").children("li").removeClass("selected");
			$(this).parent("li").addClass("selected");
		}
		else
		{
			$("." + $(this).attr("id")).slideToggle();
			$("#overlay").fadeOut();
			$(this).parent("li").toggleClass("selected");
		}
	});

    $(".fixedBand .socialMedia").children("ul").children("li").find("a").click(function () {
		if($("." + $(this).attr("id")).css("display")=="none")
		{
			if($(this).attr("id")!="fixed-band-campaign")
			{
				overlay();
			}
			
			$("."+$(this).attr("id")).slideToggle().css("left",$(this).position().left-30+"px").siblings("div").not(".container").not(".footerShowHide").hide(500);
			$(".fixedBand .container").children(".popup").each(function(){
				if($(this).css("display")=="block")
				{
					$(this).hide();
				}
			});
			$(this).parents(".container").children("ul").children("li").removeClass("selected");
			$(this).parents(".container").children(".socialMedia").children("ul").children("li").removeClass("selected");
			clearTimeout(showFooterBrancCampaign);
		}
		else
		{
			$("." + $(this).attr("id")).slideToggle();
			$("#overlay").fadeOut();
			$(this).parent("li").toggleClass("selected");
		}
	});
    /* Footer Popup tab start */
   $(".detail_container .tab-content-wrapper").children(".tab-content").eq(0).show().siblings().hide();
    $(".tabs").children("li").eq(0).addClass("selected");

    $(".tabs").children("li").click(function () {
        $(this).addClass("selected").siblings().removeClass("selected");
        $(".detail_container .tab-content-wrapper").children(".tab-content").eq($(this).index()).show().siblings().hide();
    });
	
	$(".fixed-band-whatsnew .tab-content-wrapper").children(".tab-content").eq(0).show().siblings().hide();	
	$(".tabs1").children("li").eq(0).addClass("selected");

    $(".tabs1").children("li").click(function () {
        $(this).addClass("selected").siblings().removeClass("selected");
        $(".fixed-band-whatsnew .tab-content-wrapper").children(".tab-content").eq($(this).index()).show().siblings().hide();
    });
	
	
    /* Footer Popup tab End */


    /*** Fixed Footer Popup Functionality ends ***/

    /*** To set Country Cookie for NRI starts ***/
    var countryCookie = $.cookie("setCountry");

    if (location.href.match(/uk/gi) || location.href.match(/singapore/gi) || location.href.match(/middle-east/gi) || location.href.match(/africa/gi) || location.href.match(/euroland/gi) || location.href.match(/usa-canada/gi) || location.href.match(/australia/gi)) {
        if (countryCookie == null) {
            location.href = "/nri/others/others.aspx";
        }
        else {
            if ((location.href.indexOf(countryCookie)) == -1) {
                location.href = "/nri/" + countryCookie + "/" + countryCookie + ".aspx";
            }
            $("#country_dropdown").children("option").each(function () {
                if ($(this).attr("id") == countryCookie) {
                    $(this).attr("selected", "selected").siblings().removeAttr("selected", "selected");
                    $(this).parent().prev(".selectedvalue").html($("#country_dropdown option:selected").html());
                    //alert($("#country_dropdown option:selected").html());
                }
            });
        }
    }
    else if (location.href.match(/others/gi)) {
        if (countryCookie != null) {
            if ((location.href.indexOf(countryCookie)) == -1) {
                location.href = "/nri/" + countryCookie + "/" + countryCookie + ".aspx";
            }
            $("#overlay").hide();
            $(".nrilightbox").hide();
        }
        else {
            if (location.href.match(/others.aspx/gi)) {
                //location.href="/nri/usa-canada/usa-canada.aspx";
                $("#overlay").show(500);
                //var overlayHeight = $('.main-container, .main-container-inner').height() - 190;
				var overlayHeight = $(window).height();
                $("#overlay").css({"height":overlayHeight + "px","top":"0","position":"fixed"});
				$(".header").css("z-index","3");
                $('.nrilightbox').show(900);
			}
            else {
                location.href = "/nri/others/others.aspx";
            }
        }
    }

    $(".nrilightboxcontent").children("ul").children("li").click(function () {
        $.cookie("setCountry", $(this).attr("id"), { expires: 365 * 10, path: '/' });
    });

    $("#country_dropdown").change(function () {
        $.cookie("setCountry", $("#country_dropdown option:selected").attr("id"), { expires: 365 * 10, path: '/' });
        location.href = "/nri/" + $("#country_dropdown option:selected").attr("id") + "/" + $("#country_dropdown option:selected").attr("id") + ".aspx";
    });

    //alert($.cookie("setCountry"));

    $(".reset-nri").click(function () {
        $.cookie("setCountry", $.cookie("setCountry"), { path: '/', expires: -5 });
    });
    /*** To set Country Cookie for NRI ends ***/
    //			$('.LBD_CaptchaDiv').attr('style', 'width:230px;');
    //			$('.LBD_CaptchaImageDiv').attr('style', 'width:200px;');


    /** Show Hide Fixed Band starts **/
    //$("")
    /** Show Hide Fixed Band ends **/

    /** Hide the lightbox and overlay when clicked anywhere in the document starts **/
    $("#overlay,.footer").click(function () {
        if ($("#overlay").css("display") == "block") {
            $("#overlay").fadeOut();
            $('.themecontainer').slideUp(400);
            $(".popup").hide();
			$(".fixedBand ul,.fixedBand .socialMedia ul").children("li").removeClass("selected");
			if($(".nrilightbox").length)
			{
				$(".nrilightbox").hide();
				$.cookie("setCountry","others",{expires: 365 * 10,path: '/'});
			}
        }
    });
    /** Hide the lightbox and overlay when clicked anywhere in the document ends **/
	
	/** Internet Banking Dropdown starts **/
    $(".selectbg").next("img").click(function () {
        if ($(this).prev().children("select").children("option:selected").val() == "Personal Banking") {
            location.href = "/pre-login/internetbanking_prelogin.aspx";
        }
        else if ($(this).prev().children("select").children("option:selected").val() == "Corporate Banking") {
            location.href = "/pre-login/business-internetbanking_prelogin.aspx";
        }
        else if ($(this).prev().children("select").children("option:selected").val() == "Premium Banking") {
            location.href = "/pre-login/internetbanking_prelogin.aspx";
        }
        else if ($(this).prev().children("select").children("option:selected").val() == "Speed Banking") {
            location.href = "/pre-login/internetbanking_prelogin.aspx";
        }
    });
    /** Internet Banking Dropdown ends **/

    /** Print Click Functionality starts **/
    $(".print").click(function () {
        window.print();
    });
    /** Print Click Functionality ends **/

    /** Global Search Functionality Search starts here **/
    $(".header").find(".topright-nav").find(".search").find("input").click(function () {
        $(this).val('');
    });

    $(".header").find(".topright-nav").find(".search").find("input").blur(function () {
        if ($(this).val() == "Looking for Something" || $(this).val() == "") {
            $(this).val("Looking for Something");
        }
    });
    /** Global Search Functionality Search ends here **/

    /** Hiding How to Apply starts **/
   /* $(".detail_container .left ul li").each(function () {
        if ($(this).children("a").html().replace(/ /g, '') == "Howtoapply") {
            $(this).hide();
        }
    });*/
    /** Hiding How to Apply ends **/
	
	/** Hiding How to Comments starts **/
	$(".detail_wrap ul").children("li").eq(1).show();
	/** Hiding How to Comments ends **/

    /** Title Replacement starts **/
    //alert($("title").html());
    /*if($("title").html().replace(/ /g,'')=="YETTOBERECEIVED")
    {*/
    //$("title").html($("h1").html());
    /*}*/
    /** Title Replacement ends **/

    /** Alternate Row Color in Tables starts **/
    $(".detail_container").children(".right").find("table tr").each(function () {
        if ($(this).index() % 2 == 0) {
            $(this).children("td").css("background-color", "#f8f6f7");
        }
    });
	
	$(".contain-right").find("table tr").each(function () {
        if ($(this).index() % 2 == 0) {
            $(this).children("td").css("background-color", "#f8f6f7");
        }
    });
	
    /** Alternate Row Color in Tables ends **/
	
	/** Hide all inputs with type hidden for FF 3.5 starts **/
	$("input[type='hidden']").each(function(){
		$(this).addClass("hideInputTypeHidden");
	});
	/** Hide all inputs with type hidden for FF 3.5 ends **/
	
	/** Highlighting the section in the Main NAV on basis of the breadcrumbs starts **/	
	$(".main-nav").children("li").each(function(){
		if($(".breadcrums").length)
		{
			if($(this).children("span").eq(0).text()==$(".breadcrums ul").children("li").eq(1).text())
			{
				$(this).addClass("currentActive");
			}
			else if($(this).children("span").eq(0).children("a").text()==$(".breadcrums ul").children("li").eq(1).text())
			{
				$(this).addClass("currentActive");
			}
			else if($(this).children("span").eq(0).text()==$(".breadcrums ul").children("li").eq(1).children("a").text())
			{
				$(this).addClass("currentActive");
			}
			
			if($(this).children("span").eq(0).children("a").text()!="" || $(".breadcrums ul").children("li").eq(1).children("a").text()!="")
			{
				if($(this).children("span").eq(0).children("a").text()==$(".breadcrums ul").children("li").eq(1).children("a").text())
				{
					$(this).addClass("currentActive");
				}
			}
		}
	});
	
	$(".topright-nav .quickLinks ul").children("li").each(function(){
		if($(".breadcrums").length)
		{
			if($(this).children("a").text()==$(".breadcrums ul").children("li").eq(1).text())
			{
				$(this).addClass("currentActive");
			}
		}
	});
	/** Highlighting the section in the Main NAV on basis of the breadcrumbs ends **/
	
	/** Keep the personalize band open if cookie exists starts **/
	if($.cookie("CustHome") && $.cookie("CustHome")!="personal/index")
	{
		if($('.themecontainer').length)
		{
			var overlayHeight = $('.main-container, .main-container-inner').height() - 190;
			$("#overlay").css('height', overlayHeight + 'px');
			$('.themecontainer').slideDown();
			$("#overlay").show(500);
		}
	}
	/** Keep the personalize band open if cookie exists ends **/
	
	/** fbShare functionality on Money Mantra Banner starts **/
	var hostLocation=document.location.host;
	
	if(location.href.match(/money-mantra/gi))
	{
		$(".slidebanner ul#slideContainer").children("li").each(function(){
			$(this).find(".fshare").attr("href","http://www.facebook.com/sharer.php?u=http://" + hostLocation + $(this).children("p").children("span").eq(0).children("a").eq(0).attr("href")+"&src=sp");
		});
	}
	/** fbShare functionality on Money Mantra Banner ends **/
	
	/** Toggle Show/Hide Fixed Band Footer starts **/
	$(".footerShowHide").click(function(){
		$(this).parents(".fixedBand").slideToggle();
		$(".fixedBandForShow").slideToggle();
	});
	
	$(".footerHide").click(function(){
		$(this).parents(".fixedBandForShow").slideToggle();
		$(".fixedBand").slideToggle();
	});
	/** Toggle Show/Hide Fixed Band Footer ends **/
	
	/** Auto scrolling functionality of main banner starts **/
	bannerLooping();
	/** Auto scrolling functionality of main banner ends **/
	/** Auto scrolling functionality of Money Mantra main banner starts **/
	mantraBannerLooping();
	/** Auto scrolling functionality of Money Mantra main banner ends **/
	
	/** Personalized theme band starts **/
	$(".themecontainer .theme").children("li").each(function() {
		if($(this).hasClass("cursornormal"))
		{
			if($(".themecontainer .right-link").children(".reset").length)
				$(".themecontainer .right-link").children(".reset").css("display","block");
			else
				$(".themecontainer .right-link").children(".reset-nri").css("display","block");
		}
	});
	/** Personalized theme band ends **/
	
	/** Showing Brand Campaign on Page Load starts **/
	setTimeout("showFooterBrancCampaign()",1000);	
	//setTimeout("hideFooterBrancCampaign()",10000);
	/** Showing Brand Campaign on Page Load ends **/
	
	if($(".themecontainer").css("display")=="block")
	{
		setTimeout("autoHidePersonalizedBar()",5000);
	}
	
	$(".country .india").click(function(){
		$(".country .hongkong").slideToggle();
	});
});


/** Auto Hide Persoanlized Bar After 5 secs starts **/
function autoHidePersonalizedBar()
{
	$('.themecontainer').slideUp(400);
	$("#overlay").fadeOut();
}
/** Auto Hide Persoanlized Bar After 5 secs ends **/

/** Showing Brand Campaign on Page Load starts **/
function showFooterBrancCampaign()
{
	$('.fixed-band-campaign').css({'left':'355px','bottom':'-10px'}).slideToggle();
	$(".footer-our-brand-txt").addClass("selected");
}

function hideFooterBrancCampaign()
{
	$(".fixed-band-campaign").slideToggle();
	$("#overlay").fadeOut();
	$(".footer-our-brand-txt").removeClass("selected");
}
/** Showing Brand Campaign on Page Load ends **/


/*** Get focus on results on Branch Locator Page starts ***/
function onClickSubmitFocus()
{
	$("html,body").animate({
		scrollTop:$(".search_results").offset().top
	},1000)
}
/*** Get focus on results on Branch Locator Page ends ***/

/** Main banner looping functionality starts **/
var alertTimerId = 0;
function bannerCarousel() {
	if ($(".banner").find(".slidebanner").children("ul").find("li").length > 1)
	{
 		//if(Math.abs(parseInt($('.slidebanner ul#slideContainer').css("marginLeft")))==1956)
		if(Math.abs(parseInt($('.slidebanner ul#slideContainer').css("marginLeft")))==$(".banner").find(".slidebanner").children("ul").find("li").length*978-978)
		{
			$('.slidebanner ul#slideContainer').animate({"marginLeft":"0px"});
			$('.banner .prevBtn').addClass("prevBtnDisable");
			$('.banner .nextBtn').removeClass("nextBtnDisable");
		}
		else
		{
			var currMargin=parseInt($('.slidebanner ul#slideContainer').css("marginLeft"));
			$('.slidebanner ul#slideContainer').animate({"marginLeft":currMargin-978+"px"});
			$('.banner .prevBtn').removeClass("prevBtnDisable");
		}
		
		if(Math.abs(parseInt($('.slidebanner ul#slideContainer').css("marginLeft")))==978)
		{
			$('.banner .nextBtn').addClass("nextBtnDisable");
		}
	}
	bannerLooping();	
}

function bannerLooping()
{	
	alertTimerId=setTimeout("bannerCarousel()",5000);
}
/** Main banner looping functionality ends **/

/** Money Mantra Main banner looping functionality starts **/
var clearTimerId = 0;
var counter=1;
function mantraBannerCarousel() {	
	if ($(".banner_wrapper").find(".slidebanner").children("ul").find("li").length > 1)
	{
 		if(Math.abs(parseInt($('.slidebanner ul#slideContainer').css("marginLeft")))==$(".banner_wrapper").find(".slidebanner").children("ul").find("li").length*641-641)
		{
			$('.slidebanner ul#slideContainer').animate({"marginLeft":"0px"});
			$('.banner_wrapper .prevBtn').addClass("prevBtnDisable");
			$('.banner_wrapper .nextBtn').removeClass("nextBtnDisable");
			counter=1;
			$(".slidebanner .feauturedArticle").children("span").html(counter);
		}
		else
		{
			if($(".feauturedArticle").children("span").html()<4)
			{
				counter+=1;
			}
			var currMargin=parseInt($('.slidebanner ul#slideContainer').css("marginLeft"));
			$('.slidebanner ul#slideContainer').animate({"marginLeft":currMargin-641+"px"});
			$('.banner_wrapper .prevBtn').removeClass("prevBtnDisable");
			$(".slidebanner .feauturedArticle").children("span").html(counter);
		}
		
		if(Math.abs(parseInt($('.slidebanner ul#slideContainer').css("marginLeft")))==1282)
		{
			$('.banner_wrapper .nextBtn').addClass("nextBtnDisable");
		}
	}
	mantraBannerLooping();
}

function mantraBannerLooping()
{	
	clearTimerId=setTimeout("mantraBannerCarousel()",5000);
}
/** Money Mantra Main banner looping functionality ends **/

function overlay(){
	var overlayHeight = $('.main-container, .main-container-inner').height() - 190;
	$("#overlay").css('height', overlayHeight + 'px');	
	$("#overlay").fadeIn();
}
	
function themebanner() {	
	if ($('.themecontainer').css("display") == 'none') {
		$('.themecontainer').slideDown();
		//$(this).parent().parent().parent().css('backgroundPosition', '0 0');	
		overlay();
		$(".button span").addClass("open").removeClass("close");
		
	}
	else {
		$('.themecontainer').slideUp(400);
		//$(this).parent().parent().parent().css('backgroundPosition', '0 -120px');
		$("#overlay").fadeOut();
		$(".button span").addClass("close").removeClass("open");
	}
}
