/* Functions Created By Tom Duffy, DHTML Pro
   Click Event Functions Created by Cassius T. Josey
   Functions Customized by Cassius T. Josey
   Last Updated: Sept.7,2001
   
   File was created for developers at G.W.Henssler & Assoc. to have centralized distribution and control over all validation, formatting, and click events in application development.
*/

/*The following Validated user's below have authorization to do the following
	Execute ETickets
	Delete ETickets
	Create MFUpload from ETickets
	Create MasterAllocation from ETickets
	ReRoute Pending Tickets to ETickets
	ReRoute Pending Tickets to Block Monthly Trading
	ReRoute Pending Tickets to Block-ATB
*/
//document.onmousedown=click
var times=0
var times2=10

/*
    function click() {


        if ((event.button==2) || (event.button==3)) {
        if (times>=10) { bye() }
        alert("Sorry this website doesn't support that function!!."); 
        times++ } }


            function bye() {
            alert("Sorry I warned you.");
            bye() }
		*/	

var newwindow;
function openWindow(url,winName,wt,ht,res,scr)
{
	if(name == "")
	name = "win1";
	if(wt == "")
	wt = "450";
	if(ht == "")
	ht = "475";
	if(res == "1")
	res = "resizable,"
	else
	res = ""
	if(scr == "1")
	scr = "scrollbars,"
	else
	scr = ""
	newwindow=window.open(url,winName,res + scr + 'width=' + wt + ',height=' + ht + ',scrolling=' + scroll);
	if (window.focus) {newwindow.focus()}
}

function alphanumeric(alphane)
{
 var numaric = alphane;
 for(var j=0; j<numaric.length; j++)
  {
    var alphaa = numaric.charAt(j);
    var hh = alphaa.charCodeAt(0);
    if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
    {
    }
  else {
    return false;
    }
  }
 return true;
}
/*
function playVoiceMail(iPath,iName,iCount,iSize,iDate)
{
	document.write("<li><a href=""" + iPath + iName + """>");
	document.write("Message " + iCount + "</a> - " + iSize + " bytes");
	document.write("<br>" + iDate + "." + "</li>");
}
*/
function showAudio(client,service,file,call,color,param,param,param,param,param)
{
		if(color != "")
		{
			color = strip("#",color)
		}
		else
		{
			color = "FFFFFF"
		}
		document.write("<OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 WIDTH=75 HEIGHT=30 id=test ALIGN=>");
		document.write("<PARAM NAME=movie VALUE=http://www." + service + ".com/global/images/Flash/iUnityCity.swf?iColor=0x" + color + "&iExt=" + client + "&iExtFile=" + client + file + "&iAddress=http://www." + service + ".com/global/usersconnectcollect/>");
		document.write("<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF></OBJECT>");
		document.write("<EMBED src=http://www." + service + ".com/global/images/Flash/iUnityCity.swf?iColor=0x" + color + "&iExt=" + client + "&iExtFile=" + client + file + "&iAddress=http://www." + service + ".com/global/usersconnectcollect/ quality=high bgcolor=white  WIDTH=1 HEIGHT=1 NAME=test ALIGN= TYPE=application/x-shockwave-flash PLUGINSPAGE=http://www.macromedia.com/go/getflashplayer> ");
		document.write("</EMBED> ");

		if(call != "")
		{
			document.write("<a href=# onclick=javascript:openWindow('http://www." + service + ".com/" + client + "','profile',800,675,1,1)>");
			document.write("<font size=-1>" + call + "</font></a>");
		}
}

function showAudioDONTWORK(client,service,file,call,param,param,param,param,param,param)
{
	var Fo =new ActiveXObject("Scripting.FileSystemObject");
	var StrOut = new String();
	var FileName = new String();
	var Extention = new String();

	function FindFile(FOo)
	{
		var FSo = new Enumerator(FOo.Files);
		var counter;
		counter = 0;
		for(i=0;!FSo.atEnd();FSo.moveNext())
		{
			if(FileName == "*" ||  FSo.item().name.slice(0,FSo.item().name.lastIndexOf(".")).toLowerCase().indexOf(FileName)>-1)
				if(Extention == "*" || FSo.item().name.slice(FSo.item().name.lastIndexOf(".")+1).toLowerCase().indexOf(Extention)>-1)
				{
					counter = counter + 1;
				}
		}
		if(counter > 0)
			return true;
		else
			return false;
	}

	function Scan()
	{
		FileName = (search.value.lastIndexOf(".")>-1)? search.value.slice(0,search.value.lastIndexOf(".")):(search.value.length>0)? search.value.toLowerCase():"*"; //Get Searched File Name
		Extention = (search.value.lastIndexOf(".")>-1)? search.value.slice(search.value.lastIndexOf(".")+1).toLowerCase():"*"; // Get Searched File Extention Name
		if(path.value.length>0 && Fo.FolderExists(path.value))
		{
			if(FindFile(Fo.GetFolder(path.value)))
			{
				document.write("<OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 WIDTH=75 HEIGHT=30 id=test ALIGN=>");
				document.write("<PARAM NAME=movie VALUE=http://www.connectcollect.com/global/images/Flash/iUnityCity.swf?iExt=" + client + "&iExtFile=" + client + file + "&iAddress=http://www.connectcollect.com/global/usersconnectcollect/>");
				document.write("<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF></OBJECT>");
				if(call != "")
				{
					document.write("<a href=# onclick=javascript:openWindow('http://www." + service + ".com/" + client + "','profile',800,675,1,1)>");
					document.write("<font size=-1>" + call + "</font></a>");
				}
			}
		}
	}
	Scan();
}

