/************************************\
* Customerservicedesk.net Javascript *
*         Magic Version 2.3          *
*                                    *
*             Coded By..             *
*                                    *
*        Šlint "Ripperjack" H.       *
*            ICQ: 9497025            *
\************************************/
	
var countryEx = new Array("asx", "tsx", "jse", "lse", "nasdaq", "nyse", "us");
var countryList = new Array("Australia", "Canada", "South Africa", "United Kingdom", "USA - NASDAQ", "USA - NYSE", "USA - All Exchanges");
var firstIn;
var helpPopUp;
var isIE = ( document.all ) ? true : false;
var isHelpWindowOpen = false;
var macOSList = new Array("MacOS 6 or earlier", "MacOS 7", "MacOS 8", "MacOS 9", "MacOS 10", "Other");
var netscapeWindowCounter = 0;
var pcOSList = new Array("Windows 95", "Windows 98", "Windows ME", "Windows 2000", "Windows XP", "Linux/Unix", "Other");
var selectThisOS;

searchNowUP = new Image; searchNowUP.src="images/searchup.gif";
searchNowDWN = new Image; searchNowDWN.src="images/searchdwn.gif";

function adobeLink( hoverEvent )
{
	
	if ( isIE )
	{
		
		if ( hoverEvent )
		{
			document.all.pdfDownLoad.className = "adobeLinkHover";
		}
		else
		{
			document.all.pdfDownLoad.className = "adobeLink";		
		}
	}
}

function alertOtherOS( passedInForm )
{
	var selection = passedInForm.OSselect.options[passedInForm.OSselect.selectedIndex].value;

	if ( selection == "Other" )
	{
		var alertUnknown = "Attention!!\n\n";
		alertUnknown += "Please specify your computer Operating System\n"
		alertUnknown += "within the text box below, with the details\n";
		alertUnknown += "of your problem.";

		alert(alertUnknown);
	}
}

function bottomPosition()
{
	
	if ( isIE )
	{	
		var thisClientHeight = document.body.clientHeight;
		var thisScrollHeight = document.body.scrollHeight;
			
		if ( thisScrollHeight <= thisClientHeight )
		{
			thisClientHeight -= 50;
			eval("bottomRow.style.pixelTop=" + thisClientHeight);
		}
	}
}

function bounceToFeedback()
{
	var goToThisPage = "";
	
	if ( isIE )
	{
		goToThisPage = "feedback.asp";
	}
	else
	{
		goToThisPage = "nscapeshtfb.asp";
	}

	window.location.href = goToThisPage;
}

function browserToggle( showThisStatusText, linkID, hoverEvent )
{
	statusText( showThisStatusText );
	
	if ( isIE )
	{

		if ( hoverEvent )
		{
			eval( "document.all.get" + linkID + ".className = 'browserDownloadHover'" );
		}
		else
		{
			eval( "document.all.get" + linkID + ".className = 'browserDownload'" );
		}
	}
	
	return true;
}

