﻿function cleanbullets() {
$("#sli1,#sli2,#sli3,#sli4").addClass("li_unselected").removeClass("li_selected");
}

function giveclasstobullet(bulnum) {
cleanbullets();
$("#sli"+bulnum).removeClass("li_unselected").addClass("li_selected");
$('.content').fadeTo('fast', 0.3, function() { $(this).css('background-image', 'url(images/landingpage/0'+bulnum+'.jpg)'); }).fadeTo('fast', 1);
}

function slideaction() {
var heightscroll = $('.toggler').scrollLeft();
cleanbullets();
if (heightscroll == 0) { 
$("#sli1").removeClass("li_unselected").addClass("li_selected");
$('.content').fadeTo('fast', 0.3, function() { $(this).css('background-image', 'url(images/landingpage/01.jpg)'); }).fadeTo('fast', 1);
}
else if (heightscroll == 986) {
$("#sli2").removeClass("li_unselected").addClass("li_selected");
$('.content').fadeTo('fast', 0.3, function() { $(this).css('background-image', 'url(images/landingpage/02.jpg)'); }).fadeTo('fast', 1);
}
else if (heightscroll == 1972) {
$("#sli3").removeClass("li_unselected").addClass("li_selected");
$('.content').fadeTo('fast', 0.3, function() { $(this).css('background-image', 'url(images/landingpage/03.jpg)'); }).fadeTo('fast', 1);
}
else if (heightscroll == 2958) {
$("#sli4").removeClass("li_unselected").addClass("li_selected");
$('.content').fadeTo('fast', 0.3, function() { $(this).css('background-image', 'url(images/landingpage/04.jpg)'); }).fadeTo('fast', 1);
}
}


$(function(){

$(".slide_topic").ieffembedfix();

slideaction();


$('#button1').click(function() {
  var heightscroll1 = $('.toggler').scrollLeft();
  if (heightscroll1 == 0) {
    $('.toggler').animate({scrollLeft: '+=2986'}, 'slow');
  }
  else {
    $('.toggler').animate({scrollLeft: '-=986'}, 'slow');
  }
  slideaction();
});


$('#button2').click(function() {
  var heightscroll2 = $('.toggler').scrollLeft();
  if (heightscroll2 == 2958) {
    $('.toggler').animate({scrollLeft: '0'}, 'slow');
  }
  else {
    $('.toggler').animate({scrollLeft: '+=986'}, 'slow');
  }
  slideaction();
});


$('#slideto1').click(function() {
    $('.toggler').animate({scrollLeft: '0'}, 'slow');
    giveclasstobullet(1);
});
$('#slideto2').click(function() {
    $('.toggler').animate({scrollLeft: '986'}, 'slow');
    giveclasstobullet(2);
});
$('#slideto3').click(function() {
    $('.toggler').animate({scrollLeft: '1972'}, 'slow');
    giveclasstobullet(3);
});
$('#slideto4').click(function() {
    $('.toggler').animate({scrollLeft: '2958'}, 'slow');
    giveclasstobullet(4);
});

var quoteval1 = "<i>\"Make a Renova Solar system work for you and we promise you SAVINGS, a CLEAN ENVIRONMENT and energy SECURITY.\"</i>&nbsp;&nbsp;&nbsp;The Renova Team.";

var quoteval2 = "<i>\"The Renova Solar Lease makes solar affordable for EVERYONE.\"</i>&nbsp;&nbsp;&nbsp;Vincent Battaglia, CEO.";
var quoteval3 = "<i>\"As a NABCEP Certified PV Installer, solar performance is job one!.\"</i>&nbsp;&nbsp;&nbsp;Thomas Hall, CTO.";
var quoteval4 = "<i>\"If your solar panel doesn't stay shiny, it can't perform at it's best for you.\"</i>&nbsp;&nbsp;&nbsp;Jermie Meyer, Renova Plus.";
var quoteval5 = "<i>\"The solar lease is the best thing to happen to solar since the sun.\"</i>&nbsp;&nbsp;&nbsp;Jeff Godels, Renova Solar Consultant.";
var quoteval6 = "<i>\"We help make sure your materials come in on time and correctly.\"</i>&nbsp;&nbsp;&nbsp;Lea Waki, Office Manager.";

var countquotes = 1;
var count = 10;
$('.quote_buttom').html(quoteval1).fadeIn("slow");

  countdownquotes = setInterval(function(){
    
    countquotes++;

    if (countquotes == '7') {
        countquotes = '1';
    }

    if (countquotes == '1') {
        $('.quote_buttom').html(quoteval1).fadeIn("slow");
    }
    else if (countquotes == '2') {
        $('.quote_buttom').html(quoteval2).fadeIn("slow");
    }
    else if (countquotes == '3') {
        $('.quote_buttom').html(quoteval3).fadeIn("slow");
    }
    else if (countquotes == '4') {
        $('.quote_buttom').html(quoteval4).fadeIn("slow");
    }
    else if (countquotes == '5') {
        $('.quote_buttom').html(quoteval5).fadeIn("slow");
    }
    else if (countquotes == '6') {
        $('.quote_buttom').html(quoteval5).fadeIn("slow");
    }

  }, 10000); 


  countdown = setInterval(function(){
    
    var minutes = "0" + parseInt( count / 60 ) % 60 + ":";
    if (!minutes)
    var minutes = "00:";
    var seconds = count % 60;
    if (seconds < 10) 
    var seconds = "0" + seconds;
    if (!seconds)
    var seconds = "00";
    

    if (count == 0) {
      var height = $('.toggler').scrollLeft();

      cleanbullets();
      if (height == 0) { 
        giveclasstobullet(2);
      }
      else if (height == 986) {
        giveclasstobullet(3);
      }
      else if (height == 1972) {
        giveclasstobullet(4);
      }
      else if (height == 2958) {
        giveclasstobullet(1);
      }
      
      
      if (height == 2958) {
        $('.toggler').animate({scrollLeft: '-=2986'}, 'slow');
      }
      else {
        $('.toggler').animate({scrollLeft: '+=986'}, 'slow');
      }
      count = 10;
    } 
    count--; 
  }, 1000); 


$("div.little_box1").mouseover(function() {
$(this).css('background-image', 'url(images/landingpage/renovaacademy.png)');
$(this).find("#littboxcon1").html("")
}).mouseout(function(){
$(this).find("#littboxcon1").html("<br /><img src=\"images/landingpage/solar1but.png\" alt=\"SOLAR EDUCATION\" title=\"SOLAR EDUCATION\" />");
$(this).css('background-image', 'none');
});

$("div.little_box2").mouseover(function() {
$(this).css('background-image', 'url(images/landingpage/renovaplus.png)');
$(this).find("#littboxcon2").html("")
}).mouseout(function(){
$(this).find("#littboxcon2").html("<br /><img src=\"images/landingpage/solar2but.png\" alt=\"SOLAR MAINTENANCE\" title=\"SOLAR MAINTENANCE\" />");
$(this).css('background-image', 'none');
});

$("div.little_box3").mouseover(function() {
$(this).css('background-image', 'url(images/landingpage/zeromoney.png)');
$(this).find("#littboxcon3").html("")
}).mouseout(function(){
$(this).find("#littboxcon3").html("<br /><img src=\"images/landingpage/solar3but.png\" alt=\"SOLAR FINANCING\" title=\"SOLAR FINANCING\" />");
$(this).css('background-image', 'none');
});


});


