var mousex, mousey;

function getEl(el) {
 if(document.getElementById(el))
   return document.getElementById(el);
 else 
   return false;
}

function _getmousePos(e) {
 
   if (!e) e = window.event;

    if (e.pageX || e.pageY) {
     mousex = e.pageX;
     mousey = e.pageY;
    }
  else if (e.clientX || e.clientY) {
    mousex = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
    mousey = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
  }
}



function isValidEmail (email) {
	return (/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i).test(email);
}


function unsetId(id) {
  if(getEl(id)) {
    getEl(id).style.display = 'none';
    getEl(id).style.visibility = 'hidden';  
  }
}

function _unsetAll() {
  unsetId('imgageLayer');
}


function bigImage(img, w, h) {
w = parseInt(w);
h = parseInt(h);

x = (screen.width / 2) - 21 - (w / 2);
y = (document.body.scrollTop + screen.height / 2) - (h / 2);

window.status = y;

  _unsetAll();

 IMG = '<img src="' +img+ '" border="0"  hspace="8" vspace="11"/>';
 CLOSE = '<div id="close"><img src="/site/img/close1.gif" border="0" onClick = "unsetId(\'imgageLayer\')" /></div>';

 this.id = 'imgageLayer'; 
 if(!getEl(this.id)) {

   var div = document.createElement("DIV") ;
    div.id = this.id ;
    div.name = this.id ;
//    div.style.width = 18+w+'px' ;
//    div.style.height = 24+h+'px' ;
    div.style.width = 16+w+'px' ;
    div.style.height = 22+h+'px' ;
    div.style.position = 'absolute' ;
    div.style.left = 10 +x+ 'px';
    div.style.top = 10 +y+ 'px';
    div.style.padding = '0px 0px 0px 0px';
    div.style.border = '2px solid #7e7e28';
    div.style.textAlign = 'center';
    div.style.backgroundColor = '#ffffff';
    div.style.zIndex = 100000;
    document.body.insertBefore(div, document.body.lastChild);   
    div.innerHTML = CLOSE + IMG;
    div.style.visibility = 'visible'; 
   }
    
  else {
   el = getEl(this.id);
   el.style.left = 10+x+'px'; 
   el.style.top = 10+y+'px';
   el.innerHTML = CLOSE + IMG; 
   el.style.visibility = 'visible'; 
   el.style.display = 'block'; 
  }
 cll = w - 12;

 getEl('close').style.left = cll + 'px';
 getEl('close').style.top  = 5+'px';

}
