function addfav()
   {
   if (document.all)
      {
      window.external.AddFavorite
      ("http://esw-eCommerce.co.uk","#1 UK Web Design & Development 0845 634 3864")
      }
   }
   
function HashMap() {
    this.i = 0;
    this.names = new Array();
    this.values = new Array();

    this.set = _hashmap_set;
    this.get = _hashmap_get;
}

function _hashmap_set(name, value) {
    // Reset existing first
    for(var j=0;j<this.i;j++) {
        if(this.names[j] == name) {
            this.values[j] = value;
            return;
        }
    }
    // Doesn't exist, so add new entry
    this.names[this.i] = name;
    this.values[this.i] = value;
    this.i++;
}

function _hashmap_get(name) {
    for(var j=0;j<this.i;j++) {
        if(this.names[j] == name) {
            return this.values[j];
        }
    }
    return null;
}
// --------------------------------------------------------

function ImageHandler() {
    // Attributes
    this.map = new HashMap();
    this.agt = navigator.userAgent.toLowerCase();
    this.is_ie5 = (this.agt.indexOf("msie 5.0")!=-1);
    this.is_ie5_5 = (this.agt.indexOf("msie 5.5") !=-1);
    this.is_ie6 = (this.agt.indexOf("msie 6.")!=-1);
    this.fade_time = 0.7;

    this.preload = _imagehandler_preload;
    this.load = _imagehandler_load;
    this.swap = _imagehandler_swap;
    this.fade = _imagehandler_fade;
    this.setFade = _imagehandler_set_fade;
}

function _imagehandler_preload(name, src) {
    img = new Image();
    img.src = src;
    this.map.set(name, img);
}

function _imagehandler_load(target, to, src) {
    if(!this.map.get(to)) {
        this.preload(to, src);
    }
    this.swap(target, to);
}

function _imagehandler_swap(target, to) {
    if(document.images) {
        img = document.images[target];
        ref = this.map.get(to);
        if(img && ref) {
            img.src = ref.src;
        }
    }
}

function _imagehandler_fade(target, to) {
    if(document.images) {
        img = document.images[target];
        ref = this.map.get(to);
        if(img && ref) {
            if((this.is_ie5_5 || this.is_ie6) && img.style) {
                img.style.filter = "progid:DXImageTransform.Microsoft.Fade(overlap=1.00,duration="+this.fade_time+")";
                img.filters[0].apply();
                img.src = this.map.get(to).src;
                img.filters[0].play();
            }
            else {
                img.src = ref.src;
            }
        }
    }
}

function _imagehandler_set_fade(t) {
    this.fade_time = t;
}

function changeBg(id,style){
	var prefix1="bgIcon";
	var prefix2="bgMenuItem";
	id1 = prefix1+id;
	id2 = prefix2+id; 
	document.getElementById(id1).className = style;
	document.getElementById(id2).className = style;
	}
//-------------------------------------------

if(typeof ImgH == "undefined") {
    ImgH = new ImageHandler();
}

//left navigation bar
ImgH.preload("homeIN", "http://esw-ecommerce.co.uk/images/homeIN.gif");
ImgH.preload("homeOUT", "http://esw-ecommerce.co.uk/images/homeOUT.gif");
ImgH.preload("servicesIN", "http://esw-ecommerce.co.uk/images/esw_ecommerce_servicesON.gif");
ImgH.preload("servicesOUT", "http://esw-ecommerce.co.uk/images/esw_ecommerce_services.gif");
ImgH.preload("ecommerceIN", "http://esw-ecommerce.co.uk/images/esw_ecommerce_ecommerceON.gif");
ImgH.preload("ecommerceOUT", "http://esw-ecommerce.co.uk/images/esw_ecommerce_ecommerce.gif");
ImgH.preload("webdesignIN", "http://esw-ecommerce.co.uk/images/esw_ecommerce_webdesignON.gif");
ImgH.preload("webdesignOUT", "http://esw-ecommerce.co.uk/images/esw_ecommerce_webdesign.gif");
ImgH.preload("databaseIN", "http://esw-ecommerce.co.uk/images/esw_ecommerce_databaseON.gif");
ImgH.preload("databaseOUT", "http://esw-ecommerce.co.uk/images/esw_ecommerce_database.gif");
ImgH.preload("detailsIN", "http://esw-ecommerce.co.uk/images/esw_ecommerce_detailsON.gif");
ImgH.preload("detailsOUT", "http://esw-ecommerce.co.uk/images/esw_ecommerce_details.gif");
ImgH.preload("homeIN", "http://esw-ecommerce.co.uk/images/esw_ecommerce_homeON.gif");
ImgH.preload("homeOUT", "http://esw-ecommerce.co.uk/images/esw_ecommerce_home.gif");


function MM_reloadPage(init) { 
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
	
function lshow(layerid)
{
	if (document.getElementById(layerid).style.visibility == 'hidden')
	{
		document.getElementById(layerid).style.visibility = 'visible';
	}
}
function lhide(layerid)
{
	if (document.getElementById(layerid).style.visibility == 'visible')
	{
		setTimeout("hidenow('"+layerid+"')",500);
	}
}

function hidenow(layerid)
{	
	if (document.getElementById(layerid).style.visibility == 'visible')
	{
		document.getElementById(layerid).style.visibility = 'hidden';
	}
}

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


