
// Use this function to retrieve a cookie.
function getCookieGAG(name){
//alert("GET cookie "+name)
	var cname = name + "=";
	var dc = document.cookie;
	if (dc.length > 0) {
		begin = dc.indexOf(cname);
		if (begin != -1) {
			begin += cname.length; 
			end = dc.indexOf(";", begin); 
			if (end == -1) end = dc.length; 
				return unescape(dc.substring(begin, end));
		 }
	 }
}

// Use this function to save a cookie.
function setCookieGAG(name, value, expires) { 
//alert("SET cookie "+name)
	document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString());
}


function mydelCookieGAG() {
//alert("DEL cookie")
document.cookie = "playonce=; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
}




function playonce(soundfile){
	var token = getCookieGAG('playonce');
	if (token == null){
//alert("TOKEN IS NULL")
		document.write('<embed hidden=true class=snd type=audio/x-mp3 src='+soundfile+' autostart=true loop=false width=0 height=0 id=bkgsound enablejavascript=true>')
		var today = new Date();
		var expires = new Date();
		expires.setTime(today.getTime() + 1000*60*60*24*7);
		setCookieGAG('playonce', 'OK',expires);
	}
}

playonce("http://guelfoalexander.com/snd/anche-se_piacere.mp3");







