//jQuery.noConflict();

jQuery(document).ready(function(){
	
	function addLoadEvent(your_function) {
			if (window.attachEvent) {window.attachEvent('onload', your_function);}
			else if (window.addEventListener) {window.addEventListener('load', your_function, false);}
			else {document.addEventListener('load', your_function, false);}
		}
	
		function tweetfeed_load() {
			// IE8 doesn't support html5 canvas, so better just "try" to show it (else show standard tag widget)
			try {

		    	
		    	
		    	TagCanvas.weight = true;
				TagCanvas.weightFrom = 'data-weight';
				TagCanvas.outlineColour = '#9A9A8E';
				TagCanvas.textColour = '#9A9A8E';
				TagCanvas.shadow = '#9A9A8E';
				TagCanvas.maxSpeed = 0.035;
				TagCanvas.initial = [0.1,-0.1];
				TagCanvas.interval = 25;
				TagCanvas.hideTags = false;
				TagCanvas.reverse = true;
				TagCanvas.Start('myCanvas1','myCanvasul1');
				TagCanvas.Start('myCanvas2','myCanvasul0');
				//TagCanvas.Start('myCanvas1','myCanvasul1');
		    	
	    	} catch(err) 
	    	{
	    		//jQuery('#taglist').css('myCanvas','none');
	    		//jQuery('#taglist').css('display','block');
	   	 	}
		}
	
		addLoadEvent(tweetfeed_load);
	
	
	
	
	/*jQuery('#myCanvas0').tagcanvas(
			{
				weight : true,
				weightFrom : 'data-weight',
				outlineColour : '#9A9A8E',
				textColour : '#9A9A8E',
				//shadow : '#ccf',
				maxSpeed : 0.04,
				//initial : [0.1,-0.1],
				interval : 25,
				hideTags : false,
				reverse : true
	   	},'#myCanvasul0');
	jQuery('myCanvas1').tagcanvas(
			{
				weight : true,
				weightFrom : 'data-weight',
				outlineColour : '#9A9A8E',
				textColour : '#9A9A8E',
				//shadow : '#ccf',
				maxSpeed : 0.04,
				//initial : [0.1,-0.1],
				interval : 25,
				hideTags : false,
				reverse : true
	   	},'myCanvasul1');
	
	*/
	// Formularfelder
	jQuery('.eingabefeld').bind({
	  click: function() {
	  	var v = jQuery(this).val();
	  	if(v == 'Suchbegriff eingeben')
	  	{
	  		jQuery(this).val('');
	  	}
	  },
	  blur: function() {
	    var i = jQuery(this).val();
		if(i.length == 0)
		{
			jQuery(this).val('Suchbegriff eingeben');
		}
	  }
	});
	jQuery('#user').bind({
	  click: function() {
	  	var v = jQuery(this).val();
	  	if(v == 'Händlername')
	  	{
	  		jQuery(this).val('');
	  	}
	  },
	  blur: function() {
	    var i = jQuery(this).val();
		if(i.length == 0)
		{
			jQuery(this).val('Händlername');
		}
	  }
	});
	jQuery('#pass').bind({
	  click: function() {
	  	var v = jQuery(this).val();
	  	if(v == 'Passwort')
	  	{
	  		jQuery(this).val('');
	  	}
	  },
	  blur: function() {
	    var i = jQuery(this).val();
		if(i.length == 0)
		{
			jQuery(this).val('Passwort');
		}
	  }
	});
	jQuery('#anfahrt').bind({
	  click: function() {
	  	var v = jQuery(this).val();
	  	if(v == 'Straße, Stadt')
	  	{
	  		jQuery(this).val('');
	  	}
	  },
	  blur: function() {
	    var i = jQuery(this).val();
		if(i.length == 0)
		{
			jQuery(this).val('Straße, Stadt');
		}
	  }
	});
	
	
	
	// Übersichtseite der Produkte
	
	jQuery('#pro_ueber .menu li a').bind({
		click: function(){
	  		var id = jQuery(this).parent().attr('id');
	  		jQuery('#'+id+'_e .text').css('display','block');
	  		
	  		return false;
	  },
	  mouseover: function (){
	  	
	  	var id = jQuery(this).parent().attr('id');
	  	
	  	if( jQuery('#'+id+'_e').css('display') != 'block')
	  	{
		  	jQuery('#pro_ueber .element .text').css('display','none');
		  	jQuery('#pro_ueber .element').css('display','none');
		  	jQuery('#'+id+'_e').css('display','block');
	  	}
	  }
	});
	
	// Schließen Button
	jQuery('#pro_ueber .element .textbottom .close').click(function(){
		
		jQuery(this).parent().parent().css('display','none');
	});
	
	
	
	
});
