function open_new_window (the_url,win_name,win_props) {
        window.open(the_url,win_name,win_props); 
}
var HOST = 'www.onthemarktech.com';

// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}
function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

function rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
	setCookie('otmfname', f.p_first_name.value, now, '', HOST, '');
	setCookie('otmlname', f.p_last_name.value, now, '', HOST, '');
    setCookie('otmmail', f.p_email.value, now, '', HOST, '');
    setCookie('otmwebsite', f.p_website.value, now, '', HOST, '');
}

function forgetMe (f) {
    deleteCookie('otmmail', '', HOST);
    deleteCookie('otmwebsite', '', HOST);
	deleteCookie('otmfname', '', HOST);
	deleteCookie('otmlname', '', HOST);
    f.p_email.value = '';
    f.p_first_name.value = '';
	f.p_last_name.value = '';
    f.p_website.value = '';
}
function showMore(varA1, varB1){
var123 = ('varXYZ' + (varA1));
varABC = ('varP' + (varA1));
if( document.getElementById ) {
if( document.getElementById(var123).style.display ) {
if( varB1 != 0 ) {
document.getElementById(var123).style.display = "block";
document.getElementById(varABC).style.display = "none";
} else { document.getElementById(var123).style.display = "none"; 
document.getElementById(varABC).style.display = "block"; }
} else { location.href = varB1;
return true; }
} else { location.href = varB1;
return true; }
}
function showComm(varA1, varB1){
var123 = ('varcXYZ' + (varA1));
varABC = ('varcP' + (varA1));
if( document.getElementById ) {
if( document.getElementById(var123).style.display ) {
if( varB1 != 0 ) {
document.getElementById(var123).style.display = "block";
document.getElementById(varABC).style.display = "none";
} else { document.getElementById(var123).style.display = "none"; 
document.getElementById(varABC).style.display = "block"; }
} else { location.href = varB1;
return true; }
} else { location.href = varB1;
return true; }
}
function swap(e1, e2)
{
  ttext = e1.text;
  tvalue = e1.value;
  e1.text = e2.text;
  e1.value = e2.value;
  e2.text = ttext;
  e2.value = tvalue;
} 
function deleteBlankRowIfNotEmpty(list)
{
   var idx = -1;
   var val = "";
// find a blank row in table 
   for (i = 0; i < list.length; i++){ 
        val = list.options[i].value;
        if (val == "") {
           idx = i;
           break;
        }
   } 
   if (idx >= 0 && (list.length > 1))
      list.options[idx] = null;
}
 function moveElementUp(list)
         {    // go through the list and get all selected items
              for ( i = 0; i <= list.length-1; i++) 
              { // if the item is selected then swap it
                if (list.options[i].selected)                     
                {   // check if it is not the first item
                    if (i != 0)
                    {
                        swap(list.options[i], list.options[i - 1]);
                        list.options[i - 1].selected = true;
                        list.options[i].selected = false;
                    }                        
                }
              }
          newOrder(list, eval("document." + list.form.name + "." + list.name.substr(0, list.name.lastIndexOf("select"))));
         }
 function moveElementDown(list)
         {    // go through the list and get all selected items
              for ( i = list.length-1; i >= 0; i--) 
              { // if the item is selected then swap it
                if (list.options[i].selected)                     
                {   // check if it is not the first item
                    if (i != list.length-1)
                    {
                        swap(list.options[i], list.options[i + 1]);
                        list.options[i + 1].selected = true;
                        list.options[i].selected = false;
                    }                        
                }
              }
          newOrder(list, eval("document." + list.form.name + "." + list.name.substr(0, list.name.lastIndexOf("select"))));
         }
 function moveElementTop(list)
         {    // get the first item selected which needs to move to top
              iSelected = list.selectedIndex;
              if (iSelected == 0)
                 return;
              // now run the moveup loop   
              for ( iMoveTop = 1; iMoveTop <= iSelected; iMoveTop++) {
                 moveElementUp(list);
              } 
         }
 function moveElementBottom(list)
         {    // get the last item selected which needs to move to bottom
              for ( i = 0; i <= list.length-1; i++) 
              { // if the item is selected then swap it
                if (list.options[i].selected)                     
                    iSelected = i;
              }
              if (iSelected == list.length-1)  
                 return;
              iSelected = list.length - 1 - iSelected; 
              // now run the movedown loop   
              for ( iMoveDown = 1; iMoveDown <= iSelected; iMoveDown++)
                 moveElementDown(list);
         }
