$(document).ready(function() {

	$('#ssBox1').hoverIntent(
		function(){$('.pageid_2').show('slow');},
		function(){$('.pageid_2').hide('slow');}
	);
	$('#ssBox2').hoverIntent(
		function(){$('.pageid_3').show('slow');},
		function(){$('.pageid_3').hide('slow');}
	);
	$('#ssBox3').hoverIntent(
		function(){$('.pageid_4').show('slow');},
		function(){$('.pageid_4').hide('slow');}
	);

	$("body").append('<img src="/sitedata/images/form-popup-email.png" class="ssFormPopEmail" style="position:absolute; display:none;" />');

	$("input[name=ajhduas]").bind('focus',function(ev) {
	  //get the position of the placeholder element
	  var pos = $("input[name=ajhduas]").offset();  
	  var width = $("input[name=ajhduas]").width();
	  //show the menu directly over the placeholder
	  $("img.ssFormPopEmail").css( { "left": (pos.left) + "px", "top":(pos.top-157) + "px" } );
	  $("img.ssFormPopEmail").fadeIn('slow');
	});

	$("input[name=ajhduas]").bind('blur',function(ev) {
		$("img.ssFormPopEmail").fadeOut('fast');
	});
	
	// Twitter
	$.ajax({
		type: 'GET',
		url: 'http://twitter.com/statuses/user_timeline/iundm.json?count=10',
		dataType: 'jsonp',
		success: function(data){
			$.each(data,function(i,item){
				$('div#ssTwitter').append('<div class="ssTweet"><img src="'+item.user.profile_image_url+'" alt="Instandhaltung &amp; Montage Twitter Avatar"/><p>'+item.text+'</p></div>');
			});
		},
		complete: function(){
			//$('div#ssTwitter').append('<p>... mehr gibt es auf <a href="http://twitter.com/polarity">Twitter</a>.</p>');
		},
		error: function(){
			$('div#ssTwitter').append('<p>... fehler!</p>');
		}
	});
});
