var DOM = document.getElementById;
  function clearBG()
    {
      this.style.backgroundImage = "none"
    }
  function restoreBG()
    {        
      if (this.value == '')
        {
          bgpath = "url(images/hp/" + this.id + ".gif)"
          this.style.backgroundImage = bgpath
        }
    }
  if (DOM)
    {
      
      var fields = ["username","password","demosubmit"]
      var tmp
      for(i=0; i< fields.length; i++)
        {
          tmp = document.getElementById(fields[i])
          tmp.onfocus = clearBG
          tmp.onblur = restoreBG
          if (tmp.value == '') tmp.style.backgroundImage = "url(images/hp/" + tmp.id + ".gif)"
        }      
    }
    
  var emailfield = document.demo.email;
  var defaultval = " Enter eMail Address"
  
  document.demo.onsubmit = submitdemoform
  
  function setEmail()
    {
      if (emailfield.value =="") 
       {
        emailfield.value = defaultval
       }
    }
  function clearEmail()
   {
    
    if(emailfield.value == defaultval)
      {          
        emailfield.value =''
      }
   }
  setEmail()
  emailfield.onfocus = clearEmail
  emailfield.onblur = setEmail;
  
  var imgnames =["login","demosubmit","searchsite"]
  var srcpath = "images/hp/"
  
  if (document.images)
    {
     //preload rollovers
     var linkElemName =""
     var thisLk
     
     for(var i=0;i<imgnames.length;i++)
       {
        var thisname=imgnames[i]
        var thisnameon=thisname + 'on'
        eval("var "+thisnameon+" = new Image()");
        
        eval(thisnameon+".src =\"" +srcpath + thisname + "_over.gif\"");
        var thisnameoff=thisname + 'off'
        eval("var "+thisnameoff+" = new Image()");
        eval(thisnameoff+".src =\"" +srcpath + thisname + ".gif\"");          
       }
     } 
  (navigator.userAgent)  
   if (DOM && navigator.userAgent.indexOf('Opera')==-1)//work around Opera messing up floats
    {
      for(i=0; i<imgnames.length; i++)
        {
          tmp = document.getElementById(imgnames[i]);
          tmp.onimagesrc = srcpath + imgnames[i] + "_over.gif"
          tmp.offimagesrc = srcpath + imgnames[i] + ".gif"
          tmp.onmouseover = function() {this.src = this.onimagesrc}
          tmp.onmouseout = function() {this.src = this.offimagesrc}
        }
    }
    
 
 //preload logo images
 var imageslots = 4 
 var imagesets  = 9 
 var initialDelay = 5000; //time before starting after page is loaded, in milliseconds.
 var interval = 1000; //interval between changes, in milliseconds
 var srcfile; //establishing.
 
 var currentSlot = 0;
 var currentSet = 1;
 
 var logoarray = new Array(imageslots);
 var j
 for (i=0; i<logoarray.length;i++)
  {
    logoarray[i] = new Array(imagesets)
    for(j=0; j< logoarray[i].length; j++)
      {
        logoarray[i][j] = new Image()
        srcfile = srcpath + "logo" + i + "_" + j + ".gif";
        logoarray[i][j].src = srcfile;        
      }
  }

 //function to change the logos
function changeLogo()
  {
    var imageToChange = document.images["logo" + currentSlot];
    //window.status = 'currentSlot = [' + currentSlot +'] currentSet = [' +currentSet +']';
    imageToChange.src = logoarray[currentSlot][currentSet].src;
    currentSlot++ //update slot counter
    if (currentSlot == imageslots) //if at limit, rollover to 0, increment set counter.
      {
        currentSlot = 0;
        currentSet++
        if (currentSet == imagesets)
          {
            currentSet = 0
          }
      }
  }
 window.defaultStatus = "pureCommerce: Maximizing Business Potential";

function gallery()
{
   window.location.href="/company/gallery.html";
}

function submitdemoform()
  {    
   if(!this) { alert("We\'re sorry.\nThere seems to have been a problem with the demo request form.\n\nPlease email contact@bx.com\n\nWe apologise for the inconvenience."); return false; }
    var emailval = this.email.value;
    var pattern=/(^[\-_\.a-zA-Z0-9]+)@((([0-9]{1,3}\.){3}([0-9]{1,3})((:[0-9])*))|(([a-zA-Z0-9\-]+)(\.[a-zA-Z]{2,})+(\.[a-zA-Z]{2})?((:[0-9])*)))/;
    if (emailval == "" || emailval == defaultval){
    	alert("Please supply an email address.");
       return false;
    }
    else if (emailval.search(pattern) == -1) {
    	alert("Please supply your REAL email address.");
       return false;
    }
    return true
  
    }
    
