var opera = (navigator.appName.indexOf("Opera") != -1) ? true : false;
var firefox = navigator.userAgent.toLowerCase(); 
    firefox = (firefox.indexOf("firefox") != -1) ? true : false;
var safari = navigator.userAgent.toLowerCase();
    safari = (safari.indexOf("safari") != -1) ? true : false;
var chrome = navigator.userAgent.toLowerCase();
    chrome = (chrome.indexOf('chrome') != -1) ? true : false;
var msie_only = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
var msie_old = false; // MSIE older than 7.0
var msie_80  = false; // MSIE 8.0 or newer
var msie_70  = false; // MSIE 7.0
var msie_60  = false; // MSIE 6.0
var msie_55  = false; // MSIE 5.5

if (msie_only) {
  fullVerStr = navigator.appVersion;
  verStr = fullVerStr.substring(fullVerStr.indexOf('MSIE')+4,fullVerStr.length);
  verStr = verStr.substring(0,verStr.indexOf(';'));
  msie_old = (parseFloat(verStr) <  7.0) ? true : false;
  msie_80  = (parseFloat(verStr) >= 8.0) ? true : false;  
  msie_70  = (parseFloat(verStr) == 7.0) ? true : false;
  msie_60  = (parseFloat(verStr) == 6.0) ? true : false;
  msie_55  = (parseFloat(verStr) == 5.5) ? true : false;
}

document.writeln('<style type="text/css">\n/*<![CDATA[*/\n');
  if (msie_old) {
    document.writeln(".ForJSBubble  {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/speech-bubble4.png', sizingMethod='scale');}\n");
    document.writeln(".ForJSBubble2 {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/speech-bubble4v2.png', sizingMethod='scale');}\n");
    document.writeln(".ForJSBubble3 {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/speech-bubble4v3.png', sizingMethod='scale');}\n");
    document.writeln(".ForJSBubble4 {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/speech-bubble4v4.png', sizingMethod='scale');}\n");
    
    document.writeln("#ForJSWelcomeGreen         {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-green-120px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSWhyBudgensGreen      {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-green-149px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSOurOfferGreen        {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-green-120px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSWorkingTogetherGreen {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-green-170px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSYourPlansGreen       {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-green-149px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSTheFactsGreen        {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-green-120px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSIndustryNewsGreen    {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-green-149px.png', sizingMethod='scale');}\n");

    document.writeln("#ForJSWelcomeWhite         {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-white-120px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSWhyBudgensWhite      {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-white-149px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSOurOfferWhite        {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-white-120px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSWorkingTogetherWhite {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-white-170px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSYourPlansWhite       {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-white-149px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSTheFactsWhite        {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-white-120px.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSIndustryNewsWhite    {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/tab-white-149px.png', sizingMethod='scale');}\n");
    
    
    document.writeln("#ForJSPopUpTop {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/pop-up-box-top.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSPopUpBottom {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/pop-up-box-bottom.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSPopUpTop2 {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/pop-up-box-top.png', sizingMethod='scale');}\n");
    document.writeln("#ForJSPopUpBottom2 {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/pop-up-box-bottom.png', sizingMethod='scale');}\n");

    document.writeln(".PlaylistTop .RoundBottom {bottom:15px}\n");
    document.writeln(".RoundTop span {right:-1px}\n");
    document.writeln(".RoundBottom span {right:-1px}\n");
    document.writeln(".AnimBox div {right:-520px}\n");



    document.writeln(".MainDiv .Content .InnerContent1 {height:400px;}\n");
    document.writeln(".MainDiv .Content .InnerContent2 {height:400px;}\n");
    document.writeln(".MainDiv .Content .InnerColumn1 {height:400px;}\n");
    document.writeln(".MainDiv .Content .InnerColumn2 {height:400px;}\n");
    document.writeln(".IEcorrection1  {margin-bottom:-3px;}\n");
    document.writeln("#ForJSBarTop    {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/bar-top.png', sizingMethod='scale');}\n");
    document.writeln("#ForJsBarBottom {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/bar-bottom.png', sizingMethod='scale');}\n");
    document.writeln(".NewsList {height:430px;}\n");
  }
  if (msie_80) {
  }
  if (msie_70) {
      document.writeln(".IEcorrection1  {margin-bottom:-3px;}\n");
  }
  if (msie_only) {
  }
  if (opera) {
    document.writeln('.Radio, .CheckBox {margin-left:3px; margin-right:0px;}\n');
  }
  if (firefox) {
    document.writeln('.Radio, .CheckBox {margin:4px; margin-right:3px; top:2px;}\n');
  }
  if (safari) {
    document.writeln('.Radio, .CheckBox {margin:4px; margin-right:2px; top:1px;}\n'); 
  }
  if (chrome) {
    //document.writeln('body {background-color:lime;}\n');
  }
