$(document).ready(function() {
/*
if ($('#a7-slider li').length) {
$('#a7-slider')
.cycle({
fx: 'scrollLeft',
speed: 'slow',
timeout: 6000,
containerResize: 0
});
}
*/
$(".page-id-60 .gallery .gallery-item:last").css({"width":"50%"});
$("#gform_6").validate({
rules: {
input_7: "required",
input_2: {
required: true,
email: true
},
input_5: "required",
},
messages: {
input_7: "Please tell us your name",
input_2: {
required: "Please tell us your email",
email: "Please enter a valid email address"
},
input_5: "Please tell us your message"
},
validClass: "success",
errorElement: "span",
errorPlacement: function(error,element) {
error.appendTo(element.parent().prev('label'));
}
});
$("#gform_1").validate({
rules: {
input_5: "required",
input_6: {
required: true,
email: true
},
input_3: "required",
},
messages: {
input_5: "Please tell us your name",
input_6: {
required: "Please tell us your email",
email: "Please enter a valid email address"
},
input_3: "Please tell us your question"
},
validClass: "success",
errorElement: "span",
errorPlacement: function(error,element) {
error.appendTo(element.parent().prev('label'));
}
});
if ($("#video-container").length > 0){
$('#video-container a').click( function() {
$('.video-triggers li').first().children('a').trigger('click');
return false;
});
//var url = $('.video-triggers li:first a').attr('href').replace("watch?v=", "embed/");
//var html = '';
//alert(html);
//$('#video-container').html(html);
}
$('.video-triggers li a').click( function(e){
e.preventDefault();
var url = $(this).attr('href').replace("watch?v=", "embed/");
var html = '
x
';
html += '' + $(this).text() + '
';
html += '';
html += '';
html += '
';
var index = $(this).parent('li').index();
var count = $(this).parent('li').siblings().length;
wibble = index + ': ' + count;
//alert(wibble);
if (index < count) {
next_link = $(this).parent('li').next().children('a');
next_anchor = next_link.text();
} else {
next_link = $('.video-triggers li').first().children('a');
next_anchor = next_link.text();
}
html += 'NEXT '+next_anchor+' >
';
//alert(html);
//$('#video-container').html(html);
$("#a7-overlay").html(html);
$("#a7-overlay").fadeIn(1000);
$("#container").fadeTo(1000, 0.5);
positionPopup();
//alert(next_link);
$('.a7-video-next').click( function() {
next_link.trigger('click');
//alert("next");
});
$('.a7-overlay-close').click( function() {
$("#a7-overlay").fadeOut(500);
$("#container").fadeTo(500, 1);
$("#a7-overlay").html('');
});
$('.video-triggers li').removeClass('active');
$(this).parent().addClass('active');
return false;
});
$('.a7-slidedown-VAT-trigger').click( function() {
$('.a7-slidedown-VAT').slideToggle();
});
$('.a7-slidedown-Ch-VAT-trigger').click( function() {
$('.a7-slidedown-Ch-VAT').slideToggle();
});
//close popup
$("#close").click(function(){
$("#a7-overlay").fadeOut(500);
$("#a7-overlay").html('');
});
});
//position the popup at the center of the page
function positionPopup(){
if(!$("#a7-overlay").is(':visible')){
return;
}
$("#a7-overlay").css({
left: ($(window).width() - $('#a7-overlay').width()) / 2,
top: $(window).scrollTop() + (($(window).height() - $('#a7-overlay').height()) / 2),
position:'absolute'
});
}
//maintain the popup at center of the page when browser resized
$(window).bind('resize',positionPopup);