var DropDownMenu = Class.create();
var search_menu;
DropDownMenu.prototype = {
	
 initialize: function(menuElement) {
	menuElement.childElements().each(function(node){
		// if there is a submenu
		var submenu = $A(node.getElementsByTagName("ul")).first();
		var m = $A(node.getElementsByTagName("div")).first();
		if(submenu != null){
			// make sub-menu invisible
			Element.extend(submenu).childElements().each(function(su){
				if (su != null){
					Element.extend(su).childElements().each(function(s){
						var a = $A(s.getElementsByTagName("a")).first();
						if (s != null){
							Element.extend(s).onmouseover = function(){
//								Element.extend(s).setStyle({'color':'#ffffa0'});
								Element.extend(s).setStyle({'color':'#00FDDF'});
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#4c4c4c"});}, 100);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#4f4f4f"});}, 200);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#545454"});}, 300);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#585858"});}, 400);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#5c5c5c"});}, 500);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#606060"});}, 600);
							}
							Element.extend(s).onmouseout = function(){
								if (search_menu!=null){
									if (s.readAttribute('href')!=search_menu){
										Element.extend(s).setStyle({'color':'#a0a0a0'});
									}
								}else{
									Element.extend(s).setStyle({'color':'#a0a0a0'});
								}
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#383838"})}, 800);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#404040"})}, 700);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#484848"})}, 600);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#4c4c4c"})}, 500);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#4f4f4f"})}, 400);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#545454"})}, 300);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#585858"})}, 200);
								setTimeout(function(){Element.extend(su).setStyle({'backgroundColor' : "#5c5c5c"})}, 100);
							}
						}
					});
				}
			});
			Element.extend(submenu).setStyle({display: 'none'});
			 //toggle the visibility of the submenu
			node.onclick = function(){
//				Effect.toggle(Element.extend(submenu), 'blind');
				Effect.toggle(Element.extend(submenu), 'slide');
			}
			Element.extend(m).onmouseover = function(){
				Element.extend(m).setStyle({'color':'#6060FF'});
				setTimeout(function() {Element.extend(m).setStyle({'backgroundColor' : "#4c4c4c"})}, 100);
				setTimeout(function() {Element.extend(m).setStyle({'backgroundColor' : "#4f4f4f"})}, 200);
				setTimeout(function() {Element.extend(m).setStyle({'backgroundColor' : "#545454"})}, 300);
				setTimeout(function() {Element.extend(m).setStyle({'backgroundColor' : "#585858"})}, 400);
				setTimeout(function() {Element.extend(m).setStyle({'backgroundColor' : "#5c5c5c"})}, 500);
				setTimeout(function() {Element.extend(m).setStyle({'backgroundColor' : "#606060"})}, 600);
			}
			Element.extend(m).onmouseout = function(){
				var yes=0;
				if (search_menu!=null){
					var sub = $A(node.getElementsByTagName("ul")).first();
					sub.childElements().each(function(p){
						var par=$A(p.getElementsByTagName("a")).first();
						if (par!=null){
							if (par.readAttribute('href')==search_menu){
								Element.extend(m).setStyle({'color' : "#6060FF"});
								yes=1;
							}else{
								if (yes!=1)
									Element.extend(m).setStyle({'color':'#FFFFFF'});
							}
						}
					});
				}else{
					Element.extend(m).setStyle({'color':'#FFFFFF'});
				}

				setTimeout(function(){Element.extend(m).setStyle({'backgroundColor' : "#383838"})}, 800);
				setTimeout(function(){Element.extend(m).setStyle({'backgroundColor' : "#404040"})}, 700);
				setTimeout(function(){Element.extend(m).setStyle({'backgroundColor' : "#484848"})}, 600);
				setTimeout(function(){Element.extend(m).setStyle({'backgroundColor' : "#4c4c4c"})}, 500);
				setTimeout(function(){Element.extend(m).setStyle({'backgroundColor' : "#4f4f4f"})}, 400);
				setTimeout(function(){Element.extend(m).setStyle({'backgroundColor' : "#545454"})}, 300);
				setTimeout(function(){Element.extend(m).setStyle({'backgroundColor' : "#585858"})}, 200);
				setTimeout(function(){Element.extend(m).setStyle({'backgroundColor' : "#5c5c5c"})}, 100);
			}
		}
	});
}

};
var time;
var time2;
function on(id){
	
	if (id=='radio'){
		//window.open('radio.php','radiotornado',"width=290,height=150,location=0,directories=0,toolbar=0,menubar=0,scrollbars=0,resizable=0,status=0");
		parent.select_radio();
//		var radiotornado=open('','popup',"width=320,height=180,location=0,directories=0,toolbar=0,menubar=0,scrollbars=0,resizable=0,status=0");
//		radiotornado.document.open;
//		radiotornado.document.write('<div align="center"></div><div id="radio_box" style="display:none;" align="center"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="290" height="150" id="player_radio" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="movie" value="swf/player_radio.swf?path=xml/radio_xml.php" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#0000ff" /><embed src="swf/player_radio.swf?path=xml/radio_xml.php" quality="high" wmode="transparent" bgcolor="#000000" width="290" height="150" name="player_radio" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" /></object></div>');
//		radiotornado.document.close;
//		if($('radio').visible()==false){
//			clearInterval(time2);
//			$('radio').show();
//			time=setInterval(function(){
//				var l=$('radio_box').getStyle('left');
//				var filter = /(^.*)(px|pt)$/;
//				l=l.replace(filter ,"$1");
//				if (l<=0){
//					$('radio_box').setStyle({'left' : '0px'});
//					clearInterval(time);
//				}else{
//					l=l-20;
//					$('radio_box').setStyle({'left' : l+'px'});
//				}
//			},10);
//		}else{
//			clearInterval(time);
//			clearInterval(time2);
//			time2=setInterval(function(){
//				var l=$('radio_box').getStyle('left');
//				var filter = /(^.*)(px|pt)$/;
//				l=l.replace(filter ,"$1");
//				if (l>=340){
//					$('radio_box').setStyle({'left' : '340px'});
//					clearInterval(time2);
//					$('radio').hide();
//				}else{
//					l=1*l+40;
//					$('radio_box').setStyle({'left' : l+'px'});
//				}
//			},10);
//		}
	}
	if (id=='login'){
		if ($('login').visible()==false) Effect.toggle($('login'), 'blind');
		if ($('search').visible()==true) Effect.toggle($('search'), 'blind');
	}
	if (id=='search'){
		if ($('login').visible()==true) Effect.toggle($('login'), 'blind');
		if ($('search').visible()==false) Effect.toggle($('search'), 'blind');
	}
}