document.writeln('/*]]>*/\n</style>\n');

function clearField (field_to_clear, initial_value) {
  if (initial_value == field_to_clear.value) field_to_clear.value="";
} 

function fillField (field_to_clear, initial_value) {
  if (field_to_clear.value == "") field_to_clear.value=initial_value;
}

//information box on validation image rollover
function validationInfo(operation, img_ref){
  if(operation == "show") {
    if (img_ref.alt.length > 0) img_ref.previousSibling.innerHTML = img_ref.alt;
    img_ref.alt = "";
    img_ref.previousSibling.style.display = "block";
  }
  if(operation == "hide") img_ref.previousSibling.style.display = "none";
}

//Limits length of text in textarea "element" (dom reference), writes information in "info" (id), counts characters
function checkLength(element, info, max_length){
  var actual_length = element.value.length;
  var characters_left = max_length - actual_length;
  if (characters_left < 0) characters_left = 0;

  if (actual_length == 0) {
    document.getElementById(info).innerHTML="Maximum text length is "+ max_length +" characters.";
  }
  if ((actual_length > 0)&&(actual_length <= max_length)) {
    document.getElementById(info).innerHTML="You may enter "+ characters_left +" more characters.";
  }
  if (actual_length > max_length) {
    element.value = element.value.substr(0, max_length);
    document.getElementById(info).innerHTML="You may enter "+ characters_left +" more characters.";
  }
}

//init a textarea, textarea_container - id, for charaacters limit
function initLengthInfo(textarea_container, info_id, max_length) {
  if (document.getElementById(textarea_container)) {
    element_ref = document.getElementById(textarea_container).getElementsByTagName("textarea")[0];
    checkLength(element_ref, info_id, max_length);
  }
}

//replaces the image with a spacer, id on the image tag or on parent element
function CorrectPngForIE6(id_or_parent_id) {
  if (msie_old) {
    var img_ref;
    if (document.getElementById(id_or_parent_id).nodeName.toLowerCase() == "img") {
      img_ref = document.getElementById(id_or_parent_id);
    } else {
      img_ref = document.getElementById(id_or_parent_id).getElementsByTagName("img")[0];
    }
    img_ref.src = "/images/spacer.gif";
   }
 }

 function CorrectPngForIE6v2(image_class) {
   if (msie_old) {

     $('".' + image_class + '"').attr("src","/images/spacer.gif")

   }
 }



//show single element with given id
function show(id_show, type) {
  switch (type) {
    case 'fade':
      $('#' + id_show).fadeIn(200);
    break;
    case 'slide':
      $('#' + id_show).slideDown(200);
    break;
    case 'blink':
      $('#' + id_show).show();
    break;
  }
}

//hide single element with given id
function hide(id_hide, type) {
  switch (type) {
    case 'fade':
      $('#' + id_hide).fadeOut(10);
    break;
    case 'slide':
      $('#' + id_hide).slideUp(10);
    break;
    case 'blink':
      $('#' + id_hide).hide();
    break;
  }
}


// hide 0 or more elements and show 0 or more oter elements, indicated by id
// css width property is required for every switchable element. Can be in pixels or percents
// use example1: hideShowList(["id1","id2","id3"],["id6"], fade);
// use example2: hideShowList(["-"],["id6","id7","id8"], blink);
function hideShowList(hide_array, show_array, type) {
  if (hide_array[0] != '-') {
    for(var i=0; i<hide_array.length; i++) {
      hide(hide_array[i], type);
    }
  }
  
  if (show_array[0] != '-') {
    for(var i=0; i<show_array.length; i++) {
      show(show_array[i], type);
    }
  }
}

