
/////////////////////////////////////////////////////////////////////
////ONLY/////////////////////////////////////////////////////////////
////////SIFR/////////////////////////////////////////////////////////
////////////ABOVE////////////////////////////////////////////////////
/////////////////THIS////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////


function toggleStep(area, current) {
	alert(area);
	alert(current);
	var currentObj = $(current);
	
	var areaObj = $("#"+area);
		alert('togglar');
		
	//alert(area.attr('id'));
	//alert(current.attr('id'));
	areaObj.css('border', '1px solid red');
	
	$(".consumer button").removeClass("buttonhover");
	currentObj.addClass("buttonhover");
	
	if(visible(areaObj)) {
		
		$(".accordion:visible").slideUp("fast", function() {});
		areaObj.slideDown();
	} else {
		areaObj.slideUp("fast");
	}
}
function visible(e) {
	if(e.css("display") != "none") {
		return false;	
	} else {
		return true;
	}
}
$(document).ready(function() {
	$("p:last-child").addClass("last");
	$("#thumbnails_list li:odd").addClass("last");
	$("td:last-child").addClass("text_right");
	$("th:last-child").addClass("text_right");

	$("ul li:last-child").addClass("last");
	$(".column-right h1").addClass("header");
	$(".column-right h1.header:first").addClass("header-first");

	$("#newslist .newsitem:last-child").addClass("last");

	$(".column-left img[align=right]").addClass("right");

	
	$('#productmenu ul.menu li:first-child').addClass("firstmenuitem");
	$('#productmenu ul.menu li:last-child').addClass("lastmenuitem");
	
	$('#no_reg').click(function() {
		$('div.consumer div.accordion').hide();
		$('div.consumer div#noRegister').toggle();
	});
	$('#already_customer').click(function() {
		$('div.consumer div.accordion').hide();
		$('div.consumer div#alreadyClient').toggle();
	});
	$('#new_customer').click(function() {
		$('div.consumer div.accordion').hide();
		$('div.consumer div#createUser').toggle();
	});
	
	
	$('.consumer button').hover(function() {
  		$(this).addClass('buttonhover');
	}, function() {
  		$(this).removeClass('buttonhover');
	});
	
	$("div.loopImgs").children().each(function() {
		var oki = false;
		var tn = this.tagName.toLowerCase();
		if (tn == 'img') {
			oki = true;
		}
		if (tn == 'a') {
			$(this).children().each(function() {
				if (this.tagName.toLowerCase() == 'img') {
					oki = true;
				}
			});
		}
		if (oki == true) {
			$(this).wrap("<div class=\"image\"></div>");
			loopImgsNum++;
		} else {
			$(this).remove();
		}
	});
})


var loopImgsIndex = -1;
var loopImgsNum = 0;
function loopImgsNext () {
	if (loopImgsIndex != null) {
		$("div.loopImgs div.image:eq(" + loopImgsIndex + ")").fadeOut("slow");
	}
	loopImgsIndex++;
	if (loopImgsIndex==loopImgsNum) { loopImgsIndex = 0; }

	$("div.loopImgs div.image:eq(" + loopImgsIndex + ")").fadeIn("slow", function () {
		setTimeout("loopImgsNext();", 2500);
	});
}

$(window).bind('load', function () {
	$("div.loopImgs div.image:eq(0)").fadeIn();
	var highest = 0, widthest = 0;
	$("div.loopImgs div.image").each(function () {
		if ($(this).height() > highest) {
			highest = $(this).height();
		}
		if ($(this).width() > widthest) {
			widthest = $(this).width();
		}
	});
	$("div.loopImgs").height(highest);
	$("div.loopImgs").width(widthest);

	loopImgsNext();
});