detectBrowser(false,false);

musicPreviewed = false;
stampPreviewed = false;

function playMusic(music,source) { 

	if (source == "my") {
		musicBase = "http://www.e-cards.com/sounds/";
	} else {
		musicBase = "";
	}
	
	embedString = "<html><head><title>Music</title></head><body bgcolor=#ffffcc><link rel=\"stylesheet\" type=\"text/css\" href=\"http://www.e-cards.com/styles/ecards00.css\"><center><table bgcolor=ffffff border=1 cellpadding=2><tr><td align=center>\n\n";
	embedString = embedString  + "E-Cards Music Preview Box<br><br>\n\n";
	
	menuOption = new Array();
	
	if (browser == "explorer") {
		menuOption = music.value.split('|');
		embedString = embedString + "<bgsound name=\"player\" src=\"" + musicBase + menuOption[0] + "\" loop=2 volume=0>\n\n";
	} else if ((browser == "opera") && (platform == "windows")) {	
		menuOption = music.value.split('|');
		embedString = embedString + "<bgsound name=\"player\" src=\"" + musicBase + menuOption[0] + "\" loop=2 volume=0>\n\n";
	} else if (browser == "firefox") {	
		// hidden property not liked
		menuOption = music.options[music.selectedIndex].value.split('|');
		embedString = embedString + "<embed name=\"player\" border=0 src=\"" + musicBase + menuOption[0] + "\" width=1 height=1 autostart=\"true\" loop=2>\n\n";
	} else {
		menuOption = music.options[music.selectedIndex].value.split('|');
		embedString = embedString + "<embed name=\"player\" border=0 src=\"" + musicBase + menuOption[0] + "\" width=1 height=1 hidden=\"true\" autostart=\"true\" loop=2>\n\n";
	}

	if (menuOption[2]) {
		embedString = embedString + menuOption[2] + "<br>\n";
	}
	if (menuOption[1]) {
		embedString = embedString + "&copy; " + menuOption[1] + "<br><br>\n";
	}
	
	if (menuOption[3] == "my") {
		embedString = embedString + "<span class=errorText>Apologies, this song is only available for My E-Cards subscribers and cannot be added to your card.</span><br><br>\n";
		embedString = embedString + "| <a href=\"javascript:opener.location='https://secure.e-cards.com/my/subscribe/selectAccount.jsp';self.close()\">Leave this card & Join Now</a> |<br><br>";
	}
	
	embedString = embedString + "|<a href=\"javascript:window.close();\">Close</a>|<br></td></tr></table>\n";
	embedString = embedString + "</body></html>";
	
	musicWindow = window.open( "", "music", "height=220,width=205,screenX=0,screenY=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0") ;
	musicWindow.document.writeln(embedString);
	musicWindow.document.close();
	
	if ( !((platform == "mac") && (browser == "explorer")) ) {
		//musicWindow.blur();
	}
	
	musicPreviewed = true;
}


function changeStamp(stampString) {
	if (stampString == "None") stampString = "";
	stampStuff = stampString.split('|');
	if (stampStuff[1] != "my") {
		if (stampStuff[0] != '') { 
			document.cardForm.stamp.src= stampStuff[0];
		} else { 
			document.cardForm.stamp.src='/images/bits/clear.gif';
		}
	} else {
		document.cardForm.stamp.src='/images/cardStamps/basic/E-Cards-stamp_N.gif';
			
		embedString = "<html><head><title>Stamp</title></head><body bgcolor=#ffffcc><link rel=\"stylesheet\" type=\"text/css\" href=\"http://www.e-cards.com/styles/ecards00.css\"><center><table bgcolor=ffffff border=1 cellpadding=2><tr><td>\n\n";
		embedString = embedString  + "<center>\n";
		embedString = embedString  + "E-Cards Stamp Preview Box<br><br>\n\n";
		embedString = embedString  + "</center>\n";
		embedString = embedString  + '<img src="' + stampStuff[0] + '" border=0><br><br>\n\n';
		embedString = embedString  + "<center>\n";
		embedString = embedString + "<span class=errorText>Apologies, this stamp is only available for My E-Cards subscribers and cannot be added to your card.</span><br><br>\n";
		embedString = embedString + "| <a href=\"javascript:opener.location='https://secure.e-cards.com/my/subscribe/selectAccount.jsp';self.close()\">Leave this card & Join Now</a> |<br><br>";
		embedString = embedString + "|<a href=\"javascript:window.close();\">Close</a>|<br>\n";
		embedString = embedString  + "</center>\n";
		embedString = embedString + "</td></tr></table></body></html>";
	
		stampWindow = window.open( "", "stamp", "height=300,width=210,screenX=50,screenY=50,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0") ;
		stampWindow.document.writeln(embedString);
		stampWindow.document.close();

		stampPreviewed = true;

	}
}


function closePreviewWindows() { 
	if (musicPreviewed) {
		musicWindow.close();
		musicPreviewed = false;
	}
	if (stampPreviewed) {
		stampWindow.close();
		stampPreviewed = false;
	}
	var theVal = cardForm.Tag.value;
	if ( theVal.substring(theVal.length-5,theVal.length) != "     ") {
		cardForm.Tag.value=cardForm.Tag.value +"     ";
	} 
}


function changePenFont(theFont){
	document.cardForm.CardNote.style.fontFamily = theFont;
}



function changePenSize(theSize){
	document.cardForm.CardNote.style.fontSize = theSize + "pt";
}



function changePenStyle(){
	
	if (document.cardForm.theFontWeight.checked) {
		document.cardForm.CardNote.style.fontWeight = "bold";
	} else {
		document.cardForm.CardNote.style.fontWeight = "normal";
	}
	
	if (document.cardForm.theFontStyle.checked) {
		document.cardForm.CardNote.style.fontStyle = "italic";
	} else {
		document.cardForm.CardNote.style.fontStyle = "normal";
	}
	
}
