//<!-- 
/*
------------------------------------------------------------------------------
File Name:config.js
Company: ph2enterprises
Client: JMK -- CF Ranch
Author: Phillip J. Henslee II <ph2@ph2.us> ©2003
Purpose: Site Javascript File
Functions: Eight
Date Created: January 15, 2002
Last Modified: October 17, 2003
Dependent Files: None
File Status: Required
----------------------------------------------------------------------------
*/

/*  ------------------------------------------
     Debug State (used for debugging purposes)
     Default value: false
    ------------------------------------------
*/    

			var debugState = false;

/*  ------------------------------------------
    Define default status text
    Default value: blank
    Insert desired status between double quotes
    ------------------------------------------
*/    

			defaultStatus = "CF Ranch";

/*  ------------------------------------------
    Set Base URL 
    Default Value: None 
    Example: http://www.ph2enterprises.com/
    ------------------------------------------
*/    

			var baseURL = 'http://10.0.5.28/cfranch/';
			
			
			
			
// ** Begin Browser Detection **
// ---------------------------------------------------------------------------
	
    var bAgent=navigator.userAgent.toLowerCase();

    var brwName = navigator.appName;
    var majorVersion = parseInt(navigator.appVersion);
    var minorVersion = parseFloat(navigator.appVersion);
    var isWindows = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
    var isMac = (navigator.appVersion.indexOf("Macintosh") != -1) ? true : false;


    var isNav  = ((bAgent.indexOf('mozilla')!=-1) && (bAgent.indexOf('spoofer')==-1)
                && (bAgent.indexOf('compatible') == -1) && (bAgent.indexOf('opera')==-1)
                && (bAgent.indexOf('webtv')==-1) && (bAgent.indexOf('hotjava')==-1));
                
    var isNav2 = (isNav && (majorVersion == 2));
    var isNav3 = (isNav && (majorVersion == 3));
    var isNav4 = (isNav && (majorVersion == 4));
    var isNav4plus = (isNav && (majorVersion >= 4));
    var isNavonly  = (isNav && ((bAgent.indexOf(";nav") != -1) ||(bAgent.indexOf("; nav") != -1)) );
    var isNav6 = (isNav && (majorVersion == 5));
    var isNav6plus = (isNav && (majorVersion >= 5));
    var isGecko = (bAgent.indexOf('gecko') != -1);

    var isIe     = ((bAgent.indexOf("msie") != -1) && (bAgent.indexOf("opera") == -1));
    var isIe3    = (isIe && (majorVersion < 4));
    var isIe4    = (isIe && (majorVersion == 4) && (bAgent.indexOf("msie 4")!=-1) );
    var isIe4plus  = (isIe && (majorVersion >= 4));
    var isIe5    = (isIe && (majorVersion == 4) && (bAgent.indexOf("msie 5.0")!=-1) );
    var isIe5_5  = (isIe && (majorVersion == 4) && (bAgent.indexOf("msie 5.5") !=-1));
    var isIe5plus  = (isIe && !isIe3 && !isIe4);
    var isIe5_5plus =(isIe && !isIe3 && !isIe4 && !isIe5);
    var isIe6    = (isIe && (majorVersion == 4) && (bAgent.indexOf("msie 6.")!=-1) );
    var isIe6plus  = (isIe && !isIe3 && !isIe4 && !isIe5 && !isIe5_5);
    
    var isOtherBrw = (!isIe4plus | !isNav4plus);
        
	if(debugState == true){
	var strMessage = 'Browser Configuration:\n\n';
				
		for(eachItem in navigator){
				
			strMessage = strMessage + eachItem +': ' + navigator[eachItem] +'\n'
		}
					
	alert(strMessage);
			    
	}
		
		

    			
/* 
------------------------------------------------------------------------
** Begin flash detection
------------------------------------------------------------------------
*/ 

