$(function(){
	$('#menu a img.other')
		.css( {backgroundPosition: "center 0px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(center -56px)"}, {duration:210});
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(center 0px)"}, {duration:210, complete:function(){
				$(this).css({backgroundPosition: "center 0px"})
			}});
		});
		$('#currentpage').unbind("mouseover");
});

$(function(){
	$(".part_overview_text p").hide();
	$("a.slider_trig").hover(function(){
	  $("#" + $(this).parents(".part_overview").attr("id") + " p").slideToggle(170);
	  $("#" + $(this).parents(".part_overview").attr("id") + " .part_overview_arrow").toggleClass("part_overview_arrowUp");
	  $(this).bgFade("fadeIn",
      		{
            top: 0,
            left: 0,
            width: 316,
            height: 90});}, function(){																							 
	  		$("#" + $(this).parents(".part_overview").attr("id") + " p").slideToggle(170);
	  		$("#" + $(this).parents(".part_overview").attr("id") + " .part_overview_arrow").removeClass("part_overview_arrowUp");
	  		$(this).bgFade("fadeOut",
      		{
            top: 0,
            left: 0,
            width: 316,
            height: 90});});
});
	
	
/*$(function(){
	$("#contact").hide();
	$(".contactme").click(function(){
	
		$("#contact").click(function(){return false;});
	  $("#contact").slideToggle(500, function() {
		$("body").click(function(){
		if($("#contact").is(":visible")) {
			$("#contact").slideToggle(500);
		}
		$("body").unbind('click');
		});
	});
	return false;
	  });
});*/

$(function(){
	$("#contact").hide();
	$(".contactme").click(function(){
	  $("#contact").slideToggle(500);
	});
	$("#close").click(function(){
	  $("#contact").slideToggle(500);
	});
});

$(function(){
	$("#contactme").click(function(){
	$("#contact").hide();
	  $("#contact").delay(1000).slideToggle(500);
	});
});

/*$(function(){
	$("#cntctFrm").submit(function(){
		var str = $(this).serialize();
		$.ajax({
		type: "POST",
		url: "/contact.php",
		data: str,
		success: function(msg){
			//$("#note").ajaxComplete(function(event, request, settings){
			$("#note").ajaxComplete(function(event, request, settings){
				if(msg == 'OK') {// Message Sent? Show the 'Thank You' message and hide the form
					result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
					$("#contact_form").hide();
					$("#contact").delay(1300).fadeOut(500);
					
				}
				else {
					result = msg;
				} 
				$(this).html(result);
			});
			}
		});
		return false;
	});
});*/
	
$(function(){
	$(".tools_exp:not(.firsttool_exp)").hide();
	$("#tools_icons ul li").click(function() {
		var getIndex = $(this).index() + 1;
		//$(this).get(getIndex);
		$("#tools_main div").fadeOut(500);
		$("#tools_main div:nth-child(" + getIndex + ")").delay(200).fadeIn(500);
		//alert("this is the " + getIndex + " item");
	});
});

/**
(function($){
 
	$.fn.addEventIco = function(){
                $(this).hover(function() { //On hover...

		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'

		//Set a background image(thumbOver) on the <a> tag - Set position to bottom
		$(this).find("a.icon_overfx").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});

		//Animate the image to 0 opacity (fade it out)
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).hide() //Hide the image after fade
		});
	} , function() { //on hover out...
		//Fade the image to full opacity 
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});
        };
 
})(jQuery)
**/
$(function() {
	var thumbOver = $("#tools_icons ul li.firsttool a.icon_overfx").find("img").attr("src");
	$("#tools_icons ul li.firsttool a.icon_overfx").css({'background' : 'url(' + thumbOver + ') 				no-repeat center bottom'})
	$("#tools_icons ul li.firsttool a.icon_overfx").stop().find("span").fadeTo('normal', 0);
	
	
});

(function($){
 
	$.fn.addEventIco = function(){
                $(this).bind("mouseover", function() { //On hover...

		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'

		//Set a background image(thumbOver) on the <a> tag - Set position to bottom
		$(this).find("a.icon_overfx").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});

	if ($(this).find("span").css('opacity') == 1) {
	  $(this).bind("mouseout", function() { //on hover out...
		//Fade the image to full opacity 
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});
	
		}
		//Animate the image to 0 opacity (fade it out)
		$(this).find("span").stop().fadeTo('normal', 0);
	})
        };
 
})(jQuery)


$(function() {

	$("#tools_icons ul li").addEventIco();
	
	$("#tools_icons ul li").click(function() { //On click...
		$(this).unbind("mouseout");
		$("#tools_icons ul li").not(this).addEventIco();
		$("#tools_icons ul li").not(this).find("span").stop().fadeTo('normal', 1).show();
	});
});

$(document).ready(function() {
	$('#footer_publication_ul').hide();
	$('#publi').css({display: 'block'});
	$('#footer_legal').css({right:'0px', top:'0px', textAlign: 'right', backgroundPosition: 'right 26px'});
		$('#validXhtml').css({marginTop: '21px'});
		$('#footer_publication_ul').css({marginTop: '27px'});
	$('#footer_content #publi a').click(function() {
		if ($('#footer_publication_ul').is(":hidden")) {
		$('#footer_legal').animate({backgroundPosition: 'left 26px'}, 200);
		$('#validXhtml').animate({marginTop: '0px'}, 1200);
		$('#footer_content #publi a').animate({color:'#979797'}, 600);
		$('#footer_content #publi').animate({left:'+=353px'}, 500);
		$('#footer_content #publi a').append(" (close)");
		$('#footer_legal').animate({top:'100px'}, 500).animate({right:'700px'},  500).animate({top:'20px'}, 500);
		$('#footer_legal').css({textAlign: 'left'});
		$('#footer_publication_ul').fadeIn(900);
		}
		else {
			$('#footer_publication_ul').fadeOut(300);
			$('#footer_legal').animate({backgroundPosition: 'right 26px'}, 200);
			$(this).animate({color:'#383838'}, 600);
			$('#footer_content #publi').animate({left:'0px'}, 600);
			$('#footer_content #publi a').html("INSTIX as seen on...");
			$('#validXhtml').animate({marginTop: '21px'}, 600);
			$('#footer_legal').animate({right:'0px', top:'0px'}, 500);
			$('#footer_legal').css({textAlign: 'right'});
		}
		//$('#footer_publication_ul').fadeToggle(600);
	});
});

