// 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 = "/admissionsServices/"; break;

	case "admissions":
	newurl = "/admissionsServices/"; break;
	
	case "admissionsforms":
	newurl = "/admissionsServices/admissions/forms.php"; break;
	
	case "advise": 
	newurl = "http://saas.byu.edu/Scripts/allegianceRefer.php?companyID=128333"; break;
	
	case "advisement":
	newurl = "/advisement/"; break;
	
	case "apib":
	newurl = "/admissionsServices/admissions/AP_IBCredit.php"; break;
	
	case "applyforscholarships":
	newurl = "/depts/scholarships/applysch.aspx"; 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/2009-2010ucat/"; break;
	
	case "faculty":
		newurl = "/ecatalog/2008-2009ucat - January 2008/facultyNamesTest.php"; break;
	
	case "feedback":
	newurl = "http://saas.byu.edu/Scripts/allegianceRefer.php"; break;
	
	case "financialaid":
	newurl = "/financialAid/"; break;
	
	case "financialpath":
	newurl = "https://saas.byu.edu/depts/finaid/applications/financialpath/app/finpath/"; break;
	
	case "graduation":
	newurl = "/registrar/graduation/"; 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 = "/advisement/newstudent/"; break;
	
	case "onestop":
	newurl = "/ebrochure/One_Stop_Student_Services/"; 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 = "/admissionsServices/schoolRelations/index.htm"; break;
	
	case "preparing":
	newurl = "/admissionsServices/schoolRelations/index.htm"; break;
	
	case "records":
	newurl = "/registrar/records/"; 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 = "/admissionsServices/transferEvaluation/"; break;
	
	case "transferevaluation":
	newurl = "/admissionsServices/transferEvaluation/"; break;
	
	case "tuition":
	newurl = "http://home.byu.edu/webapp/finserve/content/page/Tuition.html"; break;
	
	case "veterans":
	newurl = "/ebrochure/Financial_Aid_and_Scholarships/Veterans.php"; break;

	case "visitingstudent":
	newurl = "/admissionsServices/admissions/visiting.php"; break;       
	
	
//case "name":
//newurl = "/path"; break;

}//end switch
	

}//end if 3




return newurl; 
}//end function redirect()