function eventapp ( o ){
	var container = getDivsByClassName ( "spotcontent", o.parentNode.parentNode )[0];
	var aTxt = getDivsByClassName ( "fulltxt", container );
	var aTeaser = getDivsByClassName ( "txt", container );
	var oLang = document.body.id.toString()
	
	if ( aTxt[ 0 ].style.display == '' || aTxt[ 0 ].style.display == 'none' ){
		aTxt[ 0 ].style.display = 'block'
		aTeaser[ 0 ].style.display = 'none'
		o.style.background = "url( '/ui/park/img/spots/"+oLang+"/close.gif' ) no-repeat top left"
	}else{
		aTxt[ 0 ].style.display = 'none'
		aTeaser[ 0 ].style.display = 'block'
		o.style.background = "url( '/ui/park/img/spots/"+oLang+"/read_more.gif' ) no-repeat top left"
	}	
}

function getDivsByClassName ( sClass, o ) {
	var aElements = new Array ();
	var aTotal = o.getElementsByTagName ( "div" );
	for ( i = 0; i < aTotal.length; i++ ) 
		if ( aTotal.item ( i ).className == sClass ) aElements [ aElements.length ] = aTotal.item ( i );
	return aElements;
}

// FAQ - css - Display block/none 
function toggleContainerClass(o){
	var container = o.parentNode;
	if(container.className.match(/\bshow\b/i)){
		container.className = container.className.replace(/\bshow\b/i, "hide");
	}
	else if(container.className.match(/\bhide\b/i)){
		container.className = container.className.replace(/\bhide\b/i, "show");
	}
	else {
		container.className += " show";
	}
	updateFlash();
}


// General site loads

var legoSiteUtils = {
   
   init : function() {
        //Selectbox navigation init
        var jumpBox = document.getElementById("parkjumper");
        if(!jumpBox)
        return false;
        oDOMUtils.mAddEvent(jumpBox, "change", legoSiteUtils.parkjumper, false);
 
   },
    //Footer figurs
    minifigs: function() {
	    var y 			= Math.round(Math.random()*7);	
	    var sUrl 		= "/ui/park/img/minifigs/fig_"+y.toString()+".png";
	    var oFig 	= getDivsByClassName ( "figure", document.getElementById( 'bar' ));
	    $("#bar .figure").css("background-image","none");
	        if ( document.all )	
	            oFig[ 0 ].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+sUrl+"', sizingMethod='scale')";
	        else 
	   $("#bar .figure").css("background-image",'url( "'+sUrl+'" )');
    },
    
    //Selectbox navigation in HTML mode
    parkjumper: function() {
        box = document.forms[0].parkjumper;
	    destination = box.options[box.selectedIndex].value;
	    if (destination) location.href = destination;
        //alert(destination);
    },
    /*flashonfunc: function() {
        var currentURLforFlash = document.location;
       
    },*/
    // Push the linkbox right on subpage
    SetLeftNavHeight: function() {
        if(document.getElementById("leftMenu")) {
            var leftnavHeight = document.getElementById("wrapper").offsetHeight - 100 + 'px';
            document.getElementById("leftMenu").style.height = leftnavHeight;
        }
    }
};


function openwindow ( s ) {
	window.open( s,"popup","toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,width=709,height=539,left=100,top=5" );return false;
}



function openImage( s, w, h ){
	window.open( s,"popup","toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1,width="+w+",height="+h+",left=100,top=5" )
	return false;
}

$(document).ready(function() {
 $("#flashonbut").click(function () { 
    var randomSTAMP = new Date().getTime();
    var currentHOSTforFlash = document.location.host;
    var currentURLforFlash = document.location.protocol+'//'+document.location.host+document.location.pathname;
    var currentURLforFlashSearch = document.location.search;
    if(document.location.search){
      document.location.href=currentURLforFlash+currentURLforFlashSearch+'&flashpreferred=true&rnd='+randomSTAMP;
    }
    else{
        document.location.href=currentURLforFlash+'?flashpreferred=true&rnd='+randomSTAMP;
    }
  });
  legoSiteUtils.minifigs(); 
  legoSiteUtils.SetLeftNavHeight();
  legoSiteUtils.init();
});



     