// Set max version and other variables
var maxFlashVersion = 7;
var detectedVersion = 0; 
var isFlash3 = false;    
var isFlash4 = false;    
var isFlash5= false;    
var isFlash6 = false;
var isFlash7 = false;         


/* 
------------------------------------------------------------------------
Function detectFlashPlugin()
Purpose: detect presence of Flash plug-in
Arguments: None
------------------------------------------------------------------------
*/

function detectFlash() {

		
	if(isIe && isWindows){
		
		// create flash objects in vbscript
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('isFlash3 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
		document.write('isFlash4 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
		document.write('isFlash5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
		document.write('isFlash6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
		document.write('isFlash7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');   
		document.write('</SCR' + 'IPT\> \n');
		
		for (var i = 3; i <= maxFlashVersion; i++) {  
		if ( eval("isFlash" + i ) == true){detectedVersion = i};		
		}	
	 
		
	}   
	
	if (navigator.plugins){
		if (navigator.plugins["Shockwave Flash"]) {
			var flashDesc = navigator.plugins["Shockwave Flash"].description;
			this.detectedVersion = parseInt(flashDesc.charAt(flashDesc.indexOf(".") - 1));
		}
	
	}
	
	 
	if(debugState){
		if (detectedVersion > 0){
		alert("Flash player detected!\nFlash player version: " + detectedVersion);
		}
	}


}

/* 
------------------------------------------------------------------------
Function insertFlash()
Purpose: insert flash content
Arguments: eight
------------------------------------------------------------------------
*/

function insertFlash(flashMovie,altImage,iwidth,iheight,isLoop,altPage,upgradePage,targetFlashVersion) {

	// Handle Redirection to alternate non flash page
		if(altPage != 'NO'){
			if(!isOtherBrw){
				window.location.replace(altPage);  
			}else{
				window.location = altPage;
			}
		}	  
        
        // Handle Upgrade page option
        if (detectedVersion < targetFlashVersion && upgradePage != 'NO'){
			if(!isOtherBrw){
				window.location.replace(upgradePage);  
			} else {
				window.location = upgradePage;
			}
		}	  
		
		// insert flash content if flash is detected or is ie
		if (detectedVersion > 0 | isIe ){
		
			// build html output string
			var strHTML = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
			+ ' WIDTH="' + iwidth + '" HEIGHT="' + iheight +'" '
			+ 'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#'
			+ 'version=' + targetFlashVersion +',0,0,0">'
			+ '<PARAM NAME="MOVIE" VALUE="' + flashMovie + '">'
			+ '<PARAM NAME="PLAY" VALUE="true">'
			+ '<PARAM NAME="LOOP"'
			if (isLoop == true){
				strHTML += ' VALUE="true"'
			}else{
				strHTML += ' VALUE="false"'
			}
			strHTML += '">'
			+ '<PARAM NAME="QUALITY" VALUE="high">'
			+ '<PARAM NAME="MENU" VALUE="false">'
			+ '<EMBED SRC="'  + flashMovie + '"'
			+ ' WIDTH="'+ iwidth + '" HEIGHT="' + iheight +'" '
			+ ' PLAY="true"'
			if (isLoop == true){
			strHTML += ' LOOP="true"'
			}else{
			strHTML += ' LOOP="false"'
			}
			strHTML += 'QUALITY="high"'
			+ 'MENU="false"'
			+ 'TYPE="application/x-shockwave-flash"'
			+ 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
			+ '</EMBED>'
			+ '</OBJECT>';
		
		} else {
			
			// Insert alternate image
			var strHTML = '<IMG SRC="' + altImage + '" HEIGHT="' + iheight + '" WIDTH="' + iwidth +'">'	+ '<BR>';
		}
		
		
		if(debugState == true){
			alert('Inserting flash content!\n\n' + strHTML);
		}
			
		// Insert Content
		document.write ( strHTML );
		
		//return strHTML;
		

}   

// Call detection function
detectFlash();	

/*
------------------------------------------------------------------------
Function preLoadImages()
Purpose: loads images(rollover events)
Arguments: 1
Arg 0: arrImages - array of images
------------------------------------------------------------------------
*/ 

	function preLoadImages(){

		var arrImages = new Array();

		arrImages[0] = 'images/apply_h.gif';
		arrImages[1] = 'images/dir_h.gif';
		arrImages[2] = 'images/join_h.gif';
		arrImages[3] = 'images/visit_h.gif';
		// add lines as needed


		arrImageList = new Array ();

		for (i in arrImages) {
		    arrImageList[i] = new Image();
		    arrImageList[i].src =  arrImages[i];
		}

	}


/* 
------------------------------------------------------------------------
Function loadImage
Purpose: loads images(rollover events)
Arguments: 2
Arg 0: imgObj - Name of the image (<img name=myimage ....)
Arg 1: image - Name of the image to change
------------------------------------------------------------------------
*/ 

function loadImage(imgObj,imageName){
	if (document.images){
		document.images[imgObj].src = imageName;
	}
}


/* 
------------------------------------------------------------------------
Function fadeImageIn
Purpose: fades image (works only in ie)
Arguments: 1
Arg 0: src - Name of the image (<img name=myimage ....)
------------------------------------------------------------------------
*/ 

var a=0  // starting opacity

function fadeImageIn(src){
if(document.all)
document.images[src].filters.alpha.opacity=0 + a
a++
thesrc = src
setTimeout("fadeImageIn(thesrc)",10)
}


/* 
------------------------------------------------------------------------
Function: loadURL
Purpose: load URL in browser curent window or target window
Arguments: 1
Arg 0: thePage - Name of the file to open
------------------------------------------------------------------------
*/  

function loadURL(){

	var args, tempStr, strURL, strPos, myLen, myStr;
	args = loadURL.arguments;
	tempStr = args[0]
	strPos = tempStr.indexOf(",");
	myLen = tempStr.length;
	
	if (strPos != -1){
		strURL = tempStr.slice(0,strPos)
		myStr =  tempStr.slice(strPos +1 , myLen)
	 }
	 else
	 {
		strURL = tempStr
		myStr  = 'self';
	 }
	
	if ( myStr != -1){
	
		if (myStr == "NEWWINDOW"){
		
	        window.open(strURL);
	        	
	    }else{
	      	
	      	window.parent[myStr].location.href=strURL;
	    }
	 }    	
}

/* 
------------------------------------------------------------------------
Function: goMenu(theMenu)
Purpose: loads selected URL from select menu
Arguments: 1
Arg 0: theMenu  the name of the select menu (this)
------------------------------------------------------------------------
*/ function goMenu(theMenu){

	var strURL = theMenu.options[theMenu.selectedIndex].value
	if (strURL != 'null'){
	loadURL(strURL);
	}
	
}

/* 
------------------------------------------------------------------------
Function openWin
Purpose: opens new browser windows
Arguments: 5
Arg 0: thePage - Name of the file to open
Arg 1: winname - Name of the window
Arg 2: iwidth - width of the window
Arg 3: iheight - height of window
Arg 4: scroll - show scrollbars YES OR NO
------------------------------------------------------------------------
*/  
function openWin(thepage,winname,iwidth,iheight,scroll) {
   
	if (parseInt(navigator.appVersion) >= 4) {
	
		var winl = (screen.width - iwidth) / 2;
		var wint = (screen.height - iheight) / 2;
		winargs = 'height='+iheight+',width='+iwidth+',top='+wint+',left='+winl+',scrollbars='+scroll
		win = window.open(thepage,winname,winargs)
		
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } 
		} 
      	else
		{
		winargs = 'height='+iheight+',width='+iwidth+ ', scrollbars='+scroll
		window.open(thepage,winname,winargs)
		}
}


// -->










