//options = {type: options.type || "POST",url: options.url || "",timeout: options.timeout || 5000,onComplete: options.onComplete || function(){},
//    onError: options.onError || function(){},onSuccess: options.onSuccess || function(){},data: options.data || "",postdata:options.postdata||null};
WOTSZUP={};
WOTSZUP.Interactive={};
WOTSZUP.Info={};
WOTSZUP.Display={};
WOTSZUP.Info.orderfunc
WOTSZUP.Info.ORDERCONTACTS=1;
WOTSZUP.Info.ORDERPHOTOS=2;
function domReady( f ) {
    if ( domReady.done ){
        return f();
    }
    if ( domReady.timer ) {
        domReady.ready.push( f );
    }
    else {
        addEvent( window, "load", isDOMReady );  domReady.ready = [ f ];
        domReady.timer = setInterval( isDOMReady, 13 );
         }
}
function isDOMReady() {
    if ( domReady.done ){
        return false;
    }
    if ( document && document.getElementsByTagName && document.getElementById && document.body ) {
        clearInterval( domReady.timer );
        domReady.timer = null;
        for ( var i = 0; i < domReady.ready.length; i++ ){
            domReady.ready[i]();
        }
        domReady.ready = null;
        domReady.done = true;
    }
}
function tag(name, elem) {
    return (elem || document).getElementsByTagName(name);
}
function id(name) {
    return document.getElementById(name);
}
function first( elem ) {
    elem = elem.firstChild;
    return elem && elem.nodeType != 1 ? next ( elem ) : elem;
}
function last( elem ) {
    elem = elem.lastChild;
    return elem && elem.nodeType != 1 ? prev ( elem ) : elem;
}
function next( elem ) {
    do {
        elem = elem.nextSibling;
    } while ( elem && elem.nodeType != 1 );
    return elem;
}
function prev( elem ) {
    do {
        elem = elem.previousSibling;
    } while ( elem && elem.nodeType != 1 );
    return elem;
}
function attr( elem, name, value) {
    if ( !name || name.constructor != String ){
        return '';
    }
    name = { 'for': 'htmlFor', 'class': 'className' }[name] || name;
    if ( typeof value != 'undefined' ) {
        elem[name] = value;
        if ( elem.setAttribute ){
            elem.setAttribute(name,value);
        }
    }
    return elem[name] || elem.getAttribute?elem.getAttribute(name) : '';
}
function text(e) {
    var t = "";
    e = e.childNodes || e;
    for ( var j = 0; j < e.length; j++ ) {
       t += e[j].nodeType != 1 ? e[j].nodeValue : text(e[j].childNodes);
    }
    return t;
}
function getStyle( elem, name ) {
    if (elem.style[name]){
        return elem.style[name];
    }
    else if (elem.currentStyle){
        return elem.currentStyle[name];
    }
    if (document.defaultView && document.defaultView.getComputedStyle) {
        name = name.replace(/([A-Z])/g,"-$1");
        name = name.toLowerCase();
        var s = document.defaultView.getComputedStyle(elem,"");
        return s && s.getPropertyValue(name);
    }
    else{
        return null;
    }
}
function pageX(elem){
    return elem.offsetParent?elem.offsetLeft + pageX(elem.offsetParent):elem.offsetLeft;
}
function pageY(elem){
    return elem.offsetParent?elem.offsetTop + pageY(elem.offsetParent):elem.offsetTop;
}
// A function for setting the horizontal position of an element
function setX(elem, pos) {
// Set the 'left' CSS property, using pixel units
    elem.style.left = pos + "px";
}
// A function for setting the vertical position of an element
function setY(elem, pos) {
// Set the 'left' CSS property, using pixel units
    elem.style.top = pos + "px";
}
// A function for adding a number of pixels to the horizontal
// position of an element
function addX(elem,pos) {
// Get the current horz. position and add the offset to it.
    setX( posX(elem) + pos );
}
// A function that can be used to add a number of pixels to the
// vertical position of an element
function addY(elem,pos) {
// Get the current vertical position and add the offset to it
    setY( posY(elem) + pos );
}
// Get the actual height (using the computed CSS) of an element
function getHeight( elem ) {
// Gets the computed CSS value and parses out a usable number
    return parseInt( getStyle( elem, 'height' ) );
}
// Get the actual width (using the computed CSS) of an element
function getWidth( elem ) {
// Gets the computed CSS value and parses out a usable number
    return parseInt( getStyle( elem, 'width' ) );
}
// Find the full, possible, height of an element (not the actual,
// current, height)
function fullHeight( elem ) {
// If the element is being displayed, then offsetHeight
// should do the trick, barring that, getHeight() will work
    if ( getStyle( elem, 'display' ) != 'none' ){
        return elem.offsetHeight || getHeight( elem );
    }
// Otherwise, we have to deal with an element with a display
// of none, so we need to reset its CSS properties to get a more
// accurate reading
    var old = resetCSS( elem, { display: '',visibility: 'hidden',position: 'absolute'});
// Figure out what the full height of the element is, using clientHeight
// and if that doesn't work, use getHeight
    var h = elem.clientHeight || getHeight( elem );
// Finally, restore the CSS properties back to what they were
    restoreCSS( elem, old );
// and return the full height of the element
    return h;
}
// Find the full, possible, width of an element (not the actual,
// current, width)
function fullWidth( elem ) {
// If the element is being displayed, then offsetWidth
// should do the trick, barring that, getWidth() will work
    if ( getStyle( elem, 'display' ) != 'none' ){
        return elem.offsetWidth || getWidth( elem );
    }
// Otherwise, we have to deal with an element with a display
// of none, so we need to reset its CSS properties to get a more
// accurate reading
    var old = resetCSS( elem, {display: '',visibility: 'hidden',position: 'absolute'});
// Figure out what the full width of the element is, using clientWidth
// and if that doesn't work, use getWidth
    var w = elem.clientWidth || getWidth( elem );
// Finally, restore the CSS properties back to what they were
    restoreCSS( elem, old );
// and return the full width of the element
    return w;
}
function resetCSS( elem, prop ) {
    var old = {};
// Go through each of the properties
    for ( var i in prop ) {
// Remember the old property value
        old[ i ] = elem.style[ i ];
// And set the new value
        elem.style[ i ] = prop[i];
    }
// Retun the set of changed values, to be used by restoreCSS
    return old;
}
// A function for restoring the side effects of the resetCSS function
function restoreCSS( elem, prop ) {
// Reset all the properties back to their original values
    for ( var i in prop ){
        elem.style[ i ] = prop[ i ];
    }
}
// A function for hiding (using display) an element
function hide( elem ) {
// Find out what its current display state is
    var curDisplay = getStyle( elem, 'display' );
// Remember its display state for later
    if ( curDisplay != 'none' ){
        elem.$oldDisplay = curDisplay;
    }
// Set the display to none (hiding the element)
    elem.style.display = 'none';
}
// A function for showing (using display) an element
function show( elem ) {
// Set the display property back to what it use to be, or use
// 'block', if no previous display had been saved
    elem.style.display = elem.$oldDisplay || '';
}
// Set an opacity level for an element
// (where level is a number 0-100)
function setOpacity( elem, level ) {
// If filters exist, then this is IE, so set the Alpha filter
    if ( elem.filters ){
        elem.style.filters = 'alpha(opacity=' + level + ')';
    }
// Otherwise use the W3C opacity property
    else{
        elem.style.opacity = level / 100;
    }
}
function slideDown( elem ) {
// Start the slide down at 0
    elem.style.height = '0px';
// Show the element (but you can see it, since the height is 0)
    show( elem );
// Find the full, potential, height of the element
    var h = fullHeight( elem );
// We're going to do a 20 'frame' animation that takes
// place over one second
    for ( var i = 0; i <= 100; i += 5 ) {
// A closure to make sure that we have the right 'i'
        (function(){var pos = i;setTimeout(function(){elem.style.height = (( pos / 100 ) * h ) + "px";}, ( pos + 1 ) * 100 );})();
    }
}
function fadeIn( elem ) {
// Start the opacity at 0
    setOpacity( elem, 0 );
// Show the element (but you can't see it, since the opacity is 0)
    show( elem );
// We're going to do a 20 'frame' animation that takes
// place over one second
    for ( var i = 0; i <= 100; i += 5 ) {
// A closure to make sure that we have the right 'i'
        (function(){var pos = i;var delem=elem;setTimeout(function(){setOpacity( delem, pos );}, ( pos - 1 ) * 10 );})();
    }
}
function getX(e) {
// Normalize the event object
    e = e || window.event;
// Check for the non-IE position, then the IE position
    return e.pageX || e.clientX + document.body.scrollLeft;
}
// Find the vertical position of the cursor
function getY(e) {
// Normalize the event object
    e = e || window.event;
// Check for the non-IE position, then the IE position
    return e.pageY || e.clientY + document.body.scrollTop;
}
// Get the X position of the mouse relative to the element target
// used in event object 'e'
function getElementX( e ) {
// Find the appropriate element offset
    return ( e && e.layerX ) || window.event.offsetX;
}
// Get the Y position of the mouse relative to the element target
// used in event object 'e'
function getElementY( e ) {
// Find the appropriate element offset
    return ( e && e.layerY ) || window.event.offsetY;
}
// Returns the height of the web page
// (could change if new content is added to the page)
function pageHeight() {
    return document.body.scrollHeight;
}
// Returns the width of the web page
function pageWidth() {
    return document.body.scrollWidth;
}
function windowHeight() {
// A shortcut, in case we're using Internet Explorer 6 in Strict Mode
    var de = document.documentElement;
// If the innerHeight of the browser is available, use that
    return self.innerHeight ||( de && de.clientHeight ) ||document.body.clientHeight;
}
// Find the width of the viewport
function windowWidth() {
// A shortcut, in case we're using Internet Explorer 6 in Strict Mode
    var de = document.documentElement;
// If the innerWidth of the browser is available, use that
    return self.innerWidth ||( de && de.clientWidth ) ||document.body.clientWidth;
}
// A function for determining how far horizontally the browser is scrolled
function scrollX() {
  // A shortcut, in case we're using Internet Explorer 6 in Strict Mode
  // If the pageXOffset of the browser is available, use that
  //Otherwise, try to get the scroll left off of the root node
  //Finally, try to get the scroll left off of the body element
  var de = document.documentElement;
  return window.pageXOffset || ( de && de.scrollLeft ) || document.body.scrollLeft;
}
// A function for determining how far vertically the browser is scrolled
function scrollY() {
  // A shortcut, in case we're using Internet Explorer 6 in Strict Mode
  var de = document.documentElement;
  // If the pageYOffset of the browser is available, use that
  // Otherwise, try to get the scroll top off of the root node
  // Finally, try to get the scroll top off of the body element
  return window.pageYOffset ||  ( de && de.scrollTop ) ||  document.body.scrollTop;
}
/************************************************************************************************
Modern html data entry fields can display a value when unedited and remove that value clearing the
field for data entry. If nothing is entered the default value is restored.
This function enables any html textfield to exhibit such behaviour
@8:00 p.m. January 28 2009
@author Dumbi Olise
updated
@3:55p.m. Sunday February 1 2009
Can now handle password fields effectively, shows a non masked string when blank and masks the field
on input
textItem -  the textItem whose behaviour is to be altered
defaultContent -  Unedited unfocused content of the textitem
defaultclass -  class specifying visual attributes of the element when unfocused
editclass -  class specifying visual attributes of the element during editing
************************************************************************************************/
function initDefaultContent(textItem, defaultContent,defaultClass,editClass){
      attr(textItem,"w_defaultvalue",defaultContent);
      attr(textItem,"w_blankclass",defaultClass);
      attr(textItem,"w_editclass",editClass);
      attr(textItem,"className",defaultClass);
      attr(textItem,"data","false");
      if(attr(textItem,"type")=="password"){
          attr(textItem,"w_password","true");
          attr(textItem,"type","");
      }
      attr(textItem,"value",defaultContent);
      textItem.onfocus=function(){
              if(attr(this,"data")=="false"){
                  this.value="";//blank out text
                  this.className=attr(this,"w_editclass");//change style thru class
                  if(attr(this,"w_password")=="true")
                      attr(this,"type","password");
                  this.focus();
              }
      };
      textItem.onblur=function(){
              if(this.value.length<=0){
                  attr(this,"type","");
                  attr(this,"data","false");
                  this.className=attr(this,"w_blankclass");//change style back
                  this.value=attr(this,"w_defaultvalue");//reset to default
              }
              else{
                attr(this,"data",true);
              }
      };
}
function create( elem ) {
    return document.createElementNS ? document.createElementNS( 'http://www.w3.org/1999/xhtml', elem ) : document.createElement( elem );
}
function fadeOut( elem ) {
    setOpacity( elem, 100 );
    setTimeout(function(){setOpacity(elem,90)},100);
    setTimeout(function(){setOpacity(elem,80)},200);
    setTimeout(function(){setOpacity(elem,70)},300);
    setTimeout(function(){setOpacity(elem,60)},400);
    setTimeout(function(){setOpacity(elem,50)},500);
    setTimeout(function(){setOpacity(elem,40)},600);
    setTimeout(function(){setOpacity(elem,30)},700);
    setTimeout(function(){setOpacity(elem,20)},800);
    setTimeout(function(){setOpacity(elem,10)},900);
    setTimeout(function(){setOpacity(elem,0)},1000);
    setTimeout(function(){hide(elem)},1100);
}
function stopDefault( e ) {
  if ( e && e.preventDefault ){
    e.preventDefault();
  }
  else{
    window.event.returnValue = false; return false;
  }
}
function stopBubble(e) {
  if ( e && e.stopPropagation ){
     e.stopPropagation();
  }
  else{
     window.event.cancelBubble = true;
  }
}
function transferNodes(elem,nodehtml){
         tempdiv=create("div");
         tempdiv.innerHTML=nodehtml;
         for ( var j = 0; j < tempdiv.childNodes.length; j++ ){
           elem.appendChild(tempdiv.removeChild(tempdiv.childNodes[j]));
         }
}
//temporary fix
WOTSZUP.Display.transferNodes=window.transferNodes;
function msgbox(mboxmsg,mboxtitle,icon){
         msgtype="color_b";
         if(icon){
           switch(icon){
             case 1:// information
                msgtype="color_b";
             break;
             case 2://yes no
                msgtype="color_c";
             break;
             case 3://yes no
                msgtype="color_a";
             break;
             case 4:  //error
                msgtype="color_d";
             break;
             default:
                msgtype="color_b";
             break;
           }
         }
         if(WOTSZUP.Info.w_dlgw){
             WOTSZUP.Info.w_dlgw++;
         }
         else{
             WOTSZUP.Info.w_dlgw=1;
         }
         var refwindow="w_msgbox"+WOTSZUP.Info.w_dlgw;
         var msgbx=create("div");
         attr(msgbx,"id","w_msgbox"+WOTSZUP.Info.w_dlgw);
         msgbx.style.position="absolute";
         var wWidth=windowWidth();
         var wHeight=windowHeight();
         msgbx.style.left=(wWidth*.2)+(window.pageXOffset || document.documentElement.scrollLeft  || document.body.scrollLeft)+"px";//couldn't use scrollX cos of opera
         msgbx.style.top=(wHeight*.25)+80+(window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop)+"px";
         var msgpane=create("div");
         msgbx.className="xsnazzy";
         msgpane.className="xboxcontent";
         var msgtitle=create("h1");
         msgtitle.className=msgtype;
         transferNodes(msgtitle,"<span id=\"draghandle"+WOTSZUP.Info.w_dlgw+"\"><a title=\"Drag anywhere\">"+mboxtitle+"</a></span>");
         var closebox=create("div");
         closebox.className="closebox";
         closebox.innerHTML="<a title=\"Close\">&nbsp;X&nbsp;</a>";
         closebox.style.position="absolute";
         closebox.style.left="570px";
         closebox.style.top="5px";
         closebox.width="50px";
         closebox.height="50px";
         closebox.onmouseover=function(){this.className="closeboxhi";};
         closebox.onmouseout=function(){this.className="closebox";};
         attr(closebox,'refwindow',"w_msgbox"+WOTSZUP.Info.w_dlgw);
         closebox.onclick=function(){new Effect.Opacity(msgbx, {duration:1.5, from:1, to:0});var elem=this;setTimeout(function(){document.body.removeChild(id(attr(elem,'refwindow')));},1200);};
         //msgtitle.appendChild(sp);
         var msg=create("p");
         msg.innerHTML=mboxmsg+"<br>";
         var okbtn=create("button");
         okbtn.innerHTML="Ok";
         attr(okbtn,'refwindow',"w_msgbox"+WOTSZUP.Info.w_dlgw);
         attr(okbtn,'id',"w_msgbox"+WOTSZUP.Info.w_dlgw+'okbtn');
         attr(msgbx,'okbtn',"w_msgbox"+WOTSZUP.Info.w_dlgw+'okbtn');
         okbtn.style.position="relative";
         okbtn.style.width="50px";
         okbtn.style.height="25px";
         okbtn.style.left="500px";
         msg.appendChild(okbtn);
         msgpane.appendChild(msgtitle);
         msgpane.appendChild(msg);
         msgpane.appendChild(closebox);
         transferNodes(msgbx,"<b class=\"xtop\"><b class=\"xb1\"></b><b class=\"xb2 "+msgtype+"\"></b><b class=\"xb3 "+msgtype+"\"></b><b class=\"xb4 "+msgtype+"\"></b></b>");
         msgbx.appendChild(msgpane);
         transferNodes(msgbx,"<b class=\"xbottom\"><b class=\"xb4\"></b><b class=\"xb3\"></b><b class=\"xb2\"></b><b class=\"xb1\"></b></b>");
         okbtn.onclick=function(){new Effect.Opacity(msgbx, {duration:1.5, from:1, to:0});var elem=this;setTimeout(function(){document.body.removeChild(id(attr(elem,'refwindow')));},1200);};
         document.body.appendChild(msgbx);
         Drag.init( document.getElementById("w_msgbox"+WOTSZUP.Info.w_dlgw) );
         msgbx=$(msgbx);
         msgbx.setOpacity(0);
         new Effect.Opacity(msgbx, {duration:1.5, from:0, to:1});
         okbtn.focus();
         return refwindow;
}
function dlgbox(dlgboxmsg,dlgboxtitle,icon,oktitle,okaction,cancelaction){
         dlgtype="color_b";
         if(icon){
           switch(icon){
             case 1:// information
                 dlgtype="color_b";
             break;
             case 2://yes no
                 dlgtype="color_c";
             break;
             case 3://yes no
                 dlgtype="color_a";
             break;
             case 4:  //error
                 dlgtype="color_d";
             break;
             default:
                 dlgtype="color_b";
             break;
           }
         }
         if(WOTSZUP.Info.w_dlgw){
             WOTSZUP.Info.w_dlgw++;
         }
         else{
             WOTSZUP.Info.w_dlgw=1;
         }
         var refwindow="w_msgbox"+WOTSZUP.Info.w_dlgw;
         var dlgbx=create("div");
         attr(dlgbx,"id",refwindow);
         dlgbx.style.position="absolute";
         wWidth=windowWidth();
         wHeight=windowHeight();
         dlgbx.style.left=(wWidth*.2)+(window.pageXOffset || document.documentElement.scrollLeft  || document.body.scrollLeft)+"px";
         dlgbx.style.top=(wHeight*.25)+30+(window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop)+"px";
         var dlgpane=create("div");
         dlgbx.className="xsnazzy";
         dlgpane.className="xboxcontent";
         var dlgtitle=create("h1");
         dlgtitle.className=dlgtype;
         transferNodes(dlgtitle,"<span id=\"draghandle"+WOTSZUP.Info.w_dlgw+"\"><a title=\"Drag here\">"+dlgboxtitle+"</a></span>");
         var closebox=create("div");
         closebox.className="closebox";
         closebox.innerHTML="<a title=\"Close\">&nbsp;X&nbsp;</a>";
         attr(closebox,'refwindow',"w_msgbox"+WOTSZUP.Info.w_dlgw);
         closebox.style.position="absolute";
         closebox.style.left="570px";
         closebox.style.top="5px";
         closebox.width="50px";
         closebox.height="50px";
         closebox.onmouseover=function(){this.className="closeboxhi";};
         closebox.onmouseout=function(){this.className="closebox";};
         closebox.onclick=function(){eval(cancelaction);new Effect.Opacity(dlgbx, {duration:1.5, from:1, to:0});var elem=this;setTimeout(function(){document.body.removeChild(id(attr(elem,'refwindow')));},1200);};
         attr(closebox,'refwindow',"w_msgbox"+WOTSZUP.Info.w_dlgw);
         var msg=create("p");
         msg.innerHTML=dlgboxmsg+"<br>";
         var okbtn=create("button");
         okbtn.innerHTML=oktitle;
         attr(okbtn,'refwindow',"w_msgbox"+WOTSZUP.Info.w_dlgw);
         okbtn.style.position="relative";
         okbtn.style.width="100px";
         okbtn.style.height="25px";
         okbtn.style.left="450px";
         msg.appendChild(okbtn);
         dlgpane.appendChild(dlgtitle);
         dlgpane.appendChild(msg);
         dlgpane.appendChild(closebox);
         transferNodes(dlgbx,"<b class=\"xtop\"><b class=\"xb1\"></b><b class=\"xb2 "+dlgtype+"\"></b><b class=\"xb3 "+dlgtype+"\"></b><b class=\"xb4 "+dlgtype+"\"></b></b>");
         dlgbx.appendChild(dlgpane);
         transferNodes(dlgbx,"<b class=\"xbottom\"><b class=\"xb4\"></b><b class=\"xb3\"></b><b class=\"xb2\"></b><b class=\"xb1\"></b></b>");
         okbtn.onclick=function(){if(okaction.length&&eval(okaction)){new Effect.Opacity(dlgbx, {duration:1.5, from:1, to:0});;var elem=this;setTimeout(function(){document.body.removeChild(id(attr(elem,'refwindow')));},1200);}};
         document.body.appendChild(dlgbx);
         //Drag.init( msgtitle );
         new Draggable("w_msgbox"+WOTSZUP.Info.w_dlgw,{scroll:window,zindex:500,handle:'draghandle'+WOTSZUP.Info.w_dlgw,revert:false});
         dlgbx=$(dlgbx);//adds Prototype element methods to dlgbx so we can set the opacity
         dlgbx.setOpacity(0);
         new Effect.Opacity(dlgbx, {duration:1.5, from:0, to:1});//fadeIn(dlgbx);
         return refwindow;
}
function onlynumbers(txt){
    var num="09";
	for(var i=0;i<txt.length;i++){
	    if(txt.charCodeAt(i)<num.charCodeAt(0)||txt.charCodeAt(i)>num.charCodeAt(1)){
	        return false;
	    }
	}
	return true;
 }