function checkFormFields( fieldArray, fieldType, friendlyNameArray, formRef, formName, checkForOther, exchangeListExists )
{
	var addToAlertString;
	var alertString;
	var contentsOfField;
	var lengthOfFieldList;
	var radioCounter;
	var thisExchangeValue;
	
	addToAlertString = "";
	lengthOfFieldList = fieldArray.length

	for( var eachFieldNumber = 0; eachFieldNumber < lengthOfFieldList; eachFieldNumber++ )
	{

    contentsOfField = eval( "document.forms." + formName + "." + fieldArray[eachFieldNumber] + ".value" );

		if ( fieldType[eachFieldNumber] == "L" )
		{
		
		  if ( !isIE )
		  {	  
		    contentsOfField = eval( "document.forms." + formName + "." + fieldArray[eachFieldNumber] + ".options[" + "document.forms." + formName + "." + fieldArray[eachFieldNumber] + ".selectedIndex].value" );
		  }
		
		  if ( contentsOfField == "nil" || contentsOfField == null || contentsOfField.length == 0 )
		  {
 
 				if ( addToAlertString.length > 0 )
				{
					addToAlertString += ",\n";
  			}
		
				addToAlertString += friendlyNameArray[eachFieldNumber] + " has not been specified";
			}
		}
    else
    {

  		if ( contentsOfField == null || contentsOfField.length == 0 )
	  	{
	
		  	if ( addToAlertString.length > 0 )
			  {
  				addToAlertString += ",\n";
	  		}
		
		  	addToAlertString += friendlyNameArray[eachFieldNumber];
		  }
		}		

		if ( fieldType[eachFieldNumber] == "N" )
		{

			if ( isNaN( contentsOfField ))
			{

				if ( addToAlertString.length > 0 )
				{
					addToAlertString += ",\n";
				}
		
				addToAlertString += friendlyNameArray[eachFieldNumber] + " needs a numerical value";
			}
		}
			
		if ( fieldType[eachFieldNumber] == "E" && contentsOfField != null && contentsOfField.length > 0 )
		{
			
			var malpassedInFormedEmail = false;
			var posOfAt = contentsOfField.indexOf("@");
			
			if ( posOfAt == -1 )
			{

				if ( addToAlertString.length > 0 )
				{
					addToAlertString += ",\n";
				}
		
				addToAlertString += friendlyNameArray[eachFieldNumber] + " is missing the '@' character";			
			}

			posOfAt += 2;
				
			if ( contentsOfField.length < posOfAt )
			{
				malpassedInFormedEmail = true;				
			}
			else
			{
				
				if ( contentsOfField.indexOf(".", posOfAt) == -1 )
				{
					malpassedInFormedEmail = true;				
				}
				else
				{
	
					if ( eval(contentsOfField.indexOf(".", posOfAt) + 1) == contentsOfField.length )
					{
						malpassedInFormedEmail = true;				
					}
				}
			}
				
			if ( malpassedInFormedEmail )
			{

				if ( addToAlertString.length > 0 )
				{
					addToAlertString += ",\n";
				}
		
				addToAlertString += friendlyNameArray[eachFieldNumber] + " appears to be malformed";			
			}				
		}

		if ( fieldType[eachFieldNumber] == "S" && contentsOfField != null && contentsOfField.length > 0 )
		{

			var isPoppedUpBadCharAlert = false;
     	var isThereABadCharacter;
			
		  for ( var stringCounter = 0; stringCounter < contentsOfField.length; stringCounter++ )
		  {

			  isThereABadCharacter = false;

       	if ( contentsOfField.charCodeAt(stringCounter) < 65 )
       	{
            
          if ( contentsOfField.charCodeAt(stringCounter) != 32 )
          {             
          	isThereABadCharacter = true;
          }
        }
        else
        {
            
         	if ( contentsOfField.charCodeAt(stringCounter) > 90 && contentsOfField.charCodeAt(stringCounter) < 97 )
         	{
            isThereABadCharacter = true;
          }
          else
          {
               
		   		  if ( contentsOfField.charCodeAt(stringCounter) > 122 )
						{
						  isThereABadCharacter = true;
           	}
          }
        }

        if ( isThereABadCharacter && !isPoppedUpBadCharAlert )
        {

          if ( addToAlertString.length > 0 )
          {
            addToAlertString += ",\n";
          }
		
          addToAlertString += friendlyNameArray[eachFieldNumber] + " contains invalid characters";
          isPoppedUpBadCharAlert = true;
        }
      }
    }
  }

	if ( exchangeListExists )
  {

    for ( radioCounter = 0; radioCounter < formRef.exchangeSelect.length; radioCounter++ )
    {
		
      if ( formRef.exchangeSelect[radioCounter].checked )
      {
        thisExchangeValue = formRef.exchangeSelect[radioCounter].value;
      }
    }

    if ( thisExchangeValue == null )
    {

      if ( addToAlertString.length > 0 )
      {
        addToAlertString += ",\n";
      }

      addToAlertString += "No selection checked from exchange list";	
    }
  }

  if ( checkForOther )
  {

    if ( formRef.exchangeSelect[7].checked )
    {
      
      if ( formRef.otherExchange.value == "" )
      {

        if ( addToAlertString.length > 0 )
        {
          addToAlertString += ",\n";
        }

        addToAlertString += "No country name specified";	
      }
    }
    else
    {
      formRef.otherExchange.value = "";      
    }
  }		
		
  if ( addToAlertString.length > 0 )
  {
    alertString = "Warning!!\n\n";
    alertString += "The following fields are missing or are invalid:\n\n";
    alertString += addToAlertString + "\n\n";
    alertString += "Please try again.";
		
    alert( alertString );	
  }
  else
  {
    formRef.submit();
  }

	return true;
}

function checkMiniSearch()
{
  
	if ( document.forms.miniSearch.searchTerm.value.length > 0 )
  {
		return true;
  }
  else
  {
    var alertString = "Attention!!\n\n";
    alertString += "You need to enter a keyword before you can run the search again."

    alert( alertString );

    return false;
  }
}

