$(function() {
$('.frontpage-carousel li').each(function() {
$(this).children().wrapAll('
');
//var $img = $(this).find('img').detach();
//var $html = $(this).html();
//$(this).html('');
//$(this).append('');
//$(this).children('div').append($img);
//$(this).children('div').append('
');
//$(this).children('div').first().children('div.text').append($html);
//$(this).children('div').first().children('div.background').fadeTo(0, .3);
});
$('.frontpage-carousel').jCarouselLite({
auto: 5000,
circular: true,
visible: 1,
scroll: 1,
speed: 800
});
$('.logo-carousel').jCarouselLite({
auto: 5000,
circular: true,
visible: 1,
scroll: 1,
speed: 800
});
/**
* Find containers with class="clickable" and make them trigger
* the first or inside them.
*/
$('.clickable').click(function(e) {
if (e.triggeredByClickable) return;
if ($(e.target).closest('a, input, select, button').length > 0) return;
var $elm = $('a[href], input[type=radio], input[type=checkbox], input[type=submit], input[type=button]', this).first();
if ($elm.length == 0) return;
var event = $.Event('click');
event.triggeredByClickable = true;
$elm.trigger(event);
if (!event.isDefaultPrevented()) {
if ($elm[0].tagName.toLowerCase() == 'a') {
if ($elm.attr('target').toLowerCase() == '_blank') {
window.open($elm.attr('href'));
} else {
window.location.href = $elm.attr('href');
}
} else {
switch ($elm.attr('type').toLowerCase()) {
case 'radio':
case 'checkbox':
$elm.attr('checked', 'checked');
break;
case 'submit':
$elm.closest('form').submit();
break;
}
}
}
});
$('.popup').colorbox();
});