//THIS IS A COLLECTION OF SHARED SCRIPTS FOR BUSINESS BYTES WEBSITE


// Hides all Javascript errors
window.onerror=null;

// Array of document names referenced to Tab Number for flash navBar
tab = new Array('home.html', 'web.html', 'software.html', 'account.html', 'network.html', 'analysis.html');

// This function checks for flash compatibility and launchs appropriate starting page

function dispatchFlash( winURL, tabNum ){
    var myURL = "javascript:openMain('" + winURL + "', '" + tabNum + "');";
    MM_FlashDispatch(
	myURL,
	"6.0",
	false,				// don't require latest rev. of plug-in
	"home.html?activeTab=1",
	!MM_FlashUserDemurred(),	// don't install if user said no once
	"noflash.html",
	"noflash.html",
	false
    );
}

// This function opens the main window presized and centered

function openMain( winURL, tabNum ) {
offset = (screen.availWidth - 717) / 2;
tall = Math.min((screen.availHeight-160),470);
mainWin = window.open( winURL + '?activeTab=' + tabNum,'mainWin','toolbar,menubar,scrollbars,resizable,status,location,copyhistory,width=717,height=' + tall + ',top=0,screenY=0,left=' + offset + ',screenX=' + offset);
mainWin.opener.location.href="thankyou.html";
mainWin.focus();
}


// This function checks if visitor came in back door

function checkIt(){
  if(window.name!="mainWin") {  // Checks to see if you came in the back door
    if(window.location.href.indexOf("home.html")!=-1) {tabNum=1};
    if(window.location.href.indexOf("web.html")!=-1) {tabNum=2};
    if(window.location.href.indexOf("software.html")!=-1) {tabNum=3};
    if(window.location.href.indexOf("account.html")!=-1) {tabNum=4};
    if(window.location.href.indexOf("network.html")!=-1) {tabNum=5};
    if(window.location.href.indexOf("analysis.html")!=-1) {tabNum=6};
	dispatchFlash(window.location.href, tabNum);
  }
}


// This disables the right mouse click

var msg="All Material Copyright © 2001-2002 Business Bytes";
function disableIE() {if (document.all) {alert(msg);return false;}
}
function disableNS(e) {
  if (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {alert(msg);return false;}
  }
}
if (document.layers) {
  document.captureEvents(Event.MOUSEDOWN);document.onmousedown=disableNS;
} else {
  document.onmouseup=disableNS;document.oncontextmenu=disableIE;
}
document.oncontextmenu=new Function("alert(msg);return false")


// This parses the document URL for the variables needed in flash navbar intialization

var search1 = "beenHere=";
var beenHereLoc = document.URL.indexOf(search1);
if (beenHereLoc!=-1) {
   start = beenHereLoc+9;
   end = beenHereLoc+10;
   beenHere = unescape(document.URL.substring(start, end));
} else {
  beenHere = "";
}
var search2 = "activeTab=";
var activeTabLoc = document.URL.indexOf(search2);
if (activeTabLoc!=-1) {
   start = activeTabLoc+10;
   end = activeTabLoc+11;
   activeTab = unescape(document.URL.substring(start, end));
} else {
   activeTab = "";
}


//  This function opens an outside link in a separate window with header bar to return to Business Bytes Site

function show_link(pLinkName) {

 // specify window parameters
 linkWin = window.open('','link','scrollbars,resizable,status,menubar,location,toolbar,');

 // write content to window
 linkWin.document.write('<html><head><title>Business Bytes</title></head>');
 linkWin.document.write('<frameset framespacing=0 frameborder=1 border=4 rows="55,*">');
 linkWin.document.write('<frame name=TopFrame src=top_frame.htm noresize scrolling=no>');
 linkWin.document.write('<frame name=OutSideFrame src="' + pLinkName + '">');
 linkWin.document.write('<noframes>');
 linkWin.document.write('<body>');
 linkWin.document.write('This page uses frames, but your browser does not support them.');
 linkWin.document.write('</body>');
 linkWin.document.write('</noframes>');
 linkWin.document.write('</frameset>');
 linkWin.document.write('</html>');
 linkWin.document.close();    
 linkWin.focus();
}


// This function retrieves a cookie by name

// Get cookie routine by Shelley Powers 
function get_cookie(Name) {
   var search = Name + "="
   var returnvalue = "";
   if (document.cookie.length > 0) {
   offset = document.cookie.indexOf(search)
  // if cookie exists
   if (offset != -1) { 
   offset += search.length
  // set index of beginning of value
   end = document.cookie.indexOf(";", offset);
  // set index of end of cookie value
   if (end == -1) end = document.cookie.length;
   returnvalue=unescape(document.cookie.substring(offset, end))
   }
   }
   return returnvalue;
}

// This script opens a new browser window and writes
// HTML to display an image with a title and caption

function show_photo( pFileName, pTitle, pCaption, pWidth, pHeight) {

 // specify window parameters dependant upon screen resolution
 if ( screen.height<768||screen.width<1024) {
 photoWin = window.open( "", "photo", "width=665,height=540,screenX=70,screenY=0,left=70,top=0,scrollbars,resizable");
 } else {
 photoWin = window.open( "", "photo", "width=665,height=620,screenX=170,screenY=40,left=170,top=40");
 }
 // write content to window
 photoWin.document.write('<html><head><title>' + pTitle + '</title></head>');        
 photoWin.document.write('<body style="margin:0px" bgcolor="#006600" link="#0000ff" vlink="#880088">');
 photoWin.document.write('<center>');
 photoWin.document.write('<b>' + pTitle + '</b><br>');        
 if (pWidth != null) {
 photoWin.document.write('<img src="' + pFileName + '" width="' + pWidth + '" height="' + pHeight + '" alt="' + pTitle + '"><br>');
 } else {
  photoWin.document.write('<img src="' + pFileName + '" width="640" height="480" alt="' + pTitle + '"><br>');}
 photoWin.document.write('<font size="-1">' + pCaption + '</font><br>');
 photoWin.document.write('<font face="arial,helvetica" size="-2">');
 photoWin.document.write('photo &copy; Copyright 2002 Business Bytes</font><br>');
 photoWin.document.write('<form><input type="button" value="Close Window" onClick="self.close()"></form>');
 photoWin.document.write('</center></body></html>');
 photoWin.document.close();    
 photoWin.focus();
}


