﻿
var coolives_popupmenu_slideinout_obj=new Array();
function coolives_popupmnenuAddObject(sender,imgstr)
{
	    
		var html=JamieDurieGetMinSlider(imgstr);
		
	    var obj=new Object();
		obj.id=sender.id,
		obj.type="searcharray";
		obj.parameter=html.html;
		var i;
		for(i=0;i<coolives_popupmenu_slideinout_obj.length;i++)
		{
			 
		   if(coolives_popupmenu_slideinout_obj[i].id==sender.id)
		   {
			   	return;
		   }
		}
		coolives_popupmenu_slideinout_obj.push(obj);
		 
		coolives_popupmenustart();
		
}
function JamieDurieAddImageTagPopUp(sender)
{
    coolives_popupmenu_slideinout_obj.push(sender);	 
	coolives_popupmenustart();
}
function JamieDurieGetMinSlider(strOriginal)
{
    var obj=new Object();
    obj.has=false;
    var imgs=strOriginal.split("|");
    var i;
    var btm="";
	var html="";
	if(imgs.length>0){
	obj.has=true;
    for(i=0;i<imgs.length;i++)
    {
        btm+="<td><img onload=\"resizeimagetothumbnailview(this,20,20)\" width=\"20\" height=\"20\" src=\""+imgurl+"plants/"+imgs[i]+"\"/></td>";
    }
    }
     html="<table><tr>"+btm+"</tr></table>";
     obj.imgs=imgs;
     obj.html=html;
    return obj;
  }
function coolives_popupmenustart()
{
     
    
    coolives_globalpopupmenuitem = new mtDropDownSet(mtDropDown.direction.down, 0, 0, mtDropDown.reference.bottomLeft);
	var i;
	var obj;
	 
	 for(i=0;i<coolives_popupmenu_slideinout_obj.length;i++)
	{  
	    
		obj=coolives_popupmenu_slideinout_obj[i];
		 
		if(obj.type=="searcharray")
		{
		     
			eval["lmenuname"+obj.id]=coolives_globalpopupmenuitem.addMenu(document.getElementById(obj.id));
			eval["lmenuname"+obj.id].addItem(obj.parameter,"#");		
		}
	} 
	 
	mtDropDown.renderAll();
	coolives_popupmenu_init();
}