var pathPrefix="";
function SetPathPrefix( prefix )
{
	pathPrefix = prefix;
}

function ShowTitleLogo()
{
	document.writeln( '<img src="'+pathPrefix+'Images/HeadLogo.GIF">' );
}

function ShowHeader()
{
	document.writeln( '<div align="left"><img src="'+pathPrefix+'WinSchedHeader.jpg"></div>' );
	document.writeln( '<div align="left">' );
	
}

function ShowLogoHeader( pgName )
{
	document.writeln( '<table width="726" height="146" usegridx usegridy showgridx showgridy gridx="200" gridy="200" border="0" cellpadding="0" cellspacing="0" bgcolor="#d7d5d7">');
	document.writeln('<tr height="145">');
	document.write('<td width="400" height="145" valign="top" align="left" xpos="0"><img src="' );
	document.write( pathPrefix );
	document.writeln( 'Images/HeaderImage1.jpg" width="400" height="145" border="0"></td>');
	document.write('<td width="200" height="145" valign="top" align="left" xpos="400"><img src="' );
	document.write( pathPrefix );
	document.write( 'Images/Header');
	document.write(pgName);
	document.write('.jpg" width="200" height="145" border="0"></td>');
	document.write('<td width="126" height="145" valign="top" align="left" xpos="600"><img src="' );
	document.write( pathPrefix );
	document.write( 'Images/HeaderImage3.jpg" width="124" height="145" border="0"></td>');
	document.writeln('</tr></table>');
}

function ShowTopNav( pgName )
{
	document.writeln( '<table width=100% border="1" bordercolor="#000000" bgcolor="#CCCCCC">' );
	document.writeln( '<tr class="navbox">' );
	if( pgName != 'Home' )
		document.writeln( '<td align="center"><a href="'+pathPrefix+'index.php">Home</a></td>' );
	if( pgName != 'Demo' )
		document.writeln( '<td align="center"><a href="'+pathPrefix+'Demo.php">Demo</a></td>' );
	if( pgName != 'Products' )
		document.writeln( '<td align="center"><a href="'+pathPrefix+'Products.html">Products</a></td>' );
	if( pgName != 'Support' )
		document.writeln( '<td align="center"><a href="'+pathPrefix+'Support.html">Support</a></td>' );
	if( pgName != 'Training' )
		document.writeln( '<td align="center"><a href="'+pathPrefix+'Training.php">Training</a></td>' );
	if( pgName != 'Store' )
		document.writeln( '<td align="center"><a href="'+pathPrefix+'EStore.php">Store</a></td>' );
	if( pgName != 'Search' )
		document.writeln( '<td align="center"><a href="'+pathPrefix+'Search/search.php">Search</a></td>' );
	document.writeln( '</tr></table>' );
}

var foundPage=0;
var curPage="";
var newBrowser = 1;
function ShowNavLink( pName, pLink, level )
{
	if( newBrowser )
		document.write('<tr class="navbox"><td>');
	else
		document.write('<tr><td>');
	document.write('<a href="');
	document.write( pathPrefix+pLink );
	document.write('">');
	document.write('&nbsp;');
	for( var i=0;i<level;i++ )
		document.write( '&nbsp;&nbsp;');
	document.write( pName );
	if( foundPage == 0 ) {
		var idx = pLink.indexOf( ".", 0 );
		var stIdx = pLink.indexOf( "/", 0 );
		stIdx++;
		var baseName;
		if( idx == -1 )
			baseName = pLink;
		else
			baseName = pLink.substring( stIdx, idx );
		if( curPage  == baseName ) {
			document.write('&nbsp;&gt;&gt;');
			foundPage = 1;
		}
	}
	document.write('</a></td></tr>\n');
//	document.write('<br></a>');
}
function ShowNavBox( high, wid )
{
	document.write('<tr height="');
	document.write(high);
	document.write('">');
	document.write('<td class="navbox" width="');
	document.write(wid);
	document.write('" height="');
	document.write(high);
	document.write('" align="left" xpos="0" content valign="top" csheight="');
	document.write('">');
}

//var minimized = 0;

