$(document).ready(function() {
	//bind mouseover/mouseout events to buttons
	$('IMG.more-square').mouseover(function() { this.src= "/wp-content/themes/cc-wp-theme/images/orange.jpg"; }).mouseout(function() { this.src= "/wp-content/themes/cc-wp-theme/images/red.jpg"; });
	
});



$(document).ready(function() {
    $('div.homepage-cs-item').each(function() {
        $(this).hover(function() {
  $('img', this).stop().animate({ opacity: 0.5 }, 100);
			$(this).css({'background' : 'url(/wp-content/themes/cc-wp-theme/images/khaki.jpg)', 'color' : '#cc0000!important'}).fadeTo(100, 0.8);
	
        },
       function() {
           $('img', this).stop().animate({ opacity: 1.0 }, 100);
	$(this).css("background", "url(/wp-content/themes/cc-wp-theme/images/yel.jpg)").fadeTo(100, 1.0);
       });
    });
});

$(document).ready(function() {
    $('div.canright-pick').each(function() {
        $(this).hover(function() {

            $('img', this).stop().animate({ opacity: .5 }, 0);
        },
       function() {
           $('img', this).stop().animate({ opacity: 1.0 }, 0);
       });
    });
});

$(document).ready(function(){

	//Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide(); 



	//Slide up and down on click
	$("div.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("slow");

	});
	$("div.triggerc").click(function(){
		$(this).parent(".toggle_container").slideToggle("slow");
	});	

});


/*
 * tooltip2 script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip2-and-image-preview-using-jquery
 *
 */
 


this.tooltip2 = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip2").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip2'>"+ this.t +"</p>");
		$("#tooltip2")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip2").remove();
    });	
	$("a.tooltip2").mousemove(function(e){
		$("#tooltip2")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


// starting the script on page load
$(document).ready(function(){
	tooltip2();
	tooltip();
});


function validate() {
test=document.signupform.email.value;
if (test=='Enter Email Address') {
alert('Oops, looks like we didn\'t get your email. \n\nPlease write your email address in the box and click the \"Sign Up\" button, thanks!');
return false;
}
else if(test==''){alert('Oops, looks like we didn\'t get your email. \n\nPlease write your email address in the box and click the \"Sign Up\" button, thanks!'); return false;}
alert('Thanks for Signing Up!');
document.signupform.submit();

}
function validatefull() {
test=document.signupform.first_name.value;

if (test=='') {
alert('Oops, looks like we didn\'t get your first name. \n\nPlease write your first name in the box and click the \"Sign Up\" button, thanks!');
return false;
}

test=document.signupform.last_name.value;
if (test=='') {
alert('Oops, looks like we didn\'t get your last name. \n\nPlease write your last name in the box and click the \"Sign Up\" button, thanks!');
return false;
}

test=document.signupform.email.value;
if (test=='') {
alert('Oops, looks like we didn\'t get your email. \n\nPlease write your email address in the box and click the \"Sign Up\" button, thanks!');
return false;
}

alert('Thanks for Signing Up!');
document.signupform.submit();
}

function clearText(field){

    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;

}




