$(document).ready(function () {
    $('.arrows').cycle({
        fx: 'fade',
        speed: 'slow',
        timeout: 5000,
        next: '#nextslide',
        prev: '#prevslide'
    });
	 $('#largebanner').cycle({ 
    fx:     'scrollHorz', 
    speed:  'slow', 
    timeout: 6000, 
    speedIn: 500,
    speedOut:500,  
    cleartypeNoBg: true,
    pager:  '.bannav',
    pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '.bannav li:eq(' + (idx) + ') ';
    } 
});




 
    var fboxheight2 = $('.fboxsignup').height() / 2;
    $('.signupbtn').click(function () {
	signupvalue = $('.fieldbuttonnews input').val();
	$('#signupemail').val(signupvalue);
	

        $('body').append('<div id="overlay"></div>');
        $('#overlay').fadeTo("slow", 0.7);
        $('#overlay').css('height', $(document).height());
        $('#overlay').css('opacity', 0).fadeTo('fast', 0.7)
        $('.fboxsignup').animate({ "opacity": "show" }, 500);
        $('.fboxsignup').css('marginTop', -fboxheight2);
        if ($('#overlay').is(':visible')) {
            $('#overlay').click(function () {
                $('#overlay').fadeOut('fast', function () { $(this).remove(); });
                $('.fboxsignup').animate({ "opacity": "hide" }, 500);
            });
        };
        $('body,html').animate({scrollTop:0},1500);
    });
    $('.closefbox').click(function () {
        $('#overlay').fadeOut('fast', function () { $(this).remove(); });
        $('.fboxsignup').animate({ "opacity": "hide" }, 500);
    });






    $('.tabs').cycle({
        fx: 'fade',
        speed: 'slow',
        after:
function onAfter(curr, next, opts, fwd) {
    var $ht = $(this).height();

    //set the container's height to that of the current slide
    $(this).parent().animate({ height: $ht });
}
,

        speed: 'slow',
        timeout: 0,
        cleartypeNoBg: true,
        pager: '.tabs_nav',
        pagerAnchorBuilder: function (idx, slide) {
            // return sel string for existing anchor
            return '.tabs_nav li:eq(' + (idx) + ') a';
        }
    });
    var myIndex = $('.tabs_nav li.SelectedSlidehere').prevAll().length;
    $('.tabs').cycle(myIndex);
    $('.internaltabcontent').cycle({
        fx: 'fade',
        speed: 'slow',
        after:
function onAfter(curr, next, opts, fwd) {
    var $ht = $(this).height();

    //set the container's height to that of the current slide
    $(this).parent().animate({ height: $ht });
}
,
        speed: 'slow',
        timeout: 0,
        cleartypeNoBg: true,
        pager: '.internaltab',
        pagerAnchorBuilder: function (idx, slide) {
            // return sel string for existing anchor
            return '.internaltab li:eq(' + (idx) + ') a';
        }
    });

  

    $('#banner').jqFancyTransitions({
        effect: 'wave',
        width: 636,
        height: 250,
        strips: 20,
        delay: 5000,
        stripDelay: 50,
        links: true
    });

    $('.accounttog li').click(function () {
        $(this).find('.accounttogcon').slideToggle('show');
        if ($(this).hasClass('closeaccount')) {
            $(this).removeClass('closeaccount');
        }
        else {
            $(this).addClass('closeaccount');
        }
    });

    /*///////////////////////////////////////*/
    //Set default open/close settings
    $('.acc_container').hide(); //Hide/close all containers
    $('.acc_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container

    //On Click
    $('.acc_trigger').click(function () {
        if ($(this).next().is(':hidden')) { //If immediate next container is closed...
            $('.acc_trigger').removeClass('active').next().slideUp(); //Remove all .acc_trigger classes and slide up the immediate next container
            $(this).toggleClass('active').next().slideDown(); //Add .acc_trigger class to clicked trigger and slide down the immediate next container
        }
        return false; //Prevent the browser jump to the link anchor
    });
    /*/////////////////////////////////////*/

    $("#nav li div.submenudiv").each(function () {
        var widthmenu = $(this).width();
        var numItems = $(this).find('div.submenuholder').length;
        if (numItems >= 2) { $(this).width(widthmenu * numItems); } else {
            $('this').width(widthmenu);
        }
    });

    if ($.browser.msie && $.browser.version <= 8) { }
    else {
        $("#nav div.submenuholder ").css({ display: "none" }); // Opera Fix
        $("#nav li").hover(function () {
            $(this).find('div.submenuholder ').css({ visibility: "visible", display: "none" }).show(400);
        }, function () {
            $(this).find('div.submenuholder ').css({ visibility: "hidden" });
        });
    };

    $("#nav li span").eq(4).parent().parent().find('div.submenudiv').css({ 'left': '-518px', 'width': '948px' }).find('div.submenuholder').css({ 'width': '203px' });

    function Gototop() {
        if ($.browser.safari) { bodyelem = $("body") } else { bodyelem = $("html") } bodyelem.animate({ scrollTop: 0 }, 500);
    };
    var fboxheight = $('.fbox').height() / 2;
    $('.requestlink').click(function () {
        $('body').append('<div id="overlay"></div>');
        $('#overlay').fadeTo("slow", 0.7);
        $('#overlay').css('height', $(document).height());
        $('#overlay').css('opacity', 0).fadeTo('fast', 0.7)
        $('.fbox').animate({ "opacity": "show" }, 500);
        $('.fbox').css('marginTop', -fboxheight);
        if ($('#overlay').is(':visible')) {
            $('#overlay').click(function () {
                $('#overlay').fadeOut('fast', function () { $(this).remove(); });
                $('.fbox').animate({ "opacity": "hide" }, 500);
            });
        };
        Gototop();
    });
    $('.closefbox').click(function () {
        $('#overlay').fadeOut('fast', function () { $(this).remove(); });
        $('.fbox').animate({ "opacity": "hide" }, 500);
    });
    $(".account li").filter(function (idx) {
        return (idx % 2) == 1
    }).addClass('useleft');
    $(".account li").filter(function (idx) {
        return (idx % 2) != 1
    }).addClass('useright');

});

