<!--
/* ********************************************************************************* 
   COPYRIGHT('(C) CMS MANUFACTURING SYSTEMS INC. - 1993, 1997')
   File Name:  CMSEasy_navigation.js                                                          
   Description:  This script will control the navigation for the CMSEasy pages.
  
   Insturctions:
   1) Include this script in all of the CMSEasy-Main HTML documents.
      script language="JavaScript" src="/script/CMSEasy_navigation.js"
  
   _________________________________________________________________________________ 
   Modification History:                                                             
   2001-04-16  Michael Victor    Created script                             
   2001-06-01  Michael Victor    Added EZ018-Shipping Schedules 
   2001-06-01  Michael Victor    Added EZ020-Order Entry 
   2001-08-20  Michael Victor    The Navigation, PageContents and Footer divisions,
                                 are now written using document.writeln, instead of
                                 using the .innerHTML methods.  (this should resolve
                                 the header section expanding and contracting when
                                 rendering the page)
   2001-10-19  Michael Victor    /M05 Fixed sizing of the navigation buttons 
   2001-10-23  Michael Victor    /M06 Added EZ036-ASN
   2001-12-11  Michael Victor    /M07 Added support for new sales rep user type ('4')
                                      and brokers ('5')
   2002-03-27  Michael Victor    /M08 Place the URL for the portal & main signon in
                                      variables.  Note the hard-coded ip has been 
                                      removed from the url as a relative refernce 
                                      will work.
   2002-05-28  Michael Victor    Release 2.0 mods
   2002-06-26  Michael Victor    /M10 Mods to handle the new select user for
                                 sales reps and brokers
   2003-03-11  Michael Victor    /M11 Added EZ042-PO Inquiry
   2006-05-08  HW                /101 add EZ048 (register warranty product)
   2006-06-06  HW                /102 do not show 'Main Signon' for generic consumer
   2007-03-07  HCT               Added EZ051 (supplier inventory inquiry)
   *********************************************************************************  */
   
/* /M08 navigation values */
portalURL     = '/net/ez001'
mainSignonURL = "parent.location='/net/ez001'"

/* supplier programs */
var EZ003="N"
var EZ011="N"
var EZ018="N"
var EZ036="N" /* /M06 */
var EZ042="N" /* /M11 */
var EZ051="N"


/* customer programs */
var EZ013="N"
var EZ014="N"
var EZ015="N"
var EZ016="N"
var EZ017="N"
var EZ020="N"

/* /M07 Sales Rep programs, in addition to thes pgms, the customer programs will also be made available */
var EZ039="N"

/* admin programs */
var EZ009="N"
var EZ010="N"

/* /101 generic consumer programs */
var EZ048="N"

/* general programs */
var EZ004="N"
var EZ025="N"

var user = ""
var userType=""
var lng  = ""
var XXSLIB =""
var XXACTID ="" /* /M07 variable to hold the selected customer */
var XXACTUSER ="" /* /M10 variable to hold the selected user */
var newline = "\n"
var navigationHtml = ""

function setUser(xxuser)
{
	user=xxuser
}

function setUserType(value)
{
	userType=value
}
function setLng(xxlng)
{
	lng=xxlng
}

function setXXSLIB(value)
{
	XXSLIB=value
}

/* /M07 */
function setXXACTID(value)
{
	XXACTID=value
}

/* /M10 */
function setXXACTUSER(value)
{
	XXACTUSER=value
}

function callPgm(pgm)
{
	nForm = document.navForm
	nForm.XXACTN.value = pgm
	nForm.submit()
}

