function OpenNewSized(url, width, height) {  
  // alert(url);
  NWin = open (url, 'additional'+Math.floor(Math.random()*1000), 'menubar=0,location=0,status=0,toolbar=0,scrollbars=1,resizable=1,height='+height+',width='+width);
}

function switchDIV(id) {
  if ( (!document.getElementById(id).style.display) || (document.getElementById(id).style.display=="none") ) {
      document.getElementById(id).style.display="block";
  } else {
      document.getElementById(id).style.display="none";
  }
}

function GetCoordinates(elem) {
  ret = new Array();
  ret[0]=elem.offsetTop;
  ret[1]=elem.offsetLeft;
  ret[2]=1;
  cElem=elem.offsetParent;
  // alert(cElem.nodeName);

  while (cElem.nodeName!="BODY") {
     ret[0]+=cElem.offsetTop;
     ret[1]+=cElem.offsetLeft;
     ret[2]++;
     ret[3]=cElem.offsetParent;
     cElem=cElem.offsetParent;
     // alert(ret);
  }
  return ret;

}

function ShowDiv(name) {
   eval('coordinates=GetCoordinates(document.getElementById("' + name + '_A"));');
   // alert(coordinates);
   eval('document.getElementById("' + name + '_DIV").style.display="block";');
   eval('document.getElementById("' + name + '_DIV").style.left="168";');
   eval('document.getElementById("' + name + '_DIV").style.top=coordinates[0]-3;');
   // eval('alert(document.getElementById("' + name + '_DIV").style.top);');
}

function HideDiv(name) {
   eval('document.getElementById("' + name + '_DIV").style.display="none";');
}

function preloadImages() {
  var d=document; 
  if(d.images) { 
      if(!d.MMp) d.MMp=new Array();
      var i,j=d.MMp.length,a=preloadImages.arguments; 
      for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MMp[j]=new Image; d.MMp[j++].src=a[i];}
  }
}

function changeImage(ImageName, ImageNumber) {
  if (document.MMp){document.images[ImageName].src=document.MMp[ImageNumber].src;}
}

function show_pic(pname,  ptitle, w, h) {  
  var hh = h+1;
  var ww = w+1;
  NWin = open ('', 'Pic', 'menubar=0,location=0,status=0,toolbar=0,scrollbars=0,resizable=0,height='+hh+',width='+ww);
  NWin.document.open();
  NWin.document.write('<HTML><HEAD><TITLE>'+ptitle+'</TITLE></HEAD>');
  NWin.document.write('<STYLE type=text/css>BODY {margin: 0px 0px 0px 0px;}</STYLE>');
  NWin.document.write('<BODY bgColor=#FFFFFF><TABLE width=100% height=100% cellspacing=0 cellpadding=0 border=0><TR><TD height=100% width=100% align=center valign=center><IMG src="'+pname+'" alt="'+ptitle+'" align=center></TD></TR></TABLE></BODY></HTML>');
  NWin.document.close();
}

function OpenNew(url) {  
  NWin = open (url, 'additional', 'menubar=0,location=0,status=0,toolbar=0,scrollbars=1,resizable=1,height=500,width=600');
}

function changeURL(Url) {
  location.href=Url;         // +document.form.;
}


function dec2Hex(dec) {
    dec = parseInt(dec, 10);
    if (!isNaN(dec)) {
        hexChars = "0123456789ABCDEF";
        if (dec > 255) {
            return "Out of Range";
        }
        var i = dec % 16;
        var j = (dec - i) / 16;
        result = hexChars.charAt(j) + hexChars.charAt(i);
        return result;
    } else {
        return NaN;
    }
}

function trim(str) {
   nStr=str.replace(/\s/,'');
   return nStr;
}

function getHexColor(color) {
  if (color.substr(0,1)=='#') {
       return color.toUpperCase();
  }
  if (color.substr(0,3)=='rgb') {
       var nColor = color.substr(4,color.length-5);
       var aColor = nColor.split(',');
       var hColor='#'+dec2Hex(trim(aColor[0]))+dec2Hex(aColor[1])+dec2Hex(aColor[2]);
       return hColor; // '"'+aColor[0]+'"->"'+trim(aColor[0])+'"';
  }
  return (color.substr(0,3));
}


var blinkColor='#FF0000';
var blinkArray=new Array();
var blinkShortPause=500;
var blinkLongPause=2000;

function blinkIt(id) {
  setTimeout("blinkChangeColor('"+id+"')", blinkLongPause);
  // alert (getHexColor(document.getElementById('blink1').style.color));
}

function blinkChangeColor(id) {
  eval ("var e = document.getElementById('blink"+id+"')");
  // alert('color:"'+getHexColor(e.style.color)+'", ('+(!blinkArray[id])+') oldColor="'+blinkArray[id]+'"');
  if (!blinkArray[id]) {
      blinkArray[id]=getHexColor(e.style.color);
  }
  if (getHexColor(e.style.color)==blinkColor) {
      e.style.color=blinkArray[id];
      setTimeout("blinkChangeColor('"+id+"')", blinkLongPause);
  } else {
      e.style.color=blinkColor;
      setTimeout("blinkChangeColor('"+id+"')", blinkShortPause);
  }
}

function AllImagesPreload() {

preloadImages('/images/26.gif','/images/41.gif');
preloadImages('/images/30.gif','/images/42.gif');
preloadImages('/images/31.gif','/images/39.gif');
preloadImages('/images/32.gif','/images/40.gif');
preloadImages('/images/35.gif','/images/38.gif');
preloadImages('/images/36.gif','/images/37.gif');
preloadImages('/images/74.gif','/images/75.gif');
preloadImages('/images/76.gif','/images/77.gif');

preloadImages('/images/48.gif','/images/54.gif');
preloadImages('/images/49.gif','/images/55.gif');
preloadImages('/images/50.gif','/images/56.gif');
preloadImages('/images/51.gif','/images/57.gif');
preloadImages('/images/52.gif','/images/58.gif');
preloadImages('/images/53.gif','/images/59.gif');

preloadImages('/images/01.gif','/images/65.gif');
preloadImages('/images/02.gif','/images/66.gif');
preloadImages('/images/06.gif','/images/67.gif');

preloadImages('/images/directions-off.gif','/images/directions-on.gif');
preloadImages('/images/price-n.gif','/images/price-b.gif');
preloadImages('/images/sale-n.gif','/images/sale-b.gif');
preloadImages('/images/ft-off.gif','/images/ft-on.gif');
preloadImages('/images/mwh-off.gif','/images/mwh-on.gif');
preloadImages('/images/eh-off.gif','/images/eh-on.gif');
preloadImages('/images/vacancies-off.gif','/images/vacancies-on.gif');
preloadImages('/images/child-off.gif','/images/child-on.gif');
preloadImages('/images/infertility-off.gif','/images/infertility-on.gif');
preloadImages('/images/specialists-off.gif','/images/specialists-on.gif');
preloadImages('/images/faq-off.gif','/images/faq-on.gif');
preloadImages('/images/article-off.gif','/images/article-on.gif');
}