$(document).ready(function() {


$('.slider').cycle({ 
    fx:     'fade', 
    speed:  'slow', 
    timeout: 0, 
    cleartypeNoBg: true,
    pager:  '#pagerrfxt',
    pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '#pagerrfxt li:eq(' + (idx) + ') a';
    }
    });
    var myIndex2 = $('#pagerrfxt li.SelectedTab').prevAll().length;
    $('.slider').cycle(myIndex2);

$('.slider12').cycle({ 
    fx:     'fade', 
    speed:  'slow', 
    timeout: 0, 
    cleartypeNoBg: true,
    pager:  '#pagerrfxtta',
    pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '#pagerrfxtta li:eq(' + (idx) + ') a';
    } 
});



});

$(document).ready(function(){
	
		$("#trigger").click(function () {
$("#toggle_container").slidetoggle("slow");
 $("#toggle_container2").hide();
  $("#toggle_container3").hide();
    $("#toggle_container4").hide();
      $("#toggle_container5").hide();

});
		$("#trigger2").click(function () {
$("#toggle_container2").toggle("slow");
 $("#toggle_container").hide();
  $("#toggle_container3").hide();
   $("#toggle_container4").hide();
      $("#toggle_container5").hide();

});
		$("#trigger3").click(function () {
$("#toggle_container3").toggle("slow");
 $("#toggle_container2").hide();
 $("#toggle_container").hide();
  $("#toggle_container4").hide();
      $("#toggle_container5").hide();

 });
	$("#trigger4").click(function () {
$("#toggle_container4").toggle("slow");
 $("#toggle_container").hide();
 $("#toggle_container2").hide();
  $("#toggle_container3").hide();
      $("#toggle_container5").hide();

 });
$("#trigger5").click(function () {
$("#toggle_container5").toggle("slow");
 $("#toggle_container").hide();
 $("#toggle_container2").hide();
  $("#toggle_container3").hide();
      $("#toggle_container4").hide();

 });



function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
return false;
}




});



$(document).ready(function() {

			$('.expand').click(function(){
				$(this).parent().find('.links').slideToggle('show');
	if($(this).hasClass('closeexpand'))
	{
	$(this).removeClass('closeexpand');
	}
	else
	{
	$(this).addClass('closeexpand');
	}

						});

});


