_uacct = "UA-1173244-2";

/*start of floating divs using BoxOver*/

/* --- BoxOver ---*/
/* --- v 2.1 17th June 2006
By Oliver Bryant with help of Matthew Tagg
http://boxover.swazz.org */

if (typeof document.attachEvent!='undefined') {
   window.attachEvent('onload',init);
   document.attachEvent('onmousemove',moveMouse);
   document.attachEvent('onclick',checkMove); }
else {
   window.addEventListener('load',init,false);
   document.addEventListener('mousemove',moveMouse,false);
   document.addEventListener('click',checkMove,false);
}

var oDv=document.createElement("div");
var dvHdr=document.createElement("div");
var dvBdy=document.createElement("div");
var windowlock,boxMove,fixposx,fixposy,lockX,lockY,fixx,fixy,ox,oy,boxLeft,boxRight,boxTop,boxBottom,evt,mouseX,mouseY,boxOpen,totalScrollTop,totalScrollLeft;
boxOpen=false;
ox=10;
oy=10;
lockX=0;
lockY=0;

function init() {
  oDv.appendChild(dvHdr);
  oDv.appendChild(dvBdy);
  oDv.style.position="absolute";
  oDv.style.visibility='hidden';
  document.body.appendChild(oDv);
}

function defHdrStyle() {
  dvHdr.innerHTML='<img  style="vertical-align:middle"  src="icons/info.gif">&nbsp;&nbsp;'+dvHdr.innerHTML;
  dvHdr.style.fontWeight='bold';
  dvHdr.style.width='150px';
  dvHdr.style.fontFamily='arial';
  dvHdr.style.border='1px solid #A5CFE9';
  dvHdr.style.padding='3';
  dvHdr.style.fontSize='11';
  dvHdr.style.color='#4B7A98';
  dvHdr.style.background='#D5EBF9';
  dvHdr.style.filter='alpha(opacity=85)'; // IE
  dvHdr.style.opacity='0.85'; // FF
}

function defBdyStyle() {
  dvBdy.style.borderBottom='1px solid #A5CFE9';
  dvBdy.style.borderLeft='1px solid #A5CFE9';
  dvBdy.style.borderRight='1px solid #A5CFE9';
  dvBdy.style.width='150px';
  dvBdy.style.fontFamily='arial';
  dvBdy.style.fontSize='11';
  dvBdy.style.padding='3';
  dvBdy.style.color='#1B4966';
  dvBdy.style.background='#FFFFFF';
  dvBdy.style.filter='alpha(opacity=85)'; // IE
  dvBdy.style.opacity='0.85'; // FF
}

function checkElemBO(txt) {
if (!txt || typeof(txt) != 'string') return false;
if ((txt.indexOf('header')>-1)&&(txt.indexOf('body')>-1)&&(txt.indexOf('[')>-1)&&(txt.indexOf('[')>-1))
   return true;
else
   return false;
}

function scanBO(curNode) {
    if (checkElemBO(curNode.title)) {
         curNode.boHDR=getParam('header',curNode.title);
         curNode.boBDY=getParam('body',curNode.title);
      curNode.boCSSBDY=getParam('cssbody',curNode.title);
      curNode.boCSSHDR=getParam('cssheader',curNode.title);
      curNode.IEbugfix=(getParam('hideselects',curNode.title)=='on')?true:false;
      curNode.fixX=parseInt(getParam('fixedrelx',curNode.title));
      curNode.fixY=parseInt(getParam('fixedrely',curNode.title));
      curNode.absX=parseInt(getParam('fixedabsx',curNode.title));
      curNode.absY=parseInt(getParam('fixedabsy',curNode.title));
      curNode.offY=(getParam('offsety',curNode.title)!='')?parseInt(getParam('offsety',curNode.title)):10;
      curNode.offX=(getParam('offsetx',curNode.title)!='')?parseInt(getParam('offsetx',curNode.title)):10;
      curNode.fade=(getParam('fade',curNode.title)=='on')?true:false;
      curNode.fadespeed=(getParam('fadespeed',curNode.title)!='')?getParam('fadespeed',curNode.title):0.04;
      curNode.delay=(getParam('delay',curNode.title)!='')?parseInt(getParam('delay',curNode.title)):0;
      if (getParam('requireclick',curNode.title)=='on') {
        curNode.requireclick=true;
        document.all?curNode.attachEvent('onclick',showHideBox):curNode.addEventListener('click',showHideBox,false);
        document.all?curNode.attachEvent('onmouseover',hideBox):curNode.addEventListener('mouseover',hideBox,false);
      }
      else {// Note : if requireclick is on the stop clicks are ignored
        if (getParam('doubleclickstop',curNode.title)!='off') {
          document.all?curNode.attachEvent('ondblclick',pauseBox):curNode.addEventListener('dblclick',pauseBox,false);
        }
        if (getParam('singleclickstop',curNode.title)=='on') {
          document.all?curNode.attachEvent('onclick',pauseBox):curNode.addEventListener('click',pauseBox,false);
        }
      }
      curNode.windowLock=getParam('windowlock',curNode.title).toLowerCase()=='off'?false:true;
      curNode.title='';
      curNode.hasbox=1;
     }
     else
        curNode.hasbox=2;
}


function getParam(param,list) {
  var reg = new RegExp('([^a-zA-Z]' + param + '|^' + param + ')\\s*=\\s*\\[\\s*(((\\[\\[)|(\\]\\])|([^\\]\\[]))*)\\s*\\]');
  var res = reg.exec(list);
  var returnvar;
  if(res)
    return res[2].replace('[[','[').replace(']]',']');
  else
    return '';
}

function Left(elem){
  var x=0;
  if (elem.calcLeft)
    return elem.calcLeft;
  var oElem=elem;
  while(elem){
     if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderLeftWidth)))&&(x!=0))
      x+=parseInt(elem.currentStyle.borderLeftWidth);
     x+=elem.offsetLeft;
     elem=elem.offsetParent;
    }
  oElem.calcLeft=x;
  return x;
  }

function Top(elem){
   var x=0;
   if (elem.calcTop)
    return elem.calcTop;
   var oElem=elem;
   while(elem){
     if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderTopWidth)))&&(x!=0))
      x+=parseInt(elem.currentStyle.borderTopWidth);
     x+=elem.offsetTop;
           elem=elem.offsetParent;
   }
   oElem.calcTop=x;
   return x;

}

var ah,ab;
function applyStyles() {
  if(ab)
    oDv.removeChild(dvBdy);
  if (ah)
    oDv.removeChild(dvHdr);
  dvHdr=document.createElement("div");
  dvBdy=document.createElement("div");
  CBE.boCSSBDY?dvBdy.className=CBE.boCSSBDY:defBdyStyle();
  CBE.boCSSHDR?dvHdr.className=CBE.boCSSHDR:defHdrStyle();
  dvHdr.innerHTML=CBE.boHDR;
  dvBdy.innerHTML=CBE.boBDY;
  ah=false;
  ab=false;
  if (CBE.boHDR!='') {
    oDv.appendChild(dvHdr);
    ah=true;
  }
  if (CBE.boBDY!=''){
    oDv.appendChild(dvBdy);
    ab=true;
  }
}

