var arrPartners = new Object();
var arrChannels = new Object();

// Partners
arrChannels['wretched'] = 'Our networks';
arrPartners['wretched'] = new Object();
arrPartners["wretched"]["DamnedSociety"] = 'http://www.damnedsociety.com';
arrPartners["wretched"]["Sinister Gallery"] = 'http://www.sinistergallery.net';
arrPartners["wretched"]["Gothic Match"] = 'http://damnedsociety.cb.gothicmatch.com/';
arrPartners["wretched"]["Vanessa Rosa"] = 'http://www.vanessarosa.com';





function redirect()
{
	var url = document.getElementById('wretchedbar_partners').value;
	if(url != '')
	{
		window.location.href = url;
	}
}


function buildBar()
{
	if(cbFormColor === 'CCCCCC') { var strSepColor = 'FF8618'; } else { var strSepColor = cbFormColor; }
	document.write('<style type="text/css">');
	document.write('	#wretchedbar_mainbar {');
	document.write('		width: '+cbWidth+';');
	document.write('		height: 30px;');
	document.write('		background-image: url(http://www.damnedsociety.com/images/networkbar.jpg);');
	document.write('		font-family: Arial;');
	document.write('		font-size: 10px;');
	document.write('		text-transform: uppercase;');
	document.write('	}');
	document.write('	#wretchedbar_mainbar a {');
	document.write('		color: #'+cbFormTextColor+';');
	document.write('		text-decoration: none;');
	document.write('	}');
	document.write('	#wretchedbar_mainbar a:hover {');
	document.write('		color: #'+cbFormColor+';');
	document.write('		text-decoration: none;');
	document.write('	}');
	document.write('	#wretchedbar_logo {');
	document.write('		width: 84px;');
	document.write('		float: left;');
	document.write('		margin-left: 10px;');
	document.write('	}');
	document.write('	#wretchedbar_sep {');
	document.write('		width: auto;');
	document.write('		height: 30px;');
	document.write('		line-height: 30px;');
	document.write('		float: left;');
	document.write('		color: #'+strSepColor+';');
	document.write('		margin-left: 5px;');
	document.write('		margin-right: 5px;');
	document.write('	}');
	document.write('	#wretchedbar_section {');
	document.write('		width:auto;');
	document.write('		height: 30px;');
	document.write('		line-height: 30px;');
	document.write('		float: left;');
	document.write('		color: #'+cbFormTextColor+';');
	document.write('		text-decoration: none;');
	document.write('	}');
	document.write('	#wretchedbar_dropform {');
	document.write('		width: auto;');
	document.write('		float: left;');
	document.write('		height: 30px;');
	document.write('		line-height: 30px;');
	document.write('	}');
	document.write('	#wretchedbar_dropform #wretchedbar_dropformlinks {');
	document.write('		float: left;');
	document.write('		width: auto;');
	document.write('		background: url(http://www.damnedsociety.com/images/pulldown.jpg) no-repeat 0 100%;');
	document.write('	}');
	document.write('	#wretchedbar_dropform #wretchedbar_dropformlinks select {');
	document.write('		width: auto;');
	document.write('		opacity: 0;');
	document.write('	}');
	document.write('	#wretchedbar_search {');
	document.write('		height: 30px;');
	document.write('		float: left;');
	document.write('		margin-right: 10px;');
	document.write('	}');
	document.write('</style>');
	document.write('<div id="wretchedbar_mainbar">');
	document.write('	<div id="wretchedbar_logo"><a href="http://www.wretched-entertainment.com"><img src="http://www.damnedsociety.com/images/wretchedlogo.png" border="0"></a></div>');
	document.write('	<div id="wretchedbar_sep">  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp; ></div>');
	document.write('	<div id="wretchedbar_section">HORROR</div>');
	document.write('	<div id="wretchedbar_sep">></div>');
	document.write('	<div id="wretchedbar_section"><a href="'+cbBcSiteUrl+'" id="wretchedbar_section">'+cbBcSite+'</a></div>');
	document.write('	<div style="float: right;">');
	document.write('		<div id="wretchedbar_dropform">');
	document.write('			<div id="wretchedbar_dropformlinks">');
	document.write('				<select name="wretchedbar_partners" id="wretchedbar_partners" onchange="redirect();">');
	document.write('					<option value="">View Sites In Our Network</option>');
	
	if(cbChannel === 'show all' || arrPartners[cbChannel] === undefined)
	{
		for(x in arrChannels)
		{
			var channelName = arrChannels[x];
			
			document.write('					<option value="">------------------------</option>');
			document.write('					<option value="">'+channelName+'</option>');
			document.write('					<option value="">------------------------</option>');
			
			for(y in arrPartners[x])
			{
				var strSiteName = y;
				var strSiteUrl = arrPartners[x][y];
				
				document.write('					<option value="'+strSiteUrl+'">'+strSiteName+'</option>');
			}
		}
	}
	else
	{
		var channelName = arrChannels[cbChannel];
		
		document.write('					<option value="">------------------------</option>');
		document.write('					<option value="">'+channelName+'</option>');
		document.write('					<option value="">------------------------</option>');
		
		for(x in arrPartners[cbChannel])
		{
			document.write('					<option value="'+arrPartners[cbChannel][x]+'">'+x+'</option>');
		}
	}
	
	document.write('				</select>');
	document.write('			</div>');
	document.write('		</div>');
	
	if(cbSearch === 'on')
	{
		document.write('		<div style="float: left;">');
		document.write('			<form name="wretchedbar_search" action="'+cbSearchAction+'" method="'+cbSearchMethod+'">');
		document.write('				<div style="width: auto; float: left; margin: 3px 10px 0 0;">');
		document.write('					<input type="text" name="'+cbSearchInputName+'" value="">');
		document.write('					<input type="hidden" name="'+cbSearchButtonName+'" value="'+cbSearchButtonValue+'">');
		document.write('				</div>');
		document.write('				<div style="float: left;"><input type="image" src="http://www.damnedsociety.com/images/button.jpg" onclick="document.wretchedbar_search.submit();"></div>');
		document.write('			</form>');
		document.write('		</div>');
	}
	
	
	document.write('	</div>');
	document.write('</div>');
}


