	var hue;
	var picker;
	//var gLogger;
	var dd1, dd2;
	var r, g, b;
	var icon="caption_marker";
	var mwidth=30;
	var mheight=30;
	

//Quick workaround for Radio Button
function setIcon(name, image) {
document.getElementById('symbols').style.display="none";
document.getElementById('characters').style.display="none";
document.getElementById('fc').style.display="none";

document.getElementById('i').value = name;
document.getElementById('previewIcon').innerHTML = 'Currently Selected Marker: <img src="'+image+'" style="padding-top:1px; vertical-align:middle; padding-left:5px"/>';

_updateMarker();
}

//Quick workaround for Radio Button
function setStyle(name) {
document.getElementById('st').value = name;
}

//Make sure the width/height are positive numbers and greater than 0
function checkWidth(w) {
	if (parseFloat(w) <= 0) {
	alert('Width and Height Must Be Greater than 0');
	document.mapiconForm.h.value=1;
	document.mapiconForm.w.value=1;
	}
	else {
	document.mapiconForm.h.value=w;
	}
//Update the swatch box size and text
iconBox = document.getElementById('iBox').style;
mBox = document.getElementById('messageBox').style;
//iconBox.margintop = "-125px";
iconBox.width = w+"px";
iconBox.height = w+"px";
iconBox.display = "block";
document.getElementById('iBox').innerHTML = w+"px";
setTimeout('iconBox.display="none"',2500);

	if (w > 15 && w < 75) {
		mBox.display = "none";	
	}
	else {
	setTimeout("showmBox("+w+")",1600);
	
	}
}
function showmBox(w) {
	 if (w > 75) {
			if (w == document.mapiconForm.h.value) {
			mBox.display = "block";
			document.getElementById('messageBox').innerHTML = w+"px is very large.";
			setTimeout('mBox.display="none"',2000);
			}
		}
	 if (w < 15) {
			if (w == document.mapiconForm.h.value) {
			mBox.display = "block";
			document.getElementById('messageBox').innerHTML = w+"px is very small.";
			setTimeout('mBox.display="none"',2000);
			}
		}
}
	



//Show and Hide Icons DIV
function showIcons() {
iDiv = document.getElementById('iconSelector').style;
	if (iDiv.display == 'none') {
	iDiv.display = 'block';
	document.getElementById('symbols').style.display="none";
	document.getElementById('characters').style.display="none";
	document.getElementById('fc').style.display="none";
	}
	else {
	iDiv.display = 'none';
	document.getElementById('symbols').style.display="block";
	document.getElementById('characters').style.display="block";
	document.getElementById('fc').style.display="block";
	}
}

//Hide Icons (Called by Icon Preview Radio Buttons)
function hideIcons() {
iDiv = document.getElementById('iconSelector').style;
	setTimeout('iDiv.display="none"',700);
	
	setTimeout('document.getElementById("symbols").style.display="block"',700);
	setTimeout('document.getElementById("characters").style.display="block"',700);
	setTimeout('document.getElementById("fc").style.display="block"',700);
} 

//Show and Hide Style DIV
function showStyles() {
iDiv = document.getElementById('styleSelector').style;
	if (iDiv.display == 'none') {
	iDiv.display = 'block';
	}
	else {
	iDiv.display = 'none';
	}
}

//Show color DIV for style color
function changeStyleColor() {
var styleId= document.mapiconForm.fc.options[document.mapiconForm.fc.selectedIndex].style.color;
document.getElementById('styleColor').style.background=styleId;
}


function showP() {
fm_i = document.mapiconForm.i.value;
fm_d = document.mapiconForm.d.checked;
fm_w = document.mapiconForm.w.value;
fm_h = document.mapiconForm.h.value;
fm_c = document.mapiconForm.c.value;
fm_st = document.mapiconForm.st.value;
fm_fc = document.mapiconForm.fc.value;
fm_r = document.mapiconForm.r.value;
fm_g = document.mapiconForm.g.value;
fm_b = document.mapiconForm.b.value;

	//Set the random string for the directory name:
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var string_length = 8;
	var fm_rn = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		fm_rn += chars.substring(rnum,rnum+1);
	}
