// JavaScript Document

var activeBigMap;
var aah_contactinfo = "<img src='images/contact_aah_header.png' width='200' height='29'><br />Filmbyen 4<br />8100 aarhus c<br />+45 8620 4060<br /><a href='mailto:info@zuparecommended.dk' class='contact'>info<span class='at'>@</span>zuparecommended.dk</a><p class='contacts'><a href='mailto:jorgen.blauert@zuparecommended.dk' class='contact'>Jørgen Blauert</a> +45 2124 4616<br /><a href='mailto:jannek.bejtrup@zuparecommended.dk' class='contact'>Jannek Bejtrup</a> +45 2630 7826<br /><br /></p>";
var cph_contactinfo = "<img src='images/contact_kbh_header.png' width='235' height='31'><br />nygårdsvej 5, 2. sal<br />2100 københavn ø<br />+45 8620 4060<br /><a href='mailto:info@zuparecommended.dk' class='contact'>info<span class='at'>@</span>zuparecommended.dk</a><p class='contacts'><a href='mailto:niels.ranum@zuparecommended.dk' class='contact'>Niels Ranum</a> +45 2630 3520<br /><a href='mailto:rune.gitz-johansen@zuparecommended.dk' class='contact'>Rune Gitz - Johansen</a> +45 26 82 85 63<br /><a href='mailto:per.lobedanz@zuparecommended.dk' class='contact'>Per Lobedanz Witthøfft</a> +45 2422 4370</p>";

function initContact()
{	
	contact_resetCircles()
}





///////////////* OPENING SCREEN WITH TWO EQUAL SIZED CIRCLES *//////////////

function contact_resetCircles()
{
	//Resets the circles when the circles 
	$("#contact_txt_cph").css({ 'display':'none' });
	$("#contact_txt_aah").css({ 'display':'none' });
	
	$("#contact_redcircle_big * img").animate({ 'width':314, 'height':345}, 500 );
	$("#contact_redcircle_big * img").css({ 'margin-right':20 }); 
	$("#contact_redcircle_big * img").attr( 'src', 'images/contact_redcircle_shadow.png');
	
	$("#contact_blackcircle_big * img").animate({ 'width':314, 'height':345}, 500 ); 
	$("#contact_blackcircle_big * img").css({ 'margin-left':20 });
	$("#contact_blackcircle_big * img").attr( 'src', 'images/contact_blackcircle_shadow.png');
	
	$("#contact_td1").css({ 'width':'' });
	$("#contact_td2").css({ 'width':'' });
	
	$("#contact_txt_cph").html(cph_contactinfo);
	$("#contact_txt_aah").html(aah_contactinfo);
	
	$("#contact_redcircle_big").unbind('click mouseenter mouseleave');
	$("#contact_blackcircle_big").unbind('click mouseenter mouseleave');
	
	
	// Creates  the hover effect for both of the circles
	$("#contact_redcircle_big").hover(
	function()
	{
		$("#contact_blackcircle_big * img").animate({ 'width':238, 'height':261}, 500 ); 
		$("#contact_blackcircle_big * img").attr( 'src', 'images/contact_blackcircle_shadow_blur.png');
	},
	function()
	{
		$("#contact_blackcircle_big * img").animate({ 'width':314, 'height':345}, 500 ); 
		$("#contact_blackcircle_big * img").attr( 'src', 'images/contact_blackcircle_shadow.png');
	});
	
	
	$("#contact_redcircle_big").click( 
	function()
	{
		$("#contact_redcircle_big").unbind('click mouseenter mouseleave');
		$("#contact_blackcircle_big").unbind('click mouseenter mouseleave');
		$("#contact_redcircle_big * img").animate({ 'width':0, 'height':345}, 200,  'easeInExpo', function(){contact_flipToMap("cph")} ); 
	});
	

	
	
	$("#contact_blackcircle_big").hover(
	function()
	{
		$("#contact_redcircle_big * img").animate({ 'width':238, 'height':261}, 500 ); 
		$("#contact_redcircle_big * img").attr( 'src', 'images/contact_redcircle_shadow_blur.png');
	},
	function()
	{
		$("#contact_redcircle_big * img").animate({ 'width':314, 'height':345}, 500 ); 
		$("#contact_redcircle_big * img").attr( 'src', 'images/contact_redcircle_shadow.png');
	});
	
	
	$("#contact_blackcircle_big").click( 
	function()
	{
		$("#contact_blackcircle_big").unbind('click mouseenter mouseleave');
		$("#contact_redcircle_big").unbind('click mouseenter mouseleave');
		$("#contact_blackcircle_big * img").animate({ 'width':0, 'height':345}, 200,  'easeInExpo', function(){contact_flipToMap("aah")} ); 
	});
	
}