var CSE,iterElem,LSE,CBE,LBE, totalScrollLeft, totalScrollTop, width, height ;
var ini=false;

// Customised function for inner window dimension
function SHW() {
   if (document.body && (document.body.clientWidth !=0)) {
      width=document.body.clientWidth;
      height=document.body.clientHeight;
   }
   if (document.documentElement && (document.documentElement.clientWidth!=0) && (document.body.clientWidth + 20 >= document.documentElement.clientWidth)) {
      width=document.documentElement.clientWidth;
      height=document.documentElement.clientHeight;
   }
   return [width,height];
}


var ID=null;
function moveMouse(e) {
   //boxMove=true;
  e?evt=e:evt=event;

  CSE=evt.target?evt.target:evt.srcElement;

  if (!CSE.hasbox) {
     // Note we need to scan up DOM here, some elements like TR don't get triggered as srcElement
     iElem=CSE;
     while ((iElem.parentNode) && (!iElem.hasbox)) {
        scanBO(iElem);
        iElem=iElem.parentNode;
     }
  }

  if ((CSE!=LSE)&&(!isChild(CSE,dvHdr))&&(!isChild(CSE,dvBdy))){
     if (!CSE.boxItem) {
      iterElem=CSE;
      while ((iterElem.hasbox==2)&&(iterElem.parentNode))
          iterElem=iterElem.parentNode;
      CSE.boxItem=iterElem;
      }
    iterElem=CSE.boxItem;
    if (CSE.boxItem&&(CSE.boxItem.hasbox==1))  {
      LBE=CBE;
      CBE=iterElem;
      if (CBE!=LBE) {
        applyStyles();
        if (!CBE.requireclick)
          if (CBE.fade) {
            if (ID!=null)
              clearTimeout(ID);
            ID=setTimeout("fadeIn("+CBE.fadespeed+")",CBE.delay);
          }
          else {
            if (ID!=null)
              clearTimeout(ID);
            COL=1;
            ID=setTimeout("oDv.style.visibility='visible';ID=null;",CBE.delay);
          }
        if (CBE.IEbugfix) {hideSelects();}
        fixposx=!isNaN(CBE.fixX)?Left(CBE)+CBE.fixX:CBE.absX;
        fixposy=!isNaN(CBE.fixY)?Top(CBE)+CBE.fixY:CBE.absY;
        lockX=0;
        lockY=0;
        boxMove=true;
        ox=CBE.offX?CBE.offX:10;
        oy=CBE.offY?CBE.offY:10;
      }
    }
    else if (!isChild(CSE,dvHdr) && !isChild(CSE,dvBdy) && (boxMove)) {
      // The conditional here fixes flickering between tables cells.
      if ((!isChild(CBE,CSE)) || (CSE.tagName!='TABLE')) {
        CBE=null;
        if (ID!=null)
            clearTimeout(ID);
        fadeOut();
        showSelects();
      }
    }
    LSE=CSE;
  }
  else if (((isChild(CSE,dvHdr) || isChild(CSE,dvBdy))&&(boxMove))) {
    totalScrollLeft=0;
    totalScrollTop=0;

    iterElem=CSE;
    while(iterElem) {
      if(!isNaN(parseInt(iterElem.scrollTop)))
        totalScrollTop+=parseInt(iterElem.scrollTop);
      if(!isNaN(parseInt(iterElem.scrollLeft)))
        totalScrollLeft+=parseInt(iterElem.scrollLeft);
      iterElem=iterElem.parentNode;
    }
    if (CBE!=null) {
      boxLeft=Left(CBE)-totalScrollLeft;
      boxRight=parseInt(Left(CBE)+CBE.offsetWidth)-totalScrollLeft;
      boxTop=Top(CBE)-totalScrollTop;
      boxBottom=parseInt(Top(CBE)+CBE.offsetHeight)-totalScrollTop;
      doCheck();
    }
  }

  if (boxMove&&CBE) {
    // This added to alleviate bug in IE6 w.r.t DOCTYPE
    bodyScrollTop=document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
    bodyScrollLet=document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
    mouseX=evt.pageX?evt.pageX-bodyScrollLet:evt.clientX-document.body.clientLeft;
    mouseY=evt.pageY?evt.pageY-bodyScrollTop:evt.clientY-document.body.clientTop;
    if ((CBE)&&(CBE.windowLock)) {
      mouseY < -oy?lockY=-mouseY-oy:lockY=0;
      mouseX < -ox?lockX=-mouseX-ox:lockX=0;
      mouseY > (SHW()[1]-oDv.offsetHeight-oy)?lockY=-mouseY+SHW()[1]-oDv.offsetHeight-oy:lockY=lockY;
      mouseX > (SHW()[0]-dvBdy.offsetWidth-ox)?lockX=-mouseX-ox+SHW()[0]-dvBdy.offsetWidth:lockX=lockX;
    }
    oDv.style.left=((fixposx)||(fixposx==0))?fixposx:bodyScrollLet+mouseX+ox+lockX+"px";
    oDv.style.top=((fixposy)||(fixposy==0))?fixposy:bodyScrollTop+mouseY+oy+lockY+"px";

  }
}

function doCheck() {
  if (   (mouseX < boxLeft)    ||     (mouseX >boxRight)     || (mouseY < boxTop) || (mouseY > boxBottom)) {
    if (!CBE.requireclick)
      fadeOut();
    if (CBE.IEbugfix) {showSelects();}
    CBE=null;
  }
}

function pauseBox(e) {
   e?evt=e:evt=event;
  boxMove=false;
  evt.cancelBubble=true;
}

function showHideBox(e) {
  oDv.style.visibility=(oDv.style.visibility!='visible')?'visible':'hidden';
}

function hideBox(e) {
  oDv.style.visibility='hidden';
}

var COL=0;
var stopfade=false;
function fadeIn(fs) {
    ID=null;
    COL=0;
    oDv.style.visibility='visible';
    fadeIn2(fs);
}

function fadeIn2(fs) {
    COL=COL+fs;
    COL=(COL>1)?1:COL;
    oDv.style.filter='alpha(opacity='+parseInt(100*COL)+')';
    oDv.style.opacity=COL;
    if (COL<1)
     setTimeout("fadeIn2("+fs+")",20);
}


function fadeOut() {
  oDv.style.visibility='hidden';

}

function isChild(s,d) {
  while(s) {
    if (s==d)
      return true;
    s=s.parentNode;
  }
  return false;
}

var cSrc;
function checkMove(e) {
  e?evt=e:evt=event;
  cSrc=evt.target?evt.target:evt.srcElement;
  if ((!boxMove)&&(!isChild(cSrc,oDv))) {
    fadeOut();
    if (CBE&&CBE.IEbugfix) {showSelects();}
    boxMove=true;
    CBE=null;
  }
}

function showSelects(){
   var elements = document.getElementsByTagName("select");
   for (i=0;i< elements.length;i++){
      elements[i].style.visibility='visible';
   }
}

function hideSelects(){
   var elements = document.getElementsByTagName("select");
   for (i=0;i< elements.length;i++){
   elements[i].style.visibility='hidden';
   }
}


/*end of floating divs*/