function clearForm( formRef )
{
  formRef.newSearchTerm.value = "";
  formRef.useTheAnd[0].checked = true;
}

function clearOtherBox( formRef )
{
	formRef.otherExchange.value = "";
}  

function closeWindow( windowRef, whichWindow )
{

	if ( parseInt(navigator.appVersion) > 3 )
	{
	
		if ( windowRef != null )
		{
			windowRef.close();
			windowRef = null;
		}
	}
		
	window.status = "";
	
	switch( whichWindow )
	{
		case "help" :
			isHelpWindowOpen = false;
			break;
			
		default:
			alert( "Unknown window reference!\nCheck 'closeWindow' function." );	
	}
		
	return true;
}

function fillArray( popArray, passedInForm )
{
	passedInForm.OSselect.options.length = 0;

	for( var counter = 0; counter < popArray.length; counter++ )
	{
		passedInForm.OSselect.options[counter] = new Option( popArray[counter], popArray[counter] );

		if ( popArray[counter] == selectThisOS )
		{
			passedInForm.OSselect.options[counter].selected = true;	
		}
		else
		{
			passedInForm.OSselect.options[counter].selected = false;	
		}
	}
}

function fillCountry( passedInForm, countryFromCookie )
{
	var checkForCookie = "";
	var softwareType = passedInForm.yourSoftware.options[passedInForm.yourSoftware.selectedIndex].value;

	if ( isIE )
	{
		passedInForm.countrySelect.options.length = 0;
	}

	if ( softwareType != "nil" && softwareType != undefined )
	{

		if ( countryFromCookie != "" && countryFromCookie != null )
		{
			checkForCookie = countryFromCookie;
		}
		else
		{
			checkForCookie = "asx";
		}

		if ( softwareType == "gg" )
		{
			passedInForm.countrySelect.options[0] = new Option( "Canada", "tsx" );
			passedInForm.countrySelect.options[1] = new Option( "United States of America", "us" );
			passedInForm.countrySelect.options[2] = new Option( "United Kingdom", "lse" );

			if ( checkForCookie == "us" )
			{
				passedInForm.countrySelect.options[1].selected = true;
			}
			else
			{
				passedInForm.countrySelect.options[0].selected = true;
			}
  	  
			passedInForm.countrySelect.options.length = 3;
		}
		else if ( softwareType == "pro" )
		{
			passedInForm.countrySelect.options[0] = new Option( "Australia", "asx" );
			passedInForm.countrySelect.options[0].selected = true;
			passedInForm.countrySelect.options.length = 1;
		}
		else
		{
    
			for( var counter = 0; counter < countryEx.length; counter++ )
			{
				passedInForm.countrySelect.options[counter] = new Option( countryList[counter], countryEx[counter] );

				if ( countryEx[counter] == checkForCookie )
				{
					passedInForm.countrySelect.options[counter].selected = true;	
				}
				else
				{
					passedInForm.countrySelect.options[counter].selected = false;	
				}
			}

			passedInForm.countrySelect.options.length = countryEx.length;  		
		}
	}
	else
	{
    
		if ( !isIE )
		{
	  	
			for( var counter = 0; counter < 7; counter++ )
			{
				passedInForm.countrySelect.options[counter] = new Option( "..............................." );
			}
		}
	} 
}

function getThisFile( basePath, yearBit, fileBit )
{
	var fullpath = basePath + "/" + yearBit + "/" + fileBit;
  var timeObj;
    
  timeObj = setTimeout("window.location.href = '" + fullpath + "'", 1000);
}

function genToggle( imageName, toggle, statusMessage, allImage )
{

	if ( allImage != null )
  {
    document.images[imageName].src = eval( allImage + toggle + ".src" )
  }
	else
  {
    document.images[imageName].src = eval( imageName + toggle + ".src" )
  }
	
	if ( statusMessage != "" )
  {
    window.status = statusMessage;
  }
	else
  {
    window.status = "";
  }
	
	return true;
}

function goSearchHereNow( restartHere, formRef )
{
	formRef.goSearchHere.value = restartHere;
  formRef.submit();
}

function homeMenu( linkID, toggle, showThisStatusText, hoverEvent )
{
	var fullImageName = linkID + "Img";
	
	document.images[fullImageName].src = eval( linkID + toggle + ".src" );
		
	statusText( showThisStatusText );
	
	if ( isIE )
	{

		if ( hoverEvent )
		{
			eval( "document.all." + linkID + "Text.className = 'hoverOverhomeLink'" );
		}
		else
		{
			eval( "document.all." + linkID + "Text.className = 'homeLink'" );
		}
	}
	
	return true;
}