// addEvent/removeEvent written by Dean Edwards, 2005 with input from Tino Zijdel http://dean.edwards.name/weblog/2005/10/add-event/
function addEvent(element, type, handler) {
    if (!handler.$$guid){
        handler.$$guid = addEvent.guid++;
    }
    if (!element.events){
        element.events = {};
    }
    var handlers = element.events[type];
    if (!handlers) {
        handlers = element.events[type] = {};
        if (element["on" + type]) { handlers[0] = element["on" + type]; }
    }
    handlers[handler.$$guid] = handler;
    element["on" + type] = handleEvent;
    };
addEvent.guid = 1;
function removeEvent(element, type, handler) {
    if (element.events && element.events[type]) {
        delete element.events[type][handler.$$guid];
    }
};
function handleEvent(event) {
    var returnValue = true;
    event = event || fixEvent(window.event);
    var handlers = this.events[event.type];
    for (var i in handlers) {
        this.$$handleEvent = handlers[i];
        if (this.$$handleEvent(event) === false) {
            returnValue = false;
        }
    }
    return returnValue;
 };
function fixEvent(event) {
    event.preventDefault = fixEvent.preventDefault;
    event.stopPropagation = fixEvent.
    stopPropagation;
    return event;
};
fixEvent.preventDefault = function() {
    this.returnValue = false;
};
fixEvent.stopPropagation = function() {
    this.cancelBubble = true;
};
//end of dean edwards contribution
function cleanWhitespace( element ) {
  element = element || document;
  var cur = element.firstChild;
  while ( cur != null ) {
     if ( cur.nodeType == 3 && ! /\S/.test(cur.nodeValue) ) {
        element.removeChild( cur );
     }
     else if ( cur.nodeType == 1 ) {
         cleanWhitespace( cur );
     }
     cur = cur.nextSibling;
  }
}
function initEditInPlace(displayid,editid,editfieldid,savebtnid,cancelbtnid,saveAction){
    if(typeof saveAction != 'function'){
        saveAction=function(arg){return true;};
    }
    $(displayid).ondblclick=function(){
        $(displayid).style.display='none';
        $(editid).style.display='block';
        if(attr($(editfieldid),"wselect")=='true'){
            var i=0;
            for(i=0;i<$(editfieldid).options.length;i++){
                if($(editfieldid).options[i].text==$(displayid).innerHTML){
                    $(editfieldid).options[i].selected=true;
                    break;
                }
            }
        }
        else{
            $(editfieldid).value=$(displayid).innerHTML;
        }
    };
    $(savebtnid).onclick=function(){
        if($(editfieldid).value){
            if(saveAction($(editfieldid).value)){
                if(attr($(editfieldid),"wselect")=='true'){
                    var sindex=$(editfieldid).selectedIndex;
                    $(displayid).innerHTML=$(editfieldid).options[sindex].text;
                }
                else{
                    $(displayid).innerHTML=$(editfieldid).value;
                }
            }
            else{
                return false;
            }
            $(editid).style.display='none';
            $(displayid).style.display='block';
        }
    };
    $(savebtnid).onkeypress=function(){
        if($(editfieldid).value){
            if(saveAction($(editfieldid).value)){
                if(attr($(editfieldid),"wselect")=='true'){
                    var sindex=$(editfieldid).selectedIndex;
                    $(displayid).innerHTML=$(editfieldid).options[sindex].text;
                }
                else{
                    $(displayid).innerHTML=$(editfieldid).value;
                }
            }
            else{
                return false;
            }
        }
        $(editid).style.display='none';
        $(displayid).style.display='block';
    };
    $(cancelbtnid).onclick=function(){
        $(editid).style.display='none';
        $(displayid).style.display='block';
    };
    $(cancelbtnid).onkeypress=function(){
        $(editid).style.display='none';
        $(displayid).style.display='block';
    };
}
function isemail(ab,ac){
	var emdot= ab.indexOf(".");
	var emat=ab.indexOf("@");
	var hostat=ac.indexOf("@");
	var hostdot=ac.indexOf(".");
	var hlen=ac.length;
	if(emdot>=0||emat>=0||hostat>=0||hostdot<=0||(hostdot+1)==hlen){
		return false;
	}
	else{
		return true;
	}
}
function checkEmail(email){
    if(email.indexOf("@")<=0){
	    alert("Please enter a valid email address");
		return false;
	}
	var user,domain;
	user=email.substring(0,email.indexOf("@"));
	domain=email.substring(email.indexOf("@")+1,email.length);
	if(isemail(user,domain)){
	    return true;
	}
	else{
		alert("Please enter a valid email address");
	}
	return false;
}
function validateEmail(elementValue){
   var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
   return emailPattern.test(elementValue);
 }