function KeyPress(what,e,max,action) {
    if (document.layers) {
        if (e.target.value.length >= max)
            eval(action);
    }
    else if (document.all) {
        if (what.value.length > (max-1))
            eval(action);
    }
}

with (document)
{
	write("<STYLE TYPE='text/css'>");
	//if (navigator.appName == 'Microsoft Internet Explorer')
		//{
		write(".hiddentext {display:none}  .outline {cursor:hand;}");
		//}
	write("</STYLE>");
}

function NotLoggedIn(url)
						{
							//msg="To send a mail message, you need to create a UnityCity-<%= Request.Cookies("GlobalClient") %> Account or Login. If you'd rather do this later, click Cancel. ";
							//if(confirm(msg))
							location.replace(url);
						}
						
function strip(filter,str)	//Filters data within a string
{
      var i,curChar;
      var retStr = '';
      var len = str.length;
      for(i=0; i<len; i++)
	  {
         curChar = str.charAt(i);
         if(filter.indexOf(curChar)<0) 
           //not in filter, keep it
            retStr += curChar;
      }
      return retStr;
}

function reformat(str)  //Reformats a string
{
      var arg;
      var pos = 0;
      var retStr = '';
      var len = reformat.arguments.length;
      for(var i=1; i<len; i++)
	  {
         arg = reformat.arguments[i];
         if(i%2==1)
            retStr += arg;
         else
		 {
            retStr += str.substring(pos, pos + arg);
            pos += arg;
         }
      }
      return retStr;
}	 


function notEmpty(str)	//Checks to see if the text field is empty Note* Used for text fields only
{
      if(strip(" \n\r\t",str).length ==0)
         return false;
      else
         return true;
}

//Validation functions
function validateInteger(str)
{
      str = strip(' \n\r\t',str);
      //remove leading zeros, if any
      while(str.length > 1 && str.substring(0,1) == '0')
	  {
         str = str.substring(1,str.length);
      }
      var val = parseInt(str);
      if(isNaN(val))
         return false;
      else
         return true;
}
   
function validateFloat(str)
{
      str = strip(' \n\r\t',str);
      //remove leading zeros, if any
      while(str.length > 1 && str.substring(0,1) == '0')
	  {
         str = str.substring(1,str.length);
      }
      var val = parseFloat(str);
      if(isNaN(val))
         return false;
      else
         return true;
} 

function validateUSPhone(str)
{
      str = strip("*() -./_\n\r\t\\",str);
      if((str.length==0)||(str.length == 10 || str.length == 7))
         return true;
      else
         return false;
}
   
function validateSSN(str)
{
      str = strip(" -.\n\r\t",str);
      if((str.length==0)||(validateInteger(str) && str.length == 9))
         return true;
      else
         return false;
}

function validateZip(str)
{
      str = strip("- \n\r\t",str);
      if(validateInteger(str) && (str.length==9 || 
         str.length==5))
      	return true;
      else
       	return false;
}

function validateCC(str,type)
{
      str = strip("-./_\n\r\t\\",str);
      if(type=="1")	//VisaCard 
         if(str.charAt(0)!="4")	
            return false;
      if(type=="2")	//MasterCard
         if(str.charAt(0)!="5")
            return false;
      if(type=="3")	//DiscoverCard
         if(str.charAt(0)!="6")
            return false;
      if(type=="4")	//AmericanExpressCard
         if(str.charAt(0)!="3")
            return false;
      if(validateInteger(str) && ((str.length==15 && type=="4") || str.length==16))
         return true;
      else
         return false;
}

 function daysInFebruary (year){
 // February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n) {
 for (var i = 1; i <= n; i++) 
 {
  this[i] = 31;
  if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
  if (i==2) {this[i] = 29;}
   } 
   return this;
}
 
