/*  Created Date:  1/26/2007 4:44 PM
 * 	Author:  Irvin Owens Jr
 *  For: Epocrates, Inc.
 *  Project: EOL 2 / Topamax
 *  Description:  This file will act as a library / repository for tools to be used in applications
 *  Libraries Used:  
 */

/* globals */



/* constructors */

function TypeValidator(){
	
}

function BrowserInformation(){
	
}


/* prototypes */

TypeValidator.prototype.validateType = validTypeChecker;

BrowserInformation.prototype.browserSniffer = browserSniffer;

/* implementations */

function validTypeChecker(anObject /* Object */,expectedType /* String */){
	if(typeOf(anObject) == expectedType){
		// do nothing
	}else{
		throw("The object is of " + typeof(anObject) + " not of type " + expectedType);
	}
}

function browserSniffer(){
		if(navigator.userAgent.toLowerCase().indexOf("msie") != -1){
			return 1;
	 	}
	 	if(navigator.userAgent.toLowerCase().indexOf("firefox") != -1){
	 		return 2;
	 	}
	 	if(navigator.userAgent.toLowerCase().indexOf("opera") != -1){
	 		return 3;
	 	}
	 	if(navigator.userAgent.toLowerCase().indexOf("safari") != -1){
	 		return 4;
	 	}
	 return 5;
}

function getServer() {
	 var urlHolder = new Array();
	 var currentAddress = window.location.href;
	 if(currentAddress.indexOf("?") != -1 && currentAddress.indexOf(".c") == -1) {
		 urlHolder = currentAddress.split("?");
		
		 finalURL = urlHolder[0];
		
	 }else{
		 urlHolder = currentAddress.split("/");
		 urlHolder.pop();
		 finalURL = urlHolder[0] + "//" + urlHolder[2] + "/";
	 }
	 return finalURL;
}
