/********************************************************************/
// vars
/********************************************************************/

var sExpressInstall = "pix/expressInstall.swf";
var captionDiv = "caption";


/********************************************************************/
// general functions
/********************************************************************/

// address flash movie for external interface in action script
function thisMovie( movieName )
{
    if ( navigator.appName.indexOf("Microsoft") != -1 )
    {
        return window[movieName];
    }
    else
    {
        return document[movieName];
    }
}



/********************************************************************/
// jquery function flip box
/********************************************************************/
$(document).ready(function(){

	// state default value
	var state 					= 'flipped-open';
	
	// remind box height before it's flipped close
	var heightOpened			= '';

	// box height when closed (dependent on headline)
	var heightClosed			= '';
	
	// init
	set_state(state);
	
	// event handler
	$('#flip').click(function(event) {
		
		
		
		if(state == "flipped-open") {
		
			heightOpened = $('.box').height();
			heightClose	 = $('.box h2').height();
			
			}
		
		flip(state);
		
		});
	
	
	function flip(state) {
		switch(state) {
			case "flipped-open":
			
				set_state("flipped-close");

				// fadeout content
				$('.box h3').fadeOut("slow");
				$('.box p').fadeOut("slow");
				$('.box <br />').fadeOut("slow");
			
				//flip box(-height)
				$('.box').animate({
					'min-height': '0',
					height:heightClose
					
					}, 500, function() {
					//remove dotted line
					$('.box h2').css({"background-position":"0 200px"});
					
				});
				
			break;

			case "flipped-close":
			
				set_state("flipped-open");
				//add dotted line
				$('.box h2').css({"background-position":"0 bottom"});
				
				// fadein content			
				$('.box h3').fadeIn("fast");
				$('.box p').fadeIn("fast");
				$('.box <br />').fadeIn("fast");
			
				//flip box(-height)
				$('.box').animate({
					'min-height':'132',
					'height':heightOpened
					
					}, 500, function() {

					
				});
				
			break;
		}
	}
	
	
	function set_state(arg) {
		state = arg;
		
		//fill the span id="flip" with html [-] or [+]
		
		state == "flipped-open" ? $('#flip').html('<img src="/web/pix/flip-close.png" />')	:	$('#flip').html('<img src="/web/pix/flip-open.png" />')
		//state == "flipped-open" ? $('#flip').html('[-]')	:	$('#flip').html('[+]')
	}
	


});