mReq = 'i='+fm_i+'&3d='+fm_d+'&w='+fm_w+'&h='+fm_h+'&c='+fm_c+'&st='+fm_st+'&fc='+fm_fc+'&r='+fm_r+'&g='+fm_g+'&b='+fm_b+'&rn='+fm_rn;

return mReq;
}

function setSymbols() {
document.getElementById('symbols').disabled=false;
document.getElementById('characters').disabled=true;
document.getElementById('numbers').disabled=true;
document.getElementById('c').value = "symbols";
theVal = document.mapiconForm.symbols.options[document.mapiconForm.symbols.selectedIndex].value
document.getElementById('st').value = theVal;
}

function setCharacters() {
document.getElementById('symbols').disabled=true;
document.getElementById('characters').disabled=false;

stVal = document.mapiconForm.characters.options[document.mapiconForm.characters.selectedIndex].value;
	if (stVal == "") {
	document.getElementById('numbers').disabled=true;
	}
	else {
	document.getElementById('numbers').disabled=false;
	}

	if (document.getElementById('numbers').checked == false) {
		document.getElementById('c').value = "characters";
	}
	else {
		document.getElementById('c').value = "numbers";
	}
theVal = document.mapiconForm.characters.options[document.mapiconForm.characters.selectedIndex].value;
document.getElementById('st').value = theVal;
}

var cb = 0;
function setNumbers() {
	if (cb == 0) {
	document.getElementById('c').value = "numbers";
	theVal = document.mapiconForm.characters.options[document.mapiconForm.characters.selectedIndex].value;
	document.getElementById('st').value = theVal;
	cb = 1;
	}
	else {
	document.getElementById('c').value = "characters";
	theVal = document.mapiconForm.characters.options[document.mapiconForm.characters.selectedIndex].value;
	document.getElementById('st').value = theVal;
	cb = 0;
	}
}

function setSt(theSt) {
if (theSt == "symbols") {
document.getElementById('st').value = document.mapiconForm.symbols.options[document.mapiconForm.symbols.selectedIndex].value
}
if (theSt == "characters") {
document.getElementById('st').value = document.mapiconForm.characters.options[document.mapiconForm.characters.selectedIndex].value
}
	if (document.mapiconForm.characters.options[document.mapiconForm.characters.selectedIndex].value == "") {
	document.getElementById('numbers').disabled=true;
	}
	else {
	document.getElementById('numbers').disabled=false;
	}

}

//Show and Hide Help
function showHelp(theDiv) {
document.getElementById(theDiv).style.display = "block";
}

function hideHelp(theDiv) {
document.getElementById(theDiv).style.display = "none";
}


//Function to update marker
function _updateMarker() {
	//Get the preview icon
	fm_r = document.getElementById('r').value;
	fm_g = document.getElementById('g').value;
	fm_b = document.getElementById('b').value;
	fm_i = document.mapiconForm.i.value;
	fm_d = document.mapiconForm.d.checked;
	fm_fc = document.mapiconForm.fc.value;
	fm_r = document.mapiconForm.r.value;
	fm_g = document.mapiconForm.g.value;
	fm_b = document.mapiconForm.b.value;
	fm_w = document.mapiconForm.w.value;
	
	browsername=navigator.appName;
	//If IE 4+
	if (browsername.indexOf("Microsoft")!=-1) {
	document.getElementById("mapiconPreview").style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=dm_lite_preview.php?i='+fm_i+'&3d='+fm_d+'&fc='+fm_fc+'&r='+fm_r+'&g='+fm_g+'&b='+fm_b+'&w='+fm_w+', sizingMethod=image, enabled=true)';
	}
	else {
	document.getElementById("mapiconPreview").innerHTML = '<img src="dm_lite_preview.php?i='+fm_i+'&3d='+fm_d+'&fc='+fm_fc+'&r='+fm_r+'&g='+fm_g+'&b='+fm_b+'&w='+fm_w+'" border="0"/>';
	}
}
