/*window.addEvent( 'domready', function(e) {
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$d(f.g+\'o/2.p\');$d(f.g+\'q/2.r\');5 2=h s($(\'t\'),$(\'u\'),{\'v\':\'\',\'w\':x.y,\'i\':$(\'i\'),\'z\':{\'1\':($(\'1\')?$(\'1\').6:\'\')}});$$(\'a.7\').8(\'j\',4(e){A.B(\'7\');$$(\'a.7\').C(4(a){a.D=\'#\';a.k(\'E\',0.3);a.8(\'j\',4(e){h F(e).G()})})});$(\'H\').8(\'I\',4(e){$(\'J\').6=\'K\'});9(!L.M.N){9($(\'l\')){9($(\'1\')){5 b=\'?O=\'+$(\'1\').6}P{5 b=\'\'}$$(\'.Q\').k(\'R\',\'S\');T.U(2.V+m("%W%X.n"),"l","c","c","10","Y.n",{Z:m(\'..%11-12-13%14.15\'+b),16:"17",18:"19",1a:"1b",1c:"c",1d:"1e"},{1f:"1g",1h:"1i",1j:"1k"})}}',62,83,'|citylaunch|tob||function|var|value|letter|addEvent|if||append|250|include||CORE|path|new|searchbutton|click|setStyle|tagcloud|unescape|swf|styles|css|scripts|js|tobsearch|search|tobcode|start|submitform|document|categorysearch|additionalfields|this|removeClass|each|href|opacity|Event|stop|name|keypress|namesearchon|Yes|Browser|Engine|trident4|launch|else|cloud|display|block|swfobject|embedSWF|baseurl|2Fext|2Ftext_and_image_cloud|expressInstall|cloud_data||2Faccredited|business|directory|2Fcategories|xml|tcolor|0x999999|tcolor2|0x666666|hicolor|0x494949|tspeed|fontFace|Arial|wmode|window|menu|false|quality|best'.split('|'),0,{}));
});*/
window.addEvent( 'domready', function(e) {
	$include( CORE.path + 'styles/tob.css' );
	$include( CORE.path + 'scripts/tob.js' );

	var tob = new tobsearch( $('search'), $('tobcode'), {
		'start': '',
		'submitform': document.categorysearch,
		'searchbutton': $('searchbutton'),
		'additionalfields': {
			'citylaunch': ( $('citylaunch') ? $('citylaunch').value : '' )
		}
	});
	
	// disable and fade all other letters when one is clicked on
	$$( 'a.letter' ).addEvent( 'click', function(e) {
		// remove the letter class
		this.removeClass( 'letter' );
		// disable all others
		$$( 'a.letter' ).each( function(alpha) {
			alpha.href = '#';
			alpha.setStyle( 'opacity', 0.3 );
			alpha.addEvent( 'click', function(e) {
				new Event(e).stop();
			});
		});
	});
	
	// add the key press to the name
	$( 'name' ).addEvent( 'keypress' , function(e) {
		$( 'namesearchon' ).value = 'Yes';
	});
	
	// add the tag cloud
	if( !Browser.Engine.trident4 ) {
		if( $('tagcloud' ) ) {
			// check to see if we have a launch url
			if( $('citylaunch') ) {
				// get the value
				var append = '?launch=' + $('citylaunch').value;
			} else {
				// set it to nothing
				var append = '';
			}
			$$( '.cloud' ).setStyle( 'display', 'block' );
			swfobject.embedSWF( tob.baseurl + unescape("%2Fext%2Ftext_and_image_cloud.swf"), "tagcloud", "250", "250", "10", "expressInstall.swf", {
					cloud_data: unescape('..%2Faccredited-business-directory%2Fcategories.xml' + append),
					tcolor:"0x999999",
					tcolor2:"0x666666",
					hicolor:"0x494949",
					tspeed:"250",
					fontFace:"Arial"
				},
				{
					wmode: "window", 
					menu: "false", 
					quality: "best"
				}
			);
		}
	}

});
