/*
  Workspace Login 
  Vincent Fiduccia
  

  Version: 1.6 () 
  2009-12-04 19:09:18 (p3plpassweb02.prod.phx3.secureserver.net)

  js_file_Sel
*/

function Sel(props)
{this.elem=$(props.elem)||document.getElementsByTagName('BODY')[0];this.name=(props.name||'map').toUpperCase();this.selected_name=(props.selected_name||'is_selected');this.unselected_name=(props.unselected_name||this.selected_name+'_not');this.depth=props.depth||1;this.onselect=props.onselect;this.description=props.description;this.last_click=null;if(Env.is_khtml)
this.maps=this.elem.getElementsByTagName(this.name);this.selected=document.getElementsByName(this.selected_name);this.unselected=document.getElementsByName(this.unselected_name);}
Sel.prototype.get=function()
{return this.selected;}
Sel.prototype.toJSON=function()
{var obj,attrs,attr;var i,j;var ary=[];for(i=0;i<this.selected.length;i++)
{attrs=this.selected[i].attributes;obj=new AjaxObject();for(j=0;j<attrs.length;j++)
{attr=attrs[j];if(attr.specified&&attr.nodeName!='name')
obj[attr.nodeName]=attr.nodeValue;}
ary[ary.length]=obj;}
return ary.toJSON();}
Sel.prototype.mapToElem=function(map)
{for(var i=1;i<=this.depth&&map;i++)
{map=map.parentNode;}
return map;}
Sel.prototype.elemToMap=function(elem)
{for(var i=1;i<=this.depth&&elem;i++)
{elem=$L.firstChild(elem);}
if(elem&&elem.tagName==this.name)
return elem;else
return false;}
Sel.prototype.elemToDest=function(elem)
{for(var i=1;i<this.depth&&elem;i++)
{elem=$L.firstChild(elem);}
return elem;}
Sel.prototype.add=function(elem,update_last)
{var i,attr;var map;if(elem.tagName==this.name)
{map=elem;elem=this.mapToElem(elem);}
else
{map=this.elemToMap(elem);}
if(update_last!==false)
this.last_click=elem;if(!map)
return;if(map.getAttribute('name')==this.selected_name)
{return;}
else
{if(Env.is_ie)
{var html=map.outerHTML.replace(/name="?[^" ]+"?/,'name="'+this.selected_name+'"');var newmap=document.createElement(html);$L.prependChild(map.parentNode,newmap);map.parentNode.removeChild(map);}
else
{map.setAttribute('name',this.selected_name);}
if(this.onselect)
this.onselect(elem,true);}}
Sel.prototype.is=function(elem)
{var map=this.elemToMap(elem);if(!map)
return false;if(map&&map.getAttribute('name')==this.selected_name)
return true;else
return false;}
Sel.prototype.remove=function(elem,update_last)
{var map;if(elem.tagName==this.name)
{map=elem;elem=this.mapToElem(elem);}
else
{map=this.elemToMap(elem);}
if(update_last!==false)
this.last_click=elem;if(!map)
return;if(map.getAttribute('name')==this.selected_name)
{if(Env.is_ie)
{var html=map.outerHTML.replace(/name="?[^" ]+"?/,'name="'+this.unselected_name+'"');var newmap=document.createElement(html);$L.prependChild(map.parentNode,newmap);map.parentNode.removeChild(map);}
else
{map.setAttribute('name',this.unselected_name);}
if(this.onselect)
{this.onselect(elem,false);}}}
Sel.prototype.toggle=function(elem)
{if(this.is(elem))
this.remove(elem);else
this.add(elem);}
Sel.prototype.isAll=function()
{if(this.unselected.length==0)
return true;else
return false;}
Sel.prototype.clear=function()
{this._allOrNone(false);}
Sel.prototype.all=function()
{this._allOrNone(true);}
Sel.prototype._allOrNone=function(all)
{var start=Utils.getMillitime();var fn=(all?this.add:this.remove);var search=(all?this.unselected:this.selected);if(Env.is_khtml)
{for(var i=0;i<this.maps.length;i++)
{if(this.maps[i])
fn.call(this,this.mapToElem(this.maps[i]));}}
else
{for(var i=search.length-1;i>=0;i--)
{fn.call(this,this.mapToElem(search[i]));}}
var dur=Utils.getMillitime()-start;}
Sel.prototype.toggleAll=function()
{if(this.isAll())
this.clear();else
this.all();}
Sel.prototype.range=function(elem)
{var start=Utils.getMillitime();var newstate=!this.is(elem);var cur,to;if($L.compareOrder(this.last_click,elem)==-1)
{cur=this.last_click;to=elem;}
else
{cur=elem;to=this.last_click;}
while(cur)
{if(newstate)
this.add(cur,(cur==to));else
this.remove(cur,(cur==to));if(cur==to)
break;else
cur=$L.nextSibling(cur);}
var dur=Utils.getMillitime()-start;}
Sel.prototype.getDescription=function()
{if(this.description)
{return this.description(this);}
else
{var sel=this.get();if(sel.length==0)
return"No Items";else if(sel.length==1)
return"1 Item";else
return sel.length+" Items";}}

if ( typeof(loaded) == 'undefined' ) var loaded = {};
  loaded['/js.php?file=Sel&r='] = 1;
