var popup1Window=null;
var popup2Window=null;
var popup3Window=null;
var popup4Window=null;
var popup5Window=null;
var popup6Window=null;
var popup7Window=null;
var popup8Window=null;

//
// popup1
//
function popup1(mypage,myname,w,h,pos,infocus) {
	if (pos == 'random')
	{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	else
	{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';popup1Window=window.open('',myname,settings);
	if(infocus=='front'){popup1Window.focus();popup1Window.location=mypage;}
	if(infocus=='back'){popup1Window.blur();popup1Window.location=mypage;popup1Window.blur();}
}

//
// popup2
//
function popup2(mypage,myname,w,h,pos,infocus) {
	if (pos == 'random')
	{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	else
	{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';popup2Window=window.open('',myname,settings);
	if(infocus=='front'){popup2Window.focus();popup2Window.location=mypage;}
	if(infocus=='back'){popup2Window.blur();popup2Window.location=mypage;popup2Window.blur();}
}

//
// popup3
//
function popup3(mypage,myname,w,h,pos,infocus) {
	if (pos == 'random')
	{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	else
	{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';popup3Window=window.open('',myname,settings);
	if(infocus=='front'){popup3Window.focus();popup3Window.location=mypage;}
	if(infocus=='back'){popup3Window.blur();popup3Window.location=mypage;popup3Window.blur();}	
}

//
// popup4
//
function popup4(mypage,myname,w,h,pos,infocus) {
	if (pos == 'random')
	{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	else
	{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';popup4Window=window.open('',myname,settings);
	if(infocus=='front'){popup4Window.focus();popup4Window.location=mypage;}
	if(infocus=='back'){popup4Window.blur();popup4Window.location=mypage;popup4Window.blur();}
}

//
// popup5
//
function popup5(mypage,myname,w,h,pos,infocus) {
	if (pos == 'random')
	{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	else
	{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';popup5Window=window.open('',myname,settings);
	if(infocus=='front'){popup5Window.focus();popup5Window.location=mypage;}
	if(infocus=='back'){popup5Window.blur();popup5Window.location=mypage;popup5Window.blur();}
}

//
// popup6
//
function popup6(mypage,myname,w,h,pos,infocus) {
	if (pos == 'random')
	{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	else
	{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';popup6Window=window.open('',myname,settings);
	if(infocus=='front'){popup6Window.focus();popup6Window.location=mypage;}
	if(infocus=='back'){popup6Window.blur();popup6Window.location=mypage;popup6Window.blur();}
}

//
// popup7
//
function popup7(mypage,myname,w,h,pos,infocus) {
	if (pos == 'random')
	{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	else
	{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';popup7Window=window.open('',myname,settings);
	if(infocus=='front'){popup7Window.focus();popup7Window.location=mypage;}
	if(infocus=='back'){popup7Window.blur();popup7Window.location=mypage;popup7Window.blur();}
}

//
// popup8
//
function popup8(mypage,myname,w,h,pos,infocus) {
	if (pos == 'random')
	{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	else
	{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';popup8Window=window.open('',myname,settings);
	if(infocus=='front'){popup8Window.focus();popup8Window.location=mypage;}
	if(infocus=='back'){popup8Window.blur();popup8Window.location=mypage;popup7Window.blur();}
}