/**
 * Continent7 Design based on YAML
 *
 * (en) central javascript - layout Continent7 based on YAML (http://www.yaml.de)
 * (de) Zentrales Javascript - layout Continent7 based on YAML (http://www.yaml.de)
 *
 * @copyright       Copyright Continent7 Bartels & Nellessen GbR
 * @link            http://www.continent7.com
 */

var c7 = {};


$(document).ready(function(){
	//enable hidden content for the case images are not enabled
	$(".showwithoutimages").removeClass('hideme').addClass('showme');
	
	//check if images are activated in the browsers (source: Peter Paul Koch | http://www.quirksmode.org/dom/fir.html)
	var W3CDOM = (document.createElement && document.getElementsByTagName);
	if (!W3CDOM) return;
	var testimage = new Image();
	var tmpdate = new Date();
	var suffix = tmpdate.getTime();
	testimage.src = '/fileadmin/images/dot.png?'+suffix;
	testimage.onload = c7.imagesLoaded;

	$("#web-engineering-cloud>li").tsort({order:"rand"});
	$("#web-engineering-cloud").tagcloud({height:250,type:"sphere",colormax:"116793",colormin:"555555"});
	$("#managed-server-cloud>li").tsort({order:"rand"});
	$("#managed-server-cloud").tagcloud({height:250,type:"sphere",colormax:"116793",colormin:"555555"});


});

c7.imagesLoaded = function (){
	//disable content if images are activated
	$(".showwithoutimages").removeClass('showme').addClass('hideme');
	
	if(typeof images_to_preload != 'object' || !$.isArray(images_to_preload) )
	images_to_preload = new Array(7);
	images_to_preload[0] = new Image();
	images_to_preload[0].src = '/fileadmin/simages/transparent-background-dot.png';
	images_to_preload[1] = new Image();
	images_to_preload[1].src = '/fileadmin/images/home/ws-expanded.png';
	images_to_preload[2] = new Image();
	images_to_preload[2].src = '/fileadmin/images/home/se-expanded.png';
	images_to_preload[3] = new Image();
	images_to_preload[3].src = '/fileadmin/images/home/itc-expanded.png';
	images_to_preload[4] = new Image();
	images_to_preload[4].src = '/fileadmin/images/home/ws-expanded-ie.png';
	images_to_preload[5] = new Image();
	images_to_preload[5].src = '/fileadmin/images/home/se-expanded-ie.png';
	images_to_preload[6] = new Image();
	images_to_preload[6].src = '/fileadmin/images/home/itc-expanded-ie.png';
	c7.startboxhover();
};

/* ----------------------------------------------------------------------------
	Startseite: Box Hover Effekt 
---------------------------------------------------------------------------- */
c7.startboxhover = function (){
	$("a.homebox_link").hover(
		      function () {
		    	  $(this).stop();
		    	  
		    	  $(this).removeClass("homebox_link");
		    	  $(this).addClass("homebox_link_effect");
		    	  $(this).css("height", "106px");
		    	  

		    	  $(this).animate({ 
		    	        height: "300px"
		    	      });


			        /*$(this).css("background", "url(\"./images/home/ws.png\")");
			        $(this).css("height", "106px");*/
		      },
		      function () {
		    	  $(this).stop();
		    	  $(this).animate({ 
		    	        height: "106px"
		    	      }, 200 , "linear", function(){
		    	    	  $(this).removeClass("homebox_link_effect");
				    	  $(this).addClass("homebox_link");
		    	      }
		    	  );
		    	  /*
		    	  $(this).height(106);
		    	  $(this).removeClass("homebox_link_effect");
		    	  $(this).addClass("homebox_link");*/
		      }
		    );
};


