/*
DROP CLASS FOR DROP ITEMS (MENU, SELECT BOXES)
author: alexbridge

usage example:
##############################################

<style>
div.drop-parent {background: transparent url(/images/drop.gif); padding: 2px 16px 2px 16px; color: #b4bc8b; font: normal 11px Arial; cursor:pointer; text-align:left;}

div.drop {position:relative; z-index:1000;}
div.drop2 {top:-2px; left:0px; z-index:1000; width: 232px; position:absolute;}

iv.drop-optgroup {background-color: #374622; border: 1px solid #66672d; padding: 2px 16px 2px 16px; color: #b4bc8b; font: normal 11px Arial; cursor:pointer; text-align:left;}
div.drop-option {background-color: #374622; border: 1px solid #66672d; padding: 2px 16px 2px 16px; color: #b4bc8b; font: normal 11px Arial; cursor:pointer; text-align:left;}
div.drop-option:hover {background-color: #f4f4f4; color: #900;}

</style>

<div id="drop_conteiner">

<div id="drop_parent" class="drop-parent">Here default text to change from $VARIANTS</div>

<div class="drop" style="padding:0; margin:0">
<div class="drop2 drop-prolong" id="drop">

{foreach from=$VARIANTS key=k item=item}

<div class="drop-option drop-hide" lang="{$item.title}">{$item.name}</div>

{/foreach}

</div>
</div>
</div>

<script language="JavaScript" type="text/javascript">
$('drop').hide();
var drop=new DropSelect('drop');
drop.process="location.href='/live_auctions.php?cat_id=[PROCESS_ID]'";
drop.selected={$SEL_AUCITON_CAT_ID|default:"-1"};
</script>

##############################################

*/
var dropMouseOverClassName='drop-option-hover';
var dropMouseOutClassName='drop-option';

var DropSelect = Class.create({
	initialize: function(div_id)
	{
		this.div_id = div_id;
		this.div_conteiner = div_id+'_conteiner';
		this.div_parent= div_id+'_parent';
		this.timeout_var= null;
		this.time= 1000;
		this.selected= null;

		var self = this;

		$(this.div_parent).onmouseover=function()
		{
			$(self.div_id).show();
			//Effect.SlideDown(self.div_id, {duration:0.8});

		};
		$(this.div_parent).onmouseout=function()
		{
			self.hide();
		};
		//		$(this.div_parent).onclick=function()
		//		{
		//			//$(self.div_id).show();
		//			Effect.SlideDown(self.div_id, {duration:0.2});
		//			$(self.div_parent).onmouseout=function()
		//			{
		//				self.hide();
		//			};
		//		};


		$(this.div_id).onmouseover=function(){self.prolong();};

		$(this.div_id).onmouseout=function(){self.hide();};

		$A($$('#'+this.div_conteiner+' .drop-option')).each(function(el){
			el.onmouseover=function(){el.className=dropMouseOverClassName;}
			el.onmouseout=function(){el.className=dropMouseOutClassName; self.hide();}
			el.onclick=function(){
				$(self.div_parent).update(el.innerHTML);
				self.processing(el.lang);
			}
		});

		$A($$('#'+this.div_conteiner+' .drop-prolong')).each(function(el){$(el).onmouseout=function(){self.prolong();}});

		if(this.selected==null) {}
		else
		{
			$A($$('#'+this.div_conteiner+' .drop-option')).each(function(el){
				if(el.lang==self.selected)
				{
					$(self.div_parent).update($(el).innerHTML);
				}

			});
		}
	},
	prolong: function()
	{
		clearTimeout(this.timeout_var);
	},
	processing: function(s)
	{
		if(s!='') eval (s);
	},
	hide: function()
	{
		this.prolong();
		this.timeout_var=setTimeout('$("'+this.div_id+'").hide()',this.time);
		//this.timeout_var=setTimeout('Effect.SlideUp("'+this.div_id+'", {duration:0.2})',this.time);
	}
});



