window.name = 'main';

function openWindow(windowSize,url){
		
	var win;
	
    if (windowSize=='small')  {
		var win=window.open(url,"smallWindow","width=300,height=250,scrollbars,resizable");
    } else if (windowSize=='crossword')  {
		var win=window.open(url,"crosswordWindow","width=650,height=680,scrollbars,toolbar=yes,menubar=yes,resizable");
    } else if (windowSize=='medium')  {
		var win=window.open(url,"mediumWindow","width=450,height=350,scrollbars,resizable");
    } else if (windowSize=='helpWin')  {
		var win=window.open(url,"helpWindow","width=600,height=400,scrollbars,resizable,toolbar=yes");
    } else if (windowSize=='large')  {
		var win=window.open(url,"largeWindow","width=750,height=500,scrollbars,resizable,toolbar=yes,menubar=yes");
	} else if (windowSize=='sports') {
		var win=window.open(url,"SportsScore","width=600,height=400,scrollbars,resizable");
	} else if (windowSize=='video') {
		var win=window.open(url,"VideoStreaming","status=no,toolbar=no,location=no,directories=no,menu=no,scrollbars=no,resizable=yes,width=212,height=285");
	} else if (windowSize=='listserv') {
		var win=window.open(url,"MailingListsNL","width=450,height=350,left=300,top=100,scrollbars=yes,resizable=no");
	} else if (windowSize=='chat') {
		var win=window.open(url,"Chat","width=750,height=500,scrollbars,resizable,toolbar=no,menubar=no");
	} else {
		var win=window.open(url,windowSize,"width=800,height=500,scrollbars,resizable,toolbar=yes,menubar=yes,status=yes,location=yes");
	}
	windowToTop(win);

}

function openChatOrMbMgr(tool) {
	if (tool == 'chat')
		var path = "/CC/CMA/Chat_Admin/CC_Chat_Administration/1,,,00.html";
	else
		var path = "/MessageBoards/Administration/1,,,00.html";
	
	var win = window.open(path, tool, "width=750,height=500,scrollbars,resizable,toolbar=no,menubar=no");
	windowToTop(win);
}

function openEmailWindow(mode) {
	var path = "/CC/CDA/CC_Home/CC_EMail/1,,,00.html?mode=" + mode
	var win = window.open(path, "Email", "width=750,height=600,scrollbars,resizable");
	windowToTop(win);
}

function openEcalWindow(tl) {
	var path = "/CC_Ecal_Authenticate_User/1,,,00.html?tl=" + tl
	var win = window.open(path, "Ecal", "width=750,height=500,scrollbars,resizable");
	windowToTop(win);
}
	
function openStreamWindow() {
	var	path = "http://www.activate.com/calculator/";
	var win = window.open(path, "Calculator", "width=500,height=400,scrollbars,resizable=no,toolbar=yes,menubar=yes");
	windowToTop(win);
}

function openStreamDownload(url) {
	var win = window.open(url, "Download", "width=750,height=400,scrollbars,resizable,toolbar=yes,menubar=yes");
	windowToTop(win);
}

function openFreeI() {
	var win = window.open("/CC/CDA/CC_Third_Party_Tools/CC_CrossBooks/CC_Crossbooks_Frame","freei","top=50,left=50,width=750,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no",false);
	windowToTop(win);
}

function openMakeLinkWindow() {
	var pathURL = "/CC/CDA/CC_Navigation/CC_Make_Default_Browser_Page/1,,,00.html?popup=http%3A%2F%2Fwww%2Efca%2Eorg%2FCC%2FJS%2FCC%5FOpen%5FWindow%2F0%2C%2C%2C00%2Ejs&partnerid=";
	var win = window.open(pathURL,"MakeLink","top=50,left=50,width=750,height=500,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no",false);
	windowToTop(win);
}

function openReportWindow(superflag,activity) {
	if (superflag)
		window.location = "?reportType=" + activity;
	else 
		window.location = "?reportType=" + activity;
}
	
function osDetection() {
	var win = window.open("/CC/CDA/CC_Third_Party_Tools/CC_CrossBooks/CC_Crossbooks_Frame/1,,,00.html",'CrossBooks','top=50,left=50,width=764,height=520,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no',false);

	windowToTop(win);
}

function clientDateText() {
	var now = new Date();
	var date = now.getDate();
	var datesuffix;
	var monthArr = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	
	if (date==1 || date==21 || date==31) datesuffix="st"
	  else if (date==2 || date==22) datesuffix="nd"
	  else if (date==3 || date==23) datesuffix="rd"
	  else datesuffix="th";
	
	return monthArr[now.getMonth()] + " " + date + datesuffix +"," + " " + now.getFullYear();
}

function clientDateAlt() {
	var now = new Date();
	var date = now.getDate();
	var datesuffix;
	var dayArr = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
	var monthArr = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	
	if (date==1 || date==21 || date==31) datesuffix="st"
	  else if (date==2 || date==22) datesuffix="nd"
	  else if (date==3 || date==23) datesuffix="rd"
	  else datesuffix="th";
	
	return dayArr[now.getDay()] + ", " + monthArr[now.getMonth()] + " " + date + datesuffix
}

function windowToTop(win)
{

	win.focus();
}

function openTutorial()
{
	var win = window.open('/christianity/tutorial/1,,,00.html', 
		'tutorialwin', 
		'top=50,left=50,width=550,height=400,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=no',false);

	windowToTop2(win);
}

function openShockwave()
{
	var win = window.open('http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash', 
		'shockwavewin', 
		'top=50,left=50,width=800,height=600,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no',false);
	windowToTop2(win);
}

function windowToTop2(win)
{

	win.focus();
}

