

function OpenWindow(url)
 {
    var args = OpenWindow.arguments;
    if(args.length > 1)
    {
        x = args[1];
        y = args[2];
    }
    else
    {
        x = 720;
        y = 540;
    }
	window.open(url,'','status=0,width='+x+',height='+y+',toolbar=yes,menubar=no,location=no,resizable=yes,scrollbars=1');
}

/*
//NOT THE CORRECCT WAY TO DEFINE OVERLOADED FUNCTIONS IN JS
function OpenWindow(url, x, y)
{
	window.open(url,'Util','status=1,width='+ x + ',height=' + y + ',scrolling=1,scrollbars=1,resizable=yes,toolbar=0');
}
*/

function RefreshCaller(url)
{
	if (opener.closed)
	{
		alert('The Main window was closed.  You will have to re-open this dialog to continue.');
	}
	else
	{
		opener.location = url
		self.close();
	}
}

function RefreshCaller(paramName, paramValue)
{
	// This strips out the old querystring and adds some new parameters to it.
	rawUrl = opener.location.toString();
	pageIndex = rawUrl.lastIndexOf(".aspx") + 5;
	url = rawUrl.replace(rawUrl.substring(pageIndex), "");
	
	if (opener.closed)
	{
		alert('The Main window was closed.  You will have to re-open this dialog to continue.');
	}
	else
	{
		opener.location = url + '?' + paramName + '=' + paramValue
		self.close();
	}
}

function RefreshCaller2(paramName1, paramValue1, paramName2, paramValue2)
{
	// This strips out the old querystring and adds some new parameters to it.
	rawUrl = opener.location.toString();
	pageIndex = rawUrl.lastIndexOf(".aspx") + 5;
	url = rawUrl.replace(rawUrl.substring(pageIndex), "");
	
	if (opener.closed)
	{
		alert('The Main window was closed.  You will have to re-open this dialog to continue.');
	}
	else
	{
		var querystring =  '?' + paramName1 + '=' + paramValue1 +  '&amp;' + paramName2 + '=' + paramValue2;
		opener.location = url + querystring;
		self.close();
	}
}

function ClearFormWithAlert()
{
	rawUrl = self.location.toString();
	pageIndex = rawUrl.lastIndexOf(".aspx") + 5;
	url = rawUrl.replace(rawUrl.substring(pageIndex), "");
	t = confirm("This will clear your current form, and any unsaved changes will be lost.\n\nIf you have saved your changes, click OK, otherwise click Cancel.")
	if (!t){
		return false;
	}		
	self.location = url
}

function PrintPage(){
   if(window.print)
   {
	 window.print();
	}
   else
   {
     if(agt.indexOf("mac") != -1)
		alert("To print this page press Command-P.");
     else 
		alert("To print this page press Control-P.");
   }
}

function Redirect(url)
{
	window.location = url;
}

function popNotes()
 {
	Page = "/KDS50a/content/learning/Notes.asp"
	window.open('/KDS50a/content/learning/Notes.asp','','status=0,width=510, height=400,scrolling=0,scrollbars=1,resizable=yes,toolbar=0');
 }

function rptPop(val)
{
 
	if( val == 1)
	{
		Page = "/KDS50a/content/reports/reportHome.asp"
		window.open(Page,'pop', 'status=0,width=720,height=540,toolbar=yes,menubar=no,location=no,resizable=yes,scrollbars=1')
	}
	if( val == 2)
	{
		Page = "/KDS50a/content/reports/reportManager.asp"
		window.open(Page,'pop', 'status=0,width=720,height=540,toolbar=yes,menubar=no,location=no,resizable=yes,scrollbars=1')
	}
	if( val == 3)
	{
		Page = "/KDS50a/content/eValuator/reports/evalReportsManager.asp"
		window.open(Page,'pop', 'status=0,width=720,height=540,toolbar=yes,menubar=no,location=no,resizable=yes,scrollbars=1')
	}
	if( val == 4)
	{
		Page = "/KDS50a/content/reports/accessReports.asp"
		window.open(Page,'pop', 'status=0,width=720,height=540,toolbar=yes,menubar=no,location=no,resizable=yes,scrollbars=1')
	}
	if( val == 5)
	{
		Page = "/KDS50a/content/eventsmanager/reports/reportManager.asp"
		window.open(Page,'pop', 'status=0,width=720,height=540,toolbar=yes,menubar=no,location=no,resizable=yes,scrollbars=1')
	}
   	return;
 }
