$(document).ready(function(){
	$(function() {
		$("a.tooltip").tooltip({ 
			bodyHandler: function() { 
			return $(this).attr("value"); 
		}, 
		showURL: false 
		});
	});
	
	$("#quicklinks").change(function() {
		if (this.value)	document.location = this.value;
	});
	
	$("#backlink").click(function() {
		history.back(-1);
	});
	
	$("#printlink").click(function() {
		if (this.rel){
			window.open('print.php?'+this.rel,'printwindow','width=530,height=790,scrollbars=yes,resizable=yes');
		}
	});
	
	$("#sendlink").click(function() {
		if (this.rel) {
			window.location = 'index.php?op=MailToForm&id='+this.rel;
		}
	});
	
	$("#closelink").click(function() {
		window.close();
	});
	$("#finalprintlink").click(function() {
		window.print();
	});

	$('#s3slider').cycle({ 
	    fx: 'fade', 
		pause: 1,
		random: 1,
	    speed: 500,
	    timeout: 7000,
		cleartype:0,
		nowrap:1
	 });
	 $('#s3slider').slideDown("slow");

	$(function(){
		$(".form-textfield").focus(function(){
			$(this).toggleClass("form-input-focused");
		});
		$(".form-textfield").blur(function(){
			$(this).toggleClass("form-input-focused");
		});
	});

	$(function(){
		$(".form-textareafield").focus(function(){
			$(this).toggleClass("form-input-focused");
		});
		$(".form-textareafield").blur(function(){
			$(this).toggleClass("form-input-focused");
		});
	});
	
	/**
	 * a function to change the bg of the form buttons
	 */
	$(function() {
		$('.form-button').mouseout(function() {
			$(this).toggleClass("hover");
		});
		$('.form-button').mouseover(function() {
			$(this).toggleClass("hover");
		});
	});
	
	$(function(){
		$("#global-search-form-text").focus(function(){
			$(this).val("");
		});
	});
});