function NewWindow(mypage,myname,w,h,scroll,pos,type,pos){

	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';

	var win=null;
	win=window.open(mypage,myname,settings);
	
	var Root = find_position(pos);
	
	
	if(type==1){
	win.document.write("<HTML><BODY><CENTER><TABLE CELLPADDING=0 CELLSPACING=0><TR><TD COLSPAN=3><IMG SRC=\""+Root+myname+".gif\"></td></tr></table></center></body></html>");
	}
	else
	{
	win.document.write("<HTML><BODY><CENTER><TABLE CELLPADDING=0 CELLSPACING=0><TR><TD COLSPAN=3><IMG SRC=\""+Root+myname+".jpg\"></td></tr></table></center></body></html>");
	}
}



function PopUp(url,w,h) {
window.open(url,"width=' + w + ',height=' + h + 'toolbar=0,location=1,directories=0,status=0,menubar=0,scrollbars=1,resizable=no,top=0,left=0")
}

function find_position(pos){

switch(pos){	
	case 1:
	{
	var Root="images/gallery/admin/";
	return Root;
	}
	break;
	case 2:
	{
	var Root="images/gallery/staff/";
	return Root;
	}
	break;
	case 3:
	{
	var Root="images/gallery/spods/";
	return Root;
	}
	break;
	case 4:
	{
	var Root="images/gallery/users/";
	return Root;
	}
	break;
	default :
	break;
	}
}

function Show_pic(pic,n,pos){

	var Root = find_position(pos);
	
	if(n==1){
	document.write("<IMG SRC=\""+Root+pic+".gif\" WIDTH=130 HEIGHT=113 style=\"filter: alpha(opacity=40)\" onMouseover=\"makevisible(this,0)\" onMouseout=\"makevisible(this,1)\" border=\"1\">");
	}
	else
	{
	document.write("<IMG SRC=\""+Root+pic+".jpg\" WIDTH=130 HEIGHT=113 style=\"filter: alpha(opacity=40)\" onMouseover=\"makevisible(this,0)\" onMouseout=\"makevisible(this,1)\" border=\"1\">");
	}
}

function checksize(){
var winh = 0;
var winw = 0;


if (screen.width && screen.height)
	winw =screen.width;
	else if ((document.body) && (document.body.clientWidth))
		winw = document.body.clientWidth;
		
if (screen.height)
	winh = screen.height;
	else if ((document.body) && (document.body.clientHeight))
		winh = document.body.clientHeight;
		
		showit(winh,winw);

}
function showit(h,w)
{
		switch(w){	
	case 640:
	{
 newWindow=

window.open("index.html", "index", "width=640,height=470,top=0,left=0,right=0,bottom=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=no"); 

}
	       break;
	case 800:
	{
 newWindow=

window.open("index.html", "index", "width=800,height=590,top=0,left=0,right=0,bottom=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=no"); 

}
	       break;
	case 1024:
		{
		newWindow=
 window.open("index.html", "index", "width=1024,height=758,top=0,left=0,right=0,bottom=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=no"); 

}
	       break;
	case 1280:
	{
 newWindow=

window.open("index.html", "index", "width=1024,height=758,top=0,left=0,right=0,bottom=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=no"); 

}
	       break;
	case 1600:
	{
 newWindow=

window.open("index.html", "index", "width=1024,height=758,top=0,left=0,right=0,bottom=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=no"); 

}
	       break;	
  	default :
	break;
	}

}
function displayPopup(url,name,height,width,type) {
var popupHandle;
if(type==1){
var settings = "toolbar = 0, location = 0, scrollbars=1, height = " + height;
settings +=", width=" + width;
}
else if(type==2)
{
var settings = "toolbar = 0, location = 0, scrollbars=0, height = " + height;
settings +=", width=" + width;
}

var screenX, screenY, cursorX, cursorY, padAmt;
if(navigator.appName == "Microsoft Internet Explorer" || navigator.appName == "Netscape") {
screenY = (document.body.offsetHeight - height)/2;
screenX = (window.screen.availWidth - width)/2;
settings +=", left = " + screenX;
settings +=", top = " + screenY;
}
else 
{
screenY = (window.outerHeight - height)/2;
screenX = (window.outerWidth - width)/2;
screenY += -pageYoffset;
screenX += -pageXoffset;

}

closePopup(popupHandle);
popupHandle = open(url,name,settings);
}


function closePopup(Handle) {
if(Handle != null && !Handle.closed) Handle.close();
}

function makevisible(cur,which){

var moz = check_browser_type(navigator.userAgent);

if (which==0)
	if (moz==1){
	cur.style.opacity=100
	}
	else
	{
	cur.filters.alpha.opacity=100
	}	
else
	if (moz==1){	
	cur.style.opacity=0.50
	}
	else
	{
	cur.filters.alpha.opacity=40
	}
}

function check_browser_type(type){

//were only interested if its mozilla and not ie...will get around to the rest if we get any complaints *wink*

if(type.indexOf("Mozilla")!= -1 && type.indexOf("Firefox")!=-1)
{
var moz=1;
}

return moz;
}
