function toggleSound(flashMovieID){
	
	var toggler = getCookie('toggleSoundGranini');
	//alert(document.getElementById(flashMovieID).innerHTML);
	if (toggler==null && toggler==""){
		setCookie('toggleSoundGranini', '0', '1');
		StopFlashMovie(flashMovieID);
	} else {
		if(toggler=='1'){
			setCookie('toggleSoundGranini', '0', '1');
			StopFlashMovie(flashMovieID);
		} else {
			setCookie('toggleSoundGranini', '1', '1');
			PlayFlashMovie(flashMovieID);
		}
	}
	
}

function checkSound(flashMovieID){
	// if(!flashMovieID)
		// flashMovieID = 'sunet';
	var toggler = getCookie('toggleSoundGranini');
	//alert(getFlashMovieObject(flashMovieID));
	if (toggler==null && toggler==""){
		PlayFlashMovie(flashMovieID);
	} else {
		if(toggler=='1'){
			// autostart anyhow...
			// PlayFlashMovie(flashMovieID);
		} else {
			setTimeout("StopFlashMovie('" + flashMovieID + "');", 200);
		}
	}
	setTimeout("addBlueStreak();", 250);
}

function addBlueStreak() {
	var oimg = document.createElement("img");
	oimg.src = "http://s0b.bluestreak.com/ix.e?bb&t=38227";
	oimg.width = 0;
	oimg.height = 0;
	oimg.border = 0;
	document.getElementsByTagName("body")[0].appendChild(oimg);
}

function setCookie(c_name, value, expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name){
	if (document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	
	return "";
}

function getFlashMovieObject(movieName){
  if (window.document[movieName]){
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1){
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  } else { // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
    return document.getElementById(movieName);
  }
}

function StopFlashMovie(flashName){
	var flashMovie=getFlashMovieObject(flashName);
	//flashMovie.setAttribute('play', 'false');
	flashMovie.StopPlay();
}

function PlayFlashMovie(flashName){
	var flashMovie=getFlashMovieObject(flashName);
	flashMovie.Play();
	//embed.nativeProperty.anotherNativeMethod();
}

