﻿/// <reference path="/sondestan/js/jquery-1.3.2.min.js" />
(function($) {
        $.fn.clearDefault = function() {
                return this.each(function() {
                        var default_value = $(this).attr('title');
                        $(this).val(default_value);
                        var id = $(this).attr('id');

                        var labl = $("label[for='" + id + "']");
                        //alert(labl);
                        if (typeof (labl) != undefined) {
                                labl.hide();
                        };
                        $(this).focus(function() {
                                if ($(this).val() == default_value) $(this).val("");
                        });
                        $(this).blur(function() {
                                if ($(this).val() == "") $(this).val(default_value);
                        });
                });
        };
})(jQuery);

jQuery.fn.fadeSliderToggle = function(settings) {
 	 settings = jQuery.extend({
		speed:500,
		easing : "swing"
	}, settings)
 	if($(this).css("display") == "none"){
 		$(this).animate({
 			opacity: 1,
 			height: 'toggle'
 		}, settings.speed, settings.easing);
	}else{
		$(this).animate({
 			opacity: 0,
 			height: 'toggle'
 		}, settings.speed, settings.easing);
	}
}; 

jQuery.browser.version = (jQuery.browser.msie && /msie 7\.0/i.test(navigator.userAgent)) ? "7.0" : (jQuery.browser.msie && /msie 8\.0/i.test(navigator.userAgent) ? "8.0" : jQuery.browser.version);

$(document).ready(function() {
    $(".clear-hint").clearDefault();
    
    $(".openTarget").click(function() {
        var $this = $(this);
        var target = $this.attr("href");
        $(target).fadeSliderToggle({speed: 400});
        return false;
    });
    
    $(".changeIt").click(function() {
        var $this = $(this);
        var changeIt = $this.attr("ref");
        var src = $this.attr("src");
        //var usual = $.data($this, "usualImg");
        if (changeIt != "undefined") {
                $this.attr("src", changeIt);
                $this.attr("ref", src);
        }
    });
    
	$("a.opaque-links img").css("opacity", "0.4");
	$("a.opaque-links img").hover(function() {
	        $(this).stop(true, true).animate({opacity: "1"}, 200);
	},
	function() {
	        $(this).animate({opacity: "0.4"}, 500);
	});
	

});
