$(document).ready(function() {
// Question 1
$('#question_1').click(function(){

$.scrollTo('#answer_1', {duration: 500, onAfter:function(){
$('#answer_1_text').highlightFade({color:'hex(#F7ECDF)', speed: 500});
} });
});

// Question 2
$('#question_2').click(function(){
$.scrollTo('#answer_2', {duration: 500, onAfter:function(){
$('#answer_2_text').highlightFade({color:'hex(#F7ECDF)', speed: 500});
} });
});

// Question 3
$('#question_3').click(function(){
$.scrollTo('#answer_3', {duration: 500, onAfter:function(){
$('#answer_3_text').highlightFade({color:'hex(#F7ECDF)', speed: 500});
} });
});

// Question 4
$('#question_4').click(function(){
$.scrollTo('#answer_4', {duration: 500, onAfter:function(){
$('#answer_4_text').highlightFade({color:'hex(#F7ECDF)', speed: 500});
} });
});

// Question 5
$('#question_5').click(function(){
$.scrollTo('#answer_5', {duration: 500, onAfter:function(){
$('#answer_5_text').highlightFade({color:'hex(#F7ECDF)', speed: 500});
} });
});

// Question 6
$('#question_6').click(function(){
$.scrollTo('#answer_6', {duration: 500, onAfter:function(){
$('#answer_6_text').highlightFade({color:'hex(#F7ECDF)', speed: 500});
} });
});

// Question 7
$('#question_7').click(function(){
$.scrollTo('#answer_7', {duration: 500, onAfter:function(){
$('#answer_7_text').highlightFade({color:'hex(#F7ECDF)', speed: 500});
} });
});

// Go To TOP

$('.go_to_top').click(function(){

$.scrollTo('#top_zone', {duration: 500});

});

});

$(function() { 
    $('input[type=text]').focus(function() {  
      $(this).val(''); }).blur(function() { 
               
      }); 
 }); 
$(function() { 
    $('input[type=password]').focus(function() {  
      $(this).val(''); }).blur(function() { 
                
      }); 
 }); 

$(document).ready(function () {
    $('img.drop_class').click(function () {
	$('ul.drop').slideToggle('medium');
    });
});
$(document).ready(function(){
						   $(".fade_img").fadeTo("slow", 1.0); // This sets the opacity of the thumbs to fade down to 30% when the page loads
						   $(".fade_img").hover(function(){
						   $(this).fadeTo("slow", 0.8); // This should set the opacity to 100% on hover
						   },function(){
						   $(this).fadeTo("slow", 1.0); // This should set the opacity back to 30% on mouseout
						   });
						   });

$(document).ready(function(){
						   $("#text p").fadeTo("slow", 0.3); // This sets the opacity of the thumbs to fade down to 30% when the page loads
						   $("#text p").hover(function(){
						   $(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover
						   },function(){
						   $(this).fadeTo("slow", 0.3); // This should set the opacity back to 30% on mouseout
							   	});
						   });

$(document).ready(function(){
						   $("#div").fadeTo("slow", 0.3); // This sets the opacity of the thumbs to fade down to 30% when the page loads
						   $("#div").hover(function(){
						   $(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover
						   },function(){
						   $(this).fadeTo("slow", 0.3); // This should set the opacity back to 30% on mouseout
							   	});
						   });
	var lastopened = false;
var lastopenedodd = false;
function showfaq(ID, ODD) { 

if(lastopened)
hidefaq(lastopened, lastopenedodd);

lastopened = ID;
lastopenedodd = ODD;
var currTabElem = document.getElementById(ID); 
var currTabElemb = document.getElementById(ID + 'b'); 

currTabElemb.setAttribute("class", "entry active"); 
currTabElemb.setAttribute("className", "entry active"); 
currTabElem.setAttribute("class", "active"); 
currTabElem.setAttribute("className", "active"); 
} 

function hidefaq(ID, ODD) { 
var currTabElem = document.getElementById(ID); 
var currTabElemb = document.getElementById(ID + 'b'); 

currTabElemb.setAttribute("class", "entry hide"); 
currTabElemb.setAttribute("className", "entry hide"); 
  if(ODD){
    currTabElem.setAttribute("class", "alt"); 
    currTabElem.setAttribute("className", "alt");  
  }else{
    currTabElem.setAttribute("class", ""); 
    currTabElem.setAttribute("className", "");  
}

} 
$(document).ready(function() {

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).show(); //Fade in the active content
		return false;
	});

});

function theRotator() {
	//Set the opacity of all images to 0
	$('div#rotator ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div#rotator ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('rotate()',10000);
	
}

function rotate() {	
	//Get the first image
	var current = ($('div#rotator ul li.show')?  $('div#rotator ul li.show') : $('div#rotator ul li:first'));

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') :current.next()) : $('div#rotator ul li:first'));	
	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
};

$(document).ready(function() {		
	//Load the slideshow
	theRotator();
});