function resetField(field,defaultValue,theClass,theType){
    if(field.value=="" || field.value==defaultValue){
        if(field.type!="select-one"){
            field.value=defaultValue;
        }
        field.className=theClass;
        if(theType){
            field=changeInputType(field,theType);
        }
        field.blur();
    }
    return;
}

function clearField(field,defaultValue,theClass,theType){
    if(field.value==defaultValue && field.className!=theClass){
        if(field.type!="select-one"){
            field.value="";
        }
        field.className=theClass;
        if(theType){
            field=changeInputType(field,theType);
        }
        if(field.type!="select-one"){
            field.focus();
            field.value="";
            field.focus();
        }
    }
    return;
}

function changeInputType(
  oldElm, // a reference to the input element
  iType){ // value of the type property: 'text' or 'password'
  if(!oldElm || !oldElm.parentNode || (iType.length<4) ||
    !document.getElementById || !document.createElement) return;
  var newElm = document.createElement('input');
  newElm.type = iType;
  if(oldElm.name) newElm.name = oldElm.name;
  if(oldElm.id) newElm.id = oldElm.id;
  if(oldElm.className) newElm.className = oldElm.className;
  if(oldElm.size) newElm.size = oldElm.size;
  if(oldElm.tabIndex) newElm.tabIndex = oldElm.tabIndex;
  if(oldElm.accessKey) newElm.accessKey = oldElm.accessKey;
  if(oldElm.value) newElm.value = oldElm.value;
  if(oldElm.onchange) newElm.onchange = oldElm.onchange;
  if(oldElm.onclick) newElm.onclick = oldElm.onclick;
  if(oldElm.onfocus) newElm.onfocus = oldElm.onfocus;
  if(oldElm.onblur) newElm.onblur = oldElm.onblur;
  if(oldElm.onkeyup) newElm.onkeyup = oldElm.onkeyup;
  if(oldElm.onselect) newElm.onselect = oldElm.onselect;
  oldElm.parentNode.replaceChild(newElm,oldElm);
  return newElm;
}

function checkPassword(fieldElement,defaultValue,theClass){
    if(fieldElement.value!=defaultValue){
        fieldElement=changeInputType(fieldElement,'password');
        fieldElement.className=theClass;
        fieldElement.blur();
    }
    return;
}

function toggleDisplay(){
    var elementId = toggleDisplay.arguments
  var element = document.getElementById(elementId[0]);
  if(getStyle(element, 'display')=="none" || getStyle(element, 'display')==""){
      for(x=0;x<elementId.length;x++){
          setStyle(document.getElementById(elementId[x]),'display','none');
          }
    setStyle(element,'display','block');
    //alert(getStyle(element, 'display'));
  }else{
    for(x=0;x<elementId.length;x++){
          setStyle(document.getElementById(elementId[x]),'display','none');
          }
    setStyle(element,'display','none');
    //alert(getStyle(element, 'display'));
  }
  return false;
}

function toggleDisplayFamily(condition,toggledObjects,normallyShownObjects,normallyHiddenObjects){
    var normallyShownObject = normallyShownObjects.split(/[\s,]/);
    var normallyHiddenObject = normallyHiddenObjects.split(/[\s,]/);
    var toggledObject = toggledObjects.split(/[\s,]/);
    //alert(normallyShownObject);
    //alert(normallyHiddenObject);
    //alert(toggledObject);
  if(getStyle(document.getElementById(condition), 'display')=="none" || getStyle(document.getElementById(condition), 'display')==""){
      for(x=0;x<normallyShownObject.length;x++){
          setStyle(document.getElementById(normallyShownObject[x]),'display','block');
          }
      for(x=0;x<normallyHiddenObject.length;x++){
          setStyle(document.getElementById(normallyHiddenObject[x]),'display','none');
          }
    for(x=0;x<toggledObject.length;x++){
          setStyle(document.getElementById(toggledObject[x]),'display','block');
          }
    //alert(getStyle(element, 'display'));
  }else{
    for(x=0;x<normallyShownObject.length;x++){
          setStyle(document.getElementById(normallyShownObject[x]),'display','block');
          }
    for(x=0;x<normallyHiddenObject.length;x++){
          setStyle(document.getElementById(normallyHiddenObject[x]),'display','none');
          }
    for(x=0;x<toggledObject.length;x++){
          setStyle(document.getElementById(toggledObject[x]),'display','none');
          }
    //alert(getStyle(element, 'display'));
  }
  return false;
}

function launchPopup(htmlfile){
   window.open(htmlfile,'upload','menubar=no,width=500,height=250,toolbar=no,left=440,top=412');
   return false;
   }

function getStyle(el, style) {
    //alert(el.id+" : "+style);
   if(!document.getElementById){
    return;
    }
    var value = el.style[toCamelCase(style)];
    if(value==null || value==""){
        if(document.defaultView){
            value = document.defaultView.getComputedStyle(el, "").getPropertyValue(style);
            }
        else if(el.currentStyle){
            value = el.currentStyle[toCamelCase(style)];
        }
    }
     return value;
}

function setStyle(el, style, value) {
    //alert(el.id);
    el.style[style] = value;
}

function toCamelCase( sInput ) {
    var oStringList = sInput.split('-');
    if(oStringList.length == 1)
        return oStringList[0];
    var ret = sInput.indexOf("-") == 0 ?
       oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) : oStringList[0];
    for(var i = 1, len = oStringList.length; i < len; i++){
        var s = oStringList[i];
        ret += s.charAt(0).toUpperCase() + s.substring(1)
    }
    return ret;
}

function innerPopup(sourceDiv){
    var thisPopup=document.getElementById(sourceDiv);
    var myWidth = getWinWidth();
    var myHeight = getWinHeight();
   var xx = (myWidth / 2) - parseInt(getStyle(thisPopup,'width'))/2;
     var yy = (myHeight / 2) - parseInt(getStyle(thisPopup,'height'))/2;
     thisPopup.style.top=yy+"px";
     thisPopup.style.left=xx+"px";
   thisPopup.style.display="block";
   blurBackground();
     lockBodyScroll();
     setFocus(thisPopup);
   return false;
   }

function activatePage(){
    document.getElementById("background-div").parentNode.removeChild(document.getElementById("background-div"));
    unLockBodyScroll();
    return false;
}

function lockBodyScroll(){
        if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            document.body.style.overflow="hidden";
        } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            window.document.body.scroll = "no";
        } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            window.document.body.scroll = "no";
        }
   return;
}

function unLockBodyScroll(){
        if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            document.body.style.overflow="auto";
        } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            window.document.body.scroll = "yes";
        } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            window.document.body.scroll = "yes";
        }
   return;
}

function setFocus(element){
    element.focus();
    return false;
}

function getWinWidth(){
        var myWidth = 0;
        if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            myWidth = window.innerWidth;
        } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
        } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            myWidth = document.body.clientWidth;
        }
        return myWidth;
}

function getWinHeight(){
        var myHeight = 0;
        if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            myHeight = window.innerHeight;
        } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            myHeight = document.documentElement.clientHeight;
        } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            myHeight = document.body.clientHeight;
        }
        return myHeight;
}

function getBodyWidth(){
    return document.body.clientWidth;
}