function isDate(myfield)
{
 dtStr = myfield.value;
 if(dtStr != "")
 {
  var dtCh= "/";
  var minYear=1900;
  var maxYear=2100;
  var daysInMonth = DaysArray(12);
  var pos1=dtStr.indexOf(dtCh);
  var pos2=dtStr.indexOf(dtCh,pos1+1);
  var strMonth=dtStr.substring(0,pos1);
  var strDay=dtStr.substring(pos1+1,pos2);
  var strYear=dtStr.substring(pos2+1);
  strYr=strYear;
  if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1);
  if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1);
  for (var i = 1; i <= 3; i++) {
   if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1);
  }
  month=parseInt(strMonth);
  day=parseInt(strDay);
  year=parseInt(strYr);
  if (pos1==-1 || pos2==-1){
   alert("That does not appear to be a valid date.  The format should be mm/dd/yyyy.");
   myfield.focus();
   return false;
  }
  if (strMonth.length<1 || month<1 || month>12){
   alert("That does not appear to be a valid date.");
   myfield.focus();
   return false;
  }
  if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
   alert("That does not appear to be a valid date.  The format should be mm/dd/yyyy.");
   myfield.focus();
   return false;
  }
  if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
   alert("That does not appear to be a valid date.  The format should be mm/dd/yyyy.");
   myfield.focus();
   return false;
  }
  if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
   alert("That does not appear to be a valid date.  The format should be mm/dd/yyyy.");
   myfield.focus();
   return false;
  }
  
 }
 return true;
}
   
function validateDate(str)
{
      var dateVar = new Date(str);
      if(isNaN(dateVar.valueOf()) || 
         (dateVar.valueOf() ==0))
         return false;
      else
         return true;
}
   
function validateEMail(str)
{
      str = strip(" \n\r\t",str);
      if(str.indexOf("@") > -1 && str.indexOf(".") > -1)
         return true;
      else
         return false;
}

function emailCheck (emailStr) {

/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

//alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
//alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
//alert("Ths domain name contains invalid characters.");
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

//alert("The username doesn't seem to be valid.");
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
//alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
//alert("The domain name does not seem to be valid.");
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
//alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {
//alert("This address is missing a hostname!");
return false;
}

// If we've gotten this far, everything's valid!
return true;
}

//  End -->
//End Validation functions

//Formatting functions
   function formatPhone(str){
      str = strip("*() -./_\n\r\t\\",str);
      if(str.length==10)
         return reformat(str,"(",3,")",3,"-",4);
      else if(str.length==7)
         return reformat(str,"",3,"-",4);
      else
		 return str;
   }
   
   function formatSSN(str){
      str = strip(" -.\n\r\t",str);
      return reformat(str,"",3,"-",2,"-",4);
   }
   
   function formatZip(str){
      str = strip("- \n\r\t",str);
      if(str.length==5)
         return str;
      if(str.length==9)
         return reformat(str,"",5,"-",4);
   }
   
   function formatCC(str,type){
      str = strip("-./_\n\r\t\\",str);
      switch(type){
         case "1": 
            return reformat(str,"",4,"-",4,"-",4,"-",4);
            break;
         case "2": 
            return reformat(str,"",4,"-",4,"-",4,"-",4);
            break;
         case "3": 
            return reformat(str,"",4,"-",4,"-",4,"-",4);
            break;
         case "4":
            return reformat(str,"",4,"-",6,"-",5);
      }
   }
   function formatDate(str,style){
      var dateVar = new Date(str);
      var year = dateVar.getYear();
      if(year<10)
         year += 2000;
      if(year<100)
         year += 1900;
      switch(style){
         case "MM/DD/YY":
            return (dateVar.getMonth() + 1) + "/" + 
              dateVar.getDate() + "/" + year;
            break;
         case "DD/MM/YY":
            return dateVar.getDate() + "/" + 
              (dateVar.getMonth() + 1) + "/" + year;
            break;
         case "Month Day, Year":
            return getMonthName(dateVar) + " " + 
              dateVar.getDate() + ", " + year;
            break;
         case "Day, Month Day, Year":
            return getDayName(dateVar) + ", " + 
              getMonthName(dateVar) + " " + 
              dateVar.getDate() + ", " + year;
            break;
         default:
            return (dateVar.getMonth() + 1) + "/" + 
              dateVar.getDate() + "/" + year;
            break;
      }
   }
   
   function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num + '.' + cents);
}

function makeUpper(param)
{
var upperVal
param = strip(' ',param);
upperVal = param.charAt(0);
upperVal = upperVal.toUpperCase();
param = upperVal + param.substring(1,param.length)
return param;
}
   //End Formatting Functions



//Click Event Functions 

function checknum(objName) {
var fld = objName;
if (isNaN(fld.value)) {
fld.select();
alert("Please enter a valid number.");
fld.focus();	
return false;
}
else {
return true;
   }
}

