﻿// Background color animation
$(document).ready(function () {

    var location = $(window).attr('location').toString();

    //If we're working on localhost, subst the image.ashx
    if ((location.match("localhost") != null) ||
			(location.match("127.0.0.1") != null)) {
        $('img[src*=Image.ashx]').attr('src', function () {
            return 'http://www.techaholics.gr/' + $(this).attr('src');
        });

        $('img[src*=uploads/]').attr('src', function () {
            return 'http://www.techaholics.gr/' + $(this).attr('src');
        });

        disqus_developer = true;
    }

	//Colorbox can be used on any page by simply adding the class="colorbox" to the <a class=""> declaration.
	//For more Colorbox uses, consult http://colorpowered.com/colorbox/

	$(".colorbox").colorbox();
	$(".youtube").colorbox({ iframe: true, width: 650, height: 550 });  //for linking directly to youtube videos
	$(".iframe").colorbox({ width: "80%", height: "80%", iframe: true });  //outside webpage reference
	$(".inline").colorbox({ width: "50%", inline: true, href: "#inline_1" }); //learn more button (feature slider)
	$(".inline2").colorbox({ width: "50%", inline: true, href: "#inline_2" }); //our services button (feature slider)
	$(".search_pop").colorbox({ width: "50%", inline: true, href: "#search_pop" }); //for the search pop-up reference

	// Image Fading Technique used on frontpage
	$("img.a").hover(
		function () {
			$(this).stop().animate({ "opacity": "0" }, "slow");
		},
		function () {
			$(this).stop().animate({ "opacity": "1" }, "slow");
		}
	);

	// Color hover
	$(".box-red").hover(function () {
		$(this).stop().animate({ backgroundColor: "#E3001B" }, 200);
		$(this).children("p").stop().animate({ color: "black" }, 200);
	}, function () {
		$(this).stop().animate({ backgroundColor: "#000000" }, 400);
		$(this).children("p").stop().animate({ color: "#555" }, 400);
	});

	$(".box-green").hover(function () {
		$(this).stop().animate({ backgroundColor: "#97C00E" }, 200);
		$(this).children("p").stop().animate({ color: "black" }, 200);
	}, function () {
		$(this).stop().animate({ backgroundColor: "#000000" }, 400);
		$(this).children("p").stop().animate({ color: "#555" }, 400);
	});

	$(".box-blue").hover(function () {
		$(this).stop().animate({ backgroundColor: "#61C3DC" }, 200);
		$(this).children("p").stop().animate({ color: "black" }, 200);
	}, function () {
		$(this).stop().animate({ backgroundColor: "#000000" }, 400);
		$(this).children("p").stop().animate({ color: "#555" }, 400);
	});

	$(".box-purple").hover(function () {
		$(this).stop().animate({ backgroundColor: "#821980" }, 200);
		$(this).children("p").stop().animate({ color: "black" }, 200);
	}, function () {
		$(this).stop().animate({ backgroundColor: "#000000" }, 400);
		$(this).children("p").stop().animate({ color: "#555" }, 400);
	});

	$(".box-orange").hover(function () {
		$(this).stop().animate({ backgroundColor: "#F29400" }, 200);
		$(this).children("p").stop().animate({ color: "black" }, 200);
	}, function () {
		$(this).stop().animate({ backgroundColor: "#000000" }, 400);
		$(this).children("p").stop().animate({ color: "#555" }, 400);
	});
});