function ShowSideNav( pgName, wid )
{
	wid = 130;
	var ver = navigator.appVersion.substring( 0,1 );
	if( (navigator.appName == 'Netscape' && ver >= 6) || (navigator.appName == 'Microsoft Internet Explorer' && ver >= 4) )
		newBrowser = 1;
	else
		newBrowser = 0;

	foundPage = 0;
	curPage = pgName;
	document.write('<table width="');
	document.write(wid);
	document.write('" gridx="5" gridy="5" border="0" cellpadding="0" cellspacing="0" align="left">');

	ShowNavLink( "HOME", "index.php", 0 );
	ShowNavLink( "Contact Us", "ContactUs.html", 0 );

	ShowNavLink( "About Winsched", "AboutWinSched.html", 0 );
	ShowNavLink( "Schedule Requests", "ScheduleRequest.html", 1 );
	ShowNavLink( "WSMail", "WSMail.html", 1 );
	ShowNavLink( "WebSync", "WebSync.html", 1 );
	ShowNavLink( "Demo", "DemoRequest.php", 1 );
	ShowNavLink( "E-Store", "Store.html", 0 );
	ShowNavLink( "Links", "Links.html", 0 );

	ShowNavLink( "Search", "Search/search.php", 0 );
	ShowNavLink( "Training", "Training/Movies.html", 0 );
	ShowNavLink( "Support", "Support.html", 0 );
	
	ShowNavLink( "Feature Requests", "FeatureReq.php", 0 );
	ShowNavLink( "Defect Report", "DefectRept.php", 0 );
//	ShowNavLink( "", "", 0 );
	
//	ShowNavLink( "Downloads/Forms", "Downloads.html", 0 );
	
	document.write( '</table>\n' );
}

function ShowFooter()
{
	document.writeln( '<table class="copywrite" cellpadding="0" align="center" cellspacing="2" width="560">' );
	document.write( '<tr><td align="center" valign="bottom"><a href="' );
	document.write( pathPrefix );
	document.write( 'index.php" title="Home Page">Home</a> | <a href="' );
	document.write( pathPrefix );
	document.write( 'Demo.php">Demo</a> | <a href="' );
	document.write( pathPrefix );
	document.write( 'ContactUs.html" title="Contacts">Contact Us</a>' );
	document.write( ' | <a href="Links.html">Links</a> | <a href="mailto:webmaster@winsched.com">Webmaster</a>' );
	document.write( '</td></tr><tr><td align="center" valign="bottom" class="copywrite">' );
	document.write( '<div align="center">	<p class="copywrite">&nbsp;&copy;' );
	document.write( ' 1994 - 2009 WinSched Software Corp.&nbsp;' );
	document.write( 'All rights reserved&nbsp;&nbsp;&nbsp;<a href="' );
	document.write( pathPrefix );
	document.write( 'TermsOfUse.html">Terms of Use</a></p>' );
	document.write( '</div></td></tr></table>' );
}

//******************** Cookies ********************************
var cookies = new Object();
function AddCookie( cName, cVal, cExp, cPath )
{

	var cStr = cName+'='+cVal;
	if( cExp > '' )
		cStr += '; expires='+cExp;
	if( cPath > '' )
		cStr += '; path='+cPath;
	document.cookie = cStr;
}

function DeleteCookie( cName, cPath )
{
	var exp = new Date();
	exp.setYear( 1970 );
	var cStr = '; expires='+exp;

	if( cPath > '' )
		cStr += '; path='+cPath;
	
	document.cookie = cName+'=deleted'+cStr;
	document.cookie = cName+cStr;
}

function ExtractCookies()
{
	var name, value;
	var beginning, middle, end;
	for( name in cookies ) {
		// if there are currently entries in cookies, get rid of them
		cookies = new Object();
		break;
	}
	beginning = 0;		// start at beginning of cookie string
	while( beginning < document.cookie.length ) {
		// find the next equal sign
		middle = document.cookie.indexOf( '=', beginning );
		// find next semicolon
		end = document.cookie.indexOf( ';', beginning );
		if( end == -1 )	// if no semicolon, then this is last cookie
			end = document.cookie.length;
		// if no value, then blank its value
		if( (middle > end) || (middle == -1) ) {
			name = document.cookie.substring( beginning, end );
			value = "";
		}
		else {
			// extract the name and value
			name = document.cookie.substring( beginning, middle );
			value = document.cookie.substring( middle+1, end );
		}
		cookies[name] = unescape( value );
		beginning = end+2;		// prepare for next cookie in string
	}
}

function ShowCookies()
{
//	document.writeln( "Cookies String="+document.cookie+"<br>" );
	var name;
	for( name in cookies )
		document.writeln( name+"="+cookies[name]+'<br>' );
}

