File: /home/webmarketingplus.co.uk/public_html/JS/ACI.js
ACI = function() {
/* Private */
/* Properties */
var cmp = {};
/* Methods */
var init = function() {
/* Constructor */
TVI.Forms.handlerURL = 'handlers/index.html'; //DEVTEMP
TVI.Data.defaultURL = '/handlers/Data.aspx/query'; //DEVTEMP
// // Set up the map object
// ACI.map = {}
// MAIN NAV DROPDOWN
$('#mainNav LI A').hover(
function(){
// Show dropdown and highlight menu item
$(this).parent('LI').find('.dropdown').show();
$(this).parent('LI').find('.dropdown').prev('A').addClass('highlight');
},
function(){
// Hide dropdown and remove highlight
$(this).parent('LI').find('.dropdown').hide();
$(this).parent('LI').find('.dropdown').prev('A').removeClass('highlight');
}
);
$('#mainNav .dropdown').hover(
function(){
// Show dropdown
$(this).show();
$(this).prev('A').addClass('highlight');
},
function(){
// Hide dropdown
$(this).hide();
$(this).prev('A').removeClass('highlight');
}
);
// CONTACT FORM DROPDOWN
$('#mainNav .contactButton').click(function(){
if ( !$('#contactDropdown').hasClass('open') ) {
$('#contactDropdown').slideDown(function(){
////// if (GBrowserIsCompatible()) {
//////
////// // Create and centre the map
////// ACI.map = new GMap2(document.getElementById("map"));
////// ACI.map.setCenter(new GLatLng(51.518621, -0.107589), 14);
////// ACI.map.addControl(new GSmallMapControl());
//////
////// //Add marker
////// tvi_marker = new GMarker(new GLatLng(51.518621, -0.107589));
////// ACI.map.addOverlay(tvi_marker);
//
// }
}).addClass('open');
}
return false;
});
$('#contactDropdown .close').click(function(){
if ( $('#contactDropdown').hasClass('open') ) {
$('#contactDropdown').slideUp().removeClass('open');
}
return false;
});
// SUBSECTION DROPDOWN
$('.subsection .title').click( function() {
if( $(this).next('.subsectionContent').hasClass('open') ) {
$(this).css({ backgroundPosition: '0 0' }).next('.subsectionContent').slideUp().removeClass('open');
} else {
$(this).css({ backgroundPosition: '0 -36px' }).next('.subsectionContent').slideDown().addClass('open');
}
return false;
});
// Info Page Headers
$('#headerImages .headerImage:first').show();
// Watermark for the newsletter signup
$('#newsletterForm-email-control').focus(function(){
if($(this).val() == 'Enter email address'){
$(this).val('');
}
});
$('#newsletterForm-email-control').blur(function(){
if($(this).val() == ''){
$(this).val('Enter email address');
}
});
// Create the newsletter signup form
ACI.newsletterForm = new TVI.Form({
ID: 'newsletterForm',
buttons: [{
selector: '.newsletterSignup_button',
enter: true,
handler: function() {
// Check to see if email address is empty
if(ACI.newsletterForm.field('email').val() === ''){
return;
}
// Add the email to the database
ACI.newsletterForm.submit({
query: 'insertNewsletterEmail',
success: function(){
$('#newsletterForm').hide();
$('#newsletterThanks').show();
}
});
}
}]
});
// Create the Contact Form
ACI.contactForm = new TVI.Form({
ID: 'contactForm',
errorsEl: '.errors',
buttons: [{
selector: '.sendMessage',
enter: true,
handler: function() {
// Validate the input
ACI.contactForm.validate({
success: contactFormSend,
failure: function(d) {
ACI.contactForm.error(d.errors);
}
});
}
}]
});
// Reset the contact form after it's sent
TVI.event('.actionContactFormReset', 'click', function() {
// Show the correct sections of the form
ACI.contactForm.el.find('.fields').show();
ACI.contactForm.el.find('.contactSendButton').show();
ACI.contactForm.el.find('.errors').hide();
ACI.contactForm.el.find('.thankYou').hide();
// Clear the form
ACI.contactForm.clear();
});
};
var contactFormSend = function(){
// Hide the form
ACI.contactForm.el.find('.fields').hide();
ACI.contactForm.el.find('.contactSendButton').hide();
ACI.contactForm.el.find('.errors').hide();
// Submit the form to the handler
ACI.contactForm.submit({
url: '/handlers/ACI.Contact.aspx/sendContactForm',//DEVTEMP
success: function(){
ACI.contactForm.el.find('.thankYou').show();
}
});
}
/* Public */
TVI.apply(cmp, {
/* Properties */
test: 'test',
/* Methods */
test: function() {
/* Test function */
}
});
TVI.ready(init);
return cmp;
} ();