function GenericUtility()
{
	
}

GenericUtility.getBrowserType = function()
{
//alert("getBrowserType()");
if(window.sidebar){
		return "firefox";
	}else if(window.opera && window.print){
		return "opera";
	}else if(document.all){
		return "ie"
	}else{
		return "other";
	}
}

GenericUtility.bookmarkSite = function($url, $title)
{
	//alert("bookmarkSite()");
	if($url == undefined){
		$url = location.href;
	}
	if($title == undefined){
		$title = document.title;
	}
	
	var browser = getBrowserType();
	if(browser == "firefox"){
		window.sidebar.addPanel($title, $url, "");
	}else if(browser == "ie"){
		window.external.addFavorite($url, $title); 
	}else{
		var elem = document.createElement('a');
		elem.setAttribute('href',$url);
		elem.setAttribute('title',$title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}
}


GenericUtility.popup = function(url, windowName, title, width, height, titlebar, menubar, toolbar, location, scrollbars, status, resizable)
{
	if(!url){
		alert("Javascript Error: popup(); No URL Provided");
		return;
	}
	if(!windowName); windowName = "popup";
	
	if(!title); //ok
	if(!width) width = 780;
	if(!height) height = 560;

	if(titlebar == undefined) titlebar = true;
	if(menubar == undefined) menubar = true;
	if(toolbar == undefined) toolbar = true;
	if(location == undefined) location = true; //this is the url field
	if(scrollbars == undefined) scrollbars = true;
	if(status == undefined) status = true; //status bar at the bottom of the screen //firefox always keeps the status bar on if you have that preference set
	
	if(resizable == undefined) resizable = true;
	
	
	var attributes =
		"width=" + width + ", " +
		"height=" + height + ", " +
		"left=" + "50" + ", " +
		"top=" + "50" + ", " +
		
		"titlebar=" + titlebar + ", " +
		"menubar=" + menubar + ", " +
		"toolbar=" + toolbar + ", " +
		"location=" + location + ", " +
		"scrollbars=" + scrollbars + ", " +
		"status=" + status + ", " + 
		"resizable=" + resizable
	;
	
	window.open(url, windowName, attributes);
}

GenericUtility.chromelessPopup = function(url, windowName, title, width, height, titlebar, menubar, toolbar, location, scrollbars, status, resizable)
{
	//alert("chromelessPopup()");
	if(titlebar == undefined) titlebar = true;
	if(menubar == undefined) menubar = false;
	if(toolbar == undefined) toolbar = false;
	if(location == undefined) location = false;
	if(scrollbars == undefined) scrollbars = false;
	if(status == undefined) status = false;
	
	if(resizable == undefined) resizable = true;
	
	GenericUtility.popup(url, windowName, title, width, height, titlebar, menubar, toolbar, location, scrollbars, status, resizable);
}

GenericUtility.getURLVar = function(varname)
{
	var URLVars = GenericUtility.getURLVars();
	return URLVars[varname];
}

GenericUtility.getURLVars = function()
{
	var vars = [], hash;
	var hashes = window.location.href.slice(window.location.href.indexOf("?") + 1).split("&");
	for(var i = 0; i < hashes.length; i++){
		hash = hashes[i].split('=');
		vars.push(hash[0]);
		vars[hash[0]] = hash[1];
	}
	return vars;
}