///////////////* FLIPS TO THE BIG CARDS *//////////////



function contact_flipToMap(state)
{
	$("#contact_blackcircle_big * img").css({ 'margin-left':0 });
	$("#contact_redcircle_big * img").css({ 'margin-right':0 }); 
	
	if(state == "cph")
	{
		$("#contact_redcircle_big * img").attr( 'src', 'images/cph_map.jpg');
		$("#contact_blackcircle_big * img").attr( 'src', 'images/contact_blackcircle_shadow.png');
		$("#contact_redcircle_big * img").animate({ 'width':539, 'height':555}, 400, 'easeOutExpo');
		$("#contact_blackcircle_big * img").animate({ 'width':233, 'height':256}, 400, 'easeOutExpo' ); 
		$("#contact_txt_cph").delay(100).slideDown(1000, 'easeOutExpo'); 
		contact_mapActions("cph");
	}
	
	else
	{
		$("#contact_blackcircle_big * img").attr( 'src', 'images/aah_map.jpg');
		$("#contact_redcircle_big * img").attr( 'src', 'images/contact_redcircle_shadow.png');
		$("#contact_blackcircle_big * img").animate({ 'width':539, 'height':555}, 400, 'easeOutExpo');
		$("#contact_redcircle_big * img").animate({ 'width':233, 'height':256}, 400, 'easeOutExpo' ); 
		$("#contact_txt_aah").delay(100).slideDown(1000, 'easeOutExpo');
		contact_mapActions("aah");
	}
}





///////////////* ACTION FOR THE BIG CARDS *//////////////


function contact_mapActions(state)
{
	if(state == "cph")
	{
		$("#contact_td1").css({ 'width':539 });
		$("#contact_td2").css({ 'width':233 });
		
		activeBigMap = "cph";
		
		$("#contact_blackcircle_big").click( 
		function()
		{
			contact_changeMapRight();	
		});
	}
	
	else
	{
		$("#contact_td1").css({ 'width':233 });
		$("#contact_td2").css({ 'width':539 });
		
		activeBigMap = "aah";
		
		$("#contact_redcircle_big").click( 
		function()
		{
			contact_changeMapLeft();	
		});
	}
}




function contact_changeMapRight()
{
	if(activeBigMap == "cph")
	{
		$("#contact_redcircle_big * img").animate({ 'width':0, 'height':555}, 200,  'easeInExpo', 
			function()
			{
				$("#contact_redcircle_big * img").attr( 'src', 'images/aah_map.jpg');
				$("#contact_blackcircle_big * img").attr( 'src', 'images/contact_redcircle_shadow.png');
				$("#contact_redcircle_big * img").animate({ 'width':539, 'height':555}, 400,  'easeOutExpo');
				$("#contact_txt_cph").html(aah_contactinfo);
				
			});
			
		activeBigMap = "aah";
	}
	
	else
	{
		$("#contact_redcircle_big * img").animate({ 'width':0, 'height':555}, 200,  'easeInExpo', 
			function()
			{
				$("#contact_redcircle_big * img").attr( 'src', 'images/cph_map.jpg');
				$("#contact_blackcircle_big * img").attr( 'src', 'images/contact_blackcircle_shadow.png');
				$("#contact_redcircle_big * img").animate({ 'width':539, 'height':555}, 200,  'easeOutExpo');
				$("#contact_txt_cph").html(cph_contactinfo);
			});
			
		activeBigMap = "cph";	
	}
	
}






function contact_changeMapLeft()
{
	if(activeBigMap == "aah")
	{
		$("#contact_blackcircle_big * img").animate({ 'width':0, 'height':555}, 200,  'easeInExpo', 
			function()
			{
				$("#contact_blackcircle_big * img").attr( 'src', 'images/cph_map.jpg');
				$("#contact_redcircle_big * img").attr( 'src', 'images/contact_blackcircle_shadow.png');
				$("#contact_blackcircle_big * img").animate({ 'width':539, 'height':555}, 400,  'easeOutExpo');
				$("#contact_txt_aah").html(cph_contactinfo);
				
			});
			
		activeBigMap = "cph";
	}
	
	else
	{
		$("#contact_blackcircle_big * img").animate({ 'width':0, 'height':555}, 200,  'easeInExpo', 
			function()
			{
				$("#contact_blackcircle_big * img").attr( 'src', 'images/aah_map.jpg');
				$("#contact_redcircle_big * img").attr( 'src', 'images/contact_redcircle_shadow.png');
				$("#contact_blackcircle_big * img").animate({ 'width':539, 'height':555}, 200,  'easeOutExpo');
				$("#contact_txt_aah").html(aah_contactinfo);
			});
			
		activeBigMap = "aah";	
	}
	
}