function selectAll(list)
{
  for ( i = 0; i <= list.length-1; i++ )
    list.options[i].selected = true;
  return true;
}
function unSelectAll(list)
{
  for ( i = 0; i <= list.length-1; i++ )
    list.options[i].selected = false;
  return true;
}
function clearList(list)
{
  list.length = 0;
}
function copyToList(fromList, toList, direction) {
  for ( i = 0; i <= fromList.length-1;) {
    if (fromList.options[i].selected) {
        txt = fromList.options[i].text;
        val = fromList.options[i].value;
        if ( val != "" ) {
           // check if value is a spacer
           if ( val == "spacer" ) {
                if ( direction == "left" ) {
                     // remove from right and do not add on left
                     fromList.options[i]= null;
                }   
                else {
                    // add to right but do not remove from left
                    fromList.options[i].selected = false;
                    toList.options[toList.length] = new Option( txt, val, false, true );
                    toList.options[toList.selectedIndex].selected = false;
                }
           }
           else {  //only increment when not moving and deleting
             // create a new row
             toList.options[toList.length] = new Option( txt, val, false, true );
             // added these lines
             // removes from fromList and unselects item in toList
             fromList.options[i]= null;
             toList.options[toList.selectedIndex].selected = false;
           }  //only increment when not moving and deleting
        } else {
            i++; // increment when selected element is empty
        }
    }
    else i++;  //only increment when not moving and deleting
  }
  deleteBlankRowIfNotEmpty(fromList);
  deleteBlankRowIfNotEmpty(toList);
  // Set the order
  newOrder(toList, eval("document." + toList.form.name + "." + toList.name.substr(0, toList.name.lastIndexOf("select"))));
  newOrder(fromList, eval("document." + fromList.form.name + "." + fromList.name.substr(0, fromList.name.lastIndexOf("select"))));
}
function selectAll(theList) {
  for ( i = 0; i <= theList.length-1; i++ ) {
      theList.options[i].selected = true;
  }
}
function copyAll(fromList, toList, direction) {
     indexofspacer = -1;
        spacerval = "";
        spacertxt = "";
        indexofitem = toList.length;
     for ( i = 0; i <= fromList.length-1; i++ ) {
         txt = fromList.options[i].text;
         val = fromList.options[i].value;
         if ( val != "" ) {
             // check if we need to copy the spacer too
             if ( val != "spacer") {
                  toList.options[indexofitem] = new Option( txt, val, false, true );
                  toList.options[indexofitem].selected = false;
                     indexofitem++;
                }
                else { // found a spacer
                    indexofspacer = i;
                    spacerval = val;
                    spacertxt = txt;
                }
            }
     }   
        if (indexofspacer != -1 && direction == "right" ) // let the spacer be on the from list
            fromList.length = 1;
        else
         clearList(fromList);
     deleteBlankRowIfNotEmpty(toList);
     unSelectAll(toList);
     // Set the order
     newOrder(toList, eval("document." + toList.form.name + "." + toList.name.substr(0, toList.name.lastIndexOf("select"))));
     newOrder(fromList, eval("document." + fromList.form.name + "." + fromList.name.substr(0, fromList.name.lastIndexOf("select"))));
}
 function newOrder(list, csv) { 
    csv.value = "";
    for (var i = 0; i <= list.length - 1; i++){ 
        if (list.options[i].value != "") { 
           csv.value += list.options[i].value;
           if (i < list.length - 1 && list.options[i+1].value != "") 
              csv.value += ",";
        } 
    } 
 } 
 function sortList(checked, list, sortedList)
         {
           if (!checked) return;

           var sortKeys = new Array();

           // Get the sort key of each value in the list.
           // If the list is updated below, this list is reordered as well.
           for (var i=0; i < list.length; i++)
             for (var j=0; j < sortedList.length; j++)
               if (sortedList[j] == list.options[i].value)
                 sortKeys[i] = j;

           // Sort the HTML list according to the sortKeys.
           for (var i=0; i < list.length; i++)
           {
             // Find the list element with the lowest sort index.
             var min = i;
             for (var j=i+1; j < list.length; j++)
               if (sortKeys[j] < sortKeys[min])
                 min = j;

             // If we found one, swap the list elements.
             if (min != i)
             {
               swap(list.options[i], list.options[min]);

               var tmp = sortKeys[i];
               sortKeys[min] = sortKeys[i];
               sortKeys[i] = tmp;
             }
           }
         }


function toggleMoveButtons(prefix, checked)
         {
           if ( document.getElementById )
           {
             document.getElementById(prefix + "movetop").style.display = checked ? "none" : "";
             document.getElementById(prefix + "moveup").style.display = checked ? "none" : "";
             document.getElementById(prefix + "movedown").style.display = checked ? "none" : "";
             document.getElementById(prefix + "movebottom").style.display = checked ? "none" : "";
           }
         }