// DOM ready
$(function() {
// Create the dropdown base
$("").appendTo("nav");
// Create default option "Go to..."
$("", {
"selected": "selected",
"value" : "",
"text" : "Go to..."
}).appendTo("nav select");
// Populate dropdown with menu items
$("nav a").each(function() {
var el = $(this);
$("", {
"value" : el.attr("href"),
"text" : el.text()
}).appendTo("nav select");
});
// To make dropdown actually work
// To make more unobtrusive: http://css-tricks.com/4064-unobtrusive-page-changer/
$("nav select").change(function() {
window.location = $(this).find("option:selected").val();
});
});
function fCheckEmail(sEmailAddress) {
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(sEmailAddress)) {
return "invalid";
} else {
return "valid";
}
}
// EMAIL ENQUIRY
// ==============
// show modal box
// ===============
function fFooterEmailUs_Show() {
// open up live chat
jivo_api.open();
}
// close modal box
// ===============
function fFooterEmailUs_Close() {
// load the add to basket modal
$( "#dialogEmailEnquiry" ).dialog( "close" );
}
// submit form (form verification)
// ================================
function fFooterEmailUs_Submit() {
// form fields
var sYourName = document.getElementById('sFooterEmailUs_YourName').value;
var sYourEmail = document.getElementById('sFooterEmailUs_YourEmail').value;
var sEnquiry = document.getElementById('sFooterEmailUs_Enquiry').value;
// form verification
var sErr = "";
if (sYourName=="") {
sErr+="\n - Please enter your name";
}
if (fCheckEmail(sYourEmail)=="invalid") {
sErr+="\n - Your email address isn't valid";
}
if (sEnquiry=="") {
sErr+="\n - Please enter your enquiry / message";
}
if (sErr!="") {
alert("There were some problems submitting the form. Please see below:\n"+sErr);
} else {
fFooterEmailUs_Process();
}
// submit form via ajax
}
// submit form (process)
// ================================
function fFooterEmailUs_Process() {
// form fields
var sYourName = document.getElementById('sFooterEmailUs_YourName').value;
var sYourEmail = document.getElementById('sFooterEmailUs_YourEmail').value;
var sEnquiry = document.getElementById('sFooterEmailUs_Enquiry').value;
// define AJAX url
var sAjaxURL = "ajax/footer_enquiry_exec.php?sYourName=" + sYourName + "&sYourEmail=" + sYourEmail + "&sEnquiry=" + sEnquiry;
// call ajax URL
$.get(sAjaxURL, function(data) {
// get the result
$('.result').html(data);
// close the modal window
$( "#dialogEmailEnquiry" ).dialog( "close" );
// alert the results
alert("Thank you. Your call back request has been sent. We'll do our best to reply as soon as possible.");
});
}
// REQUEST BROCHURE
// ==============
// show modal box
// ===============
function fFooterReqBrochure_Show() {
// redirect to the request brochure page
location.href = 'webdesign-brochure.php';
}
// close modal box
// ===============
function fFooterReqBrochure_Close() {
// load the add to basket modal
$( "#dialogReqBrochure" ).dialog( "close" );
}
// submit form (form verification)
// ================================
function fFooterReqBrochure_Submit() {
// form fields
var sYourName = document.getElementById('sFooterReqBrochure_YourName').value;
var sYourEmail = document.getElementById('sFooterReqBrochure_YourEmail').value;
var sCompanyName = document.getElementById('sFooterReqBrochure_CompanyName').value;
var sTel = document.getElementById('sFooterReqBrochure_Tel').value;
var sAddress = document.getElementById('sFooterReqBrochure_Address').value;
var sTown = document.getElementById('sFooterReqBrochure_Town').value;
var sCounty = document.getElementById('sFooterReqBrochure_County').value;
var sPostCode = document.getElementById('sFooterReqBrochure_PostCode').value;
var sCountry = document.getElementById('sFooterReqBrochure_Country').value;
// form verification
var sErr = "";
if (sYourName=="") {
sErr+="\n - Please enter your name";
}
if (fCheckEmail(sYourEmail)=="invalid") {
sErr+="\n - Your email address isn't valid";
}
if (sAddress=="") {
sErr+="\n - Please enter your address";
}
if (sPostCode=="") {
sErr+="\n - Please enter your postal/zip code";
}
if (sErr!="") {
alert("There were some problems submitting the form. Please see below:\n"+sErr);
} else {
fFooterReqBrochure_Process();
}
// submit form via ajax
}
// submit form (process)
// ================================
function fFooterReqBrochure_Process() {
// form fields
var sYourName = document.getElementById('sFooterReqBrochure_YourName').value;
var sYourEmail = document.getElementById('sFooterReqBrochure_YourEmail').value;
var sCompanyName = document.getElementById('sFooterReqBrochure_CompanyName').value;
var sTel = document.getElementById('sFooterReqBrochure_Tel').value;
var sAddress = document.getElementById('sFooterReqBrochure_Address').value;
var sTown = document.getElementById('sFooterReqBrochure_Town').value;
var sCounty = document.getElementById('sFooterReqBrochure_County').value;
var sPostCode = document.getElementById('sFooterReqBrochure_PostCode').value;
var sCountry = document.getElementById('sFooterReqBrochure_Country').value;
// define AJAX url
var sAjaxURL = "ajax/footer_reqbrochure_exec.php?sYourName=" + sYourName + "&sYourEmail=" + sYourEmail + "&sAddress=" + sAddress + "&sPostCode=" + sPostCode + "&sCompanyName=" + sCompanyName + "&sTel=" + sTel + "&sCounty=" + sCounty + "&sCountry=" + sCountry + "&sTown=" + sTown;
// call ajax URL
$.get(sAjaxURL, function(data) {
// get the result
$('.result').html(data);
// close the modal window
$( "#dialogReqBrochure" ).dialog( "close" );
// alert the results
alert("Thank you. Your call back request has been sent. We'll do our best to reply as soon as possible.");
});
}
// CALL BACK
// ==============
// show modal box
// ===============
function fFooterCallBack_Show() {
// redirect to the call back page
location.href = 'call-me-back-about-web-design.php';
}
// close modal box
// ===============
function fFooterCallBack_Close() {
// load the add to basket modal
$( "#dialogCallBack" ).dialog( "close" );
}
// submit form (form verification)
// ================================
function fFooterCallBack_Submit() {
// form fields
var sYourName = document.getElementById('sFooterCallBack_YourName').value;
var sYourEmail = document.getElementById('sFooterCallBack_YourEmail').value;
var sCompanyName = document.getElementById('sFooterCallBack_CompanyName').value;
var sTel = document.getElementById('sFooterCallBack_Tel').value;
var sEnquiry = document.getElementById('sFooterCallBack_Enquiry').value;
// form verification
var sErr = "";
if (sYourName=="") {
sErr+="\n - Please enter your name";
}
if (fCheckEmail(sYourEmail)=="invalid") {
sErr+="\n - Your email address isn't valid";
}
if (sEnquiry=="") {
sErr+="\n - Please enter your enquiry / message";
}
if (sErr!="") {
alert("There were some problems submitting the form. Please see below:\n"+sErr);
} else {
fFooterCallBack_Process();
}
// submit form via ajax
}
// submit form (process)
// ================================
function fFooterCallBack_Process() {
// form fields
var sYourName = document.getElementById('sFooterCallBack_YourName').value;
var sYourEmail = document.getElementById('sFooterCallBack_YourEmail').value;
var sCompanyName = document.getElementById('sFooterCallBack_CompanyName').value;
var sTel = document.getElementById('sFooterCallBack_Tel').value;
var sEnquiry = document.getElementById('sFooterCallBack_Enquiry').value;
// define AJAX url
var sAjaxURL = "ajax/footer_callback_exec.php?sYourName=" + sYourName + "&sYourEmail=" + sYourEmail + "&sCompanyName=" + sCompanyName + "&sTel=" + sTel + "&sEnquiry=" + sEnquiry;
// call ajax URL
$.get(sAjaxURL, function(data) {
// get the result
$('.result').html(data);
// close the modal window
$( "#dialogCallBack" ).dialog( "close" );
// alert the results
alert("Thank you. Your call back request has been sent. We'll do our best to reply as soon as possible.");
});
}