/*******************************************************
* Sage MicrOpay
* Version: 1.00 25/07/2007
*
* Copyright Hothouse Interactive :: www.hothouse.com.au ::
* Unauthorised modification / use is a criminal offence, and will be prosecuted the fullest extent permitted by law.
* All Rights Reserved 
* These Scripts requires the jQuery library to run http://jquery.com
*******************************************************/

$(document).ready(function() {
						   
	// Toggle the dd when you click on dt
	$("div.recruit-jobs dl dt").each(function(){
		$(this).click(function(){
			$(this).next().toggle();
			$(this).toggleClass("active");
		});
	});
	$("div.faqs dt.title").each(function(){
		$(this).click(function(){
			$(this).next().toggle();
			$(this).toggleClass("active");
		});
	});
	$(".faqs dl dt a.toggle").each(function(){
		$(this).click(function(){
			$(this).parents('dt').next('dd').toggle();
			$(this).parents('dt').toggleClass("active");
		});
	});
	
	// Removes rules="" tag from tables
	$("table").attr("rules","");
	
	// Add border-bottom to table
	$('table.table-support-partner-profile tr:last-child').each(function() {
		var currentClass = $(this).attr('class');
		if(currentClass == "pagination") {
			$(this).prev(0).addClass("last-row");
		} else {
			$("table.table-support-partner-profile tr:last-child").addClass("last-row");
		};
	});	
	
	//$(".form input.button").each(function(){
	//	$(this).hover(function(){
	//		$(this).toggleClass("hover");
	//	});
	//});
	
	$('.form input.button').hover(function() {
		$(this).addClass('hover1');
		}, function() {
		$(this).removeClass('hover1');
	});
	
    $('.form input.submitVote').hover(function() { 
        $(this).addClass('submitVote-hover'); 
        }, function() { 
        $(this).removeClass('submitVote-hover'); 
    }); 

//	$('.submitVote').hover(function() {
//		$(this).addClass('hoverSubmitVoteBtn');
//		}, function() {
//		$(this).removeClass('hoverSubmitVoteBtn');
//	});
	
	$('.form input.button.back').hover(function() {
		$(this).addClass('hover2');
		}, function() {
		$(this).removeClass('hover2');
	});
	
	$('.header-search input.submit').hover(function() {
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});
	
	//$('table.site-control-form tr td table td:first-child').each(function() {
	//	$(this).addClass("col-1");
	//});
	
	//$('table.site-control-form tr td table td:last-child').each(function() {
	//	$(this).addClass("col-3");
	//});
	
	//$('table.site-control-form td[@colspan=2]').each(function() {
	//	$(this).removeClass("col-3");
	//	$(this).removeClass("col-1");
	//});
	
	//$('table.site-control-form table table td').each(function() {
	//	$(this).removeClass("col-3");
	//	$(this).removeClass("col-1");
	//});
		
	//$('table.site-control-form input[@type=radio]').each(function() {
	//	$(this).addClass("radio");
	//});
	
	//$('table.site-control-form input[@type=text]').each(function() {
	//	$(this).addClass("text");
	//});
	
	//$('table.site-control-form input[@type=file]').each(function() {
	//	$(this).addClass("file");
	//});
	
	//$('table.site-control-form td[@colspan=2]').each(function() {
	//	$(this).addClass("title");
	//});
	

});

/*******************************************************
* Suckerfish JavaScript
*******************************************************/

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*******************************************************
* MicroPage Javascript
*******************************************************/

function changeImage(image) {
	$("#payroll_image").attr("src","images/SageMicrOpay/circle/"+image+".gif");	
}



/*******************************************************
* Accordion List - As used in Training FAQs
*******************************************************/


	ddaccordion.init({
	headerclass: "expandable", //Shared CSS class name of headers group that are expandable
	contentclass: "categoryitems", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})