function getBodyHeight(){
    return document.body.clientHeight;
}

function blurBackground(){
    var blurDiv = document.createElement('div');
    blurDiv.setAttribute('id', 'background-div');
    blurDiv.style.width=getBodyWidth()+"px";
    blurDiv.style.height=getBodyHeight()+"px";
    blurDiv.style.display="block";
    document.body.appendChild(blurDiv);
    return false;
}


function duplicateDiv(destinationDiv,sourceClass){
  var fieldCounter=destinationDiv+'Counter';
  var sourceDiv=destinationDiv+'0';
  var counter=parseInt(document.getElementById(fieldCounter).value);
  if(counter<10){
    counter=counter+1;
    document.getElementById(fieldCounter).value=counter;
    var stringText="<div id=\""+sourceDiv+"\" class=\""+sourceClass+"\">"+document.getElementById(sourceDiv).innerHTML+"</div>";
    stringText=stringText.replace(new RegExp(sourceDiv,"g"),destinationDiv+counter);
    stringText=document.getElementById(destinationDiv).innerHTML+stringText;
    document.getElementById(destinationDiv).innerHTML=stringText;
    document.getElementById(destinationDiv+fieldCounter).style.display="block";
  }
  return false;
}

function removeDiv(sourceDiv,destinationDiv){
  var t = document.getElementById(sourceDiv);
  var counter=parseInt(document.getElementById(destinationDiv+"Counter").value);
  t.parentNode.removeChild(t);
  document.getElementById(destinationDiv+'Counter').value=counter-1;
  return false;
}

function showDiv(parentDiv,maxCount){
  var counterField = document.getElementById(parentDiv+"Counter");
  var counter = parseInt(counterField.value);
  if(counter<(maxCount-1)){
    counter=counter+1;
    counterField.value=counter;
    document.getElementById(parentDiv+counter).style.display="block";
  }
  else if(counter==(maxCount-1)){
    counter=counter+1;
    counterField.value=counter;
    document.getElementById(parentDiv+counter).style.display="block";
    document.getElementById(parentDiv+"Add").style.display="none";
  }
  return;
}

function showDiv2(parentDiv){
  var counterField = document.getElementById(parentDiv+"Counter");
  var counter = parseInt(counterField.value);
  if(counter<4){
    counter=counter+1;
    counterField.value=counter;
    document.getElementById(parentDiv+counter).style.display="block";
  }
  else if(counter==4){
    counter=counter+1;
    counterField.value=counter;
    document.getElementById(parentDiv+counter).style.display="block";
    document.getElementById(parentDiv+"Add").style.display="none";
  }
  /*var message=window.open('','upload','menubar=no,width=500,height=250,scrollbars=yes,toolbar=no,left=440,top=412');
  var temp = document.getElementById(parentDiv).innerHTML;
  temp = temp.replace(new RegExp('<','g'),'&lt;');
  temp = temp.replace(new RegExp('>','g'),'&gt;');
  temp = temp.replace(new RegExp('div&gt;','g'),'div&gt;<br /><br />');
  message.document.writeln(temp);*/
  return;
}

function hideDiv(sourceDiv,parentDiv,fieldIds,maxCount){
  //alert(sourceDiv+" : "+parentDiv);
  var counterField = document.getElementById(parentDiv+"Counter");
  //alert(counterField.value);
  var counter = parseInt(counterField.value);
  var arr = new Array();
  arr = sourceDiv.split(parentDiv);
  var x = parseInt(arr[1]);
  clearFields(fieldIds);
  var droppedDiv = document.getElementById(sourceDiv);
  droppedDiv.style.display = "none";
  droppedDiv.setAttribute("id",parentDiv+(maxCount+1));
  x = x+1;
  for(var n = x;n <= maxCount;n++){
    var m1 = parentDiv+n;
    var m2 = parentDiv+(n-1);
    var g = document.getElementById(m1);
    g.setAttribute('id',m2);
  }
  droppedDiv.setAttribute("id",parentDiv+maxCount);
  counter=counter-1;
  counterField.value=counter;
  if(counter<=(maxCount-1)){
    document.getElementById(parentDiv+'Add').style.display="inline";
  }
  reorderDivs(parentDiv,maxCount);
  /*var temp = document.getElementById(parentDiv).innerHTML;
  temp = temp.replace(new RegExp("<","gi"),"&lt;");
  temp = temp.replace(new RegExp(">","gi"),"&gt;");
  temp = temp.replace(new RegExp("div&gt;","gi"),"div&gt;<br /><br /><br />");
  alert(temp);
  var message=window.open('','upload','menubar=no,width=500,height=250,scrollbars=yes,toolbar=no,left=440,top=412');
  message.document.writeln(temp);
  message.document.close();*/
  return;
}

function hideDiv2(sourceDiv,parentDiv,fieldIds){
  //alert(sourceDiv+" : "+parentDiv);
  var counterField = document.getElementById(parentDiv+"Counter");
  var counter = parseInt(counterField.value);
  var arr = new Array();
  arr = sourceDiv.split(parentDiv);
  var x = parseInt(arr[1]);
  clearFields(fieldIds);
  var droppedDiv = document.getElementById(sourceDiv);
  droppedDiv.style.display = "none";
  droppedDiv.setAttribute("id",parentDiv+"6");
  x = x+1;
  for(var n = x;n <= 5;n++){
    var m1 = parentDiv+n;
    var m2 = parentDiv+(n-1);
    var g = document.getElementById(m1);
    g.setAttribute('id',m2);
  }
  droppedDiv.setAttribute("id",parentDiv+"5");
  counter=counter-1;
  counterField.value=counter;
  if(counter<=4){
    document.getElementById(parentDiv+'Add').style.display="inline";
  }
  reorderDivs(parentDiv);
  /*var temp = document.getElementById(parentDiv).innerHTML;
  temp = temp.replace(new RegExp("<","gi"),"&lt;");
  temp = temp.replace(new RegExp(">","gi"),"&gt;");
  temp = temp.replace(new RegExp("div&gt;","gi"),"div&gt;<br /><br /><br />");
  alert(temp);
  var message=window.open('','upload','menubar=no,width=500,height=250,scrollbars=yes,toolbar=no,left=440,top=412');
  message.document.writeln(temp);
  message.document.close();*/
  return;
}

function clearFields(fieldIds){
  var fields = new Array();
  fields = fieldIds.split(" ");
  for(var x = 0;x < fields.length;x++){
    document.getElementById(fields[x]).value="";
  }
  return;
}

function reorderDivs(parentDiv,maxCount){
  var parentElement = document.getElementById(parentDiv);
  for(var n=maxCount;n>1;n--){
    var childNode1 = document.getElementById(parentDiv+(n-1));
    var childNode2 = document.getElementById(parentDiv+n);
    parentElement.insertBefore(childNode1, childNode2);
  }
  return;
}

