// JavaScript Document

$(document).ready(function() {
		// GET CURRENT PAGE NAME:
		var sPath = window.location.pathname;
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
		var fPage = sPath.substring(sPath.lastIndexOf('/') - 9);
		var bPage = sPath.substring(sPath.lastIndexOf('/') - 5);
		if (sPage == "") { sPage = "home"; }
		fPage = fPage.substring(0, 9);
		bPage = bPage.substring(1, 5);
		
		bigbubble1 = function() {  $(".bigbubble1").animate({bottom: "10px"}, 800, "easeOutBack");  }
		bigbubble2 = function() {  $('.bigbubble2').animate({bottom: '50px'},500,'easeOutBack');  }
		bigbubble3 = function() {  $('.bigbubble3').animate({bottom: '64px'},500,'easeOutBack');  }
		bigbubble4 = function() {  $('.bigbubble4').animate({bottom: '67px'},500,'easeOutBack');  }
		bigbubble5 = function() {  $('.bigbubble5').animate({bottom: '50px'},500,'easeOutBack');  }
		
		if (sPage.indexOf("home") != -1) { // if index
			gingerman = function() {  $(".gingerman").animate({bottom: "10px" }, 1500, "easeOutElastic");  }
			popout3 = function() { $("#searchbox").animate({height: "42px"}, 1000, "easeOutBounce"); }
			netballad = function() { $(".netball").animate({height: "50px"}, 1000, "easeOutBounce"); }
			popout2 = function() { $("#whatsnew").animate({height: "215px"}, 1300, "easeOutBounce"); }
			popout33 = function() { $("#facebook").animate({height: "65px"}, 1300, "easeOutBounce", function() { 
          $('#facebook').removeClass('facebookanimate'); $('#facebook').addClass('facebookoverflow');
      }); }
			
			if (navigator.appName == "Microsoft Internet Explorer") {
					twinkle1 = function() {  $('.twinkle1').toggle(); }
					twinkle2 = function() {  $('.twinkle2').toggle(); }
					twinkle3 = function() {  $('.twinkle3').toggle(); }
					twinkle4 = function() {  $('.twinkle4').toggle(); }
					twinkle5 = function() {  $('.twinkle5').toggle(); }

			} else {
					twinkle1 = function() {  $('.twinkle1').fadeIn('1000', function() { $('.twinkle1').fadeOut('1000', function() { setTimeout("twinkle1()",500); }); });  }
					twinkle2 = function() {  $('.twinkle2').fadeIn('1000', function() { $('.twinkle2').fadeOut('1000', function() { setTimeout("twinkle2()",600); }); });  }
					twinkle3 = function() {  $('.twinkle3').fadeIn('1000', function() { $('.twinkle3').fadeOut('1000', function() { setTimeout("twinkle3()",700); }); });  }
					twinkle4 = function() {  $('.twinkle4').fadeIn('1000', function() { $('.twinkle4').fadeOut('1000', function() { setTimeout("twinkle4()",800); }); });  }
					twinkle5 = function() {  $('.twinkle5').fadeIn('1000', function() { $('.twinkle5').fadeOut('1000', function() { setTimeout("twinkle5()",900); }); });  }
			}

    } else if (sPage.indexOf("ournetballteam") != -1) {
          
          fadeball = function() { $('.basketball').fadeIn('1000'); }
          gingerman = function() {  $(".gingerman").animate({bottom: "10px" }, 1500, "easeOutElastic");  }
          popout3 = function() { $("#searchbox").animate({height: "42px"}, 1000, "easeOutBounce"); }
          popout2 = function() { $("#whatsnew").animate({height: "215px"}, 1300, "easeOutBounce"); }
    
		} else if (sPage.indexOf("blog") != -1 || bPage == "blog" || bPage == "tags" || bPage == "page") { // if blog
		
			gingerman = function() {  $(".gingerman").animate({top: "-195px" }, 1500, "easeOutElastic");  }
			radio = function() {  $(".radio").animate({bottom: "114px" }, 1700, "easeOutElastic");  }
			popout3 = function() { $("#searchbox").animate({height: "86px"}, 1000, "easeOutBounce"); }
			popout2 = function() { $("#whatsnew").animate({height: "167px"}, 1300, "easeOutBounce"); }
			greenbox = function() { $("#greenbox1").animate({height: "130px"}, 1300, "easeOutBounce"); }
			archivebox = function() { $("#greenbox2").animate({height: "120px"}, 1300, "easeOutBounce"); }
			setTimeout("radio()",800);
			
		} else if (sPage.indexOf("contact") != -1) { // if contact
		
			popout3 = function() { $("#searchbox").animate({height: "86px"}, 1000, "easeOutBounce"); }
			googlebox = function() { $(".gbox").animate({height: "121px"}, 1000, "easeOutBounce"); }
			whitebox = function() { $(".wbox").animate({height: "232px"}, 1000, "easeOutBounce"); }
			gingerman = function() {  $(".gingerman").animate({bottom: "90px" }, 1500, "easeOutElastic");  }
			
		} else if (sPage.indexOf("about") != -1) { // if contact
		
			popout3 = function() { $("#searchbox").animate({height: "86px"}, 1000, "easeOutBounce"); }
			gingerman = function() {  $(".gingerman").animate({top: "-205px" }, 1500, "easeOutElastic");  }
			
		} else if ((sPage.indexOf("products") != -1) || (sPage.indexOf("vacancies") != -1)) { // if contact
		
			popout3 = function() { $("#searchbox").animate({height: "86px"}, 1000, "easeOutBounce"); }
			gingerman = function() {  $(".gingerman").animate({top: "-195px" }, 1500, "easeOutElastic");  }
			
		} else if (sPage.indexOf("portfolio") != -1) { // if contact
		
			popout3 = function() { $("#searchbox").animate({height: "86px"}, 1000, "easeOutBounce"); }
			gingerman = function() {  $(".gingerman").animate({bottom: "60px", }, 1500, "easeOutElastic");  }
			
		} else if (fPage == "portfolio") { // if contact
		
			popout3 = function() { $("#searchbox").animate({height: "86px"}, 1000, "easeOutBounce"); }
			gingerman = function() {  $(".gingerman").animate({bottom: "60px", }, 1500, "easeOutElastic");  }
			redbox1 = function() { $(".redbox1").animate({height: "60px"}, 1000, "easeOutBounce"); }
			redbox2 = function() { $(".redbox2").animate({height: "340px"}, 1000, "easeOutBounce"); }
			redbox3 = function() { $(".redbox3").animate({height: "70px"}, 1000, "easeOutBounce"); }
			redbox4 = function() { $(".redbox4").animate({height: "90px"}, 1000, "easeOutBounce"); }
		}
		

		circle1 = function() {  $('.circle1').animate ({top: "-200px"}, 10000, "linear", function() {$(".circle1").css("top","320px"); circle1(); });  }
		circle2 = function() {  $('.circle2').animate ({top: "-200px"}, 16500, "linear", function() { $(".circle2").css("top","320px"); setTimeout("circle2()",1000); });  }
		circle3 = function() {  $('.circle3').animate ({top: "-200px"}, 8000, "linear", function() { $(".circle3").css("top","320px"); setTimeout("circle3()",2000); });  }
		circle4 = function() {  $('.circle4').animate ({top: "-200px"}, 12200, "linear", function() { $(".circle4").css("top","320px"); setTimeout("circle4()",3000); });  }
		circle5 = function() {  $('.circle5').animate ({top: "-200px"}, 10000, "linear", function() { $(".circle5").css("top","320px"); setTimeout("circle5()",2000); });  }
		circle6 = function() {  $('.circle6').animate ({top: "-200px"}, 8500, "linear", function() { $(".circle6").css("top","320px"); setTimeout("circle6()",2000); });  }
		circle7 = function() {  $('.circle7').animate ({top: "-200px"}, 4250, "linear", function() { $(".circle7").css("top","320px"); setTimeout("circle7()",2000); });  }
		circle8 = function() {  $('.circle8').animate ({top: "-200px"}, 5000, "linear", function() { $(".circle8").css("top","320px"); setTimeout("circle8()",2000); });  }
		circle9 = function() {  $('.circle9').animate ({top: "-200px"}, 7700, "linear", function() { $(".circle9").css("top","320px"); setTimeout("circle9()",2000); });  }
		circle10 = function() {  $('.circle10').animate ({top: "-200px"}, 8700, "linear", function() { $(".circle10").css("top","320px"); setTimeout("circle10()",500); });  }
		circle11 = function() {  $('.circle11').animate ({top: "-200px"}, 13700, "linear", function() { $(".circle11").css("top","320px"); setTimeout("circle11()",0); });  }
		circle12 = function() {  $('.circle12').animate ({top: "-200px"}, 4700, "linear", function() { $(".circle12").css("top","320px"); setTimeout("circle12()",0); });  }
		circle13 = function() {  $('.circle13').animate ({top: "-200px"}, 7700, "linear", function() { $(".circle13").css("top","320px"); setTimeout("circle13()",0); });  }
		circle14 = function() {  $('.circle14').animate ({top: "-200px"}, 7700, "linear", function() { $(".circle14").css("top","320px"); setTimeout("circle14()",3000); });  }
		circle15 = function() {  $('.circle15').animate ({top: "-200px"}, 7300, "linear", function() { $(".circle15").css("top","320px"); setTimeout("circle14()",1750); });  }
	
		popout1 = function() { $("#popoutoffice").animate({height: "215px"}, 1300, "easeOutBounce"); }
		
		popout4 = function() {  $('.comeinside').fadeIn('1000');  } 
		
		text = function() { $('.bannertext').animate({ opacity: 'toggle', top: '60px' }, "slow"); }


	setTimeout("bigbubble1()",000);
    setTimeout("bigbubble2()",200);
    setTimeout("bigbubble3()",300);
    setTimeout("bigbubble4()",400);
    setTimeout("bigbubble5()",600);
    setTimeout("gingerman()",500);
	
    
	
    setTimeout("circle1(),text()",1000);
    setTimeout("circle2()",900);
    setTimeout("circle3()",1500);
    setTimeout("circle4()",1000);
    setTimeout("circle5()",2000);
    setTimeout("circle6()",2000);
    setTimeout("circle7()",1000);
    setTimeout("circle8()",900);
    setTimeout("circle9()",300);
    setTimeout("circle10()",500);
    setTimeout("circle11()",3500);
    setTimeout("circle12()",3500);
    setTimeout("circle13()",4500);
    setTimeout("circle14()",500);
    setTimeout("circle15()",000);
	
	setTimeout("popout1()", 1200);
	if (sPage.indexOf("home") != -1) { // if index
		setTimeout("popout2()", 1900);
		setTimeout("netballad()", 2700);
		setTimeout("popout3()", 2700);
		setTimeout("popout33()", 3400);
		setTimeout("twinkle1()",2000);
		setTimeout("twinkle2()",2100);
		setTimeout("twinkle3()",2200);
		setTimeout("twinkle4()",2300);
		setTimeout("twinkle5()",2400);
	} else 	if (sPage.indexOf("ournetballteam") != -1) { // if netabll
		setTimeout("popout2()", 1900);
		setTimeout("popout3()", 2700);
		setTimeout("fadeball()", 1500);
	} else if (sPage.indexOf("blog") != -1 || bPage == "blog" || bPage == "tags" || bPage == "page") { // if blog
		setTimeout("popout2()", 1800);
		setTimeout("popout3()", 1100); // searchbox
		setTimeout("greenbox()", 2500);
		setTimeout("archivebox()", 2550);
	} else if (sPage.indexOf("contact") != -1) { // if contact
		setTimeout("popout3()", 1100); // searchbox  
		setTimeout("googlebox()", 1800);
		setTimeout("whitebox()", 2500);
	} else if (sPage.indexOf("about") != -1) { // if contact
		setTimeout("popout3()", 1100); // searchbox  
	} else if ((sPage.indexOf("products") != -1) || (sPage.indexOf("vacancies") != -1)) { // if contact
		setTimeout("popout3()", 1100); // searchbox  
	} else if (sPage.indexOf("portfolio") != -1) { // if contact
	
		setTimeout("popout3()", 1100); // searchbox  
		
	} else if (fPage == "portfolio") { // if contact
		setTimeout("popout3()", 1100); // searchbox  
		setTimeout("redbox1()", 1800); // searchbox  
		setTimeout("redbox2()", 1800); // searchbox  
		setTimeout("redbox3()", 2500); // searchbox  
		setTimeout("redbox4()", 2500); // searchbox  
	}
	
	setTimeout("popout4()", 1200);

  docwidth = $(window).width();

  if (docwidth < 1024) {
      $(".outnote").hide();
  }

});

