Code:
$(document).ready(function() { /*start of document ready */
$('#basic-text').siblings().hide();
$('#web-nav-container ul li a:first').css('background-color','#ffffff');
$('#web-nav-container li a').click(function() {
$('#web-nav-container li a').css('background', '#CBCBCB');
$(this).css('background', '#FFFFFF');
});
$('.more').live('click',function(){
var href = $(this).attr('href');
if ($('#web-content-container').is(':visible')) {
$('#web-content-container').empty();
}
$('#web-content-container').load('http://www.stwsonline.com/wp-content/themes/stws/web-service-text.html '+href);
});
$(".content").hide();
//toggle the componenet with class msg_body
$(".header").click(function()
{
$('.content').hide(700);
$(this).next().slideToggle(200);
});
/* highlight content and when you click slideToggle*/
$("#foo2").carouFredSel({
height: 'auto',
width: '700',
circular: false,
infinite: false,
auto : false,
padding : 0,
align : "center",
prev : {
button : "#foo2_prev",
key : "left"
},
next : {
button : "#foo2_next",
key : "right"
},
pagination : "#foo2_pag",
scroll : {
fx : "fade"
},
items : {
visible : 4,
minimum : 1
}
});
/*CarouselFred information*/
$(".web1")
.attr('rel', 'gallery')
.fancybox({
padding : 0,
'titlePosition' : 'inside'
});
$(".web2")
.attr('rel', 'gallery2')
.fancybox({
padding: 0,
'titlePosition': 'inside'
});
$(".web3")
.attr('rel', 'gallery3')
.fancybox({
padding: 0,
'titlePosition': 'inside'
});
$(".web4")
.attr('rel', 'gallery4')
.fancybox({
padding: 0,
'titlePosition': 'inside'
});
/* Web1 - web4 facybox*/
//$('#other').click(function() {
$('.input-radio').attr('checked', false);
$('#other').click(function() {
$('#other-radio').attr('checked', true);
});
/*input radio manipulation*/
$('input[type="text"]').addClass("idleField");
$('input[type="text"]').focus(function() {
$(this).removeClass("idleField").addClass("focusField");
if (this.value == this.defaultValue){
this.value = '';
}
});
/* border around form*/
$('input[type="text"]').blur(function() {
$(this).removeClass("focusField").addClass("idleField");
if ($.trim(this.value) == ''){
this.value = (this.defaultValue ? this.defaultValue : '');
}
});
/* border goes away on un-focus*/
$("#textarea").focus(function() {
if (this.value === this.defaultValue) {
this.value = '';
}
$(this).removeClass("idleField").addClass("focusField");
});
/* textarea on focus text disappears and focusField class applied */
$("#textarea").blur(function() {
if (this.value === '') {
this.value = this.defaultValue;
}
$(this).removeClass("focusField").addClass("idleField");
});
/* textarea on un-focus text disappears and focusField class applied */
});
(function($,W,D)
{
var JQUERY4U = {};
JQUERY4U.UTIL =
{
setupFormValidation: function()
{
$.validator.addMethod('defaultCheck', function (value, element) {
if (element.value == element.defaultValue) {
return false;
}
return true;
});
//form validation rules
$("#feedbackform").validate({
rules: {
phone: "required defaultCheck",
comment: "required",
cname: "required defaultCheck",
comment: "required defaultCheck",
email: {
required: true,
email: true
}
},
messages: {
cname: "Please enter your first name",
phone: "Please enter a phone number",
comment: "Please enter a comment",
email: "Please enter a valid email address"
},
submitHandler: function(form) {
form.submit();
}
}); /* end of .validate() */
$("#commentform").validate({
rules: {
CuCo_Phone: "required",
comment: "required",
author: "required defaultCheck",
comment: "required defaultCheck",
email: {
required: true,
email: true
}
},
messages: {
author: "Please enter your first name",
CuCo_Phone: "Please enter a phone number",
comment: "Please enter a comment",
email: "Please enter a valid email address"
},
submitHandler: function(form) {
form.submit();
}
}); /* end of .validate() */
}
}
//when the dom has loaded setup form validation rules
$(D).ready(function($) {
JQUERY4U.UTIL.setupFormValidation();
});
})(jQuery, window, document);
Bookmarks