PositionX = 150;
PositionY = 250;
defaultWidth  = 500;
defaultHeight = 500;
var AutoClose = false;
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='status=no,scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='status=no,scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;

function view(imageURL){
	imageTitle = '-=Image=-';
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document){
	writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
	writeln('<sc'+'ript>');
	writeln('var isNN,isIE;');
	writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
	writeln('isNN=(navigator.appName=="Netscape")?1:0;');
	writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
	writeln('function reSizeToImage(){');
	writeln('if (isIE){');
	writeln('window.resizeTo(150,150);');
	writeln('width=150-(document.body.clientWidth-document.images[0].width);');
	writeln('height=150-(document.body.clientHeight-document.images[0].height);');
	writeln('window.resizeTo(width,height);}');
	writeln('if (isNN){');       
	writeln('window.innerWidth=document.images["pRofile"].width;');
	writeln('window.innerHeight=document.images["pRofile"].height;}}');
	writeln('function doTitle(){document.title="'+imageTitle+'";}');
	writeln('</sc'+'ript>');
	if (!AutoClose) 
	writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
	else 
	writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
	writeln('<div id="Layer1" style="position:absolute; width:100%; height:100%; z-index:1">');
	writeln('<img name="pRofile" src='+imageURL+' style="display:block"></div>');
	writeln('<div id="Layer2" style="position:absolute; width:100%; height:100%; z-index:2">');
	writeln('<img src="images/px.gif" width="100%" height="100%"></div></body></html>');
	close();		
	}
} 
// -------------------------------------------------------- window open:end

newWindow = '';
function popupWindow(goLocation,wname,wdth,hght)
{
 var v=parseInt(navigator.appVersion);
 isNetscape=navigator.appName.indexOf('Netscape')>=0;
 isExplorer=navigator.appName.indexOf('Explorer')>=0;

 var ww = wdth;
 var wh = hght;

 positionCode='';
 if(v>=4)
 {
  if(isExplorer) positionCode='left='+(screen.width/2-ww/2)+',top='+(screen.height/2-wh/2);
  if(isNetscape) positionCode='screenX='+(screen.width/2-ww/2)+',screenY='+(screen.height/2-wh/2);
 }
 
 newWindow=window.open(goLocation,wname,
 'width='+ww+',height='+wh+','+
 positionCode+
 'titlebar=0,'+
 'menubar=0,'+
 'location=0,'+
 'toolbar=0,'+
 'scrollbars=1,'+
 'status=0,'+
 'resizable=1');
  if(v>=3) newWindow.focus();
  return newWindow;
}
// --------------------------------------------------------
function SetCookie(sName, sValue)
{
  document.cookie = sName + "=" + escape(sValue); 
  document.location.reload();
}

function setFocus()
{
    if (document.imp_login.imapuser.value == "") {
        document.imp_login.imapuser.focus();
    } else {
        document.imp_login.pass.focus();
    }
}


function submit_login()
{
	if (document.implogin.server[document.implogin.server.selectedIndex].value.substr(0, 1) == "_") {
		return false;
	}

    if (document.imp_login.imapuser.value == "") {
        alert('Please provide your username.');
        document.imp_login.imapuser.focus();
        return false;
    } else if (document.imp_login.pass.value == "") {
        alert('Please provide your password.');
        document.imp_login.pass.focus();
        return false;
    } else {
        SetCookie("lang", document.imp_login.lang.value);
        SetCookie("id", document.imp_login.id.value);
        document.imp_login.submit();
        return true;
    }
}


function enter_key_trap(e)
{
var keyPressed;
if (document.layers) {
keyPressed = String.fromCharCode(e.which);
} else if (document.all) {
keyPressed = String.fromCharCode(window.event.keyCode);
} else if (document.getElementById) {
keyPressed = String.fromCharCode(e.keyCode);
}
if ((keyPressed == "\r" || keyPressed == "\n") && (submit_login())) {
document.implogin.submit();
}
}


function selectLang()
{

if (document.implogin.imapuser.value == '' &&
document.implogin.pass.value == '') {
var lang_page = 'login.php?new_lang=' + document.implogin.new_lang[document.implogin.new_lang.selectedIndex].value;
self.location = lang_page;
}
}

if (window.document.captureEvents != null) {
window.document.captureEvents(Event.KEYPRESS);
window.document.onkeypress = enter_key_trap;
}