/****************************************************
     Author: Eric King
     Url: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos,res){
	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;
	}
	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=yes,menubar=no,toolbar=no,resizable='+res+'';
	if (win) win.close();
	win=window.open(mypage,myname,settings);
	win.focus();
}

var name1_open = false;
var name2_open = false;

// (window name, modal or Modeless, source, features)
function MS_win(n, m, s, features) {
	var w = window;
	if (!w[n + '_open']) {
		w[n + '_open'] = true;
		w[n] = w['show' + m + 'Dialog'](s, w, features)
	} else {
		w[n].focus()
	}
}

function newModalWindow(mypage, myparams, myfeatures) {
	var url = encodeURI(mypage);
	//alert(encodeURI(mypage));
	var vMS = window.showModalDialog(url, myparams, myfeatures+"status:no;");       
   	if (vMS == true) { 
    	//location.reload()
		location.href = location;
   	}
}