<!-- Original:  Peter Hermus -->
<!-- Web Site:  http://come.to/speedpete -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function createForm(number) {
	document.myForm.number.value = number;
	data = "";    
	inter = "'";
	if (number > 0) {
		for (i = 1; i <= number; i++) {
			data = data + "<input type='text' name='text" + i + "'>";
			data = data + "<input type='text' name='url" + i + "'><br/>";
		}
		if (document.layers) {
			document.layers.cust.document.write(data);
			document.layers.cust.document.close();
		}
		else { document.getElementById('cust').innerHTML = data; }
	}
	else {
		alert("Please enter number for [Number URLs]");
		return;
	}
}
function generate() {
	var f				= document.myForm;
	var customname		= f.customname.value;
	var number 		= f.number.value;
	if (number < 1) {
		alert("Please enter number for [Number URLs]");
		return;
	}
	var targetname		= f.targetname.value;
	var targetStr		= '';
	var styleStr		= '';

	if (f.target.selectedIndex == 1){ targetStr = 'top.'; }
	else if (f.target.selectedIndex == 2) {
		targetStr = 'top.frames[\''+f.targetname.value+'\'].';
		if (f.targetname.value.length == 0) { alert('Please enter the name of the frame to target.'); }
	}
	else if (f.target.selectedIndex == 3) {
		targetStr = f.targetname.value+'.';
		if (f.targetname.value.length == 0) { alert('Please enter the name of the window to target.'); }
	}
	else if (f.target.selectedIndex == 4) {
		targetStr = ''+f.targetname.value+'=window.open(\'\',\''+f.targetname.value+'\');'+f.targetname.value+'.';
		if (f.targetname.value.length == 0){ alert('Please enter a name for the new window.'); }
	}

	if (document.myForm.css.checked) { var styleStr=myStyle(); }

	worker = "<!-- Original: http://www.fryprograms.com/drop-down-menu-generator.php -->\n";
	worker = worker + "<!-- Revision: http://www.monster-submit.com/resources/menu/ -->\n";

	if (f.go[0].checked) {
		var worker = worker + "<form>\n<select onChange=\""+targetStr+"location=options[selectedIndex].value;\""+styleStr+">\n";
	}
	else if (f.go[1].checked) {
		var worker = worker + "<form>\n<select name=\"menu\""+styleStr+">\n";
		var buttonStr = "<input type=\"button\" onClick=\""+targetStr+"location=this.form.menu.options[this.form.menu.selectedIndex].value;\" value=\""+document.myForm.defaultbtn.value+"\">\n";
}
	else{
var worker = worker + "<form name=jump>\n<script language=\"JavaScript\">\nfunction jumpMenu(){\n"+targetStr+"location=document.jump.menu.options[document.jump.menu.selectedIndex].value;\n}\n</"+"script>\n<select name=\"menu\""+styleStr+">\n";
var buttonStr = "<a href=\"javascript:jumpMenu();\"><img src=\""+f.imageURL.value+"\" border=0></a>\n";

	if(f.imageURL.value.substring(0,7) != "http://"){//make sure it's a url
	      alert('The image URL you gave for your button ->'+f.imageURL.value+'<- probably isn\'t a valid URL.\nTry typing in the full URL like http://www.yourdomain.com/'+f.imageURL.value);}

	if(f.imageURL.value == "http://"){//if they haven't changed from orig value
	      alert('The URL http:// is not a valid image. Please enter the full URL for the image in the textbox at top of page and generate again.');}
}

for(i = 10; i <= (10 + ((number * 2) - 1)); i = (i + 2)) {
	index = (i);
	if (f[i].value){ worker+='<option value="'+((f[index + 1].value)?(f[index + 1].value):('#'))+'">'+f[index].value+'</option>\n'; }
}

//print it all out to the source box
if (f.go[0].checked) {
document.myForm.output.value=worker+"</select>\n</form>\n";
}

else if (f.go[1].checked) {
document.myForm.output.value = worker+"</select>\n"+buttonStr+"</form>\n";
}

else{
document.myForm.output.value = worker+"</select>\n"+buttonStr+"</form>\n";
}
}

