


function NewWindowStnd(mypage,myname,pos)  {


	var screenW = screen.availWidth;
	var screenH = screen.availHeight;
	var windowW = screenW * .60;
	var windowH = screenH * .60;
	if	(pos=="center")  {
		LeftPosition=(screenW)?(screenW-windowW)/2:100;
		TopPosition=(screenH)?(screenH-windowH)/2:100;
	}	
	else if ((pos!="center" && pos!="random") || pos==null)  {
		LeftPosition=0;TopPosition=20
	}
	settings='width='+windowW+',height='+windowH+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=no,menubar=yes,toolbar=yes,resizable=yes'; 
	var win=window.open(mypage,myname,settings);
	win.focus();
}


function create_popup(myurl, myname, mywidth, myheight, myxpos, myypos, additional)
{
	var regex;
	var newwin;
	
	//Check if myheight is a %. If it is, then use the % of the screen.
	regex = new RegExp(/^\d+%$/);	
	if(regex.test(myheight))
	{
		regex = new RegExp(/%/g);
		myheight = myheight.replace(regex, "");
		myheight = Math.round(screen.availHeight * myheight / 100);
	}

	//Check if mywidth is a %. If it is, then use the % of the screen.
	regex = new RegExp(/^\d+%$/);	
	if(regex.test(mywidth))
	{
		regex = new RegExp(/%/g);
		mywidth = mywidth.replace(regex, "");
		mywidth = Math.round(screen.availWidth * mywidth / 100);
	}

	//Check if myxpos is a %. If it is, then use the % of the screen.
	regex = new RegExp(/^\d+%$/);	
	if(regex.test(myxpos))
	{
		regex = new RegExp(/%/g);
		myxpos = myxpos.replace(regex, "");
		myxpos = Math.round(screen.availWidth * myxpos / 100);
		myxpos -= Math.round(mywidth / 2);
	}

	//Check if myypos is a %. If it is, then use the % of the screen.
	regex = new RegExp(/^\d+%$/);	
	if(regex.test(myypos))
	{
		regex = new RegExp(/%/g);
		myypos = myypos.replace(regex, "");
		myypos = Math.round(screen.availHeight * myypos / 100);
		myypos -= Math.round(myheight / 2);
	}
	
	
	settings='width='+mywidth+',height='+myheight+',top='+myypos+',left='+myxpos+',scrollbars=1,location=0,directories=0,status=0,menubar=1,toolbar=0,resizable=1';
	if(additional)
	{
		settings += ","+additional;
	}
	
	//alert("Screen Width: "+screen.availWidth+"\n"+"Screen Height: "+screen.availHeight+"\n"+"mywidth: "+mywidth+"\n"+"myheight: "+myheight+"\n"+"myxpos: "+myxpos+"\n"+"myypos: "+myypos+"\n");
	//alert(settings);
	
	newwin = window.open(myurl, myname, settings);
	newwin.focus();
}
