///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var fileStr = "";
var filename = "";
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function saveXMLFile(fName,fileContent)
{
	filename = fName;	
	
	var fso, d, s, t, text;
	var loc_path=unescape(document.location)+"";
	var Filestr=loc_path.substring(8,loc_path.lastIndexOf("/"));
	fileInfo=Filestr.split("/");

	var filepath2="";
	drvpath=fileInfo[0]+":";
	var drvpath=fileInfo[0];

	for(i=0;i<fileInfo.length;i++)
	{

		filepath2=filepath2+fileInfo[i]+"\\";
	
	}
	filepath2=filepath2+filename;
	
	fso = new ActiveXObject("Scripting.FileSystemObject")
	if (fso.DriveExists(drvpath))
	{
		d = fso.GetDrive(drvpath)
		if (d.IsReady)
		{
	
			var ForReading = 1, ForWriting = 2;
			s += "<br>" + "Drive is Ready.";
			var a = fso.CreateTextFile(filepath2, true,true);
			a.WriteLine(fileContent);
			a.Close();
		}
	   else
		{
			
			if (confirm("Drive is not ready. Do you want to continue?"))
			{
				setTimeout("writeFile('"+drvpath+"')",500);
			}
		}
	 }
	else
	{
	   alert("Drive does not exist");
	}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Added on Oct 31,2006
// Split URlref
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function GetGradeSelected()
{
	//alert("GetGradeSelected");
   var URLREF = unescape(window.location.href);
   //alert(URLREF);

   var qsReg = new RegExp("[?][^#]*","i","[&]");
	hRef = unescape( window.location.href);
	var qsMatch = hRef.match(qsReg);  
	//removes the question mark from the url 
	qsMatch = new String(qsMatch);
	qsMatch = qsMatch.substr(1, qsMatch.length -1);        
	this.rawString = qsMatch;   
	var myArray = new Array();
	myArray = qsMatch.split("&");
	qsMatch = myArray[0];// + "^" + myArray[1];
	
	return qsMatch;
}