//################################
// funtion: myStyle()
// decs: grabs the css info and creates
// returns: worker w/ css info
function myStyle(){
var f=document.myForm;

var styleStr=' style="';
styleStr+= "font-family:\'"+f.ownfont.value+"\';";
styleStr+="color:"+f.text_color.value+";";
styleStr+="background-color:"+f.bg_color.value+";";

if(f.style.selectedIndex==1){styleStr+='font-weight:bold;';}
else if(f.style.selectedIndex==2){styleStr+='text-decoration:underline;';}
else if(f.style.selectedIndex==3){styleStr+='font-style:italic;';}
else if(f.style.selectedIndex==4){styleStr+='text-decoration:overline;';}
else if(f.style.selectedIndex==5){styleStr+='text-decoration:line-through;';}

styleStr+='font-size:'+f.size[f.size.selectedIndex].value+';"';

return styleStr;
}//end funtion myStyle

function preview() {
	if (document.myForm.output.value != '') {
		msg=open("","DisplayWindow","menubar=1,resizable=1,width=300,height=100");
		msg.document.write(document.myForm.output.value);
	}
	else {
		generate();
		view();
	}
}

//################################
// funtion: colorpop()
// decs: displays a pre-defined set of colors
function colorpop(numberof) {
color=open("","color","resizable=1,width=450,height=140,top=0,left=0");
color.document.write('<HTML>\n'+
'<HEAD>\n'+
'  <TITLE>Text color-chart</TITLE>\n'+
'\n'+
'<SCRIPT LANGUAGE="JavaScript"><!--\n'+
'// can not be used without permission - WMUG\n\n'+
'function generate(){\n'+
'if(document.ok.ko.value){\n'+
'window.opener.document.myForm.'+numberof+'.value=document.ok.ko.value;}\n'+
'window.close();\n'+
'}\n'+
'//-->\n'+
'</'+'SCRIPT>\n'+
'\n'+
'</HEAD>\n'+
'<BODY>\n'+
'<SCRIPT LANGUAGE="JavaScript">\n'+
'<!--\n'+
'var HexD = new Array(\'00\', \'33\', \'66\', \'99\', \'CC\', \'FF\'); \n'+
'\n'+
'document.write(\'<table cellspacing=0 cellpadding=0 border=0><tr><td bgcolor="#000000"><table cellspacing=1 cellpadding=0 border=0><tr>\');\n'+
'\n'+
'for(i=0; i<=5; i++){\n'+
'\n'+
'var temp = (i%6);\n'+
'var current = HexD[temp];\n'+
'\n'+
'\n'+
'for(b_i=0; b_i<=5; b_i++){\n'+
'\n'+
'var b_temp = (b_i%6);\n'+
'var b_current = HexD[b_temp];\n'+
'\n'+
'for(c_i=0; c_i<=5; c_i++){\n'+
'\n'+
'var c_temp = (c_i%6);\n'+
'var c_current = HexD[c_temp];\n'+
'var all = c_current+\'\'+b_current+\'\'+current;\n'+
'document.write(\'<td bgcolor="#\'+all+\'">\'+\n'+
'\'<a href="javascript:void(document.ok.ko.value=\\\'#\'+all+\'\\\')"><img src="js/colors.gif" width=10 height=10 border=0></a></td>\');\n'+
'}\n'+
'\n'+
'}\n'+
'if(i<5){document.write(\'</tr><tr>\');}\n'+
'}\n'+
'\n'+
'document.write(\'</tr></table></td></tr></table>\');\n'+
'\n'+
'//--> </'+'SCRIPT>\n'+
'\n'+
'<center><FORM name="ok">\n'+
'  <INPUT type=text name="ko">   \n'+
'<input type="button" value="Save & Close" onclick="generate();" \n'+
'style="background-color: #CC6666; border-left: 1 SOLID #D98C8C; border-top: 1 SOLID #D98C8C;border-right: 1 SOLID #9B3333; border-bottom: 1 SOLID #9B3333;font-family: arial; font-size: 9pt; color: #FFFFFF;">\n'+
'</FORM></center>\n'+
'</BODY></HTML>\n');

}//end function colorpop()