function enablePgm(pgm)
{	
	switch (pgm)
	{
	case 'EZ003':
		EZ003 = 'Y'
		break

	case 'EZ004':
		EZ004 = 'Y'
		break
	
	case 'EZ009':
		EZ009 = 'Y'
		break
		
	case 'EZ010':
		EZ010 = 'Y'
		break
		
	case 'EZ011':
		EZ011 = 'Y'
		break
		
	case 'EZ013':
		EZ013 = 'Y'
		break
		
	case 'EZ014':
		EZ014 = 'Y'
		break
		
	case 'EZ015':
		EZ015 = 'Y'
		break
		
	case 'EZ016':
		EZ016 = 'Y'
		break
		
	case 'EZ017':
		EZ017 = 'Y'
		break
		
	case 'EZ018':
		EZ018 = 'Y'
		break
	
	case 'EZ020':
		EZ020 = 'Y'
		break
		
	case 'EZ025':
		EZ025 = 'Y'
		break
		
	/* /M06 */	
	case 'EZ036':
		EZ036 = 'Y'
		break
	
	/* /M07 */	
	case 'EZ039':
		EZ039 = 'Y'
		break
		
	/* /M11 */	
	case 'EZ042':
		EZ042 = 'Y'
		break

	/* /101 */
	case 'EZ048':
		EZ048 = 'Y'
		break

	case 'EZ051':
		EZ051 = 'Y'
		break
	}
}



function crtNavButton(type, action, altText)
{
	var classId="" /* /M05 */
	var overClassId =""
	
	if (type == 'S') /* submit button */
	{
		/* /M05 if the button is for contact us or change password, then it's in
		   the link section of the navigation, and therefore it's height is different,
		   use the appropriate class name */
		if (action=='EZ025' || action=='EZ004')
		{
			classId="navlink2"
		}
		else
		{
			classId="navlink"
		}
		overClassId = classId + '_over'
		
		
		navigationHtml +=	'<a ' + buttonClasses(classId, overClassId) 
		
		if (action != null)
		{
			navigationHtml += 'onClick="callPgm(' + "'" + action + "'" + ')" ' 
		}
		
		navigationHtml += '>' + altText + '</a>' + newline
	}
	
	if (type == 'L' && action != ' ')
	{
		classId="navlink2"
		overClassId = classId + '_over'
		
		navigationHtml +=	'<a ' + buttonClasses(classId, overClassId)
							+	'onClick="' + action + '">' + altText + '</a>' + newline
		
	}
		
}

function buttonClasses(dftClass, overClass)
{
	var btnClasses =	
			'class="' + dftClass + '" '
		+	'onMouseOver="this.className=' + "'" + overClass + "'" + '" '  
		+	'onMouseOut="this.className='  + "'" + dftClass  + "'" + '" '
	return(btnClasses)
}

function popHeader()
{
	document.title="Easy e-business Suite"
	
	navigationHtml =
		  '<div class="Navigation" id="navigation">' + newline
		+ ' <form name="navForm" class="NavForm" action="EZ006" method="post" target="_parent">' + newline
		+ '  <input type="hidden" name="XXUSER" value="' + user + '"></input>' + newline
   	+ '  <input type="hidden" name="XXLNG"  value="' + lng  + '"></input>' + newline
   	+ '  <input type="hidden" name="XXACTN"  value=""></input>' + newline
   	if (userType == '2')
   	{
   		navigationHtml += '<input type="hidden" name="XXSLIB"  value="' + XXSLIB + '"></input>' + newline
   	} 
   	
   	/* /M07 */
   	if (userType == '4' || userType=='5')
   	{
   		navigationHtml += 
   			  '   <input type="hidden" name="XXACTID"  value="' + XXACTID + '"></input>' + newline
   			+ '   <input type="hidden" name="XXACTUSER"  value="' + XXACTUSER + '"></input>' + newline
   	} 
   	
   	navigationHtml +=
   			'<img border="0" src="/gifs/MIG.jpg" width="460" height="70"></img>' + newline
   		+	'<img border="0" src="/gifs/spacer.gif" style="width:28px, height:45px; position:absolute; top:15px; left:597px" alt="spacer" style="vertical-align:top"></img>' + newline
   	// Create a div section to hold the main signon, change password and contact us links
   		+	'<div id="generalLinks" class="generalLinks">' + newline
   	
	// 102 do not show main signon button for generic consumer
	if (userType != '6')
	{
   	crtNavButton('L', mainSignonURL, 'Main Signon')
	}
   		
   	if (EZ004=='Y')
   	{
   		crtNavButton('S', 'EZ004', 'Change Password')
   	}
	
		if (EZ025=='Y')
   	{
   		crtNavButton('S', 'EZ025', 'Contact Us')
   	}


				
	navigationHtml +=
			'</div>' + newline
		// Create a div section to hold the navigation row
   	+	'<div id="navRow" class="navRow">' + newline
		
	switch (userType)
	{
		case '1':
			supplierNavigation()
			break
			
		case '2':
			adminNavigation()
			break
		
		case '3':
			customerNavigation()
			break
		
		case '4': /* /M07 handle salesrep type */
			salesrepNavigation()
			break
			
		case '5': /* /M07 handle salesrep type */
			brokerNavigation()
			break

		case '6': /* /101 generic consumer type */
			consumerNavigation()
			break
	}
	
	navigationHtml +=
			'</div>' + newline
		+'</form>' + newline
		+'</div>' + newline
		+'<br/>' + newline
	
	document.writeln(navigationHtml)
}