function RGBColor(color_string)
{
    this.ok = false;

    // strip any leading #
    if (color_string.charAt(0) == '#') { // remove # if any
        color_string = color_string.substr(1,6);
    }

    color_string = color_string.replace(/ /g,'');
    color_string = color_string.toLowerCase();

    // before getting into regexps, try simple matches
    // and overwrite the input
    var simple_colors = {
        aliceblue: 'f0f8ff',
        antiquewhite: 'faebd7',
        aqua: '00ffff',
        aquamarine: '7fffd4',
        azure: 'f0ffff',
        beige: 'f5f5dc',
        bisque: 'ffe4c4',
        black: '000000',
        blanchedalmond: 'ffebcd',
        blue: '0000ff',
        blueviolet: '8a2be2',
        brown: 'a52a2a',
        burlywood: 'deb887',
        cadetblue: '5f9ea0',
        chartreuse: '7fff00',
        chocolate: 'd2691e',
        coral: 'ff7f50',
        cornflowerblue: '6495ed',
        cornsilk: 'fff8dc',
        crimson: 'dc143c',
        cyan: '00ffff',
        darkblue: '00008b',
        darkcyan: '008b8b',
        darkgoldenrod: 'b8860b',
        darkgray: 'a9a9a9',
        darkgreen: '006400',
        darkkhaki: 'bdb76b',
        darkmagenta: '8b008b',
        darkolivegreen: '556b2f',
        darkorange: 'ff8c00',
        darkorchid: '9932cc',
        darkred: '8b0000',
        darksalmon: 'e9967a',
        darkseagreen: '8fbc8f',
        darkslateblue: '483d8b',
        darkslategray: '2f4f4f',
        darkturquoise: '00ced1',
        darkviolet: '9400d3',
        deeppink: 'ff1493',
        deepskyblue: '00bfff',
        dimgray: '696969',
        dodgerblue: '1e90ff',
        feldspar: 'd19275',
        firebrick: 'b22222',
        floralwhite: 'fffaf0',
        forestgreen: '228b22',
        fuchsia: 'ff00ff',
        gainsboro: 'dcdcdc',
        ghostwhite: 'f8f8ff',
        gold: 'ffd700',
        goldenrod: 'daa520',
        gray: '808080',
        green: '008000',
        greenyellow: 'adff2f',
        honeydew: 'f0fff0',
        hotpink: 'ff69b4',
        indianred : 'cd5c5c',
        indigo : '4b0082',
        ivory: 'fffff0',
        khaki: 'f0e68c',
        lavender: 'e6e6fa',
        lavenderblush: 'fff0f5',
        lawngreen: '7cfc00',
        lemonchiffon: 'fffacd',
        lightblue: 'add8e6',
        lightcoral: 'f08080',
        lightcyan: 'e0ffff',
        lightgoldenrodyellow: 'fafad2',
        lightgrey: 'd3d3d3',
        lightgreen: '90ee90',
        lightpink: 'ffb6c1',
        lightsalmon: 'ffa07a',
        lightseagreen: '20b2aa',
        lightskyblue: '87cefa',
        lightslateblue: '8470ff',
        lightslategray: '778899',
        lightsteelblue: 'b0c4de',
        lightyellow: 'ffffe0',
        lime: '00ff00',
        limegreen: '32cd32',
        linen: 'faf0e6',
        magenta: 'ff00ff',
        maroon: '800000',
        mediumaquamarine: '66cdaa',
        mediumblue: '0000cd',
        mediumorchid: 'ba55d3',
        mediumpurple: '9370d8',
        mediumseagreen: '3cb371',
        mediumslateblue: '7b68ee',
        mediumspringgreen: '00fa9a',
        mediumturquoise: '48d1cc',
        mediumvioletred: 'c71585',
        midnightblue: '191970',
        mintcream: 'f5fffa',
        mistyrose: 'ffe4e1',
        moccasin: 'ffe4b5',
        navajowhite: 'ffdead',
        navy: '000080',
        oldlace: 'fdf5e6',
        olive: '808000',
        olivedrab: '6b8e23',
        orange: 'ffa500',
        orangered: 'ff4500',
        orchid: 'da70d6',
        palegoldenrod: 'eee8aa',
        palegreen: '98fb98',
        paleturquoise: 'afeeee',
        palevioletred: 'd87093',
        papayawhip: 'ffefd5',
        peachpuff: 'ffdab9',
        peru: 'cd853f',
        pink: 'ffc0cb',
        plum: 'dda0dd',
        powderblue: 'b0e0e6',
        purple: '800080',
        red: 'ff0000',
        rosybrown: 'bc8f8f',
        royalblue: '4169e1',
        saddlebrown: '8b4513',
        salmon: 'fa8072',
        sandybrown: 'f4a460',
        seagreen: '2e8b57',
        seashell: 'fff5ee',
        sienna: 'a0522d',
        silver: 'c0c0c0',
        skyblue: '87ceeb',
        slateblue: '6a5acd',
        slategray: '708090',
        snow: 'fffafa',
        springgreen: '00ff7f',
        steelblue: '4682b4',
        tan: 'd2b48c',
        teal: '008080',
        thistle: 'd8bfd8',
        tomato: 'ff6347',
        turquoise: '40e0d0',
        violet: 'ee82ee',
        violetred: 'd02090',
        wheat: 'f5deb3',
        white: 'ffffff',
        whitesmoke: 'f5f5f5',
        yellow: 'ffff00',
        yellowgreen: '9acd32'
    };
    for (var key in simple_colors) {
        if (color_string == key) {
            color_string = simple_colors[key];
        }
    }
    // emd of simple type-in colors

    // array of color definition objects
    var color_defs = [
        {
            re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
            example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
            process: function (bits){
                return [
                    parseInt(bits[1]),
                    parseInt(bits[2]),
                    parseInt(bits[3])
                ];
            }
        },
        {
            re: /^(\w{2})(\w{2})(\w{2})$/,
            example: ['#00ff00', '336699'],
            process: function (bits){
                return [
                    parseInt(bits[1], 16),
                    parseInt(bits[2], 16),
                    parseInt(bits[3], 16)
                ];
            }
        },
        {
            re: /^(\w{1})(\w{1})(\w{1})$/,
            example: ['#fb0', 'f0f'],
            process: function (bits){
                return [
                    parseInt(bits[1] + bits[1], 16),
                    parseInt(bits[2] + bits[2], 16),
                    parseInt(bits[3] + bits[3], 16)
                ];
            }
        }
    ];

    // search through the definitions to find a match
    for (var i = 0; i < color_defs.length; i++) {
        var re = color_defs[i].re;
        var processor = color_defs[i].process;
        var bits = re.exec(color_string);
        if (bits) {
            channels = processor(bits);
            this.r = channels[0];
            this.g = channels[1];
            this.b = channels[2];
            this.ok = true;
        }

    }

    // validate/cleanup values
    this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);
    this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);
    this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);

    // some getters
    this.toRGB = function () {
        return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')';
    }
    this.toHex = function () {
        var r = this.r.toString(16);
        var g = this.g.toString(16);
        var b = this.b.toString(16);
        if (r.length == 1) r = '0' + r;
        if (g.length == 1) g = '0' + g;
        if (b.length == 1) b = '0' + b;
        return '#' + r + g + b;
    }

    // help
    this.getHelpXML = function () {

        var examples = new Array();
        // add regexps
        for (var i = 0; i < color_defs.length; i++) {
            var example = color_defs[i].example;
            for (var j = 0; j < example.length; j++) {
                examples[examples.length] = example[j];
            }
        }
        // add type-in colors
        for (var sc in simple_colors) {
            examples[examples.length] = sc;
        }

        var xml = document.createElement('ul');
        xml.setAttribute('id', 'rgbcolor-examples');
        for (var i = 0; i < examples.length; i++) {
            try {
                var list_item = document.createElement('li');
                var list_color = new RGBColor(examples[i]);
                var example_div = document.createElement('div');
                example_div.style.cssText =
                        'margin: 3px; '
                        + 'border: 1px solid black; '
                        + 'background:' + list_color.toHex() + '; '
                        + 'color:' + list_color.toHex()
                ;
                example_div.appendChild(document.createTextNode('test'));
                var list_item_value = document.createTextNode(
                    ' ' + examples[i] + ' -> ' + list_color.toRGB() + ' -> ' + list_color.toHex()
                );
                list_item.appendChild(example_div);
                list_item.appendChild(list_item_value);
                xml.appendChild(list_item);

            } catch(e){}
        }
        return xml;

    }

}

