var popUp; 
function doOpen(x)
{
newWin = window.open(x,"small","width=800,height=600,toolbar=no,scrollbars=yes,resizable=no");
}
/*
function OpenCalendar(idname, postBack)
{
	
	idname = 'RadDesigner1:_ctl2' + idname;
	popUp = window.open('CalendarPop.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=208,left=200,top=250');
}
*/
function OpenCalendar2(idname, postBack)
{
	popUp = window.open('CalendarPop.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=220,left=350,top=200');
}

function OpenCalendar3(idname, postBack)
{
	popUp = window.open('../CalendarPop.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=208,left=200,top=250');
}

function OpenCalendar1(idname, postBack)
{
	
	//idname = 'RadDesigner1:_ctl2' + idname;
	var date = document.forms[0].elements[idname].value
	
	//alert(document.forms[0].elements[idname].name)
	//popUp = window.open('/CalendarPop.aspx?formname=' + document.forms[0].name + 
	//	'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
	//	'popupcal', 
	//	'width=165,height=208,left=200,top=250');
	
	popUp = window.open('../CalendarPop.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=208,left=200,top=250');
}

function Test()
{
	//popUp = window.open('CalendarPop.aspx','width=165,height=208,left=200,top=250');
	//window.open('/CalendarPop.aspx');
	alert('test');
	//alert(document.forms[0].name);
	alert('12' + document.Stanford[12].name);
	alert('13' + document.Stanford[13].name);
	alert('14' + document.Stanford[14].name);
	alert('15' + document.Stanford[15].name);
	alert('16' + document.Stanford[16].name);
	alert('17' + document.Stanford[17].name);
	alert('18' + document.Stanford[18].name);
	alert('19' + document.Stanford[19].name);
	alert('20' + document.Stanford[20].name);
	
	alert(document.Form2[12].value);
	//alert(document.Form2.value)
}
function OpenCalendar(ElementNumber, postBack)
{
	//ElementNumber = the index of element within the form being passed in
	//We have to pass in the element # b/c the RadDesigner appends a funky name to our elements
	
	popUp = window.open('../CalendarPop.aspx?formname=' + document.forms[0].name + 
		'&id=' + ElementNumber + '&selected=' + document.forms[0].elements[ElementNumber].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=208,left=200,top=250');
}
function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}	

function WarnUser(SchoolName, timeout,logouturl)
{
	dStarted = new Date();
	window.focus();
	if ( confirm("There has been no activity on the " + SchoolName + " site for " + timeout + " minutes.\nClick 'OK' to continue your session,or click 'Cancel' to log out.\nFor your security if you are unable to respond to this message\nwithin 2 minutes you will be logged out automatically.")) 
	{ 
		//post the page to itself 
		dNow  = new Date();
		dWatch = dNow.getTime() - dStarted.getTime();
		if (dWatch > 120000) //if longer than 2 minutes, logout
		{
			if (logouturl == "")
				document.location.href = "default.aspx?logout=true"
			else
			{
				
				document.location.href = "default.aspx?logout=true&logouturl=" + logouturl
			}
		}
		else
			__doPostBack('','');
			//document.location.href = document.location.href; 
	} 
	else 
	{ 
	
		if (logouturl == "")
			document.location.href = "default.aspx?logout=true"
		else
		{
			
			document.location.href = "default.aspx?logout=true&logouturl=" + logouturl
		}
	} 
}

function CenterWindow() 
{ 
	var NS=document.all;
	if(!NS){self.moveTo((self.screen.width - self.outerWidth) / 2, (self.screen.height - self.outerHeight) / 2);}
	else{self.moveTo((self.screen.width-document.body.clientWidth) / 2, (self.screen.height-document.body.clientHeight) / 2);}
	self.focus(); 
}

function Refocus()
{
	this.focus();
}

function InsertImage(idname, folder) {

	var galleryscript = 'SelectImage.aspx?rif='+folder+'&cif='+folder;
	//if (FTB_HelperFilesParameters != '') galleryscript += '&' + FTB_HelperFilesParameters;
	imgArr = window.showModalDialog(galleryscript,window,'dialogWidth:560px; dialogHeight:500px;help:0;status:0;resizeable:1;');

	if (imgArr != null) {
		imagestring = imgArr['filename'];
		//sel = editor.document.selection.createRange();
		//sel.pasteHTML(imagestring);
		document.forms[0].elements[idname].value = imagestring
	} else {
		//alert("You did not select an image");
	}
}

function InsertImage1(idname, folder) {

	var galleryscript = '../../PCIControls/SelectImage.aspx?rif='+folder+'&cif='+folder;
	//if (FTB_HelperFilesParameters != '') galleryscript += '&' + FTB_HelperFilesParameters;
	imgArr = window.showModalDialog(galleryscript,window,'dialogWidth:560px; dialogHeight:500px;help:0;status:0;resizeable:1;');

	if (imgArr != null) {
		imagestring = imgArr['filename'];
		//sel = editor.document.selection.createRange();
		//sel.pasteHTML(imagestring);
		document.forms[0].elements[idname].value = imagestring;
	} else {
		//alert("You did not select an image");
	}
}

function InsertImage2(idname, folder) {
	var galleryscript = '../../PCIControls/SelectImage.aspx?rif='+folder+'&cif='+folder;
	imgArr = window.showModalDialog(galleryscript,window,'dialogWidth:560px; dialogHeight:500px;help:0;status:0;resizeable:1;');
	if (imgArr != null) {
		imagestring = imgArr['filename'];
		imagestring = imagestring.substr(imagestring.lastIndexOf("/")+1)
		
		document.forms[0].elements[idname].value = imagestring;
	} else {
		//alert("You did not select an image");
	}
}
/*
var upLevel = false;
var ns4 = false;
var ie4 = false;
 
if(document.getElementById) { // IE 5 and up, NS 6 and up
	upLevel = true;
}
else if(document.layers) { // Netscape 4
	ns4 = true;
}
else if(document.all) { // IE 4
	ie4 = true;
}

function showObject(obj) 
{
	if (ns4) {
		obj.visibility = "show";
		}
	else if (ie4 || upLevel) {
		obj.style.visibility = "visible";
		}
}

function hideObject(obj) {
	if (ns4) {
		obj.visibility = "hide";
	}
	if (ie4 || upLevel) {
		obj.style.visibility = "hidden";
	}
}
*/


