// Initialize all global URI resource paths
var imgPath_SVHLogo = "../assets/images/svh_logo.gif";
var imgPath_CCLogo = "../assets/images/common_code.gif";
var imgPath_eCRIPLogo= "../assets/images/ecrip_logo.gif";
var rsrcPath_JS = "../assets/js";
var rsrcPath_CSS = "../assets/css";
var rsrcPath_Privacy = "http://portal.svharbor.com/privacy.html";
var rsrcPath_Terms = "http://portal.svharbor.com/terms.html";
var rsrcPath_Comments = "http://portal.svharbor.com/portal/web/svhwebcwf.nsf/Comment?OpenForm";
var rsrcPath_Help = "http://portal.svharbor.com/portal/web/svhwebcwf.nsf/help?OpenForm";
var rsrcPath_Logout = "http://www.svharbor.com/logout.html";
var rsrcPath_HarborHome = "http://portal.svharbor.com/index.html";
var	rsrcPath_About="http://www.svharbor.com/logout.html";
var	rsrcPath_Contactus="SVCCContactNew.html";


var rsrcPath_CCHome = "index.html";

function getBrowser() {
	var svBrowser;
	if (document.getElementById) { 
		if (document.all) {
			svBrowser = "IE5";
		} else {
			svBrowser = "NS6";
		}
	} else if (document.all && !(document.getElementById)) { 
		svBrowser = "IE4"; 
	} else if (document.layers) { 
		svBrowser = "NS4";
	} else if (navigator.appVersion.indexOf("Mac") != -1) {
		svBrowser = "Mac";
	} else { 
		svBrowser = "Unknown"; 
	}
	return svBrowser;
}

function displayFooter(type) {
	document.writeln("<span class='footerText'>")
	document.writeln("<div align='center'>")
	document.writeln("Copyright &copy; 2008 &nbsp; SUPERVALU Inc.<br>")
	document.writeln("<a href='http://www.supervalu.com'>About SUPERVALU</a> - ")
	document.writeln("<a href='" + rsrcPath_Privacy + "'>Privacy Policy</a> - ")
	document.writeln("<a href='" + rsrcPath_Terms + "'>Terms of Service</a>")
	/*if (type == "std") {
		document.writeln(" - <a href='" + rsrcPath_Comments + "'>Comments</a>")
	}*/
	document.writeln("</div>")
	document.writeln("</span>")
}

function confirmLogout() {
	if (confirm("Are you sure you want to logout from SVHarbor.com?")) {
		location = rsrcPath_Logout;
	} else {
		return;
	}
}

function swapImage(imgName, newSrc) {
	document.images[imgName].src = newSrc
}

function displayLinks(filter, roles) {
	if (canDownload(roles)) {
		document.writeln("<tr>");
		document.writeln("<td width='5' height='25'></td>");
		document.writeln("<td>");
		document.writeln("<a href='FileList?filter=AVAILABLE'>");

		if (filter == "New") {
			document.writeln("<b>View New Files</b>");
		} else {
			document.writeln("View New Files");
		}

		document.writeln("</a>");
		document.writeln("</td>");
		document.writeln("</tr>");
	
		document.writeln("<tr>");
		document.writeln("<td width='5' height='25'></td>");
		document.writeln("<td>");
		document.writeln("<a href='FileList?filter=DOWNLOADED'>");

		if (filter == "Downloaded") {
			document.writeln("<b>View Downloaded Files</b>");
		} else {
			document.writeln("View Downloaded Files");
		}
	
		document.writeln("</a>");
		document.writeln("</td>");
		document.writeln("</tr>");
	}
	
	if (canUpload(roles)) {
		document.writeln("<tr>");
		document.writeln("<td width='5' height='25'></td>");
		document.writeln("<td>");
		document.writeln("<a href='Upload'>");

		if (filter == "Upload") {
			document.writeln("<b>Upload a File</b>");
		} else {
			document.writeln("Upload a File");
		}
	
		document.writeln("</a>");
		document.writeln("</td>");
		document.writeln("</tr>");
	}
}

function canDownload(roles) {
	if (roles.toLowerCase().indexOf("receive") >= 0) {
		return true;
	} else {
		return false;
	}

}
function canUpload(roles) {
	if (roles.toLowerCase().indexOf("send") >= 0) {
		return true;
	} else {
		return false;
	}
	
	}

function displayLeftMenu(){
document.writeln("<table class='sideMenu' cellspacing='0' border='0' cellpadding='0'>")
document.writeln("<tr>")
document.writeln("<td height='10 width='5'></td><td colspan='2' valign='top'><b><font color='darkblue'>&nbsp;</font></b></td>")
document.writeln("</tr>")
document.writeln("<tr>")
document.writeln("<td height='40 width='5'></td><td colspan='2'><a class=\"sideMenu\" href='SVCCLookUpNew.jsp' onMouseOver=\"window.status='Common Code Lookup';return true\" onMouseOut=\"window.status='';return true\">Common Code Lookup</a><br>");
document.writeln("</tr>")
document.writeln("<tr>")
document.writeln("<td height='40 width='5'></td><td colspan='2'><a class=\"sideMenu\" href='SVCCReportBrowseNew.jsp' onMouseOver=\"window.status='Translation Tables';return true\" onMouseOut=\"window.status='';return true\">Translation Tables</a><br>");
document.writeln("</tr>")
document.writeln("<tr>")
document.writeln("<td width='5')</td>")
document.writeln("</tr>")
document.writeln("</table>")
}

function displayCripLeftMenu(){
document.writeln("<table class='sideMenu' cellspacing='0' border='0' cellpadding='0'>")
document.writeln("<tr>")
document.writeln("<td height='10 width='5'></td><td colspan='2' valign='top'><a class=\"sideMenu\" href='SVCCLookUpNew.jsp' onMouseOver=\"window.status='Common Code Lookup';return true\" onMouseOut=\"window.status='';return true\">&nbsp</font></b></td>")
document.writeln("</tr>")
document.writeln("<tr>")
document.writeln("<td height='40 width='5'></td><td colspan='2'><a class=\"sideMenu\" href='SVCCLookUpNew.jsp' onMouseOver=\"window.status='Common Code Lookup';return true\" onMouseOut=\"window.status='';return true\">CRIP</a><br>");
document.writeln("</tr>")
document.writeln("<tr>")
document.writeln("<td height='40 width='5'></td><td colspan='2'><a class=\"sideMenu\" href='SVCCLookUpNew.jsp' onMouseOver=\"window.status='Common Code Lookup';return true\" onMouseOut=\"window.status='';return true\">Purchase Flag</a><br>");
document.writeln("</tr>")
document.writeln("<tr>")
document.writeln("<td height='40 width='5'></td><td colspan='2'><a class=\"sideMenu\" href='SVCCReportBrowseNew.jsp' onMouseOver=\"window.status='Translation Tables';return true\" onMouseOut=\"window.status='';return true\">Label Request</a><br>");
document.writeln("</tr>")
document.writeln("<tr>")
document.writeln("<td width='5')</td>")
document.writeln("</tr>")
document.writeln("</table>")
}
