// (c) 2000-2002 ricocheting <ricocheting@hotmail.com>
// Permission granted to SimplytheBest.net to feature script in its 
// DHTML script collection at http://simplythebest.net/scripts/

//################################
// funtion: generate()
// decs: creates the source depending out textboxes
function generate(){

var f = document.myForm;
var total='<script language="JavaScript"><!--\n';

if(f.url.value.length==0 || f.url.value=="http://"){
	alert('You will need to enter the "Background Music URL" for it to work right');
}

if(f.IE_size[1].checked){ IE_size='width=70 height=45';}
else if(f.IE_size[2].checked){ IE_size='width=285 height=45';}
else if(f.IE_size[3].checked){ IE_size='width=70 height=25';}
else if(f.IE_size[4].checked){ IE_size='width=285 height=25';}
else{ IE_size='hidden="true"';}

if(f.NS_size[1].checked){ NS_size='controls="LargeConsole" width=145 height=35';}
else if(f.NS_size[2].checked){ NS_size='controls="LargeConsole" width=145 height=60';}
else if(f.NS_size[3].checked){ NS_size='controls="SmallConsole" width=50 height=15';}
else if(f.NS_size[4].checked){ NS_size='controls="SmallConsole" width=145 height=15';}
else{ NS_size='hidden="true"';}

var IE='<embed src="'+f.url.value+'" autostart="'+f.autostart[f.autostart.selectedIndex].value+'" loop="'+f.loop[f.loop.selectedIndex].value+'" '+IE_size+'></embed>';
var NS='<embed src="'+f.url.value+'" autostart="'+f.autostart[f.autostart.selectedIndex].value+'" loop="'+f.loop[f.loop.selectedIndex].value+'" '+NS_size+'></embed>';
var other='<embed src="'+f.url.value+'" autostart="'+f.autostart[f.autostart.selectedIndex].value+'" loop="'+f.loop[f.loop.selectedIndex].value+'"></embed>';

total+= 'if(navigator.appName=="Netscape"){\ndocument.write(\''+NS+'\');}\n'+
'else if(navigator.appName=="Microsoft Internet Explorer"){\n'+
'document.write(\''+IE+'\');}\n'+
'else{\n'+
'document.write(\''+other+'\');}\n//-->\n</'+'script>\n';
total+= '<noscript>'+other+'</noscript>\n';
total+= '<noembed><bgsound src="'+f.url.value+'" loop='+f.loop[f.loop.selectedIndex].value+'></noembed>'

f.output.value=total;
}var worker=''+location.hostname+'';
if((worker.indexOf('ri'+'coche'+'ting.c'+'om') == -1)&&(location.hostname!='')&&(location.hostname!='localhost')){
document.write('');}


//################################
// funtion: view()
// decs: displays a preview of the script
function view() {
if(document.myForm.output.value != 'No code available. "Generate" source code first'){
msg=open("","DisplayWindow","menubar=1,resizable=1,width=300,height=100");
msg.document.write(document.myForm.output.value);
}
else{
generate();
view();}
}


// End-->