function openWindow(url, name) {
  var win = window.open(url, name, "toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=884,height=608,top=70,left=70");
  win.focus();
}

var preloadArray = new Array();
function preloadPopupImages() {
	preloadArray[0] = new Image();
	preloadArray[0].src = "/images/pop-up-box-middle.gif";
	preloadArray[1] = new Image();
	preloadArray[1].src = "/images/pop-up-budgens.gif";
	preloadArray[2] = new Image();
	preloadArray[2].src = "/images/button-1-left-end.gif";
	preloadArray[3] = new Image();
	preloadArray[3].src = "/images/button-1-right-end.gif";	
	preloadArray[4] = new Image();
	preloadArray[4].src = "/images/button-1-centre.gif";
}

function BlackOut(){
  var body_width = $("body").width();
  if (body_width < 998) {body_width = 998;}
  var body_height = $(document).height();
  var login_pos = parseInt(body_width/2) - 252;

  if (msie_old) $("select").css({visibility:"hidden"});

  //show the Thank You box
  $(".CoverLayer")
    .css({width:body_width, height:body_height, opacity:0, display:"block"})
    .animate({opacity:0.7}, 900, function(){
       $("#ThankYouBox").css({left:login_pos}).slideDown(300);
  });

  //hide Thank You box / show Win Box
  $("#ThankYouBoxClose").click(function(){
    $("#ThankYouBox").slideUp(300, function(){
      $("#WinBox").css({left:login_pos}).slideDown(300);
     });
  });

  //hide Win Box
  $("#WinBoxClose").click(function(){
    $("#WinBox").slideUp(300, function(){
      $(".CoverLayer").animate({opacity:0}, 500, function(){
        $(".CoverLayer").css({display:"none"});
        if (msie_old) $("select").css({visibility:"visible"});
       });
     });
  });
     
  $(window).resize(function(){
    var body_width = $("body").width();
    if (body_width < 998) {body_width = 998;}
    var body_height = $(document).height();
    var login_pos = parseInt(body_width/2) - 252;
    $(".CoverLayer").css({width:body_width, height:body_height});
    $("#ThankYouBox").css({left:login_pos});
    $("#WinBox").css({left:login_pos});
  });
}

function BlackOut2() {
    var body_width = $("body").width();
    if (body_width < 998) { body_width = 998; }
    var body_height = $(document).height();
    var login_pos = parseInt(body_width / 2) - 252;

    if (msie_old) $("select").css({ visibility: "hidden" });

    //show the box
    $(".CoverLayer")
    .css({ width: body_width, height: body_height, opacity: 0, display: "block" })
    .animate({ opacity: 0.7 }, 900, function() {
        $("#ThankYouBox").css({ left: login_pos }).slideDown(300);
    });

    //hide the box
    $("#ThankYouBoxClose").click(function() {
    $("#ThankYouBox").slideUp(300, function() {
            $(".CoverLayer").animate({ opacity: 0 }, 500, function() {
                $(".CoverLayer").css({ display: "none" });
                if (msie_old) $("select").css({ visibility: "visible" });
            });
        });
    });

    $(window).resize(function() {
        var body_width = $("body").width();
        if (body_width < 998) { body_width = 998; }
        var body_height = $(document).height();
        var login_pos = parseInt(body_width / 2) - 252;
        $(".CoverLayer").css({ width: body_width, height: body_height });
        $("#ThankYouBox").css({ left: login_pos });
    });
}


function checkYourPlan(ddlist_ref) {
  if (ddlist_ref.options[1].selected == true) {
    $("#ForJSAdditionalInfo").parent().slideDown();
  } else {
    $("#ForJSAdditionalInfo").parent().slideUp();
  }
}

//Video
var player = null;

function playerReady(thePlayer) {
  player = window.document[thePlayer.id];
  addListeners();
}

function loadFile(theFile) {
  currentItem = -1;
  previousItem = -1;
  player.sendEvent('LOAD', theFile);
}

function createPlayer(theFile) {
  swfobject.embedSWF("flash/player.swf", "FlashContent2", "362", "255", "8.0.22", "", { screencolor: "FFFFFF", autostart: "false", file: theFile, controlbar: "none", frontcolor: "89AB48" }, { allowfullscreen: "true", wmode: "opaque", allowscriptaccess: "always" }, { id: "player1", name: "player1" });
}