// check for defaults
if(typeof(cbWidth) === 'undefined' || typeof(cbWidth) === 'number' || cbWidth === '') { var cbWidth = '100%'; }
if(typeof(cbChannel) === 'undefined' || typeof(cbChannel) === 'number' || cbChannel === '') { var cbChannel = 'show all'; }

// color -- menu/submit button & their corresponding text
if(typeof(cbFormColor) === 'undefined' || typeof(cbFormColor) === 'number' || cbFormColor === '') { var cbFormColor = 'CCCCCC'; }
if(typeof(cbFormTextColor) === 'undefined' || typeof(cbFormTextColor) === 'number' || cbFormTextColor === '') { var cbFormTextColor = 'FFFFFF'; }

// bread crumbs
if(typeof(cbBcChannel) === 'undefined' || typeof(cbBcChannel) === 'number' || cbBcChannel === '') { var cbBcChannel = arrChannels[cbChannel]; }
if(typeof(cbBcChannelUrl) === 'undefined' || typeof(cbBcChannelUrl) === 'number' || cbBcChannelUrl === '') { var cbBcChannelUrl = arrPartners[cbChannel]['Wretched']; }
if(typeof(cbBcSite) === 'undefined' || typeof(cbBcSite) === 'number' || cbBcSite === '') { var cbBcSite = 'Wretched'; }
if(typeof(cbBcSiteUrl) === 'undefined' || typeof(cbBcSiteUrl) === 'number' || cbBcSiteUrl === '') { var cbBcSiteUrl = 'http://www.wretched-entertainment.com'; }

// search functionality
if(typeof(cbSearch) === 'undefined' || typeof(cbSearch) === 'number' || (cbSearch != 'on' && cbSearch != 'off')) { var cbSearch = 'off'; }
if(typeof(cbSearchAction) === 'undefined' || typeof(cbSearchAction) === 'number' || cbSearchAction === '') { var cbSearchAction = ''; }
if(typeof(cbSearchMethod) === 'undefined' || typeof(cbSearchMethod) === 'number' || (cbSearchMethod != 'get' && cbSearchMethod != 'post')) { var cbSearchMethod = 'get'; }
if(typeof(cbSearchInputName) === 'undefined' || typeof(cbSearchInputName) === 'number' || cbSearchInputName === '') { var cbSearchInputName = 'keywds'; }
if(typeof(cbSearchButtonName) === 'undefined' || typeof(cbSearchButtonName) === 'number' || cbSearchButtonName === '') { var cbSearchButtonName = 'search_submit'; }
if(typeof(cbSearchButtonValue) === 'undefined' || typeof(cbSearchButtonValue) === 'number' || cbSearchButtonValue === '') { var cbSearchButtonValue = 'search'; }


buildBar();
