// My Controls
$(document).ready(function() {
// target="_blank" for strict doctype
$('a.ext').attr('target','_blank');

//remove horizontal scrollbars

$("body").css("overflow-x", "hidden");


//remove search value on click
$('#search-entry').click(function () {
	if ($(this).val() == 'Search...') {$(this).val('');} else {$(this).select();}
});



// fancybox
	$(".gallery a").fancybox({
		'titleShow'		: false
	});

	$(".gallery a").append("<img src='wp-content/themes/stc/images/magnify.jpg' class='magnify' />");
	$(".magnify").css({"opacity": 0});
	
	$(".gallery a").hover(function(){
		$(this).children(".magnify").stop(true, true).animate({"opacity": 0.77});						
	}, function(){
		$(this).children(".magnify").stop(true, true).animate({"opacity": 0});	
	});




//jdigiclock
$('#digiclock').jdigiclock();

//Testimonial Fader
$('.testimony blockquote').quovolver();

/*-- Ajax Contact Form --*/
	
	$('#contactform').submit(function(){
	
		var action = $(this).attr('action');
		
		$("#message").slideUp(750,function() {
		$('#message').hide();
		
 		$('#submit')
			.after('<img src="wp-content/themes/stc/images/ajax-loader.gif" class="loader" />')
			.attr('disabled','disabled');
		
		$.post(action, { 
			name: $('#name').val(),
			email: $('#email').val(),
			phone: $('#phone').val(),
			subject: $('#subject').val(),
			comments: $('#comments').val(),
			verify: $('#verify').val()
		},
			function(data){
				document.getElementById('message').innerHTML = data;
				$('#message').slideDown('slow');
				$('#contactform img.loader').fadeOut('slow',function(){$(this).remove()});
				$('#contactform #submit').attr('disabled',''); 
				if(data.match('success') != null) $('#contactform').slideUp('slow');
				
			}
		);
		
		});
		
		return false; 
	
	});
	



});

