//\//////////////////////////////////////////////////////////////////////////////////
//\  edfundorg.js 
//\  $Id: edfundorg.js,v 1.5 2008/11/10 23:08:49 dgillila Exp $
//\//////////////////////////////////////////////////////////////////////////////////

// detect browser
function BrowserDetect(){
	var b=navigator.appName
	if (b=="Netscape") this.b="ns"
	else if (b=="Microsoft Internet Explorer") this.b="ie"
	else this.b=b
	this.version=navigator.appVersion
	this.v=parseInt(this.version)
	this.ns=(this.b=="ns" && this.v>=4)
	this.ns4=(this.b=="ns" && this.v==4)
	this.ns5=(this.b=="ns" && this.v==5)
	this.ie=(this.b=="ie" && this.v>=4)
	this.ie4=(this.version.indexOf('MSIE 4')>0)
	this.ie5=(this.version.indexOf('MSIE 5')>0)
	this.ie55=(this.version.indexOf('MSIE 5.5')>0)
	this.dom=((document.createRange&&(document.createRange().createContextualFragment))?true:false)
	this.min=(this.ns||this.ie)
	var ua=navigator.userAgent.toLowerCase()
	if (ua.indexOf("win")>-1) this.platform="win32"
	else if (ua.indexOf("mac")>-1) this.platform="mac"
	else this.platform = "other"
}
is = new BrowserDetect();

// 
function loadPage(sName, pageURL) {
		sectionName = sName;
		if ( sectionName.toLowerCase() == 'students' ) 
			document.location.href = "/students/studentpar.cfm?edfPage=" + pageURL;
		if ( sectionName.toLowerCase() == 'schools' ) 
			document.location.href = "/schools/schools.cfm?edfPage=" + pageURL;
		if ( sectionName.toLowerCase() == 'lenders' ) 
			document.location.href = "/lenders/lenders.cfm?edfPage=" + pageURL;
		if ( sectionName.toLowerCase() == 'edfund' ) 
			document.location.href = "/edfund/edcentral.cfm?edfPage=" + pageURL;
	}

function loadMenu(sName) {
		sectionName = sName;
		if ( sectionName.toLowerCase() == 'students' ) 
			document.location.href = "/students/studentmenu.html";
		if ( sectionName.toLowerCase() == 'schools' ) 
			document.location.href = "/schools/schoolsmenu.html";
		if ( sectionName.toLowerCase() == 'lenders' ) 
			document.location.href = "/lenders/lendersmenu.html";
		if ( sectionName.toLowerCase() == 'edfund' ) 
			document.location.href = "/edfund/edfundmenu.html";
	}
  
  
  
//
function checkURL(sName, url) {
	
	if (typeof currentSection == 'undefined')
		sectionName = sName;
	else
		sectionName = currentSection;
	
	if (typeof edfPage == 'undefined') {
		tmp = url.toString();
		pos = tmp.indexOf( "/", 8 );
		
		// 
		if ( pos > -1 ) {
			pageURL = tmp.substring( pos , tmp.length );
			loadPage( sName, pageURL );
		}
	}
	return true;
}

//
function getSectionName(sName) {
	if (typeof currentSection == 'undefined')
		return sName;
	else
		return currentSection;
}

//
function getSectionCFM( sName ) {
	var retValue = "";
	sectionName = sName;
	switch ( sectionName.toLowerCase() ) {
		case "students":
			retValue = "studentpar.cfm";
			break;
		case "schools":
			retValue = "schools.cfm";
			break;
		case "lenders":
			retValue = "lenders.cfm";
			break;
		case "edfund":
			retValue = "edcentral.cfm";
			break;
		default:
			retValue = "schools.cfm";
	}
	return retValue;
}

// secure & secure-auth port information
function getSecureAuthPort( port, lParam ) {
	var retValue = 0;
	if ( lParam == null )
		var Param = 0;	// this means we will return value for secure folder
	else
		var Param = 1;	// this means we will return value for secure-auth folder

	switch ( port ) {   
		case "80" :
			retValue = (Param) ? 444 : 443;
			break;    
		case "81" :
			retValue = (Param) ? 446 : 445;
			break;    
		case "82" :
			retValue = (Param) ? 448 : 447;
			break;    
		case "83" :
			retValue = (Param) ? 450 : 449;
			break;    
		case "84" :
			retValue = (Param) ? 452 : 451;
			break;    
		default :
			retValue = (Param) ? 444 : 443;
	} 
	
	return retValue;	
}

// non-secure port information
function getNonSecurePort( port) {
	var retValue = 0;
	switch ( port ) {   
		case "443": case "444":
			retValue = 80;
			break;    
		case "445": case "446":
			retValue = 81;
			break;    
		case "447": case "448":
			retValue = 82;
			break;    
		case "449": case "450":
			retValue = 83;
			break;    
		case "451": case "452":
			retValue = 84;
			break;    
		default:
			retValue = 80;
	} 
	
	return retValue;	
}

var LiveConnectOn = 0;
var hasJava = 0;        
var hasIFC = 0;        
var str = '';
self.name="ns_search_results";