function customerNavigation()
{

  	if (EZ020=='Y')
  	{
  		crtNavButton('S', 'EZ020', 'Order Entry')
  	}
  	
  	if (EZ013=='Y')
  	{
  		crtNavButton('S', 'EZ013', 'Order Inquiry')
  	}
  	
  	if (EZ016=='Y')
  	{
  		crtNavButton('S', 'EZ016', 'Price Inquiry')
  	}
	
  	if (EZ017=='Y')
  	{
  		crtNavButton('S', 'EZ017', 'Sales Order History')
  	}
  	
  	if (EZ014=='Y')
  	{
  		crtNavButton('S', 'EZ014', 'Inventory/Production')
  	}
   	
}

function adminNavigation()
{
	if (EZ010=='Y')
   	{
   		crtNavButton('S', 'EZ010', 'View Scorecard/Action')
   	}
   	
   	if (EZ009=='Y')
   	{
   		crtNavButton('S', 'EZ009', 'Select Database')
   	}
}



function supplierNavigation()
{
	if (EZ003=='Y')
   	{
   		crtNavButton('S', 'EZ003', 'View Scorecard')
   	}
   	
   	if (EZ011=='Y')
   	{
   		crtNavButton('S', 'EZ011', 'Planning Schedules')
   	}
   	
   	if (EZ018=='Y')
   	{
   		crtNavButton('S', 'EZ018', 'Shipping Schedules')
   	}
   	
   	/* /M06 handle EZ036 */
   	if (EZ036=='Y')
   	{
   		crtNavButton('S', 'EZ036', 'ASN')
   	}
   	
   	/* /M11 handle EZ042 */
   	if (EZ042=='Y')
   	{
   		crtNavButton('S', 'EZ042', 'PO Inquiry')
   	}
   
   	if (EZ051=='Y')
   	{
   		crtNavButton('S', 'EZ051', 'Part Inquiry')
   	}
}

/* /101 generic consumer navigation */
function consumerNavigation()
{
	if (EZ048=='Y')
   	{
   		crtNavButton('S', 'EZ048', 'Register Warranty Product')
   	}
}


/* M07 handle salesrep navigation */
function salesrepNavigation()
{
	// if a customer has been selected, add all of the customer programs
  	if (XXACTID != '')
  	{
  		customerNavigation()	
  	}
  	
  	if (EZ039=='Y')
  	{
  		navigationHtml += '<br />' + newline
  		crtNavButton('S', 'EZ039', 'Select Customer')
 	}
}



/* M07 handle broker navigation */
function brokerNavigation()
{
	// if a customer has been selected, add all of the customer programs
  	if (XXACTID != '')
  	{
  		customerNavigation()
  	}
  	
  	if (EZ039=='Y')
  	{
  		navigationHtml += '<br />' + newline 
  		crtNavButton('S', 'EZ039', 'Select Customer')
  	}
}







-->
