var PopW = 0;

function CI(type,who,what)
{

/*
type:
1 - user
2 - main
*/

 tt='u';
 path='/img/umenu/';

 if (type==2)
 {
  tt='m';
  path='/img/menu/';
 };
 mE=document.getElementById(tt+who); // menu Top


 img=GetName(type,who)
 if (what==1)
 {
  img=img+'-over';
 };

 mE.src=path+img+'.gif';

};

function GetName(type,who)
{

  name='';
  switch(who)
  {
    case 1:
    {
      name='acc';
      if (type==2){name='home';};
      break;
    }
    case 2:
    {
      name='wlist';
      if (type==2){name='artist';};
      break;
    }
    case 3:
    {
      name='cart';
      if (type==2){name='intro';};
      break;
    }
    case 4:
    {
      name='faq'
      break;
    }
    case 5:
    {
      name='shipping'
      break;
    }
    case 6:
    {
      name='contact'
      break;
    }
  };

  return name;
};

function pop(img, w, h)
{
  ww = w + 30;
  hh = h + 33;
  path='/img/'+img

  if (PopW) {PopClose();};
  PopW=window.open('/pop.html?'+path+'&'+w+"&"+h,'poppic','marginheight=0,marginweight=0,toolbar=no,width='+ww+',height='+hh+', left=100, top=100, resizable=no, scrollbars=no');
  PopW.focus();
};

function PopClose()
{
  PopW.close();
  PopW=0
};

var popupWindow = null;

function popup(url,width,height) {
    var top  = (screen.height - height) / 2;
    var left = (screen.width  - width)  / 2;
    popupWindow = window.open(url,'popupwindow','toolbar=no,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height+',top='+top+',left='+left+'');
    popupWindow.focus();
}

function CheckSearchString()
{
    f = document.forms['searchform'];
    searchstring = f.elements['searchstring'];

    if (searchstring.value == '') {
       alert('Please enter search string');
       searchstring.focus();
       return false;
    }

    return true;
}

function CheckEmailToSubscribe()
{
    f = document.forms['subscribeform'];
    email = f.elements['email'];

    if (email.value == '') {
       alert('Please enter Your email to subscribe');
       email.focus();
       return false;
    }

    var re = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    if (email.value.match(re) == null) {
       alert('Please enter valid email address.');
       email.focus();
       return false;
    }

    return true;
}

var popupWindow = null;

function popup(url,width,height,x,y) {
    var top, left;

    top  = (screen.height - height) / 2;
    if (x && (x > 0)) left = x;
                 else left = (screen.width  - width)  / 2;
    popupWindow = window.open(url,'popupwindow','toolbar=no,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height+',top='+top+',left='+left+'');
    popupWindow.focus();
}