function makeExchangeValue( passedInForm )
{

  if ( passedInForm.countrySelect.selectedIndex != -1 )
  {
	  passedInForm.exchangeSelect.value = passedInForm.countrySelect.options[passedInForm.countrySelect.selectedIndex].value + "+" + passedInForm.yourYears.options[passedInForm.yourYears.selectedIndex].value;
	}	  
}

function moveSplashMessage()
{

	if ( isIE )
	{
		eval("splashMsg.style.pixelTop =" + eval("(document.body.clientHeight / 2) - 150"));
		eval("splashMsg.style.pixelLeft =" + eval("(document.body.clientWidth / 2) - 220"));	
	}
	else
	{
		eval("document.splashMsg.top =" + eval("(window.innerHeight / 2) - 150"))	
		eval("document.splashMsg.left =" + eval("(window.innerWidth / 2) - 220"))
	}
}

function openHelpPopUp( openThisPage, myWidthIs, myHeightIs )
{

	if ( isHelpWindowOpen )
	{
		closeWindow( helpPopUp, "help" );
	}	

  if ( myWidthIs == 0 || myWidthIs == null )
  {
    myWidthIs = 500
  }

	var printChrome = "width=" + myWidthIs.toString() + ",";
	printChrome += "height=" + myHeightIs.toString() + ",";
	printChrome += "toolbar=no,";
	printChrome += "location=no,";
	printChrome += "directories=no,";
	printChrome += "status=yes,";
	printChrome += "menubar=no,";
	printChrome += "scrollbars=yes,";
	printChrome += "resizable=yes";

	if ( parseInt(navigator.appVersion) > 3 )
	{
		printChrome += (isIE) ? ",top=" : ",screenY=";
		printChrome += "0";
		printChrome += (isIE) ? ",left=" : ",screenX=";
		printChrome += "0";
	}

	helpPopUp = window.open( "", "", printChrome );
	helpPopUp.window.location.href = openThisPage;	
	isHelpWindowOpen = true;
}
	
function placeSplashMessage()
{
	var halfHeight = 0;
	var halfWidth = 0;
	var writeHTML = "";

	if (isIE)
	{
		halfHeight = ( document.body.clientHeight / 2 ) - 150;
		halfWidth = ( document.body.clientWidth / 2 ) - 220;
	
		writeHTML = "<div id='splashMsg' style='position:absolute\; visibility:show\; left:" + halfWidth + "px\; top:" + halfHeight + "px'>";
		writeHTML += writeSplashHTML();
		writeHTML += "</div>";
	}
	else
	{
		halfHeight = ( window.innerHeight / 2 ) - 150;
		halfWidth = ( window.innerWidth / 2 ) - 220;
	
		writeHTML = "<layer id='splashMsg' left='" + halfWidth + "' top='" + halfHeight + "' visibility='visible'>";
		writeHTML += writeSplashHTML();
		writeHTML += "</layer>";
	}	
	
	document.write( writeHTML );
}

function populateOS( passedInForm )
{
	var selection = passedInForm.CPUSelect.options[passedInForm.CPUSelect.selectedIndex].value;

	if ( selection == "Other" )
	{
		
		if ( firstIn )
    {
			firstIn = false;  
		}
		else
		{		
			var alertUnknown = "Attention!!\n\n";
			alertUnknown += "Please specify your computer specifications\n"
			alertUnknown += "within the text box below, with the details\n";
			alertUnknown += "of your problem.";

			alert(alertUnknown);
		}

		passedInForm.OSselect.options.length = 0;
		passedInForm.OSselect.options[0] = new Option( "Other", "Other" );
		passedInForm.OSselect.options[0].selected = true;	
	}
	else
	{

		if ( selection == "Apple Macintosh" )
		{
			fillArray( macOSList, passedInForm );
		}
		else
		{
			fillArray( pcOSList, passedInForm );
		}
	}
}

function resetDownloadPage()
{
  document.forms.formValDetails.reset();  
  showSoftware( false );
}

function runMiniSearch()
{

	if ( document.forms.miniSearch.searchTerm.value.length > 0 )
  {
    document.forms.miniSearch.submit()
  }
  else
  {
    var alertString = "Attention!!\n\n";
    alertString += "You need to enter a keyword before you can run the search again."

    alert( alertString );
  }
}