function initVideo(){
  createPlayer('playlist.xml')
}



/*RYANS SCRIPT*/

var timer;
var benefit_init = 0;

var benefit_timers = new Array()
benefit_timers[0] = -2
benefit_timers[1] = -2
benefit_timers[2] = -2
benefit_timers[3] = -2
benefit_timers[4] = -2
benefit_timers[5] = -2

function benefitsShow(hover_index) {
  clearTimeout(timer);

  if ($(".SpeechBubblesBottom .PopupBubble").eq(hover_index).is(":hidden")) {

    benefit_timers[0] = -2;
    benefit_timers[1] = -2;
    benefit_timers[2] = -2;
    benefit_timers[3] = -2;
    benefit_timers[4] = -2;
    benefit_timers[5] = -2;
    benefit_init = parseInt(hover_index) + 1;
    $(".SpeechBubblesBottom .PopupBubble").fadeOut(100)
    $(".Bubble1,.Bubble2,.Bubble3,.Bubble4").fadeOut(100)
    $(".SpeechBubblesBottom .PopupBubble").eq(hover_index).fadeIn(100)
    $(".SpeechBubblesBottom .PopupBubble").eq(hover_index).find(".Bubble1,.Bubble1v2,.Bubble2,.Bubble2v2,.Bubble3,.Bubble4").fadeIn(100)
  }
  benefitsTimer();
  }

