	
   //jquery flash object finder
	var flashObjs = new Array();
    function findFlashObj(objectId) {
        if (flashObjs[objectId] == null){
    	    flashObjs[objectId] = $('#'+objectId)[0];
	    }
        if (flashObjs[objectId] == null){
            return false;
        } else {
            return flashObjs[objectId];
        }
    }

    function playDinoSound(soundfile) {
        var flashObj = findFlashObj('soundplayer');
        if (flashObj) {
            var url = soundfile;
            flashObj.sendEvent("LOAD",url);
            flashObj.sendEvent("PLAY");
        }
    }

	// float panel, sound btn hover
	
	function soundBtnEnabled(){
		$('.floatSoundBtn .text').html('Némítsd el őket!');
		$('.floatSoundBtn').removeClass('floatSoundBtnHovered');
	}
		
	function soundBtnDisabled(){
		$('.floatSoundBtn .text').html('Hallgasd meg a hangjukat!');				
		$('.floatSoundBtn').addClass('floatSoundBtnHovered');
	}		
		
	$(document).ready(function(){	
		
		if($.cookie('dinoFlash_toggleMute')==0) soundBtnDisabled();		
		
		$('.floatSoundBtn').click(function(){
		
			var bool=$.cookie('dinoFlash_toggleMute');
				
			if(bool==0){
				var newBool=1;
				soundBtnEnabled();
			}else{
				var newBool=0;
				soundBtnDisabled();
			}
				
			dinoFlash_toggleMute(newBool);
			
		});
	
	});

	/* flash communication with links */

	function dinoFlash_sendProjectId_rollOver(val){
		$('.btn-'+val).addClass('dinoBtnHover');
	}

	function dinoFlash_sendProjectId_rollOut(val){
		$('.btn-'+val).removeClass('dinoBtnHover');
	}

	function dinoFlash_sendToggleMute(bool) {			
		if(bool==1 ? soundBtnEnabled() : soundBtnDisabled());
		$.cookie('dinoFlash_toggleMute', bool, { path: '/', expires: 30 });			
	}

	function dinoFlash_btnOver(id){
        var flashObj = findFlashObj('footerDinos');
        if (flashObj) flashObj.dinoFlash_receiveProjectId(id);
	}

	function dinoFlash_btnOut(){
        var flashObj = findFlashObj('footerDinos');
        if (flashObj) flashObj.dinoFlash_receiveProjectId('hideAll');
	}

	function dinoFlash_toggleMute(bool){
	    var flashObj = findFlashObj('footerDinos');
        if (flashObj) flashObj.dinoFlash_receiveSoundEnabled(bool);
	    $.cookie('dinoFlash_toggleMute', bool, { path: '/', expires: 30 });
	}

