if (typeof TOOLKITS == "undefined") {
	var TOOLKITS = {};
}


TOOLKITS.browserCheck = function(appName) {
	switch (BrowserDetect.browser) {
		//case "Safari":
			//alert("Hello! We noticed you're using Safari to access " + appName + ". Although Safari will work with this application, we strongly recommend using Firefox for optimum performance, available for free at http://www.getfirefox.com.");
			//break;
		case "Firefox":
			break;
		//case "Explorer":
			//alert("PLEASE NOTE: Internet Explorer has known compatibility issues with modern Web standards that affect Web 2.0 applications such as " + appName + ". You can use Internet Explorer, but you may not have access to all of " + appName + " features, and you will experience slower performance. For the best experience with tools on this site, please use Firefox, available for free download at http://www.getfirefox.com.");
			//alert("Hello! We noticed you're using Internet Explorer to access " + appName + ". Although IE will work with this application, we strongly recommend using Firefox for optimum performance, available for free at http://www.getfirefox.com.");
			//break;
		default:
			alert("Although other Web browsers will work with " + appName + ", we strongly recommend using Firefox for optimum performance, available for free at http://www.getfirefox.com. (With browsers other than Firefox you may experience slower performance or reduced functionality.)");
			break;
	} // end switch
}


TOOLKITS.help = function() {
	var helpWindow = window.open("help.php","Help","scrollbars=yes,resizable=yes,width=800,height=550");
	helpWindow.focus();
}


TOOLKITS.initUploadWindow = function() {
	if (!YAHOO.pbg_nl) {
		YAHOO.namespace("pbg_nl.container");
	}
	YAHOO.pbg_nl.container.uploader = 
			new YAHOO.widget.Panel("uploader",  
				{ width:"600px", 
				  fixedcenter:true, 
				  close:true, 
				  draggable:false, 
				  zindex:45,
				  modal:true,
				  visible:false
				} 
			);
	YAHOO.pbg_nl.container.uploader.setHeader("Upload an Image File");
	YAHOO.pbg_nl.container.uploader.setBody('<div><div id="upload_notes" style="font-size: 11px;"></div><form id="file_upload_form" method="post" enctype="multipart/form-data" action="" target="upload_target"><input name="thefile" id="thefile" size="27" type="file" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif;" /> <input name="MAX_FILE_SIZE" id="upload_limit" type="hidden" id="MAX_FILE_SIZE" value="500001" /> <input type="submit" name="submit" value="Upload Selected File" style="font-size: 11px; font-family: Arial, Helvetica, sans-serif;" onclick="$(\'upload_target\').src = \'..\/loading.php\'; $(\'upload_target\').style.height = \'70px\';" /><br /><iframe id="upload_target" name="upload_target" src="..\/loading.html" style="width: 570px; height: 0px; border: none; overflow: hidden; margin: 5px auto;" frameborder="0" scrolling="No"></iframe></form><\/div>');
	YAHOO.pbg_nl.container.uploader.render(document.body);
	
	// initialize book-content switcher scripts (if external js has been loaded)
	if (typeof PBP_SHARED != "undefined") {
		PBP_SHARED.changeBookContent(false);
	}
	
} // end TOOLKITS.initUploadWindow


TOOLKITS.launchUploader = function(fileType, app, position) {
	var limit;
	switch (fileType) {
		case "image":
			limit = 500001;
			break;
		default:
			limit = 1048577;
			break;
	}
	var formAction = "../upload_" + fileType + ".php?applicationType=" + app + "&limit=" + limit;
	$("upload_notes").update("Click &ldquo;Browse&rdquo; to select a file on your computer. Then click &ldquo;Upload Selected File.&rdquo;");
	if (position) {
		formAction += "&position=" + position;
		$("upload_notes").insert("<p id=\"banner_notes\" style=\"font-size: 11px; color: #333333; font-style: italic;\">Please make sure your image is a JPEG or GIF, saved in RGB color mode, with a resolution of 72 dpi.</p>");
	}
	$("file_upload_form").action = formAction;
	$("file_upload_form").target = "upload_target";
	$("upload_limit").value = limit;
	$("thefile").value = "";
	$("upload_target").style.height = "0";
	$("upload_target").src = "../loading.html";
	YAHOO.pbg_nl.container.uploader.show();
}


Event.observe(window, "load", TOOLKITS.initUploadWindow);