function checkPhoneNumber(num){
    if(typeof num =='string'&& num.length<16&&num.length>11&&num.charAt(0)=='+'&&onlynumbers(num.substr(1,num.length))){
        return true;
    }
    else{
        alert("Please enter a valid phone number in the form +234XXXXXXXXXX");
    }
}
function initEditNameInPlace(displayid,editid,editfieldid,savebtnid,cancelbtnid,saveAction){
    if(typeof saveAction != 'function'){
        saveAction=function(arg){return true;};
    }
    $(displayid).ondblclick=function(){
        $(displayid).style.display='none';
        $(editid).style.display='block';
        var fullname=$(displayid).innerHTML;
        $(editfieldid).value=fullname.substring(0,fullname.indexOf(" "));
        $('lname').value=fullname.substring(fullname.lastIndexOf(" ")+1,fullname.length);
        $('mname').value=fullname.substring(fullname.indexOf(" "),fullname.lastIndexOf(" "));

    };
    $(savebtnid).onclick=function(){
        if(!$(editfieldid).value){
            alert("Please enter your firstname");
            return false;
        }
        if(!$('lname').value){
            alert("Please enter your last name.");
            return false;
        }
        if($(editfieldid).value&&$('lname').value){
            if(saveAction($(editfieldid).value)){
                $(displayid).innerHTML=$(editfieldid).value+" "+$('mname').value+" "+$('lname').value;
            }
        }
        $(editid).style.display='none';
        $(displayid).style.display='block';
    };
    $(savebtnid).onkeypress=function(){
        if(!$(editfieldid).value){
            alert("Please enter your firstname");
            return false;
        }
        if(!$('lname').value){
            alert("Please enter your last name.");
            return false;
        }
        if($(editfieldid).value&&$('lname').value){
            if(saveAction($(editfieldid).value)){
                $(displayid).innerHTML=$(editfieldid).value+" "+$('mname').value+" "+$('lname').value;
            }
        }
        $(editid).style.display='none';
        $(displayid).style.display='block';
    };
    $(cancelbtnid).onclick=function(){
        $(editid).style.display='none';
        $(displayid).style.display='block';
    };
    $(cancelbtnid).onkeypress=function(){
        $(editid).style.display='none';
        $(displayid).style.display='block';
    };
}