/*
  -------------------------------------------------------------------------
                      JavaScript Form Validator
                                Version 2.0.2
  Copyright 2003 JavaScript-coder.com. All rights reserved.
  You use this script in your Web pages, provided these opening credit
    lines are kept intact.
  The Form validation script is distributed free from JavaScript-Coder.com

  You may please add a link to JavaScript-Coder.com,
  making it easy for others to find this script.
  Checkout the Give a link and Get a link page:
  http://www.javascript-coder.com/links/how-to-link.php

    You may not reprint or redistribute this code without permission from
    JavaScript-Coder.com.

  JavaScript Coder
  It precisely codes what you imagine!
  Grab your copy here:
    http://www.javascript-coder.com/
    -------------------------------------------------------------------------
*/
function Validator(frmname)
{
  this.formobj=document.forms[frmname];
  if(!this.formobj)
  {
    alert("BUG: could not get Form object "+frmname);
    return;
  }
  if(this.formobj.onsubmit)
  {
   this.formobj.old_onsubmit = this.formobj.onsubmit;
   this.formobj.onsubmit=null;
  }
  else
  {
   this.formobj.old_onsubmit = null;
  }
  this.formobj.onsubmit=form_submit_handler;
  this.addValidation = add_validation;
  this.setAddnlValidationFunction=set_addnl_vfunction;
  this.clearAllValidations = clear_all_validations;
}

function set_addnl_vfunction(functionname)
{
  this.formobj.addnlvalidation = functionname;
}

function clear_all_validations(frmname)
{
    this.formobj=document.forms[frmname];
  for(var itr=0;itr < this.formobj.elements.length;itr++)
  {
    this.formobj.elements[itr].validationset = null;
  }
}

function form_submit_handler()
{
    for(var ctr =0; ctr<this.elements.length; ctr++){
        if(this.elements[ctr].type!="button" && this.elements[ctr].type!="submit"){
            this.elements[ctr].style.border = "1px solid #cccccc";
        }
    }

  for(var itr=0;itr < this.elements.length;itr++)
  {
    if(this.elements[itr].validationset &&
     !this.elements[itr].validationset.validate())
    {
      return false;
    }
  }
  if(this.addnlvalidation)
  {
    str =" var ret = "+this.addnlvalidation+"()";
    eval(str);
    if(!ret) return ret;
  }
  return true;
}

function add_validation(itemname,descriptor,objLabel,errstr)
{
  if(!this.formobj)
  {
    alert("BUG: the form object is not set properly");
    return;
  }//if
  var itemobj = this.formobj[itemname];
  if(!itemobj)
  {
    alert("BUG: Could not get the input object named: "+itemname);
    return;
  }
  if(!itemobj.validationset)
  {
    itemobj.validationset = new ValidationSet(itemobj,this.formobj);
  }
  itemobj.validationset.add(descriptor,objLabel,errstr);
}

function ValidationDesc(inputitem,formobj,desc,objLabel,error)
{
    this.desc=desc;
  this.error=error;
  this.itemobj = inputitem;
  this.formobj=formobj;
  this.validate=vdesc_validate;
  this.objLabel=objLabel;
}

function vdesc_validate()
{
 if(!V2validateData(this.desc,this.itemobj,this.formobj,this.objLabel,this.error))
 {
    this.itemobj.focus();
    return false;
 }
 return true;
}

function ValidationSet(inputitem,formobj)
{
    this.vSet=new Array();
    this.formobj=formobj;
  this.add= add_validationdesc;
  this.validate= vset_validate;
  this.itemobj = inputitem;
}

function add_validationdesc(desc,objLabel,error)
{
  this.vSet[this.vSet.length]=
    new ValidationDesc(this.itemobj,this.formobj,desc,objLabel,error);
}

function vset_validate()
{
   for(var itr=0;itr<this.vSet.length;itr++)
   {
     if(!this.vSet[itr].validate())
     {
       return false;
     }
   }
   return true;
}

function validateEmailv2(email)
{
// a very simple email validation checking.
// you can add more complex email checking if it helps
    if(email.length <= 0)
  {
    return true;
  }
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null)
      {
      var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
      if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}

function displayError(strError,item){
    errorMsg = document.getElementById("errorHere");
    errorMsg.innerHTML = "<p><img class=\"exclamation-point\" src=\"/images/icons/exclamation-point.gif\" alt=\"Exclamation Point\" />"+strError+"</p>";
    document.getElementById("alertDiv").style.display = "block";
    window.scroll(0,0);
    item.style.border = "1px solid #ff0000";
    errorMsg.style.display = "block";
    return;
}

