var PopW
PopW=0

function CI(who,what)
{
  obj=document.getElementById(who)
  if (what)
  {
    obj.className='menuTdOver'
  }
  else
  {
    obj.className='menuTd'
  }
}


function CI2(who,what)
{
  who1='t'+who
  who2='b'+who
  obj1=document.getElementById(who1)
  obj2=document.getElementById(who2)
  if (what)
  {
    obj1.className='txtOver'
    obj2.className='txtOver'
  }
  else
  {
    obj1.className='txt'
    obj2.className='txt'
  }
}

function CP(N)
{
switch (N)
  {
  case 'home':
    page='/index.html';
  break;
  case 'company':
    page='/company.html';
  break;
  case 'props':
    page='/properties/';
  break;
  case 'contact':
    page='/contactus.html';
  break;
  };
  document.location.href=page;
};


// IMG Changer
function CV(who)
{
  whoX='i'+who;
  i0Obj=document.getElementById('i0');
  iXObj=document.getElementById(whoX);

  // Get IMG name from Setup Array
  i0v=Pvalues[0];
  iXv=Pvalues[who];
  
  // Change IMG
  str=PSpath+i0v+'.jpg';
  iXObj.style.backgroundImage='url('+str+')';
  str=Ppath+iXv+'.jpg';
  i0Obj.style.backgroundImage='url('+str+')';
  
  // Set IMG name in Setup Array
  Pvalues[0]=iXv;
  Pvalues[who]=i0v;
};

// Set IMGs onload
function PInit()
{
  L=Pvalues.length;
  if (L>1)
  {
    for(i=0;i<L;i++)
    {
      whoX='i'+i;
      iXObj=document.getElementById(whoX);
      p = PSpath;
      if (i==0) {p=Ppath};
      iXv=Pvalues[i];
      //iXObj.src=p+iXv+'.jpg';
      str = p+iXv+'.jpg'
      iXObj.style.backgroundImage='url('+str+')';
    }
  }
  else
  {
    whoX='i'+0;
    iXObj=document.getElementById(whoX);
    p=Ppath;
    str = p+1+'.jpg'
    iXObj.style.backgroundImage='url('+str+')';
  };
};

function Preload()
{
var preloadArray = new Array();
  L=Pvalues.length;
  if (L>1)
  {
    for(i=0;i<L;i++)
    {
      p = PSpath;
      if (i==0) {p=Ppath};
      iXv=Pvalues[i];
      str = p+iXv+'.jpg'
      preloadArray[i]=new Image;
      preloadArray[i].src=str;
    };
  }
  else
  {
    p=Ppath;
    iXv=1;
    str = p+iXv+'.jpg'
    preloadArray[0]=new Image;
    preloadArray[0].src=str;
  };

};

// Show PopUp of enlarged picture
function WpopUp()
{
  i0Obj=document.getElementById('i0');

  // Get IMG name from Setup Array
  L=Pvalues.length;
  if (L>1)
  {
    i0v=Pvalues[0];
  }
  else
  {
    i0v=1;
  }
  path=PLpath+i0v+'.jpg';

  //Get IMG size
  wh = GetSize(i0v);
  w = wh.split(",")[0]
  h = wh.split(",")[1]
  w = +w;
  h = +h;
  //w = 640;
  //h = 480;
  ww = w + 24;
  hh = h + 22;
  
  if (PopW) {PopClose();};
  PopW=window.open('/pop.html?'+path+'&'+w+"&"+h,'poppic','marginheight=0,marginweight=0,toolbar=no,width='+ww+',height='+hh+', left=50, top=50, resizable=no, scrollbars=no');
  PopW.focus();

};

function popUp(who,w,h)
{
  ww = w + 24;
  hh = h + 22;
  
  path=Mpath+'large/'+who+'.jpg';

  if (PopW) {PopClose();};
  PopW=window.open('/pop.html?'+path+'&'+w+"&"+h,'poppic','marginheight=0,marginweight=0,toolbar=no,width='+ww+',height='+hh+', left=50, top=50, resizable=no, scrollbars=no');
  PopW.focus();
};

function PopClose()
{
  PopW.close();
  PopW=0;
};