function SwitchBox(id) {
	for(var i=1 ; i <= 5; i++) {
		$("#txt" + i).hide();
		$("#tab-" + i + " a:first-child").removeClass("selected-box");
		$("#tab-" + i + " a:first-child").removeClass("not-selected-box");
		if (id != i) {
			$("#tab-" + i + " a:first-child").addClass("not-selected-box");
		} else {
			$("#tab-" + i + " a:first-child").addClass("selected-box");				
		}				
	}
	$("#txt" + id).show();
}

var bannerIdx = 0;
var bannerCount = 0;
var timerCount = 0;

$.fn.delay = function(time, name) {
    return this.queue((name || 'fx'), function() {
        var self = this;
        setTimeout(function() { $.dequeue(self); } , time);
    });
};

function loadSlideShow(groupID) {
	$('a.slideshow-' + groupID).colorbox({
		slideshow: true,
		transition: 'elastic'
	});
}

function loadBanners() {
	bannerCount = $('#banners .banner').length;
	bannerIdx = 0;

	if (bannerCount > 1) {
		showBanner(+1);
	} else {
		$('#banners div.banner:eq(0)').fadeIn(300);
	}
}

function showBanner(increase) {
	$('#banners div.banner:eq(' + bannerIdx + ')').fadeOut(300);

	bannerIdx = (bannerIdx + increase + bannerCount) % bannerCount;

	$('#banners div.banner:eq(' + bannerIdx + ')').fadeIn(300, function() {
		timerCount++;
  		$.timer(10000, function() {
  			if(timerCount == 1) {
				showBanner(+1);
			}
			timerCount--;
		});
	});
}


function verifyRequired() {
	if($('fields_email1').val() == '' || $('fields_email1').val == 'Netfang') {
		alert("Vantar netfang!");
		$('fields_email1').focus();
		return false;
    }
	return true;
	}
   
function fncSubmit() {
	if(verifyRequired()) {
	
	$.post("https://app.icontact.com/icp/signup.php", { 
        redirect: $('#redirect').val(), 
        errorredirect: $('#errorredirect').val(),
        listid: "42163",
        clientid: "515873",
        formid:"2913",
        reallistid:"1",
        doubleopt:"1",
        "specialid:42163": "Y42C"    
        },
    function(){
     $.log(this);
   });
   }	
}


