
$(document).ready(function() {


	$("#logo").wrap("<div class='bottom-shadow-bl'>").wrap("<div class='bottom-shadow-br'>");
	$(".not-front #sidebar-last .block .inner, #block-views-eliteasiakkaat_new-block_1 .view-eliteasiakkaat-new td img").wrap("<div class='bottom-shadow'>");
	//$("<div class='bottom-shadow' style='overflow:auto'>").appendTo($("#header-group"));
	//$("<div class='postscript-bottom-liner'></div>").insertBefore(".views-field-field-infobox-value .field-item-0");
	
//$("#block-views-asiakkaat_coda-block_1").show();
						   
	$("#webform-client-form-70").attr("action", "");
	$("#webform-client-form-70").attr("onSubmit", "return false");
	/*
	$(".field-field-toteutus-peruskuvasivusta").insertBefore("#sidebar-last .region-inner");
	
	$(".intro-text").parent($("p")).appendTo("#introt");
	
	var intronkorkeus = $("#introt").height();
	intronkorkeus += 30;
		$("#sidebar-last").css("margin-top", intronkorkeus+"px");
	var intronleveys = $("#content-column").width();
		intronleveys -= 900;
		$("#introt").css("padding-right", intronleveys+"px");
		//alert(intronleveys);
	
	$.each($('#block-views-eliteasiakkaat_grid-block_1 .views-row-item, .polaroid'), function(){
		
			var randomnumber=Math.floor(Math.random()*4);
			randomnumber-=2;
			var srotate = "rotate(" + randomnumber + "deg)";														 
			$(this).css("-webkit-transform", srotate );
			$(this).css("-moz-transform", srotate );
		
	});
	$.each($('.jcarousel-item, #sidebar-last a img'), function(){
		
		var randomnumber=Math.floor(Math.random()*4);
		randomnumber-=2;
		var srotate = "rotate(" + randomnumber + "deg)";														 
		$(this).css("-webkit-transform", srotate );
		$(this).css("-moz-transform", srotate );
	});
	$.each($('.screenshot_container td'), function(){
		var randomnumber=Math.floor(Math.random()*2);
		randomnumber-=1;
		var srotate = "rotate(" + randomnumber + "deg)";														 
		$(this).css("-webkit-transform", srotate );
		$(this).css("-moz-transform", srotate );
		
		//$(this).css({ "-webkit-transform": "2deg", "-moz-transform": "2deg" });
	});
	*/
	$.each($('.change-this-address'), function(){
		var address = $(this).html();
		address = address.replace("(miumau)", "@");
		$(this).html(address);
		$(this).wrap("<a href='mailto:"+address+"'></a>");
	});
	/*
	$(".screenshot_container td, #block-views-eliteasiakkaat_grid-block_1 .views-row-item, .polaroid").hover(function(){
																													  },function(){
		var randomnumber=Math.floor(Math.random()*4);
		randomnumber-=2;
		var srotate = "rotate(" + randomnumber + "deg)";
		$(this).css({"-webkit-transform": srotate, "-moz-transform": srotate}, 2000);
	});
	$("#pyyda_tarjous img").hover(function(){
  		$(this).css("-moz-box-shadow", "-3px 0 0.5em #FFFFFF");
		$(this).css("-webkit-box-shadow", "-3px 0 0.5em #FFFFFF");//D00689
	},function(){
  		$(this).css("-moz-box-shadow", "0 0 0 0 #FFFFFF");
		$(this).css("-webkit-box-shadow", "0 0 0 0  #FFFFFF");
	});
	*/
	
	$.each($("#slider .node-type-eliteasiakas"), function(){
		var title_t = $(this).attr("id");
		//alert(title_t);
		var title_tt = title_t.split("-");
		var title = title_tt[1];
		
		$("li.tabtitle-108-"+title+" a").html("");
		$("#node-"+title+" img.imagecache-eliteasiakas_icon_default").appendTo($("li.tabtitle-108-"+title+" a"));
		/*
		$("#node-"+title+" img.imagefield-field_teaser_img").insertAfter($(".tabtitle-108-"+title+" a"));
		$(".tabtitle-108-"+title+" img.imagefield-field_teaser_img").wrap($("li.tabtitle-108-"+title+" a.slidetab"));
		*/
//		$(".tabtitle-108-"+title+" a").remove();
	//	tabtitle-108-65 first
	});
	/*
	var coda_count = 1; 
	$.each($("#coda-slider-12-block-1-0 .panel-wrapper .views-field-field-teaser-img-fid-1 "), function(){
		$(this).appendTo("#coda-nav-1 li.tab"+coda_count+" a")
		coda_count++;
		/*
		var title_tt = title_t.split("-");
		var title = title_tt[1];
		
		$("li.tabtitle-108-"+title+" a").html("");
		$("#node-"+title+" img.imagecache-eliteasiakas_icon_default").appendTo($("li.tabtitle-108-"+title+" a"));
		/*
		$("#node-"+title+" img.imagefield-field_teaser_img").insertAfter($(".tabtitle-108-"+title+" a"));
		$(".tabtitle-108-"+title+" img.imagefield-field_teaser_img").wrap($("li.tabtitle-108-"+title+" a.slidetab"));
		*/
//		$(".tabtitle-108-"+title+" a").remove();
	//	tabtitle-108-65 first
	//});
	/*
	$("#block-block-53 a").hover(function(){
  		$(this).animate({"fontSize":"35px"},500);
	},function(){
		var fsize = Math.random()*11 + 20;
  		$(this).animate({"fontSize":fsize+"px"},200);
	});
	*/
	
	
/*	
	(function() {
    var x, y, $elie, pos, nowX, nowY, i, $that, vel, deg, fade, curve, ko, mo, oo, grow, len;

    // Returns a random integer between min and max  
    // Using Math.round() will give you a non-uniform distribution!  
    function ran(min, max)  
    {  
        return Math.floor(Math.random() * (max - min + 1)) + min;  
    } 

    function moveIt()
    {
        $("#block-block-53 a").each(function(i, v) {
            $elie = $(v);
            if (! $elie.data("time"))
            {
                $elie.data("time", ran(30, 100));
                $elie.data("deg", ran(-179, 180));
                $elie.data("vel", ran(3, 10));  
                $elie.data("curve", ran(0, 1));
                $elie.data("fade", ran(0, 1));
                $elie.data("grow", ran(-2, 2));                
            }

            vel = $elie.data("vel");
            deg = $elie.data("deg");
            fade = $elie.data("fade");            
            curve = $elie.data("curve");
            grow = $elie.data("grow");

            len = $elie.width();
            if (grow > 0)
                len = Math.min(len + grow, 50);
            else
                len = Math.max(len + grow, 20);

            $elie.css("-moz-border-radius", len/2);
            $elie.css("border-radius", len/2);

            $elie.css("width", len);
            $elie.css("height", len);

            pos = $elie.position();            

            $elie.data("time", $elie.data("time") - 1);

            if (curve)
                $elie.data("deg", (deg + 5) % 180);
            else
                $elie.data("deg", (deg - 5) % 180);

            ko = $elie.css("-khtml-opacity");
            mo = $elie.css("-moz-opacity");
            oo = $elie.css("opacity");
            if (fade)
            {
                $elie.css("-khtml-opacity", Math.max(ko - .1, .5));
                $elie.css("-moz-opacity", Math.max(mo - .1, .5));
                $elie.css("opacity", Math.max(oo - .1, .5));
            } else
            {
                $elie.css("-khtml-opacity", Math.min(ko - -.1, 1));
                $elie.css("-moz-opacity", Math.min(mo - -.1, 1));
                $elie.css("opacity", Math.min(oo - -.1, 1));                
            }

            if (vel < 3)
                $elie.data("time", 0);
            else
                $elie.data("vel", vel - .2);            


            nowX = pos.left;
            nowY = pos.top;

            x = vel * Math.cos(deg * Math.PI/180);
            y = vel * Math.sin(deg * Math.PI/180);

            nowX = nowX + x;            
            nowY = nowY + y;

            if (nowX < 0)
                nowX = 490 + nowX;
            else
                nowX = nowX % 490;

            if (nowY < 0)
                nowY = 490 + nowY;
            else
                nowY = nowY % 490;            
            $elie.css("left", nowX);
            $elie.css("top",  nowY);
        });
    }
    $(function() {
        $(document.createElement('div')).appendTo('#header-group-wrapper').attr('id', 'box');
        $elie = $("<div/>").attr("class","spec");
        // Note that math random is inclussive for 0 and exclussive for Max
        for (i = 0; i < 100; ++i)
        {
            $that = $elie.clone();  
            $that.css("top", ran(0, 495));
            $that.css("left", ran(0, 495));            
            $("#box").append($that);            
        }          
        timer = setInterval(moveIt, 60);
        $("input").toggle(function() {
            clearInterval(timer);
            this.value = " Start ";
        }, function() {
            timer = setInterval(moveIt, 60);        
            this.value = " Stop ";            
        });        
    });
}());


$("#block-views-infoboxes-block_1 img").wrap("<span class='hue-overlay'></span>");

$(".hue-overlay").each(function(){
  $("<img class='overlay' src='/sites/all/themes/fusion/fusion_eo/images/overlay.png' />").appendTo($(this));
});

$("#block-views-infoboxes-block_1 .hue-overlay").hover(function() { //On hover...

		
		//Animate the image to 0 opacity (fade it out)
		$(this).find("img.overlay").stop().fadeTo('normal', 0);
	} , function() { //on hover out...
		//Fade the image to full opacity 
		$(this).find("img.overlay").stop().fadeTo('normal', 1);
	});

*/

});