function setLiveConnectOn(){
        // see whether LiveConnect is there
        if (navigator.appName == "Netscape" && 
           (parseInt(navigator.appVersion) == 3 ||  
            parseInt(navigator.appVersion) == 4) &&
            navigator.javaEnabled()){
                LiveConnectOn = 1;        
        }
} 
function setIFC(){
        if (navigator.appName == "Netscape" && 
            parseInt(navigator.appVersion) == 4 &&
            navigator.javaEnabled()){
                hasIFC = 1;
        }
} 
function setJava(){
        if ((navigator.appName == "Netscape" &&
	parseInt(navigator.appVersion) >= 4 ||
             navigator.appName == "Microsoft Internet Explorer") && 
             navigator.javaEnabled()){
                hasJava = 1;
        }
}
function GuidedSearchApplet(){
        str = '';
        makeGuidedSearchApplet();
        var myWin = open("", 'guidedSearchApplet','resizeable=0,width=440,height=310,toolbar=no,scrollbars=no');
        myWin.document.write(str);
        myWin.document.close();
}
function makeGuidedSearchApplet(){

        str='<html><head><title>GuidedSearch@www.edfund.org</title>\n';
        str+='<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"></head>\n';
        str+='<body background="/images/searchbk.jpg">';
		str+='<center>';
        if(hasIFC){
        	str+='<applet codebase="search-ui/applet" archive="SearchApplet.jar" code="NetscapeApplet"  width=390 height=265>';
        } else {
        	str+='<applet codebase="search-ui/applet" archive="SearchAppletIE.jar" code="NetscapeApplet"  width=390 height=265>';
        }
        str+='<param name="ApplicationClass" value="SearchInterface">';
        str+='<param name="search-applet-search-in" value="';
        str+='Search in:'; str+='">';
        str+='<param name="search-applet-search" value="';
        str+='Search'; str+='">';
        str+='<param name="search-applet-for" value="';
        str+='for:'; str+='">';
        str+='<param name="search-applet-advanced" value="';
        str+='Advanced'; str+='">';
        str+='<param name="search-applet-help" value="';
        str+='Help'; str+='">';
        str+='<param name="search-applet-add-line" value="';
        str+='Add Line'; str+='">';
        str+='<param name="search-applet-undo-line" value="';
        str+='Undo Line'; str+='">';
        str+='<param name="search-applet-clear" value="';
        str+='Clear'; str+='">';
        str+='<param name="search-applet-and-search-for" value="';
        str+='and search for ...'; str+='">';
        str+='<param name="search-applet-or-search-for" value="';
        str+='or search for ...'; str+='">';
        str+='<param name="search-applet-words" value="';
        str+='Words'; str+='">';
        str+='<param name="search-applet-words-in-proximity" value="';
        str+='Words in proximity'; str+='">';
        str+='<param name="search-applet-phrase" value="';
        str+='Phrase'; str+='">';
        str+='<param name="search-applet-literal" value="';
        str+='Literal'; str+='">';
        str+='<param name="search-applet-attribute" value="';
        str+='Attribute'; str+='">';
        str+='<param name="search-applet-any-pattern" value="';
        str+='Any Pattern'; str+='">';
        str+='<param name="search-applet-that" value="';
        str+='that'; str+='">';
        str+='<param name="search-applet-contains" value="';
        str+='Contains'; str+='">';
        str+='<param name="search-applet-starts" value="';
        str+='Starts'; str+='">';
        str+='<param name="search-applet-ends" value="';
        str+='Ends'; str+='">';
        str+='<param name="search-applet-matches" value="';
        str+='Matches'; str+='">';
        str+='<param name="search-applet-has-a-substring" value="';
        str+='Has a substring'; str+='">';
        str+='<param name="NS-collection" value="';
        str+=''; str+='">';
        str+='<param name="NS-display-query" value="';
        str+=''; str+='">';
        str+='</applet>';
//      str+='<br><font size=-1>Copyright &#169; 1999-2000 Sun Microsystems, Inc.  Some preexisting portions Copyright &#169; 1997-2000 Netscape Communications Corporation. All Rights Reserved.</font>';
        str+='</center>';
        str+='</body></html>';
}
function GuidedSearch() {


   setJava();
   setIFC();
 

   if (hasJava) {
         GuidedSearchApplet();
      }
   else {
      var myWin = open('/search?NS-query-pat=/text/NS-advquery.pat', '_self');
      }
}
function setSearchData(myForm){

    searchContext = document.search.pushIFCContext();
    myForm.searchPattern.value = searchContext.setSearchQuery();
    myForm.collectionName.value = searchContext.setCollectionName();
    document.search.popIFCContext();
}    


function getPortalPrefix() {
    var checkString = location.hostname;
	if (checkString.indexOf("edfund.org") >= 0) {
	  return "/wps2/portal/" ;
	} else {
	  return "/wps/portal/";
	}
}
//added by Kdas on 08/12/2008
function getQuickFormsLoanPortalPrefix() {
    //var checkString = location.hostname;
	 //(checkString.indexOf("edfund.org") >= 0) 
	  return "/wps/portal/" ;
	
}

function getRedirectHostName() {
    var checkString = location.hostname;
	if ((checkString.indexOf("edfund.org") >= 0) || (checkString.indexOf("edfund.com") >= 0)) {
		return "www.edfund.org";
	} else {
	    return checkString;
	}
}
