

function writeContentToDiv(divId,msg){$(divId).innerHTML="";$(divId).innerHTML=msg;}
function debug(msg){writeContentToDiv("debug",msg);}
function getSuggestions(elementId,forWord,forType){forWord=trim(forWord);YAHOO.util.Dom.setStyle("suggest_text_"+forType+"_empty","display","none");if(forWord.length==0){$(elementId+'_suggestions').innerHTML="";YAHOO.util.Dom.setStyle("suggest_text_"+forType+"_not_empty","display","none");return;}
var suggestion=getValueInCache(forWord,forType);if(suggestion!=null){writeSuggestionsDiv(suggestion,elementId,forType);return;}
if(theLocale==undefined)theLocale="en_US";var url="/tags.dx?command="+tagSuggestCommand+"&modelId="+modelId+"&templateId="+templateId+"&attributeGroup="+forType+"&prefix="+forWord+"&locale="+theLocale;var callback={success:function(response){var tags=eval(response.responseText);var cbForWord=response.argument.forWord;var cbForType=response.argument.forType;var cbElementId=response.argument.elementId;var suggestionsDiv="<ul class=\"suggestions\">";for(var i=0;i<tags.length;i++){var oneTag=tags[i];var displayValue=replace(oneTag,apostropheReplacement,"'");displayValue=replace(displayValue,quoteReplacement,'"');suggestionsDiv+="<li><a href='javascript:void(0)' class='correctedWords' onclick='addTagWithSuggestionClick(Hash"+cbForType+", \""+cbForType+"\", \""+oneTag+"\");$(\""+cbElementId+"\").focus();return false;'>"+displayValue+"</a></li>";}
suggestionsDiv+="</ul>"
var cbSuggestion=new Suggestion(suggestionsDiv,tags.length);addWordToCache(cbForWord,cbForType,cbSuggestion);writeSuggestionsDiv(cbSuggestion,cbElementId,cbForType);},argument:{forWord:forWord,forType:forType,elementId:elementId}};YAHOO.util.Connect.asyncRequest('GET',url,callback);return false;}
function drawHash(hashToUse,tagGroupNameClean){var contents="";var hiddenValue="";var divName='Div'+tagGroupNameClean;for(var key in hashToUse){var value=hashToUse[key];var displayValue=replace(value.name,apostropheReplacement,"'");displayValue=replace(displayValue,quoteReplacement,'"');var onclick="";var className="";var hiddenBox="";if(value.inUse==true){hiddenValue+=value.name+'|';onclick='onClick="remove(Hash'+tagGroupNameClean+',\''+tagGroupNameClean+'\',\''+key+'\'); return false;"';className="checked"
hiddenBox='<input type="hidden" name="'+gUserAttributePrefix+tagGroupNameClean+'_'+key+'" value="'+value.name+'|'+value.selectedType+'">';}else{onclick='onClick="addTagWithCheckboxClick(Hash'+tagGroupNameClean+',\''+tagGroupNameClean+'\',\''+value.name+'\', true); return false;"';className="unchecked";}
var oneRow='<p class=\"checkitemcustom\"><a class="checkbox '+className+'" href="javascript:void(0)" '+onclick+'>'+displayValue+'</a></p> '+hiddenBox;contents+=oneRow;}
writeContentToDiv(divName,contents);$(sCustomAttrPrefix+tagGroupNameClean).value=hiddenValue;}
String.prototype.isEmailAddress=function(){var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;return filter.test(this.toString());}




/* DROP DOWN START */

// Copyright (C) 2005-2008 Ilya S. Lyubinskiy. All rights reserved.
// Technical support: http://www.php-development.ru/
//
// YOU MAY NOT
// (1) Remove or modify this copyright notice.
// (2) Re-distribute this code or any part of it.
//     Instead, you may link to the homepage of this code:
//     http://www.php-development.ru/javascripts/dropdown.php
//
// YOU MAY
// (1) Use this code on your website.
// (2) Use this code as part of another product.
//
// NO WARRANTY
// This code is provided "as is" without warranty of any kind.
// You expressly acknowledge and agree that use of this code is at your own risk.


// ***** Popup Control *********************************************************

// ***** at_show_aux *****

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

  var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
}

// ***** at_show *****

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);
  clearTimeout(c["at_timeout"]);
}

// ***** at_hide *****

function at_hide()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
}

// ***** at_click *****

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible") at_show_aux(p.id, c.id); else c.style.visibility = "hidden";
  return false;
}

// ***** at_attach *****

// PARAMETERS:
// parent   - id of the parent html element
// child    - id of the child  html element that should be droped down
// showtype - "click" = drop down child html element on mouse click
//            "hover" = drop down child html element on mouse over
// position - "x" = display the child html element to the right
//            "y" = display the child html element below
// cursor   - omit to use default cursor or specify CSS cursor name

function at_attach(parent, child, showtype, position, cursor)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}


/* DROP DOWN END */

<!--
function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function FP_swapImgRestore() {//v1.0
 var doc=document,i; if(doc.$imgSwaps) { for(i=0;i<doc.$imgSwaps.length;i++) {
  var elm=doc.$imgSwaps[i]; if(elm) { elm.src=elm.$src; elm.$src=null; } } 
  doc.$imgSwaps=null; }
}
// -->