function checkdate(objName) {
var datefield = objName;
if (chkdate(objName) == false) {
datefield.select();
alert("Please enter a valid date and make sure it doesn't contain any letters, dashes(-), commas(,) or spaces;\n Ex. 1/1/2001 or 1/1/01.");
datefield.focus();
return false;
}
else {
return true;
   }
}

function chkdate(objName) {
var strDatestyle = "US"; //United States date style
//var strDatestyle = "EU";  //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("/");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Jan";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "May";
strMonthArray[5] = "Jun";
strMonthArray[6] = "Jul";
strMonthArray[7] = "Aug";
strMonthArray[8] = "Sep";
strMonthArray[9] = "Oct";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dec";
strDate = datefield.value;

if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);

if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
   }
}

if (!isNaN(strDate)) {
return false;
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
   }
}
if(isNaN(strDay)){
return false;
}
if(isNaN(strMonth)){
return false;
}
if(isNaN(strYear)){
return false;
}
if((strYear.length!=2)&&(strYear.length!=4))
{
return false;
}
if (strYear.length == 2) {
strYear = '20' + strYear;
}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(intMonth)) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}

return true;
}
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}   

function checkcurrency(objName) {
var datefield = objName;
var curVal;
if (chkcurrency(objName) == false) {
datefield.select();
alert("Please enter a numerical value for the amount that contains no (,)commas, (%)percent signs,($)dollar signs, or (-)dashes.");
objName.focus();
return false;
}
else {
if(strip(' ',datefield.value)!="")
{
	datefield.value = strip('$',formatCurrency(datefield.value));
	curVal = datefield.value.split(".");
	datefield.value = curVal[0];
}
return true;
   }
}

function chkcurrency(objName) {
var datefield = objName;
var strDate = datefield.value;
if(isNaN(strip(',',strDate))){
return false;
}
}

function checkamount(objName) {
var datefield = objName;
if (chkamount(objName) == false) {
datefield.select();
alert("Please enter a numerical value that contains no (,)commas, (%)percent signs,($)dollar signs, or (-)dashes.");
objName.focus();
return false;
}
else {
return true;
   }
}

function chkamount(objName) {
var datefield = objName;
var strDate = datefield.value;
if(isNaN(strDate)){
return false;
}
}

function setCookie(NameOfCookie, value, expiredays) 
{

// Three variables are used to set the new cookie. 
// The name of the cookie, the value to be stored,
// and finally the number of days until the cookie expires.
// The first lines in the function convert 
// the number of days to a valid date.

var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

// The next line stores the cookie, simply by assigning 
// the values to the "document.cookie" object.
// Note the date is converted to Greenwich Mean time using
// the "toGMTstring()" function.

document.cookie = NameOfCookie + "=" + escape(value) + 
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function getCookie(NameOfCookie)
{

// First we check to see if there is a cookie stored.
// Otherwise the length of document.cookie would be zero.

if (document.cookie.length > 0) 
{ 

// Second we check to see if the cookie's name is stored in the
// "document.cookie" object for the page.

// Since more than one cookie can be set on a
// single page it is possible that our cookie
// is not present, even though the "document.cookie" object
// is not just an empty text.
// If our cookie name is not present the value -1 is stored
// in the variable called "begin".

begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) // Note: != means "is not equal to"
{ 

// Our cookie was set. 
// The value stored in the cookie is returned from the function.

begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return ''; 

// Our cookie was not set. 
// The value "null" is returned from the function.

}

function delCookie (NameOfCookie) 
{

// The function simply checks to see if the cookie is set.
// If so, the expiration date is set to Jan. 1st 1970.

if (getCookie(NameOfCookie)) {
document.cookie = NameOfCookie + "=" +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}

function EvalSound(soundobj) {
  var thissound= eval("document."+soundobj);
  thissound.Play();
}

var audioOn = false;
function audioDo(doWhat,toWhat){
   if(audioOn){
      //alert("Got to audio-on");
      var A = eval('document.'+toWhat);
      if (A != null){
         if (doWhat=='stop') A.stop();
         else{
            if (navigator.appName == 'Netscape') A.play();
            else{
               if (document.M == null){
                  document.M = false; var m;
                  for(m in A) if (m == "ActiveMovie"){
                     document.M = true; break;
                     }
                  }
				  //alert("document.M"+document.M);
               if (document.M) A.SelectionStart = 0;
               if (document.M) A.play();
            }
         }
      }
   }
}

//Ending Click Event Functions

function charges(processorid,processorchargesid,chargename,percentage,disable,charge,agentmin,agentmax,agentdefault)
{
this.processorid=processorid
this.processorchargesid=processorchargesid
this.chargename=chargename
this.percentage=percentage
this.disable=disable
this.charge=charge
this.agentmin=agentmin
this.agentmax=agentmax
this.agentdefault=agentdefault
}