function benefitsTimer() {
  if (benefit_init == 1) {
  if(benefit_timers[0] == -2){
  $(".PopupBubble").eq(0).find(".BubbleImage").css("opacity","0");
  $(".PopupBubble").eq(0).find(".BubbleImage").animate({ opacity: "0" }, 600).animate({ opacity: "1" }, 500);
  benefit_timers[0]++
  benefitsTimer()
  clearTimeout(timer);
  }
  else if (benefit_timers[0] == -1) {
  benefit_timers[0]++;
  $(".PopupBubble").eq(0).find(".BubbleImage").css("display","block");
  $(".PopupBubble").eq(0).find(".BubbleImage").eq(benefit_timers[0]).css("display", "none");
  }
  else if (benefit_timers[0] < 3) {
    benefit_timers[0]++;
    $(".PopupBubble").eq(0).find(".BubbleImage").fadeIn(300);
    $(".PopupBubble").eq(0).find(".BubbleImage").eq(benefit_timers[0]).fadeOut(300);

  }
  else {
  benefit_timers[0] = 0;
  $(".PopupBubble").eq(0).find(".BubbleImage").fadeIn(300);
  $(".PopupBubble").eq(0).find(".BubbleImage").eq(benefit_timers[0]).fadeOut(300);
  }
  }
  if (benefit_init == 2) {
  if (benefit_timers[1] == -2) {
  $(".PopupBubble").eq(1).find(".BubbleImage").css("opacity", "0");
  $(".PopupBubble").eq(1).find(".BubbleImage").animate({ opacity: "0" }, 600).animate({ opacity: "1" }, 500);
  benefit_timers[1]++
  benefitsTimer()
  clearTimeout(timer);
  }
  else if (benefit_timers[1] == -1) {
  benefit_timers[1]++;
  $(".PopupBubble").eq(1).find(".BubbleImage").css("display", "block");
  $(".PopupBubble").eq(1).find(".BubbleImage").eq(benefit_timers[1]).css("display", "none");
  }
  else if (benefit_timers[1] < 3) {
  benefit_timers[1]++;
  $(".PopupBubble").eq(1).find(".BubbleImage").fadeIn(300);
  $(".PopupBubble").eq(1).find(".BubbleImage").eq(benefit_timers[1]).fadeOut(300);
  }
  else {
  benefit_timers[1] = 0;
  $(".PopupBubble").eq(1).find(".BubbleImage").fadeIn(300);
  $(".PopupBubble").eq(1).find(".BubbleImage").eq(benefit_timers[1]).fadeOut(300);
  }
  }
  if (benefit_init == 3) {
  if (benefit_timers[2] == -2) {
  $(".PopupBubble").eq(2).find(".BubbleImage").css("opacity", "0");
  $(".PopupBubble").eq(2).find(".BubbleImage").animate({ opacity: "0" }, 600).animate({ opacity: "1" }, 500);
  benefit_timers[2]++
  benefitsTimer()
  clearTimeout(timer);
  }
  else if (benefit_timers[2] == -1) {
  benefit_timers[2]++;
  $(".PopupBubble").eq(2).find(".BubbleImage").css("display", "block");
  $(".PopupBubble").eq(2).find(".BubbleImage").eq(benefit_timers[2]).css("display", "none");
  }
  else if (benefit_timers[2] < 4) {
  benefit_timers[2]++;
  $(".PopupBubble").eq(2).find(".BubbleImage").fadeIn(300);
  $(".PopupBubble").eq(2).find(".BubbleImage").eq(benefit_timers[2]).fadeOut(300);
  }
  else {
  benefit_timers[2] = 0;
  $(".PopupBubble").eq(2).find(".BubbleImage").fadeIn(300);
  $(".PopupBubble").eq(2).find(".BubbleImage").eq(benefit_timers[2]).fadeOut(300);
  }
  }
  if (benefit_init == 4) {
  if (benefit_timers[3] == -2) {
  $(".PopupBubble").eq(3).find(".BubbleImage").css("opacity", "0");
  $(".PopupBubble").eq(3).find(".BubbleImage").animate({ opacity: "0" }, 600).animate({ opacity: "1" }, 500);
  benefit_timers[3]++
  benefitsTimer()
  clearTimeout(timer);
  }
  else if (benefit_timers[3] == -1) {
  benefit_timers[3]++;
  $(".PopupBubble").eq(3).find(".BubbleImage").css("display", "block");
  $(".PopupBubble").eq(3).find(".BubbleImage").eq(benefit_timers[3]).css("display", "none");
  }
  else if (benefit_timers[3] < 3) {
  benefit_timers[3]++;
  $(".PopupBubble").eq(3).find(".BubbleImage").fadeIn(300);
  $(".PopupBubble").eq(3).find(".BubbleImage").eq(benefit_timers[3]).fadeOut(300);
  }
  else {
  benefit_timers[3] = 0;
  $(".PopupBubble").eq(3).find(".BubbleImage").fadeIn(300);
  $(".PopupBubble").eq(3).find(".BubbleImage").eq(benefit_timers[3]).fadeOut(300);
  }
  }
  if (benefit_init == 5) {
  if (benefit_timers[4] == -2) {
  $(".PopupBubble").eq(4).find(".BubbleImage").css("opacity", "0");
  $(".PopupBubble").eq(4).find(".BubbleImage").animate({ opacity: "0" }, 600).animate({ opacity: "1" }, 500);
  benefit_timers[4]++
  benefitsTimer()
  clearTimeout(timer);
  }
  else if (benefit_timers[4] == -1) {
  benefit_timers[4]++;
  $(".PopupBubble").eq(4).find(".BubbleImage").css("display", "block");
  $(".PopupBubble").eq(4).find(".BubbleImage").eq(benefit_timers[4]).css("display", "none");
  }
  else if (benefit_timers[4] < 3) {
  benefit_timers[4]++;
  $(".PopupBubble").eq(4).find(".BubbleImage").fadeIn(300);
  $(".PopupBubble").eq(4).find(".BubbleImage").eq(benefit_timers[4]).fadeOut(300);
  }
  else {
  benefit_timers[4] = 0;
  $(".PopupBubble").eq(4).find(".BubbleImage").fadeIn(300);
  $(".PopupBubble").eq(4).find(".BubbleImage").eq(benefit_timers[4]).fadeOut(300);
  }
  }
  if (benefit_init == 6) {
  if (benefit_timers[5] == -2) {
  $(".PopupBubble").eq(5).find(".BubbleImage").css("opacity", "0");
  $(".PopupBubble").eq(5).find(".BubbleImage").animate({ opacity: "0" }, 600).animate({ opacity: "1" }, 500);
  benefit_timers[5]++
  benefitsTimer()
  clearTimeout(timer);
  }
  else if (benefit_timers[5] == -1) {
  benefit_timers[5]++;
  $(".PopupBubble").eq(5).find(".BubbleImage").css("display", "block");
  $(".PopupBubble").eq(5).find(".BubbleImage").eq(benefit_timers[5]).css("display", "none");
  }
  else if (benefit_timers[5] < 3) {
  benefit_timers[5]++;
  $(".PopupBubble").eq(5).find(".BubbleImage").fadeIn(300);
  $(".PopupBubble").eq(5).find(".BubbleImage").eq(benefit_timers[5]).fadeOut(300);
  }
  else {
  benefit_timers[5] = 0;
  $(".PopupBubble").eq(5).find(".BubbleImage").fadeIn(300);
  $(".PopupBubble").eq(5).find(".BubbleImage").eq(benefit_timers[5]).fadeOut(300);
  }
  }
  
  timer = setTimeout("benefitsTimer()", 12000);
  
}