//function to popup a window.  Either pass it just the url, and take the default size, or 
//pass it the url, width, height, windowname, and scrolling/non scrolling (default is non)
function popWindow(url, width, height, windowName, scrollb) {
  // default width and height for window
  if (!width) { width  = 439; }
  if (!height) { height = 325; }
  if (!scrollb) {scrollb = "no"}
  // positioning of pop-up window
  { var leftpos = 0
    if (screen) {
    leftpos = screen.width-(width+230)}
    
    // default window name if not passed to function
    if (!windowName) { windowName = "bxPopup"; }
    var wref = window.open (url, windowName,"toolbar=no,width=" + width + ",height=" + height + ",directories=no,status=no,scrollbars=" +scrollb + ",resizable=yes,menubar=no,top=50,left="+leftpos);
    wref.focus();
  }
}

hilifeaturearry=new Array();
hilifeaturearry[0]="Affiliate Manager|/product/featureaffiliate.html|Scores of individuals and companies, commonly known as affiliates, are actively promoting other organization's products. You can benefit from this by making it easy for them to show off your products and provide them with reports of monies they have earned. With the pureCommerce Affiliate Manager, you can manage commissions, and reward the affiliates who channel the most business to your site.";
hilifeaturearry[1]="Advanced Merchandising|/product/featuremerchandising.html|Advanced merchandising allows you the ability to cross-sell, up-sell and promote your products in a non-conventional way, increasing your sales per customer. You have the ability to target multiple audiences, not only enticing them to make a purchase at the initial point of sale, but breeding customer loyalty by demonstrating that you understand their needs as you incent them to return.";
hilifeaturearry[2]="eMarketing|/product/featuremarketing.html|Ensure that the perception your visitors have is the perception you want them to have. eMarketing encompasses the entire user experience from the initiation of their primary search through to the post sale. Gain new and retain previous customers by displaying the professional and consistent image they expect.";
hilifeaturearry[3]="Optimized Results with Search Engines|/product/featuresearchengine.html|The primary reason for pureCommerce's success in optimizing search results, is that our eCommerce system was built from the ground up, focusing specifically on each operational nuance of the major search engine players.";
hilifeaturearry[4]="Business Intelligence|/product/featurebizintel.html|Business Intelligence is more then just reporting information about your web sites activity. It incorporates an understanding about customer behavior, affiliate and search engine performance and the major drivers to your web site. In combination, this information provides you with the critical decision-making information to ensure your online success.";

var hilifeaturenum=0;
function changeFeature(backwards)
{
   if(backwards) {hilifeaturenum--;}
   else{hilifeaturenum++;}
   if(hilifeaturenum>=hilifeaturearry.length) {hilifeaturenum=0;}
   if(hilifeaturenum<0) {hilifeaturenum=hilifeaturearry.length-1;}
   var hftitle=document.getElementById("hphilifeaturetitle");
   var hflink=document.getElementById("hphilifeaturelink");
   var hfcontent=document.getElementById("hphilifeaturecontent");
   var thisfeaturearry=hilifeaturearry[hilifeaturenum].split("|");
   if(thisfeaturearry.length != 3) { return; }
   var newtitle=document.createTextNode(thisfeaturearry[0]);
   var newlink=thisfeaturearry[1];
   var newcontent=document.createTextNode(thisfeaturearry[2]);
   
   hftitle.replaceChild(newtitle,hftitle.childNodes[0]);
   hflink.href=newlink;
   hfcontent.replaceChild(newcontent,hfcontent.childNodes[0]);
}


function runonload()
{
   setTimeout("setInterval('changeLogo()',interval)",initialDelay);
   setTimeout("setInterval('changeFeature()',30000)",1000);
}

//window.onload = function(){setTimeout("setInterval('changeLogo()',interval)",initialDelay)}
//window.onload += function(){setTimeout("setInterval('changeFeature()',5000)",5000)}
window.onload=function(){runonload()}
//alert(window.onload)
  

    
   