function restart() {
	document.data.Recipient.value = Recipient;
	document.data.REmailList.value = REmail;
	mywindow.close();
}


function ListNames() {
	if (self.innerHeight) {
		iWidth = self.innerWidth;
		iHeight = self.innerHeight+160;
		xPos = window.screenX;
		yPos = window.screenY;
	}
	else if (document.documentElement && document.documentElement.clientWidth) {
		iWidth = document.documentElement.clientWidth+20;
		iHeight = document.documentElement.clientHeight+160;
		xPos = window.screenLeft;
		yPos = window.screenTop-110;
	}
	else if (document.body)	{
		iWidth = document.body.clientWidth+20;
		iHeight = document.body.clientHeight+160;
		xPos = window.screenLeft;
		yPos = window.screenTop-110;
	}
	var popH = 300;
	var popW = 400;
	var leftPos = (iWidth-popW)/2 + xPos, topPos = (iHeight-popH)/2 + yPos;
	
	Recipient = document.data.Recipient.value;
	REmail = document.data.REmailList.value;
	var dirIndex = document.URL.indexOf('/item');
	mywindow = open(document.URL.substring(0, dirIndex)+'/book/', 'myname', 'resizable,scrollbars,height=' + popH + ',width=' + popW + ',top=' + topPos + ',screenY=' + topPos + ',left=' + leftPos + ',screenX=' + leftPos);
	mywindow.location.href = document.URL.substring(0, dirIndex)+'/book/';
	if (mywindow.opener == null) mywindow.opener = self;
}


var mPath='/en/images/midi/';
function setEmbed(PathSong) {
	if (PathSong.substr(-4) != '.mid') PathSong = mPath + 'none.mid';
	var mimeType = "application/x-mplayer2";
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("msie")==-1) {  //  not ie, use embed
		if (navigator.mimeTypes && agt.indexOf("windows")==-1) {  // Mac/Safari & Linux/FFox
	  	var plugin=navigator.mimeTypes["audio/midi"].enabledPlugin;
	  	if (plugin) mimeType="audio/midi";
		}
   	var element = document.getElementById('midiembed');
		element.innerHTML = '';
		element.innerHTML = '<embed src="'+PathSong+'" autostart="true" id="midiplayer" height="0" width="0" type="'+mimeType+'"></embed>';
	}
}


var Muted=false;
function setSong(newSelection, playSong) {
	var agt=navigator.userAgent.toLowerCase();
	var button = document.getElementById('musicBtn');
	var iPath='/en/images/site/v2_';
	
	if (song = playSong)
		iPath = iPath + 'card_';
	else {
		var songindex=document.data.Music.selectedIndex;
		var song=document.data.Music.options[songindex].value;
	}
	
	var midiplay = document.getElementById('midiplayer');
	if (midiplay && agt.indexOf("safari")!=-1) midiplay.Stop();
	
	if (song == 'none.mid') {
		Muted=false;
		button.src = iPath + 'stop.gif';
	}
	else if (newSelection || Muted) {
		Muted=false;
		button.src = iPath + 'mute.gif';
	}
	else {
		Muted=true;
		button.src= iPath + 'play.gif';
		song = 'none.mid';
	}
	if (agt.indexOf("msie")==-1)
		setEmbed(mPath + song);  // ~pcIE
	else
	  document.all.bgSound.src = mPath + song;  //  pcIE
}


function setDay() {
	var form=document.data;
	var dayindex=form.SendMonth.selectedIndex;
	if (dayindex == 0) { form.SendDay.selectedIndex = 0; }	
	else { form.SendDay.selectedIndex = 1; }
}


function setCookie(name, value, days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
