// JavaScript Document

function redirect(url){
 //var url = document.URL.toLowerCase();
 //remove "http://" from the url if it is there
	url = url.replace("http://", "");
	   
	var urlpieces = url.split(".");
	var urlpiecesnum = urlpieces.length;
	var folder = url.split("/");
	//logic for 4 split urls
	if (urlpiecesnum ==4){
		var newurl = new String();
		
		document.writeln(urlpieces[0]);
		
		switch(urlpieces[0]){
			case "gs":
			newurl = "http://saas.byu.edu/Scripts/allegianceRefer.php?companyId=413713"; break;
		}//end switch
	}//end 4



	//logic for 3 split urls
	if (urlpiecesnum ==3){
		var newurl = new String();

		document.writeln(urlpieces[0]);

		switch(urlpieces[0])
		{
			case "academicscheduling":
			newurl = "/registrar/acadsched/"; break;
		
			case "admission":
			newurl = "/tools/b4byu/sites/b4/"; break;
		
			case "admissions":
			newurl = "/tools/b4byu/sites/b4/"; break;
			
			case "admissionsforms":
			newurl = "/tools/b4byu/sites/b4/?new-freshman/admissions-forms/"; break;
			
			case "advise": 
			newurl = "/Scripts/allegianceRefer.php?companyID=128333"; break;
			
			case "advisement":
			newurl = "/advisement/"; break;
			
			case "apib":
			newurl = "/tools/b4byu/sites/b4/?new-freshman/apib-guides/"; break;
			
			case "applyforscholarships":
			newurl = "/depts/scholarships/applysch.aspx"; break;
			
			case "beginningofsemester":
			newurl = "/onestop/index.php?load=checklists/beginning_semester.php&type=checklist&loadcolor=purple&tab=checklists"; break;
			
			case "byusurvey":
			newurl = "/surveys/";break;
			
			case "catalog":
			newurl = "/catalog/"; break;
			
			case "chat":
			newurl = "/tools/chat/secure/chatrefer.php";break;
			
			case "classschedule":
			newurl = "/classSchedule/"; break;
			
			case "core":
			newurl = "/classSchedule/policy/fall/univcore.php";break;
			
			case "discontinuance":
			newurl = "/registrar/discontinuance/instructions.php"; break;
			 
			case "ecatalog":
				newurl = "/catalog/2010-2011ucat/"; break;
			
			case "faculty":
				newurl = "/ecatalog/2008-2009ucat - January 2008/facultyNamesTest.php"; break;
			
			case "feedback":
			newurl = "http://saas.byu.edu/Scripts/allegianceRefer.php"; break;
			
			case "ferpa":
			newurl = "/registrar/records/ferpa.php"; break;
			
			case "financialaid":
			newurl = "/financialAid/"; break;
			
			case "financialpath":
			newurl = "/depts/finaid/applications/financialpath/app/finpath/"; break;
			
			case "grades":
			newurl = "/registrar/records/gradesubmission.php"; break;
			
			case "graduation":
			newurl = "/registrar/graduation/"; break;
		
			case "intern":
			newurl ="/intern/";break;
			
			
			case "majors":
			newurl =  "/catalog/2010-2011ucat/Advisement/MajorList.php"; break;
		
			case "matrix":
			newurl =  "http://saas.byu.edu/ebrochure/BYU_Financial_Aid_and_Scholarships_Guide/Step_2__Financial_Opportunities_and_Options/BYU_Undergraduate_Scholarships.php#freshman_scholarship_matrix"; break;
			
			case "mymap":
			newurl = "/mymap/"; break;
			
			case "newstudent":
			newurl = "/onestop/index.php?load=checklists/new_students.php&type=checklist&loadcolor=purple/"; break;
			
			case "onestop":
			newurl = "/onestop/"; break;
			
			case "payments":
			newurl = "http://home.byu.edu/webapp/finserve/content/page/Tuition.html"; break;
			
			case "pc":
			newurl = "http://saas.byu.edu/registrar/registration/permissioncodes.php"; break;
			
			case "pcfaculty":
			newurl = "http://saas.byu.edu/registrar/registration/facultypermissioncodes.php"; break;
			
			case "petitions":
			newurl = "/registrar/petitions/"; break;
			 
			case "prepare":
			newurl = "/tools/b4byu/sites/b4/"; break;
			
			case "preparing":
			newurl = "/tools/b4byu/sites/b4/"; break;
			
			case "records":
			newurl = "/registrar/records/"; break;
			  
			 case "regdashboard":
			newurl = "https://saas.byu.edu/registrar/dashboard/main.php"; break; 
			  
			case "registrar":
			newurl = "/registrar/index.php"; break;
			
			case "registration":
			newurl = "/registrar/registration/"; break;
			
			case "religioustransfer":
			newurl = "/classSchedule/policy/fall/intro.php#rel_trans";break;
			
		
			case "saas-assessment":
			newurl = "/Assessment/"; break;
			
			case "scholarships":
			newurl = "/financialAid/"; break;
			
			case "scholarshipforms":
			newurl = "/financialAid/scholarships/Forms.php"; break;
			
			case "springsummer":
			newurl = "/springsummer/"; break;
			
			case "transcripts":
			newurl = "/registrar/records/transcripts.php"; break;
			
			case "transfer":
			newurl = "/registrar/transferEvaluation/"; break;
			
			case "transferevaluation":
			newurl = "/admissionsServices/transferEvaluation/"; break;
			
			case "tuition":
			newurl = "http://finserve.byu.edu/content/tuition-and-general-fees"; break;
			
			case "veterans":
			newurl = "/ebrochure/Financial_Aid_and_Scholarships/Veterans.php"; break;
		
			case "visit":
			newurl = "/tools/b4byu/sites/b4/?anyone/campus-visits-tours/"; break;      
		
			case "visitingstudent":
			newurl = "/tools/b4byu/sites/b4/?new-freshman/visiting-student-program/"; break;       
			
			
		//case "name":
		//newurl = "/path"; break;
		
		}//end switch
			
		
	}//end if 3
	return newurl; 
}//end function redirect()