function runNewSearch()
{

  if ( document.forms.searchMe.newSearchTerm.value.length > 0 )
  {
    document.forms.searchMe.searchTerm.value = document.forms.searchMe.newSearchTerm.value;

    if ( document.forms.searchMe.useTheAnd[0].checked == true )
    {
			document.forms.searchMe.goWithAnd.value = true;
    }
    else
    {
      document.forms.searchMe.goWithAnd.value = false;
    }

    document.forms.searchMe.goSearchHere.value = 0;

    return true;
  }
	else
	{
    var alertString = "Attention!!\n\n";
    alertString += "You need to enter a keyword before you can run the search again."

    alert( alertString );

    return false;
	}
}

function setAttachImages()
{
	attachUP = new Image; attachUP.src="images/afileup.gif";
	attachDWN = new Image; attachDWN.src="images/afiledown.gif";
	removeUP = new Image; removeUP.src="images/rfileup.gif";
	removeDWN = new Image; removeDWN.src="images/rfiledown.gif";
}


function setDownloadImages()
{
	downloadON = new Image; downloadON.src="images/downloadon.gif";
	downloadUP = new Image; downloadUP.src="images/downloadup.gif";
	downloadDWN = new Image; downloadDWN.src="images/downloaddwn.gif";
}

function setHomeImages()
{
	aaqUP = new Image; aaqUP.src="images/hbaaqup.gif";
	aaqDWN = new Image; aaqDWN.src="images/hbaaqdwn.gif";
	faqUP = new Image; faqUP.src="images/hbfaqup.gif";
	faqDWN = new Image; faqDWN.src="images/hbfaqdwn.gif";
	fvUP = new Image; fvUP.src="images/hbfvup.gif";
	fvDWN = new Image; fvDWN.src="images/hbfvdwn.gif";
	ldUP = new Image; ldUP.src="images/hbldup.gif";
	ldDWN = new Image; ldDWN.src="images/hblddwn.gif";
	nlUP = new Image; nlUP.src="images/hbnlup.gif";
	nlDWN = new Image; nlDWN.src="images/hbnldwn.gif";
}

function setVNCImages()
{
	vncON = new Image; vncON.src="images/vncon.gif";
	vncOFF = new Image; vncOFF.src="images/vncoff.gif";
}

function setNetscapeQuestionType()
{
	var queryStringID = window.location.search;
	var questionToSelect;

	if ( queryStringID != "" )
	{
		questionToSelect = parseInt( queryStringID.substring( queryStringID.length - 1, queryStringID.length ));		
	}
	else
	{
		questionToSelect = 0;
	}
		
	with( document.forms.emailDetails )
	{
		questionType.options[questionToSelect].selected = true;
	}			
}

function showComputerStuff( passedInForm )
{
	var itemSelected = passedInForm.questionType.options[passedInForm.questionType.selectedIndex].value;

	if ( itemSelected == 1 )
	{
		
		if ( isIE )
		{

			if ( computerStuff.style.display != "block")
			{
				computerStuff.style.display = "block";
			}
		}
		else
		{
			window.location.href = "nscapelngfb.asp";
		}				
	}
	else
	{

		if ( isIE )
		{
	
			if ( computerStuff.style.display != "none")
			{
				computerStuff.style.display = "none";
			}
		}
		else
		{
			window.location.href = "nscapeshtfb.asp?nqt=" + itemSelected;
		}				
	}
}

function statusText( textToShow )
{

	if ( textToShow != "" && textToShow != null )
	{
		window.status = textToShow;
	}
	else
	{
		window.status = "";
	}
		
	return true;
}
	
function updateOSAfterCookie( nameOfTheForm )
{
	var buildFormAddress = eval( "document.forms." + nameOfTheForm );
	
	populateOS( buildFormAddress )
}
	
function writeSplashHTML()
{
  var txt = "<table width=440 border=0 cellpadding=0 cellspacing=20>\n";
	txt += "  <tr>\n";
	txt += "    <td align=center><img src=images/standby.gif width=200 height=206></td>\n";
	txt += "  </tr>\n";
	txt += "  <tr>\n";
	txt += "    <td align=center>\n";
	txt += "      <font color=#008080 face=Arial,Helvetica,sans-serif><strong>Now re-directing you to...</strong><br>\n";
  txt += "      <font size=6>Customer Service Desk .Net</font></font>\n";
	txt += "    </td>\n";
  txt += "  </tr>\n";
  txt += "</table>\n";
		
	return txt;	
}