function V2validateData(strValidateStr,objValue,formObj,objLabel,strError)
{
    var epos = strValidateStr.search("=");
    var  command  = "";
    var  cmdvalue = "";
    if(objLabel){
    }else{
    objLabel = "This";
    }
    if(epos >= 0)
    {
     command  = strValidateStr.substring(0,epos);
     cmdvalue = strValidateStr.substr(epos+1);
    }
    else
    {
     command = strValidateStr;
    }
    switch(command)
    {
        case "req":
        case "required":
         {
           if(eval(objValue.value.length) == 0)
           {
              if(!strError || strError.length ==0)
              {
                strError = "'"+objLabel+"'"+" is a required field. You cannot leave it blank.";
              }//if
              displayError(strError,objValue);
              return false;
           }//if
           break;
         }//case required
        case "maxlength":
        case "maxlen":
          {
             if(eval(objValue.value.length) >  eval(cmdvalue))
             {
               if(!strError || strError.length ==0)
               {
                 strError = cmdvalue+" characters maximum for "+"'"+objLabel+"'.";
               }//if
               displayError(strError,objValue);
               return false;
             }//if
             break;
          }//case maxlen
        case "minlength":
        case "minlen":
           {
             if(eval(objValue.value.length) <  eval(cmdvalue))
             {
               if(!strError || strError.length ==0)
               {
                 strError = cmdvalue + " characters minimum for "+"'"+objLabel+"'.";
               }//if
               displayError(strError,objValue);
               return false;
             }//if
             break;
            }//case minlen
        case "alnum":
        case "alphanumeric":
           {
              var charpos = objValue.value.search("[^A-Za-z0-9]");
              if(objValue.value.length > 0 &&  charpos >= 0)
              {
               if(!strError || strError.length ==0)
                {
                  strError = "Only alpha-numeric characters allowed for "+"'"+objLabel+"' (e.g. 0-9, a-z, A-Z).";
                }//if
                displayError(strError,objValue);
                return false;
              }//if
              break;
           }//case alphanumeric
        case "num":
        case "numeric":
           {
              var charpos = objValue.value.search("[^0-9]");
              if(objValue.value.length > 0 &&  charpos >= 0)
              {
                if(!strError || strError.length ==0)
                {
                  strError = "Only digits allowed for "+"'"+objLabel+"' (e.g. 0-9).";
                }//if
                displayError(strError,objValue);
                return false;
              }//if
              break;
           }//numeric
        case "alphabetic":
        case "alpha":
           {
              var charpos = objValue.value.search("[^A-Za-z]");
              if(objValue.value.length > 0 &&  charpos >= 0)
              {
                  if(!strError || strError.length ==0)
                {
                  strError = "Only alphabetic characters allowed for "+"'"+objLabel+"' (e.g. a, b, f, et al).";
                }//if
                displayError(strError,objValue);
                return false;
              }//if
              break;
           }//alpha
    case "alnumhyphen":
      {
              var charpos = objValue.value.search("[^A-Za-z0-9\-_]");
              if(objValue.value.length > 0 &&  charpos >= 0)
              {
                  if(!strError || strError.length ==0)
                {
                  strError = "Characters allowed are A-Z,a-z,0-9,- and _ for "+"'"+objLabel+"'.";
                }//if
                displayError(strError,objValue);
                return false;
              }//if
      break;
      }
        case "email":
          {
               if(!validateEmailv2(objValue.value))
               {
                 if(!strError || strError.length ==0)
                 {
                    strError = "Enter a valid email address for "+"'"+objLabel+"' (e.g. john.doe@developmentex.com).";
                 }//if
                 displayError(strError,objValue);
                 return false;
               }//if
           break;
          }//case email
        case "lt":
        case "lessthan":
         {
            if(isNaN(objValue.value))
            {
              strError = "'"+objLabel+"'"+" should be a number.";
              displayError(strError,objValue);
              return false;
            }//if
            if(eval(objValue.value) >=  eval(cmdvalue))
            {
              if(!strError || strError.length ==0)
              {
                strError = "The value should be less than "+ cmdvalue+" for "+"'"+objLabel+"'.";
              }//if
              displayError(strError,objValue);
              return false;
             }//if
            break;
         }//case lessthan
        case "gt":
        case "greaterthan":
         {
            if(isNaN(objValue.value))
            {
              strError = "'"+objLabel+"'"+" should be a number.";
              displayError(strError,objValue);
              return false;
            }//if
             if(eval(objValue.value) <=  eval(cmdvalue))
             {
               if(!strError || strError.length ==0)
               {
                 strError = "The value should be greater than "+ cmdvalue+" for "+"'"+objLabel+"'.";
               }//if
               displayError(strError,objValue);
               return false;
             }//if
            break;
         }//case greaterthan
        case "regexp":
         {
      if(objValue.value.length > 0)
      {
              if(!objValue.value.match(cmdvalue))
              {
                if(!strError || strError.length ==0)
                {
                  strError = "Invalid characters found for "+"'"+objLabel+"'.";
                }//if
                displayError(strError,objValue);
                return false;
              }//if
      }
           break;
         }//case regexp
        case "dontselect":
         {
            if(objValue.selectedIndex == null)
            {
              alert("BUG: dontselect command for non-select Item");
              return false;
            }
            if(objValue.selectedIndex == eval(cmdvalue))
            {
             if(!strError || strError.length ==0)
              {
              strError = "Please select an option for "+"'"+objLabel+"'.";
              }//if
              displayError(strError,objValue);
              return false;
             }
             break;
         }//case dontselect
         case "compare":
         {
            if(formObj[cmdvalue] == null){
                alert("BUG: compare command for non-existent compare operand");
                return false;
            }else if(objValue == null){
                alert("BUG: compare command for non-existent compare source");
                return false;
            }
            if(formObj[cmdvalue].value != objValue.value){
                if(!strError || strError.length ==0)
                {
                strError = "The values for '"+objLabel+"' don't match. Please make sure that the values are equal.";
                }//if
              displayError(strError,objValue);
              return false;
            }
         }//case compare
         case "dependency":
         {
            if(formObj[cmdvalue] == null){
                alert("BUG: dependency command for non-existent Item -- "+cmdvalue);
                return false;
            }else if(objValue == null){
                alert("BUG: dependency command for non-existent Item");
                return false;
            }
            if(formObj[cmdvalue].value!="" && objValue.value==""){
                if(!strError || strError.length ==0)
                {
                strError = "'"+objLabel+"'"+" is a required field. You cannot leave it blank.";
                }//if
              displayError(strError,objValue);
              return false;
            }
         }//case dependency
    }//switch
    return true;
}
/*
  Copyright 2003 JavaScript-coder.com. All rights reserved.
*/

function transferValue(fromId, toId, allowDuplicate)
{
    var dupFlag=false;
    var p = getElementValue(document.getElementById(fromId));
    var selectContainer = document.getElementById(toId);
    //alert(p);
    for(y=selectContainer.length,z=0;z<p.length;z=z+2)
    {
        if(allowDuplicate==false)
        {
            for(n=0;n<selectContainer.length;n++)
            {
                if(selectContainer.options[n].text==p[z+1] && selectContainer.options[n].value==p[z])
                {
                    dupFlag=true;
                    break;
                }
            }
            if(dupFlag==false)
            {
                selectContainer.options[y]=new Option(p[z+1], p[z]);
                y++;
            }
        }
        else
        {
            selectContainer.options[y]=new Option(p[z+1], p[z]);
            y++;
        }
        dupFlag=false;
    }
    return;
}

function getElementValue(formElement)
{
  if(formElement.length != null) var type = formElement[0].type;
  if((typeof(type) == 'undefined') || (type == 0)) var type = formElement.type;

  switch(type)
  {
    case 'undefined': return;

    case 'radio':
      for(var x=0; x < formElement.length; x++)
        if(formElement[x].checked == true)
      return formElement[x].value;

    case 'select-multiple':
      var myArray = new Array();
      for(var x=0; x < formElement.length; x++)
        if(formElement[x].selected == true)
        {
          myArray[myArray.length] = formElement.options[x].value;
          myArray[myArray.length] = formElement.options[x].text;
        }
      return myArray;

    case 'checkbox': return formElement.checked;

    default: return formElement.value;
  }
}

function setElementValue(formElement, value)
{
  switch(formElement.type)
  {
    case 'undefined': return;
    case 'radio': formElement.checked = value; break;
    case 'checkbox': formElement.checked = value; break;
    case 'select-one': formElement.selectedIndex = value; break;

    case 'select-multiple':
      for(var x=0; x < formElement.length; x++)
        formElement[x].selected = value[x];
      break;

    default: formElement.value = value; break;
  }
}

