var news=0;

function GoBack(){
	history.back();
}

function PrintPage(url){
	var ex = window.location.href;
	if (ex.indexOf('?')>-1){
		window.open(ex+"&typeP=1", "print", 'height=600,width=800,resizable=yes,scrollbars=yes,status=yes');
	} else {
		window.open(ex+"?typeP=1", "print", 'height=600,width=800,resizable=yes,scrollbars=yes,status=yes');
	}
	//window.print();
}



$(function() {
	$('#centerColumn > div.ListClients, #centerColumn > div.ListTeam,').each(function() {
		$(this).children('p.text').not(':first').slideUp(1);
		$(this).children('p.more').children('a').click(function(){
			$("#centerColumn > div").children('p.secondtext').slideUp(1000);
			$("#centerColumn > div").children('p.more').slideDown(1000);		
			$("#centerColumn > div").children('h1').removeClass("active");
			$(this).parent().parent().children('p.more').slideUp(1000);
			$(this).parent().parent().children('p.text').not(':first').slideDown(1000);
			$(this).parent().parent().children('h1').addClass("active");
			return false;
		});
		
		$(this).children('img').click(function(){
			$("#centerColumn > div").children('p.secondtext').slideUp(1000);
			$("#centerColumn > div").children('p.more').slideDown(1000);		
			$("#centerColumn > div").children('h1').removeClass("active");
					 	
			$(this).siblings('p.text').not(':first').slideDown(1000);
			$(this).siblings('p.more').slideUp(1000);
			$(this).siblings('h1').addClass("active");
			
			return false;
		 
		});
	});
	
	$('#centerColumn > div.workflow').each(function(i){
		$('.workflowContent', $(this)).slideUp(1);
		$(' > .workflowTitle, > img',$(this)).click(function(){
			$(this).parent().siblings('.workflow').children('.workflowContent').slideUp(1000);
			$(this).siblings('.workflowContent').slideToggle(1000);
		});
	});
	
	$('#centerColumn > div.workflow h1 embed').click(function(){
			$(this).parent().parent().parent().siblings('.workflow').children('.workflowContent').slideUp(1000);
			$(this).parent().parent().siblings('.workflowContent').slideToggle(1000);
		});
	
	
	//rightcolumn
	//small typo3 issue fixed here [need to move the <a> tag so i'll preserve the structure h3 + div
	$('#rightMenu > a').remove();
	$('#rightMenu > h3').click(function(){$(this).next('div').toggle("slow");}).next('div').not('.not').hide();
	
	//sitemap
	$('#sitemapWraper a.sitemap').click(function(){$(this).parent().next().toggle("slow"); $('#footer').css( "margin-top","20px" ); return false;}).parent().next().hide();


	//ballon text
	$('li.Ballon a').each(function(){
		if ($(this).attr('newtext') != undefined) {
			$(this).Tooltip({ 
				track: true, 
				delay: 0, 
				showURL: false, 
				opacity: 1, 
				fixPNG: true, 
				showBody: " - ", 
				extraClass: "pretty", 
				top: -55, 
				left: 5 
			});
		}
	});

	
	$('li.Ballon a').mouseover(function(){
		$('#tooltip').css({ display: "block" }).find('p').remove().end().append('<p>'+$(this).attr('newtext')+'</p>');
	});
});

function makeShadowBoxes()
{
	if (document.getElementsByTagName)
	{
		var anchors = document.getElementsByTagName("a");
		for (var loop = 0; loop < anchors.length; loop++)
		{
			var anchor = anchors[loop];
			var children = anchor.getElementsByTagName("img");
			for(var iloop = 0; iloop < children.length; iloop++)
			{
				var img = children[iloop];
				if(img.getAttribute("alt") == 'shadowbox')
				{
					anchor.rel = 'shadowbox;width=835;height=515';
				}
				if(img.getAttribute("alt") == 'self')
				{
					anchor.target = '_self';
				}
			}
		}
	}
}

function ToTop() {
	var url = window.location.href;
	document.location.href = url+"#top";
}