function stepShow(clicked_index, clicked) {
  if ($(clicked).parent().parent().find(".StepHideShow div").eq(clicked_index).is(":hidden")) {
    document.getElementById('FlashContent2').sendEvent('STOP');
    $('.VideoFadeDiv').fadeIn(300)
    $(clicked).closest(".InnerContent1").find(".PhotoPin .StepPhoto").fadeOut(300)
    $(clicked).closest(".InnerContent1").find(".PhotoPin .StepPhoto").eq(clicked_index).fadeIn(300)
    $(clicked).parent().parent().find(".StepHideShow div").fadeOut(300)
    $(clicked).parent().parent().find(".StepHideShow div").eq(clicked_index).fadeIn(300)
  }
}


function bookmarkPage() {

  window.external.AddFavorite('http://www.budgens.co.uk', 'Budgens')

}



$(document).ready(function() {

  $('.StepButtons a:eq(3)').click(function() {
    $('.StepPhoto').fadeOut(300)
    $('.StepHideShow div').fadeOut(300)
    $('.VideoFadeDiv').fadeOut(300)
  });

  $(".Bubble1,.Bubble1v2,.Bubble2,.Bubble2v2,.Bubble3,.Bubble4").click(function() {
    var this_bubble = $(this).parent().find('div').index(this);
    var this_section = $(this).parent().parent().find('.PopupBubble').index($(this).parent())

    clearTimeout(timer);
    $(".PopupBubble").eq(this_section).find(".BubbleImage").fadeIn(300);
    $(".PopupBubble").eq(this_section).find(".BubbleImage").eq(this_bubble).fadeOut(300);
    benefit_timers[this_section] = this_bubble
    timer = setTimeout("benefitsTimer()", 12000);
  });


  var txt = "Bookmark this Page";
  var url = "http://www.budgens.com";
  var who = "Budgens"
  if (msie_only) {
    document.getElementById('ForJSBookmark').innerHTML = '<a href="javascript:bookmarkPage()">' + txt + '</a>'
  }
  else {
    txt += " (Ctrl+D)";
    document.getElementById('ForJSBookmark').innerHTML = '<span>' + txt + '</span>'
  }




  $('.AnimBox').hover(function() {

    var hover_box = this
    $(hover_box).find('div').stop().animate({ right: '-120px' }, 500, function() { $(hover_box).find('p').css('display', 'block') })

  }, function() {

    var hover_box = this
    $(hover_box).find('p').css('display', 'none')
    if (msie_old) {
      $(hover_box).find('div').stop().animate({ right: '-520px' }, 500)
    }
    else {
      $(hover_box).find('div').stop().animate({ right: '-490px' }, 500)
    }

  });



  $(".SpeechBubblesTop img").css("opacity", "0.6");
  $(".SpeechBubblesTop img").hover(function() {


    if ($(this).css("opacity") == 0.6) {

      $(this).parent().parent().find("img").animate({ opacity: "0.6" }, 100)
      $(this).animate({ opacity: "1" }, 300)
    }
  }, (function() {


  })
   );

  $('.FlashRotator').toggleClass("DisplayNone");


  $('.VideoMinis .AnimBox').click(function() {
    var new_tag = $(this).next('.MiniTitle').html()
    $('.VideoPlaceholder2 span').html(new_tag)
  });


});                      //ready 


  