function CheckBorder(borderChoice)
{
	if (borderChoice != "width" && document.marqueeform.borderwidth.value == "") { document.marqueeform.borderwidth.options[3].selected = true; changePropById('previewmarquee','style.borderWidth', document.marqueeform.borderwidth.value); }
	if (borderChoice != "style" && document.marqueeform.borderstyle.value == "") { document.marqueeform.borderstyle.options[2].selected = true; changePropById('previewmarquee','style.borderStyle', document.marqueeform.borderstyle.value); }
	if (document.marqueeform.bordercolour.value == "") { document.marqueeform.bordercolour.value = "#000000"; changePropById('previewmarquee','style.borderColor', document.marqueeform.bordercolour.value); }
}

function addText() {
	var addtext = prompt('Please type the text you wish to add','');
	if (document.getElementById('previewmarquee').innerHTML == 'This is some preview text!') { document.getElementById('previewmarquee').innerHTML = ''; }
	document.getElementById('previewmarquee').innerHTML += ' ' + addtext;
	document.getElementById('addtext').value = 'Click Here To Add More Text';
	GenCode();
	}

function clearMarquee() {
	if (document.getElementById('previewmarquee').innerHTML != '') { document.getElementById('previewmarquee').innerHTML = 'This is some preview text!'; }
		document.getElementById('addtext').value = 'Click Here To Add Text';
		document.getElementById('addimage').value = 'Click Here To Add An Image';
		GenCode();
	}

function addImage() {
	var addimage = prompt('Please type the full URL to the image you wish to add','');
	if (document.getElementById('previewmarquee').innerHTML == 'This is some preview text!') { document.getElementById('previewmarquee').innerHTML = ''; }
		document.getElementById('previewmarquee').innerHTML += '<img src=\"' + addimage + '\">';
		document.getElementById('addimage').value = 'Click Here To Add More Images';
		GenCode();
		}

function GenCode() {
	code = '<MARQUEE style=\"';
	if (document.marqueeform.bgcolour.value != "") { code += 'background-color:' + document.marqueeform.bgcolour.value + '; '; }
	if (document.marqueeform.borderwidth.value != "" && document.marqueeform.borderstyle.value != "" && document.marqueeform.bordercolour.value != "") { code += 'border: ' + document.marqueeform.borderwidth.value + ' ' + document.marqueeform.borderstyle.value + ' ' + document.marqueeform.bordercolour.value + "; "; }
	if (document.marqueeform.textcolour.value != "") { code += 'color:' + document.marqueeform.textcolour.value + '; '; }
	if (document.marqueeform.textfont.value != "") { code += 'font-family:' + document.marqueeform.textfont.value + '; '; }
	if (document.marqueeform.textsize.value != "") { code += 'font-size:' + document.marqueeform.textsize.value + '; '; }
	if (document.marqueeform.mqwidth.value != "") { code += 'width:' + document.marqueeform.mqwidth.value + 'px; '; }
	if (document.marqueeform.mqheight.value != "") { code += 'height:' + document.marqueeform.mqheight.value + 'px; '; }
	code += '\" ';
	if (document.marqueeform.direction.value != "") { code += 'direction=\"' + document.marqueeform.direction.value + '\" '; }
	if (document.marqueeform.behavior.value != "") { code += 'behavior=\"' + document.marqueeform.behavior.value + '\" '; }
	if (document.marqueeform.scrollamount.value != "") { code += 'scrollamount=\"' + document.marqueeform.scrollamount.value + '\" '; }
	code += '>';
	if (document.getElementById('previewmarquee').innerHTML != "") { code += document.getElementById('previewmarquee').innerHTML; }
	code += '</MARQUEE>';
	for(var x = 0; x < 4; x++)
	{
		code = code.replace(/#/, "");
	}
	document.marqueeform.marqueecode.value = code;
}

