/* **********************************************************************************************************
Date Written : 08/22/2000
Company      : CRKMedia, LLC (732) 873-9300
Copyright    : (c) 2000, 2001 CRKMedia, LLC All Rights Reserved
Purpose      : Common API libray for CRKI applications
Usage        : This js should be placed in the Dreamweaver Configuration\Shared\CRKI\Scripts folder.
Revisions    :
************************************************************************************************************/

/* **********************************************************************************************************
Variables - Common variables
************************************************************************************************************/
var strCommonAPIVersion = "1.0";

/* **********************************************************************************************************
Objects - Common API Objects
************************************************************************************************************/
/* ----------------------------------------------------------------------------------------------------------
Object      : CommonInfo
Created on  : 10/07/2000
Programmer  : Peter R Lynch (plynch@crkmedia.com)
Description : Common system object that holds information about the Common System
-----------------------------------------------------------------------------------------------------------*/
function CApplicationInfo()
{ //Property declarations

  //Method declarations

  return this;
}
//Method definitions
function CApplicationInfo_AboutBLN() //Common method that displays information about the object
{ alert("Application : " + this.Name + " v" + this.Version + "\n\n" +
        "Company : " + this.Company + "\n\n" +
        "Copyright : " + this.Copyright + "\n\n" +
        "Description : " + this.Description);
  return true;
}
function CApplicationInfo_IsRegisteredBLN() //Common method that indicates if an application is registered
{ return true;
}

//Prototype objects - Used for inheritance

//Prototype properties - Used to create a single reference to a property that propagates to all instances
CApplicationInfo.prototype.Company     = "CRKInteractive, Inc.";
CApplicationInfo.prototype.Address     = "1715 Amwell Road Suite 1A Somerset, NJ 08873";
CApplicationInfo.prototype.Phone       = "732-873-9300";
CApplicationInfo.prototype.Copyright   = "Copyright 2000, 2001";
CApplicationInfo.prototype.Description = "";
CApplicationInfo.prototype.Name        = "";
CApplicationInfo.prototype.Version     = "";

//Prototype methods - Used to create a single reference to a method that propagates to all instances
CApplicationInfo.prototype.About        = CApplicationInfo_AboutBLN;
CApplicationInfo.prototype.IsRegistered = CApplicationInfo_IsRegisteredBLN;

/* **********************************************************************************************************
Functions - Common API functions
************************************************************************************************************/
/* ----------------------------------------------------------------------------------------------------------
Function    : CommonLibraryVersionSTR
Created on  : 08/22/2000
Programmer  : Peter R Lynch (plynch@crkmedia.com)
Description : Returns the version number of the common library
Parameter   : None
Returns     : String version number
-----------------------------------------------------------------------------------------------------------*/
function CommonLibraryVersionSTR()
{ return strCommonAPIVersion;
}
/* ----------------------------------------------------------------------------------------------------------
Function    : IsBlankStringBLN
Created on  : 08/22/2000
Programmer  : Peter R Lynch (plynch@crkmedia.com)
Description : Determines if the supplied string is blank or not
Parameter   : strCheck - This argument is the string that needs to be checked
Returns     : true or false
-----------------------------------------------------------------------------------------------------------*/
function IsBlankStringBLN(strCheck)
{ if(strCheck == null) return (true);
	if(strCheck.length != 0) return (false); else	return (true);
}
/* ----------------------------------------------------------------------------------------------------------
Function    : IsEmptyStringBLN
Created on  : 08/22/2000
Programmer  : Peter R Lynch (plynch@crkmedia.com)
Description : Determines if the supplied string is blank or filled with useless white space
Parameter   : strCheck - This argument is the string that needs to be checked
Returns     : true or false
-----------------------------------------------------------------------------------------------------------*/
function IsEmptyStringBLN(strCheck)
{ return IsBlankStringBLN(TrimSpacesSTR(strCheck));
}
/* ----------------------------------------------------------------------------------------------------------
Function    : IsIntegerBLN
Created on  : 08/22/2000
Programmer  : Peter R Lynch (plynch@crkmedia.com)
Description : Determines if a value is an integer value
Parameter   : intValue
Returns     : true or false
-----------------------------------------------------------------------------------------------------------*/
function IsIntegerBLN(intValue)
{ var strValue = '' + intValue;
  if(strValue.length == 0)
  { return false;
  }
  else
  { var strRef = "1234567890";
    var intI;
	  for (intI = 0; intI < strValue.length; intI++)
	  { var strTempChar = strValue.substring (intI, intI + 1);
  		if(strRef.indexOf(strTempChar, 0) == -1) return false;
  	}
  }
	return true;
}
/* ----------------------------------------------------------------------------------------------------------
Function    : TrimSpacesSTR
Created on  : 08/22/2000
Programmer  : Peter R Lynch (plynch@crkmedia.com)
Description : Trims a string of any extraneous spaces
Parameter   : strTrim - string that needs trimming
Returns     : trimmed string
-----------------------------------------------------------------------------------------------------------*/
function TrimSpacesSTR(strTrim)
{ var blnLoopCtrl = true;
  var strTemp;
  while (blnLoopCtrl)
  { if(strTrim.indexOf("  ") != -1)
    { strTemp = strTrim.substring(0, strTrim.indexOf("  "))
      strTrim = strTemp + strTrim.substring(strTrim.indexOf("  ") + 1, strTrim.length)
    }
    else
    { blnLoopCtrl = false;
    }
  }
  if (strTrim.substring(0, 1) == " ") strTrim = strTrim.substring(1, strTrim.length)
  if (strTrim.substring(strTrim.length - 1) == " ") strTrim = strTrim.substring(0, strTrim.length - 1)
  return (strTrim);
}
