
/*/ --------- :: ---------- :: ---------- :: ---------- //

CODE REFERENCE
--------------


(Scripts for use by ajax called pages)

1. MAIN NAV AJAX STUFF
2. FANCYBOX 1
3. HOME FADES 1
4. CONTACT FORM VALIDATION 1


(Scripts for use by directly accessed pages)

5. HOME FADES 2
6. FANCYBOX 2
7. CONTACT FORM VALIDATION 2


// --------- :: ---------- :: ---------- :: ---------- /*/


/* <![CDATA[ */
jQuery.noConflict();
(function($) { 
$(function() {
									
// 1. START MAIN NAV AJAX STUFF //

$("body").delegate(".reglinks", "click", function(){
var url = $(this).attr('href');

$(".node").fadeOut(700);
$("#bigladybg").slideUp(700,function(){
$(this).load( url, function() {
$(this).slideDown(700);

// --------- :: ---------- :: ---------- :: ---------- //
// --------- :: ---------- :: ---------- :: ---------- //

// 2. START FANCY BOX 1 //

$(document).ready(function() {
							
/* This is basic - uses default settings */

$("a.worksamp").fancybox({			 
'transitionIn'	: 'elastic',
'transitionOut'	: 'elastic',
'easingIn'      : 'easeOutBack',
'easingOut'     : 'easeInBack',
'titlePosition' : 'inside',
});
								
/* Using custom settings */
								
$("a#sampinline").fancybox({
'hideOnContentClick': true,
'transitionIn'	: 'elastic',
'transitionOut'	: 'elastic',
'easingIn'      : 'easeOutBack',
'easingOut'     : 'easeInBack',
'titlePosition' : 'inside',
});
							
/* Apply fancybox to multiple items */							
								
$("a.workgroup").fancybox({
'transitionIn'	:	'elastic',
'transitionOut'	:	'elastic',
'speedIn'		:	600, 
'speedOut'		:	200, 
'overlayShow'	:	false,
});
});

// 2. END FANCY BOX 1 //

// --------- :: ---------- :: ---------- :: ---------- //
// --------- :: ---------- :: ---------- :: ---------- //

// 3. START HOME FADES 1 //

function formatText(index, panel) {
return index + "";
};
						
$(document).ready(function () {
$('#pause1').fadeIn(1200,function () {	
$('#talkbubble').fadeIn(1500,function () {
$('#pause2').fadeIn(1800,function () {
$('#fadebg').fadeIn(1500,function () {
$('#sliderbg').fadeIn(2500, function() { 
$('.anythingslider').anythingSlider({
easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing 		plugin
autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
delay: 3000,                    // How long between slide transitions in AutoPlay mode
startStopped: false,            // If autoPlay is on, this can force it to start stopped
animationTime: 700,             // How long the slide transition takes
hashTags: true,                 // Should links change the hashtag in the URL?
buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
startText: "Go",                // Start text
stopText: "Stop",               // Stop text
navigationFormatter: formatText // Details at the top of the file on this use (advanced use)
});
});
});
});
});
});
});

// 3. END HOME FADES 1 //

// --------- :: ---------- :: ---------- :: ---------- //
// --------- :: ---------- :: ---------- :: ---------- //

// 4. START CONTACT FORM VALIDATION 1 //

$(document).ready(function() {
//focus on first input
//$('#fname_Req').focus();
							
function isValidEmailAddress(emailAddress) 
{
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
}
							
function isValidPhoneNumber(phone_number)
{
phone_number = phone_number.replace(/\s+/g, "");
var pattern = new RegExp(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
return pattern.test(phone_number);
}
							
//submit check
$("#submit").click(function(){
$("#message").hide();
$("#message").empty();
var hasError = false;
						
var Recipients = $("#recipients").val();
var Subject = $("#subject").val();
var Mail_options = $("#mail_options").val();
var Good_url = $("#good_url").val();
var Bad_url = $("#bad_url").val();
var nameToVal = $("#fname_Req").val();
var emailToVal = $("#contact_Req_Email").val();
var companyToVal = $("#fcompany_Req").val();
var phoneToVal = $("#fphone_Req").val();
var messageToVal = $("#fmessage_Req").val();

if(nameToVal == '') {
$("#message").append('<span class="error">Please enter your name.</span><br/>');
hasError = true;
}

if(emailToVal == '') {
$("#message").append('<span class="error">Please enter your email address.</span><br/>');
hasError = true;
} else if(!isValidEmailAddress(emailToVal)) {
$("#message").append('<span class="error">Please enter a valid email address.</span><br/>');
hasError = true;
}

if(phoneToVal == '') {
$("#message").append('<span class="error">Please enter your phone number.</span><br/>');
hasError = true;
} else if(!isValidPhoneNumber(phoneToVal)) {
$("#message").append('<span class="error">Please enter a valid phone number.</span><br/>');
hasError = true;
}

if(messageToVal == '') {
$("#message").append('<span class="error">Please enter a brief description.</span><br/>');
hasError = true;
}

if(hasError == false)
{
$.post("http://www.bigladymedia.com/inc/formmail.php",
{ recipients: Recipients, subject: Subject, mail_options: Mail_options, good_url: Good_url, bad_url: Bad_url, 	Name: nameToVal, Email: emailToVal, Company: companyToVal, Phone: phoneToVal, Message: messageToVal},
function(data){
$("#contactform").slideUp("normal", function() {
$("#contactform").before('<h1 id="formsuccess-title">Thank You!</h1><p id="formsuccess-message">Your message has been recieved.<br />The Big Lady will contact you shortly :)</p>');
});
}
);
}
else
{
$("#message").show();
}
						
return false;
});
						
});

// 4. END CONTACT FORM VALIDATION //

// --------- :: ---------- :: ---------- :: ---------- //
// --------- :: ---------- :: ---------- :: ---------- //

})
});

// ADD/REMOVE CLASSES TO NAV BUTTONS DYNAMICALLY, FOR FUTURE HOVER EFFECTS //
					
$('#navigation li').removeClass('current_page_item current_page_parent current_page_ancestor');
$(this).parent().addClass('current_page_item');
return false;
});

// 1. END MAIN NAV AJAX STUFF //

// --------- :: ---------- :: ---------- :: ---------- //
// --------- :: ---------- :: ---------- :: ---------- //

// 5. START HOME FADES 2 //

function formatText(index, panel) {
return index + "";
};
			
$(document).ready(function () {
$('#pause1').fadeIn(1200,function () {	
$('#talkbubble').fadeIn(1500,function () {
$('#pause2').fadeIn(1800,function () {
$('#fadebg').fadeIn(1500,function () {
$('#sliderbg').fadeIn(2500, function() { 
$('.anythingslider').anythingSlider({
easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
autoPlay: true,                 // This turns off the entire FUNCTIONALITY, not just if it starts running or not.
delay: 3000,                    // How long between slide transitions in AutoPlay mode
startStopped: false,            // If autoPlay is on, this can force it to start stopped
animationTime: 700,             // How long the slide transition takes
hashTags: true,                 // Should links change the hashtag in the URL?
buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
startText: "Go",                // Start text
stopText: "Stop",               // Stop text
navigationFormatter: formatText // Details at the top of the file on this use (advanced use)
});
});
});
});
});
});
});

// 5. END HOME FADES 2 //

// --------- :: ---------- :: ---------- :: ---------- //
// --------- :: ---------- :: ---------- :: ---------- //

// 6. START FANCYBOX 2 //

$(document).ready(function() {
							
/* This is basic - uses default settings */

$("a.worksamp").fancybox({			 
'transitionIn'	: 'elastic',
'transitionOut'	: 'elastic',
'easingIn'      : 'easeOutBack',
'easingOut'     : 'easeInBack',
'titlePosition' : 'inside',
});
								
/* Using custom settings */
								
$("a#sampinline").fancybox({
'hideOnContentClick': true,
'transitionIn'	: 'elastic',
'transitionOut'	: 'elastic',
'easingIn'      : 'easeOutBack',
'easingOut'     : 'easeInBack',
'titlePosition' : 'inside',
});
							
/* Apply fancybox to multiple items */							
								
$("a.workgroup").fancybox({
'transitionIn'	:	'elastic',
'transitionOut'	:	'elastic',
'speedIn'		:	600, 
'speedOut'		:	200, 
'overlayShow'	:	false,
});
});

// 6. END FANCYBOX 2 //

// --------- :: ---------- :: ---------- :: ---------- //
// --------- :: ---------- :: ---------- :: ---------- //

// 7. START CONTACT FORM VALIDATION 2 //

$(document).ready(function() {
//focus on first input
//$('#fname_Req').focus();
			
function isValidEmailAddress(emailAddress) 
{
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
}
			
function isValidPhoneNumber(phone_number)
{
phone_number = phone_number.replace(/\s+/g, "");
var pattern = new RegExp(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
return pattern.test(phone_number);
}
			
//submit check
$("#submit").click(function(){
$("#message").hide();
$("#message").empty();
var hasError = false;
		
var Recipients = $("#recipients").val();
var Subject = $("#subject").val();
var Mail_options = $("#mail_options").val();
var Good_url = $("#good_url").val();
var Bad_url = $("#bad_url").val();
var nameToVal = $("#fname_Req").val();
var emailToVal = $("#contact_Req_Email").val();
var companyToVal = $("#fcompany_Req").val();
var phoneToVal = $("#fphone_Req").val();
var messageToVal = $("#fmessage_Req").val();
				
if(nameToVal == '') {
$("#message").append('<span class="error">Please enter your name.</span><br/>');
hasError = true;
}
				
if(emailToVal == '') {
$("#message").append('<span class="error">Please enter your email address.</span><br/>');
hasError = true;
} else if(!isValidEmailAddress(emailToVal)) {
$("#message").append('<span class="error">Please enter a valid email address.</span><br/>');
hasError = true;
}
				
if(phoneToVal == '') {
$("#message").append('<span class="error">Please enter your phone number.</span><br/>');
hasError = true;
} else if(!isValidPhoneNumber(phoneToVal)) {
$("#message").append('<span class="error">Please enter a valid phone number.</span><br/>');
hasError = true;
}
				
if(messageToVal == '') {
$("#message").append('<span class="error">Please enter a brief description.</span><br/>');
hasError = true;
}
				
if(hasError == false)
{
$.post("http://www.bigladymedia.com/inc/formmail.php",
{ recipients: Recipients, subject: Subject, mail_options: Mail_options, good_url: Good_url, bad_url: Bad_url, 	Name: nameToVal, Email: emailToVal, Company: companyToVal, Phone: phoneToVal, Message: messageToVal},
function(data){
$("#contactform").slideUp("normal", function() {
$("#contactform").before('<h1>Success</h1><p>Your email was sent.</p>');
});
}
);
}
else
{
$("#message").show();
}
		
return false;
});
		
});

// 7. END CONTACT FORM VALIDATION 2 //

// --------- :: ---------- :: ---------- :: ---------- //
// --------- :: ---------- :: ---------- :: ---------- //

});
})(jQuery);
/* ]]> */