function removeOption(selectBox)
{
    p = document.getElementById(selectBox);
    for(x=p.length-1; x >= 0; x--)
        if(p.options[x].selected)
        {
                    p.options[x]=null;
        }
  return;
}

function sortSelectList(selectList) {

    return;
}

function selectAllOptions(listId)
{
    List = document.getElementById(listId);
    for (i=0;i<List.length;i++)
    {
        List.options[i].selected = true;
    }
}

function sizeEffect(itemElement, startHeight, startWidth, endHeight, endWidth){
    if(startHeight == -1){
        alert(getStyle(itemElement,height));
    }
    return;
}

function expandItemDimension(itemElement, startHeight, startWidth, endHeight, endWidth){

}

 function doBodyOnLoad(){
    /*loginPassword = document.getElementById("login_password");
    if(loginPassword){
        resetField(loginPassword,'Enter password','width-max graytext','text');
    }*/
    return false;
}

function listToArray(listID) {

  var nodeList = $(listID).getElementsByTagName('li');
  var nodes =  $A(nodeList);

  var returnArray = new Array(nodes.length);

  for (var i = 0; i < nodes.length; i++) {
    returnArray[i] = nodes[i].innerHTML;
  }
  return returnArray;
}

function listTableToArray(listID) {

  var nodeList = $(listID).getElementsByTagName('li');
  var nodes =  $A(nodeList);

  var returnArray = new Array(nodes.length);

  for (var i = 0; i < nodes.length; i++) {
    returnArray[i] = nodes[i].id;
  }
  return returnArray;

}

function isListEmpty(listID, parentDivID) {
  var nodeList = $(listID).getElementsByTagName('li');
  var nodes =  $A(nodeList);

  if (nodes.length == 0) {
    $(parentDivID).addClassName('hide')
  }
}

function getValuesOf(content) {
  var list = $$(content);
  var nodes = $A(list)

  var returnArray = new Array(nodes.length);

  for (var i = 0; i < nodes.length; i++) {
    if (nodes[i].checked == true) {
      returnArray[i] = nodes[i].value;
    } else {
      returnArray[i] = -1;
    }
  }

  return returnArray;
}

function toggleIcon(link_id, observed_id) {

  if ($(observed_id).hasClassName('hide')) {
    $(observed_id).removeClassName('hide');
    $(link_id).update("<img alt=\"Minimize\" src=\"/images/icons/contract_icon.jpg\" title=\"Minimize\" />");
  } else {
    $(observed_id).addClassName('hide');
    $(link_id).update("<img alt=\"Maximize\" src=\"/images/icons/expand_icon.jpg\" title=\"Maximize\" />");
  }
}

function toggleMyHomeSectionIcon(link_id, observed_id) {

  content_section_edit = observed_id + '_section_edit';
  content_edit_icon = observed_id + '_edit_icon';
  document.getElementById(content_section_edit).style.display = 'none';

  if ($(observed_id).hasClassName('hide')) {
    $(observed_id).removeClassName('hide');
    $(content_edit_icon).removeClassName('hide');
    $(link_id).update("<img alt=\"Minimize\" src=\"/images/icons/contract_icon.jpg\" title=\"Minimize\" />");
  } else {
    $(observed_id).addClassName('hide');
    $(content_edit_icon).addClassName('hide');
    $(link_id).update("<img alt=\"Maximize\" src=\"/images/icons/expand_icon.jpg\" title=\"Maximize\" />");
  }
}

function toggleSectionIcon(link_id, section_contents, content_type) {
  var icon = content_type +"_icon_" + link_id;
  var content = content_type +"_" + link_id;
  var id_array = section_contents.split(',');

  if ($(content).hasClassName('hide')) {
    for(i = 0; i < id_array.length; i++) {
      icon = content_type +"_icon_" + id_array[i];
      content = content_type +"_" + id_array[i];

      if(link_id == id_array[i]) {
        $(icon).update("<img alt=\"Minimize\" src=\"/images/icons/contract_icon.jpg\" title=\"Minimize\" />");
        $(content).removeClassName('hide');
      } else {
        $(icon).update("<img alt=\"Maximize\" src=\"/images/icons/expand_icon.jpg\" title=\"Maximize\" />");
        $(content).addClassName('hide');
      }
    }
  } else {
    $(icon).update("<img alt=\"Maximize\" src=\"/images/icons/expand_icon.jpg\" title=\"Maximize\" />");
    $(content).addClassName('hide');
  }
}

function showDay(formYearId,formMonthId,formDayId){
  month = document.getElementById(formMonthId);
  year = document.getElementById(formYearId);
  day = document.getElementById(formDayId);

  if(month.value==9 || month.value==4 || month.value==6 || month.value==11){
   day.options.length=0;
   for(i=1; i<31; i++){
    day.options[i]=new Option(i, i, "false", "false");
   }
   day.options[0]=new Option("Select day", "", "true", "true");
  }
  else if(month.value==2){
   day.options.length=0;
   for(i=1; i<29; i++){
    day.options[i]=new Option(i, i, "false", "false");
   }
   if(((year.value)%4)==0){
    day.options[29]=new Option("29", "29", "false", "false");
   }
   day.options[0]=new Option("Select day", "", "true", "true");
  }
  else{
   day.options.length=0;
   for(i=1; i<32; i++){
    day.options[i]=new Option(i, i, "false", "false");
   }
   day.options[0]=new Option("Select day", "", "true", "true");
  }
  return false;
 }

function expand(item) {
  var i = $(item);
  i.addClassName('expanded');
  i.down('.content').show();
  i.down('.contractor').show();
  i.down('.expander').hide();
}

function contract(item) {
  var i = $(item);
  i.removeClassName('expanded');
  i.down('.content').hide();
  i.down('.contractor').hide();
  i.down('.expander').show();
}

function expandThisOnly(parent, item) {
  var i = $(parent).down('.expanded');
  if(i) {
    contract(i);
  }
  expand(item);
}

/* My Devex RollOver */
/* Removing RollOver as requested by Kami through Mo (12/17/2007) */


/* Event.addBehavior({
  'li#_messages': function() {
  var content = $('__messages');

  this.observe('mouseover', function() {
      content.setStyle('display: block');
  });

  this.observe('mouseout', function() {
    content.setStyle('display: none');
  });
  },

  'li#_profile': function() {
  var content = $('__profile');

  this.observe('mouseover', function() {
      content.setStyle('display: block');
  });

  this.observe('mouseout', function() {
    content.setStyle('display: none');
  });
  },

  'li#_network': function() {
  var content = $('__network');

  this.observe('mouseover', function() {
      content.setStyle('display: block');
  });

  this.observe('mouseout', function() {
    content.setStyle('display: none');
  });
  },

  'li#_alerts': function() {
  var content = $('__alerts');

  this.observe('mouseover', function() {
      content.setStyle('display: block');
  });

  this.observe('mouseout', function() {
    content.setStyle('display: none');
  });
  },

  'li#_favorites': function() {
  var content = $('__favorites');

  this.observe('mouseover', function() {
      content.setStyle('display: block');
  });

  this.observe('mouseout', function() {
    content.setStyle('display: none');
  });
  }

});

*/

