

	
	//public variables 
	//for future use
	
	
 /* ********************softcomplex.com tigra menu pro******************* */

var w,F=[];G=['mout','mover','mdown'];function J0(){this.P0=window.innerWidth!=null?function(){return window.innerWidth}:function(){return document.body.clientWidth};this.j=window.innerHeight!=null?function(){return window.innerHeight}:function(){return document.body.clientHeight};this.m=window.pageXOffset!=null?function(){return window.pageXOffset}:function(){return document.body.scrollLeft};this.Q=window.pageYOffset!=null?function(){return window.pageYOffset}:function(){return document.body.scrollTop};this.N=document.all?function(i){return document.all[i]}:function(i){return document.getElementById(i)};this.b=F0;this.G0=S;}function F0(){var R0,D0;if(this.width!=(R0=this.P0())){this.width=R0;D0=true;}if(this.height!=(R0=this.j())){this.height=R0;D0=true;}if(this.d!=(R0=this.m())){this.d=R0;D0=true;}if(this.L!=(R0=this.Q())){this.L=R0;D0=true;}if(D0){if(this.x)clearTimeout(this.x);this.x=setTimeout('w.G0()',200);}window.setTimeout('w.b()',50);}function S(){for(var i=0;i<F.length;i++)if(F[i].g)F[i].G0();}function menu(J,K){this.J=J;this.K=K;this.T=[];this.I=[];this.v=[];this.q=0;this.hide=t;this.onclick=R;this.onmouseout=L0;this.onmouseover=c;this.onmousedown=A0;this.y=O;this.G0=M0;if(!w){w=new J0();w.b();}this.id=F.length;F[this.id]=this;for(var i=0;i<this.J.length;i++)new E0(i,this,this);var X=0,Y=0,n=Number.POSITIVE_INFINITY,p=Number.POSITIVE_INFINITY;for(var i=0;i<this.I.length;i++){X=Math.max(X,this.I[i].y('left')+this.I[i].y('width'));Y=Math.max(Y,this.I[i].y('top')+this.I[i].y('height'));n=Math.min(n,this.I[i].y('left'));p=Math.min(p,this.I[i].y('top'));}this.v.top=0;this.v.left=0;this.v.width=X-n;this.v.height=Y-p;this.g=true;this.G0();}function t(){if(!this.k||this.q||!this.e)return;this.e.u(0);this.e=null;}function M0(){this.v.top=this.v.left=0;if(this.K.align=='center')this.v.left=Math.round((w.width-this.v.width)/2);else if(this.K.align=='right')this.v.left=w.width-this.v.width;if(this.K.valign=='center')this.v.top=Math.round((w.height-this.v.height)/2);else if(this.K.valign=='bottom')this.v.top=w.height-this.v.height;if(this.K.scroll=='horizontal'||this.K.scroll=='both')this.v.left+=w.d;if(this.K.scroll=='vertical'||this.K.scroll=='both')this.v.top+=w.L;for(var i=0;i<this.I.length;i++){this.I[i].o('hidden',true);this.I[i].M(true);this.I[i].o('mout');}}function O(W){return this.v[W]?this.v[W]:0;}function R(id){return(this.T[id].B[1]?true:false);}function L0(id){this.q--;this.k=setTimeout('F['+this.id+'].hide();',this.K.hide_delay[this.T[id].H]);}function c(id){this.q++;clearTimeout(this.k);this.k=null;this.T[id].l();this.e=this.T[id];}function A0(id){this.T[id].o('mdown');}function E0(D,E,A){this.D=new String(D);this.E=E;this.A=A;this.B0=this.D.split('_');this.H=this.B0.length-1;var f='';for(var i=0;i<=this.H;i++)f+='['+(Number(this.B0[i])+(i?3:0))+']';eval('this.B=this.A.J'+f);if(!this.B)return;this.id=this.A.T.length;this.A.T[this.id]=this;E.I[E.I.length]=this;if(document.layers){this.write=H0;this.o=P;this.y=C0;}else{this.write=z;this.o=N0;this.y=s;}this.u=K0;this.l=Z;this.M=mitem_reposition;this.O0=[];this.C=[];this.write(this.M(false));this.V='hidden';this.I=[];var a=this.B.length-3;for(var i=0;i<a;i++)new E0(this.D+'_'+i,this,this.A);}function K0(h){for(var i=0;i<this.I.length;i++)this.I[i].o('hidden');if(h>=this.H)this.o('mout');else this.E.u(h);}function Z(){if(this.A.e&&this.H<=this.A.e.H)this.A.e.u(this.A.e.E==this?this.H+1:this.H);if(!this.A.e||this.A.e.E!=this)for(var i=0;i<this.I.length;i++)this.I[i].o('mout');this.o('mover');}function mitem_reposition(b){if(this.B0[this.H]==0){this.O0.left=this.E.y('left')+(this.B[2]!=null&&this.B[2][0]!=null?this.B[2][0]:this.A.K.block_left[this.H]);this.O0.top=this.E.y('top')+(this.B[2]!=null&&this.B[2][1]!=null?this.B[2][1]:this.A.K.block_top[this.H]);}else{this.O0.left=this.E.I[this.B0[this.H]-1].y('left')+(this.B[2]!=null&&this.B[2][0]!=null?this.B[2][0]:this.A.K.left[this.H]);this.O0.top=this.E.I[this.B0[this.H]-1].y('top')+(this.B[2]!=null&&this.B[2][1]!=null?this.B[2][1]:this.A.K.top[this.H]);}this.O0.width=(this.B[2]!=null&&this.B[2][2]!=null?this.B[2][2]:this.A.K.width[this.H]);this.O0.height=(this.B[2]!=null&&this.B[2][3]!=null?this.B[2][3]:this.A.K.height[this.H]);if(!b)return this.O0;this.y('left',this.O0.left);this.y('top',this.O0.top);for(var i=0;i<this.I.length;i++)this.I[i].M(true);}function z(y){for(var i=0;i<G.length;i++){document.write('<div id="m'+this.A.id+'i'+this.id+G[i]+'" style="position:absolute;left:'+y.left+'px;top:'+y.top+'px;width:'+y.width+'px;height:'+y.height+'px;visibility:hidden;z-index:'+this.H*2+';" class="m'+this.A.id+'l'+this.H+G[i]+'o"><div class="m'+this.A.id+'l'+this.H+G[i]+'i">'+(typeof(this.B[0])=='object'?this.B[0][i]:this.B[0])+'</div></div>');this.C[G[i]]=w.N('m'+this.A.id+'i'+this.id+G[i]);}document.write('<div id="m'+this.A.id+'i'+this.id+'i" style="position:absolute;left:'+y.left+'px;top:'+y.top+'px;width:'+y.width+'px;height:'+y.height+'px;visibility:hidden;z-index:'+(this.H*2+1)+';"><a href="'+(this.B[1]!=null&&typeof(this.B[1])!='string'&&this.B[1][0]!=null?this.B[1][0]:this.B[1])+'"'+(this.B[1]!=null&&typeof(this.B[1])!='string'&&this.B[1][1]!=null?' target="'+this.B[1][1]+'"':'')+' onclick="return F['+this.A.id+'].onclick('+this.id+');" onmouseout="F['+this.A.id+'].onmouseout('+this.id+');" onmouseover="F['+this.A.id+'].onmouseover('+this.id+');" onmousedown="F['+this.A.id+'].onmousedown('+this.id+');"><img src="'+this.A.K['pixel_path']+'" width="'+y.width+'" height="'+y.height+'" border="0"'+(this.B[1]!=null&&typeof(this.B[1])!='string'&&this.B[1][2]!=null?' alt="'+this.B[1][2]+'"':'')+'></a></div>');this.link=w.N('m'+this.A.id+'i'+this.id+'i');}function N0(V,U){if(!this.H&&V=='hidden'&&!U)V='mout';if(V==this.V)return;if(this.V=='hidden')this.link.style.visibility='visible';else this.C[this.V].style.visibility='hidden';if(V=='hidden')this.link.style.visibility='hidden';else this.C[V].style.visibility='visible';this.V=V;}function s(W,I0){if(!W)return;if(this.link.style.pixelLeft)if(W=='left')W='pixelLeft';else if(W=='top')W='pixelTop';else if(W=='width')W='pixelWidth';else if(W=='height')W='pixelHeight';if(I0){for(var i=0;i<G.length;i++)this.C[G[i]].style[W]=I0;this.link.style[W]=I0;return(this.O0[W]=I0);}else{var Q0=/^(\-?\d+)/;if(Q0.exec(this.link.style[W]))return new Number(RegExp.$1);}}function H0(y){for(var i=0;i<G.length;i++){document.write('<layer name="m'+this.A.id+'i'+this.id+G[i]+'" left="'+y.left+'" top="'+y.top+'" z-index="'+this.H*2+'" width="'+y.width+'" height="'+y.height+'" visibility="hide"><table cellpadding="0" cellspacing="0" border="0" width="'+y.width+'" height="'+y.height+'" class="m'+this.A.id+'l'+this.H+G[i]+'o"><tr><td><div class="m'+this.A.id+'l'+this.H+G[i]+'o"><div class="m'+this.A.id+'l'+this.H+G[i]+'i">'+(typeof(this.B[0])=='object'?this.B[0][i]:this.B[0])+'</div></div></td></tr></table></layer>');this.C[G[i]]=document.layers['m'+this.A.id+'i'+this.id+G[i]];}document.write('<layer name="m'+this.A.id+'i'+this.id+'i" left="'+y.left+'" top="'+y.top+'" z-index="'+(this.H*2+1)+'" visibility="hide" width="'+y.width+'" height="'+y.height+'"><a href="'+(this.B[1]!=null&&typeof(this.B[1])!='string'&&this.B[1][0]!=null?this.B[1][0]:this.B[1])+'"'+(this.B[1]!=null&&typeof(this.B[1])!='string'&&this.B[1][1]!=null?' target="'+this.B[1][1]+'"':'')+' onclick="return F['+this.A.id+'].onclick('+this.id+');" onmouseout="F['+this.A.id+'].onmouseout('+this.id+');" onmouseover="F['+this.A.id+'].onmouseover('+this.id+');" onmousedown="F['+this.A.id+'].onmousedown('+this.id+');"><img src="'+this.A.K['pixel_path']+'" width="'+y.width+'" height="'+y.height+'" border="0"'+(this.B[1]!=null&&typeof(this.B[1])!='string'&&this.B[1][2]!=null?' alt="'+this.B[1][2]+'"':'')+'></a></layer>');this.link=document.layers['m'+this.A.id+'i'+this.id+'i'];}function P(V){if(!this.H&&V=='hidden')V='mout';if(V==this.V)return;if(this.V=='hidden')this.link.visibility='show';else this.C[this.V].visibility='hide';if(V=='hidden')this.link.visibility='hide';else this.C[V].visibility='show';this.V=V;}function C0(W,I0){if(!W)return;if(I0){this.O0[W]=I0;for(var i=0;i<G.length;i++){this.C[G[i]].moveTo(this.O0.left,this.O0.top);this.C[G[i]].resizeTo(this.O0.width,this.O0.height);}this.link.moveTo(this.O0.left,this.O0.top);this.link.resizeTo(this.O0.width,this.O0.height);}return this.O0[W];}

/********END*************softcomplex.com tigra menu pro*********END********** */

//Functions & Procedures 


	 
//check for Enter Key Keypress in a text field
  function isEnterKey(objEvent) {             
     var iKeyCode, strKey;
     var result = false;
    
     if (objEvent.keyCode) { //IE
       iKeyCode = objEvent.keyCode;
     } else { //old netscape method
       iKeyCode = objEvent.which; 
     }
     strKey = String.fromCharCode(iKeyCode);
     //alert("KeyCode = " + iKeyCode + "\nCharacter =" + strKey);
     if (iKeyCode==13) result = true;
     return result;
  }

	   function ConfirmDelete() {
        
        if (confirm("Delete This Record?!")) {
        alert ("OK, The Record Will Be Deleted.");
        return true;
        }
        else {
        alert ("OK, The Record Has NOT Been Deleted.");
        return false;
           }   
      }
      function ConfirmCopy() {
        
        if (confirm("Copy This Record?!")) {
        alert ("OK, The Record Will Be Copied.");
        return true;
        }
        else {
        alert ("OK, The Record Has NOT Been Copied.");
        return false;
           }   
      }
 
  
 //Copy item to clipboard
 function loadClipBoard(copytext) //used to copy text in the hidden textarea 'holdtext' to the clipboard
          {
          //holdtext is temporary field to hold copied data
          holdtext.innerText = copytext;
          Copied = holdtext.createTextRange();
          Copied.execCommand("Copy");
          alert("Item Copied to Clipboard.");
          }
function pasteClipBoard() //paste text loaded in clipboard
          {
          var rng = document.selection.createRange(); 
          rng.execCommand("Paste"); 

          }
                             
//limit num chars entered into a textarea or text field
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}


//Site Blob Functions
	   function blobBackup() {
        /*
        if (eval(document.f_rec_dtl.blob_bakup.value)) { //check if bakup field exists
            alert("Sorry, Backup Is Only Available from Blob Detail Records");
            }
        else {//perform backup       
        */
              if (confirm("Backup This Blob Over Existing Backup?!")) {
        
              document.f_rec_dtl.blob_bakup.value=document.f_rec_dtl.blob_content.value;//copy data in content to backup field in form.
              alert ("OK, The Blob Has Been Backed Up.\nYou Must Click The Save Button to Complete This Operation.");
        
              //return true;
              }
              else {
              alert ("OK, The Blob Has Not Been Backed Up.");
              //return false;
                 }
          //}//end exists check       
      }
      function blobRestore() {
        
        if (confirm("Restore Backup Blob Over Existing Content?!")) {
        document.f_rec_dtl.blob_content.value=document.f_rec_dtl.blob_bakup.value;//copy data in content to backup field in form.
        alert ("OK, The Blob Has Been Restored.\nYou Must Click The Save Button to Complete This Operation.");
        
        //return true;
        }
        else {
        alert ("OK, The Blob Has Not Been Restored From The Backup.");
        //return false;
           }   
      }
//** END SITE BLOB Functions ***
      
	    function getPlatform()
	   {
	      var agent = navigator.userAgent.toLowerCase();
	      var is_mac = (agent.indexOf("mac") != -1);

	      if(is_mac)
	      {
	        frm.Platform.value="MAC"
	      }
	      else
	      {
			frm.Platform.value = "PC"
	      }
	   }
	   
	   function checkAlpha(theEvent, theElement)
	   {
	      var agent = navigator.userAgent.toLowerCase();
	      var is_mac = (agent.indexOf("mac") != -1);

	      if(!is_mac)
	      {
	         if(navigator.appName != "Netscape")
	         {
	            var charCode = theEvent.keyCode;

	            // check for proper characters
	            if((charCode > 31) && (charCode < 48 || charCode > 57))
	            {
	               return true
	            }
	         }
	      }
	      return false
	   }
	   
	   function checkNumeric(theEvent, theElement)
	   {
	      var agent = navigator.userAgent.toLowerCase();
	      var is_mac = (agent.indexOf("mac") != -1);

	      if(!is_mac)
	      {
	         if(navigator.appName != "Netscape")
	         {
	            var charCode = theEvent.keyCode;

	            // check for proper characters
	            if((charCode > 31) && (charCode < 48 || charCode > 57))
	            {
	               return false
	            }
	         }
	      }
	      return true
	   }
	  
	function isEmail(string) {

		if (!string) return false;
		var iChars = "*|,\":<>[]{}`\';()&$#%";

		for (var i = 0; i < string.length; i++) {
		   if (iChars.indexOf(string.charAt(i)) != -1)
		      return false;
		
		}
		//make sure u find an '@' and '.' character in there
		if (string.indexOf("@") == -1 || string.indexOf(".") == -1 ){
		      return false; 
		   }        	
		return true;
	}      
	
	//***** this function needs to be converted to javascript
	//Function IsEmail(sCheckEmail)
	 //   Dim sEmail, nAtLoc
	  //  IsEmail = True
	   // sEmail = Trim(sCheckEmail)
	    //nAtLoc = InStr(1, sEmail, "@") 'Location of "@"

	
	    //If Not (nAtLoc > 1 And (InStrRev(sEmail, ".") > nAtLoc + 1)) Then
	      //  '"@" must exist, and last "." in string must follow the "@"
	        //IsEmail = False
	    //ElseIf InStr(nAtLoc + 1, sEmail, "@") > nAtLoc Then
	      //  'String can't have more than one "@"
	        //IsEmail = False
	    //ElseIf Mid(sEmail, nAtLoc + 1, 1) = "." Then
	      //  'String can't have "." immediately following "@"
	        //IsEmail = False
	    //ElseIf InStr(1, Right(sEmail, 2), ".") > 0 Then
	      //  'String must have at least a two-character top-level domain.
	        //IsEmail = False
	    //End If
	//End Function
     

	   function checkCANZip(objPostalCode)
	   {
	      var agent = navigator.userAgent.toLowerCase();
	      var is_mac = (agent.indexOf("mac") != -1);

	      if(!is_mac)
	      {
	         if(navigator.appName != "Netscape")
	         {
	            

	            // check for proper mask
	            if(mask (objPostalCode.value,"?#? #?#" ) == 1)
	            {
	               return true
	            }
	         }
	      }
			alert ("Canadian Postal Codes Must be In The Format A#A #A#. Please Try Again")
			objPostalCode.focus()
	      return false
	   }
	   
	   //These Functions are all used to support string mask testing
	   
				   function mask (InString, Mask)  {
				   //E.G var Ret = mask ("(800) 555-1212", "(###) ###-####")
				   //1 = Match
				   //0 = No Match
				   //INPUTS:
				   //Mask Character  Meaning 
					//# Character at this position must be a number 
					//? Character at this position must be an alphabetic character 
					//! Character at this position must be number or alphabetic character 
					//* Character at this position can be anything 

				LenStr = InString.length;
				LenMsk = Mask.length;
				if ((LenStr==0) || (LenMsk==0))
					return(0);
				if (LenStr!=LenMsk)
					return(0);
				TempString=""
				for (Count=0; Count<=InString.length; Count++)  {
					StrChar = InString.substring(Count, Count+1);
					MskChar = Mask.substring(Count, Count+1);
					if (MskChar=='#') {
						if(!isNumberChar(StrChar))
							return(0);
					}
					else if (MskChar=='?') {
						if(!isAlphabeticChar(StrChar))
							return(0);
					}
					else if (MskChar=='!') {
						if(!isNumOrChar(StrChar))
							return(0);
					}
					else if (MskChar=='*') {
					}
					else {
						if (MskChar!=StrChar) 
							return(0);
					}
				}
				return (1);
			}

			function isAlphabeticChar (InString)  {
				if(InString.length!=1) 
					return (false);
				InString=InString.toLowerCase();
				RefString="abcdefghijklmnopqrstuvwxyz";
				if (RefString.indexOf (InString.toLowerCase(), 0)==-1) 
					return (false);
				return (true);
			}

			function isNumberChar (InString)  {
				if(InString.length!=1) 
					return (false);
				RefString="1234567890";
				if (RefString.indexOf (InString, 0)==-1) 
					return (false);
				return (true);
			}

			function isNumOrChar (InString)  {
				if(InString.length!=1) 
					return (false);
				InString=InString.toLowerCase();
				RefString="1234567890abcdefghijklmnopqrstuvwxyz";
				if (RefString.indexOf (InString, 0)==-1)  
					return (false);
				return (true);
			}
	   //End Functions for Mask function support - 
	   
			
		function trimAll( strValue ) {
		/************************************************
		DESCRIPTION: Removes leading and trailing spaces.

		PARAMETERS: Source string from which spaces will
		  be removed;

		RETURNS: Source string with whitespaces removed.
		*************************************************/ 
		 var objRegExp = /^(\s*)$/;

		    //check for all spaces
		    if(objRegExp.test(strValue)) {
		       strValue = strValue.replace(objRegExp, '');
		       if( strValue.length == 0)
		          return strValue;
		    }
		    
		   //check for leading & trailing spaces
		   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
		   if(objRegExp.test(strValue)) {
		       //remove leading and trailing whitespace characters
		       strValue = strValue.replace(objRegExp, '$2');
		    }
		  return strValue;
		}

	
	function validateNotEmpty( strValue ) {
		/************************************************
		DESCRIPTION: Validates that a string is not all
		  blank (whitespace) characters.
		    
		PARAMETERS:
		   strValue - String to be tested for validity
		   
		RETURNS:
		   True if valid, otherwise false.
		*************************************************/
		   var strTemp = strValue;
		   strTemp = trimAll(strTemp);
		   if(strTemp.length > 0){
		     return true;
		   }  
		   return false;
		}

//*** DATE VALIDATION STUFF
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

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(dtStr){
	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("The date format should be : mm/dd/yyyy")
		return false
	}
	if (month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		//alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		//alert("Please enter a valid date")
		return false
	}
return true
}

function ValidateForm(){
	var dt=document.frmSample.txtDate
	if (isDate(dt.value)==false){
		dt.focus()
		return false
	}
    return true
 }


		
function check_date(objName) {
    var datefield = objName;
    if (chkdate(objName) == false) {
    datefield.select();
    alert("The Date is Invalid.  Please Correct it.");
    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];
  //bsa -check to see day mo and year are valid lengths
    if (strDay.length > 2 || strMonth.length >2 || strYear.length >4) return false;
  }
  booFound = true;
     }
  }
  if (booFound == false) {
  if (strDate.length>5) {
  strDay = strDate.substr(0, 2);
  strMonth = strDate.substr(2, 2);
  strYear = strDate.substr(4);
     }
  }
  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;
  }
  }
  }
  if (strDatestyle == "US") {
  //bsa - decided to leave date as is versus converting it to string format
  //datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
  
  }
  else {
  datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
  }
  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 doDateCheck(from, to) {
    if (Date.parse(from.value) <= Date.parse(to.value)) {
    alert("The dates are valid.");
    }
    else {
    if (from.value == "" || to.value == "") 
    alert("Both dates must be entered.");
    else 
    alert("To date must occur after the from date.");
     }
}



//******** Primarily Used on Portfolio Pages *****//

var hndlPop
function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=1'+scroll+',resizable'
hndlPop = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { hndlPop.window.focus(); }
}



ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false; 


function writeit(id,text)
{
var x
	if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = text;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = text;
	}
	else if (document.layers)
	{
		x = document.layers[id];
		text2 = '<P CLASS="testclass">' + text + '</P>';
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}



function layerWrite(id,nestref,text) {
	if (ns4) {
		if (nestref) var lyr = eval('document.'+nestref+'.document.'+id+'.document')
		else var lyr = document.layers[id].document
		lyr.open()

		lyr.write(text)
		lyr.close()
		//alert ("netsuck processing")
	}
	else if (ie4) document.all[id].innerHTML = text
}

function showIcon(strPath,strIcon,strDesc) {
var strZoomIcon = strPath + "zoom_"+strIcon;
var strImageCode = "<a href=javascript:NewWindow('/zoom_big_icon.asp?uDesc=" + escape(strDesc) + "&strZoomIcon=" + strZoomIcon + "','Zoomed',550,450)><img src='" + strPath + strIcon + "' width='300' height='213' border='0' alt='Click Me to Zoom'></a>";

//writeit('uDesc',strDesc);

layerWrite('uDesc',null,strDesc);
layerWrite('bigImage',null,strImageCode); 
//determine if a zoomed icon pop-up is already open. if so, load the moused over zoomed image in it.

}

function refreshIcon(strPath,strIcon,strDesc) {
if (hndlPop && !hndlPop.closed) {NewWindow('/zoom_big_icon.asp?uDesc=" + escape(strDesc) + "&strZoomIcon=" + strZoomIcon + "','Zoomed',550,450); } 

}

//********************** //
//HIDE SHOW DIV SECTIONS

function toggleDiv(szDivID, iState) // 1 visible, 0 hidden
{
   var obj = document.layers ? document.layers[szDivID] :
   document.getElementById ?  document.getElementById(szDivID).style :
   document.all[szDivID].style;
   obj.visibility = document.layers ? (iState ? "show" : "hide") :
   (iState ? "visible" : "hidden");
}


function urlEncode(str)
{
	var ms = "%25#23 20?3F<3C>3E{7B}7D[5B]5D|7C^5E~7E`60"
	var msi = 0
	var i,c,rs,ts
	while (msi < ms.length)
	{
		c = ms.charAt(msi)
		rs = ms.substring(++msi, msi +2)
		msi += 2
		i = 0
		while (true)
		{
			i = str.indexOf(c, i)
			if (i == -1) break
			ts = str.substring(0, i)
			str = ts+"%"+rs+str.substring(++i, str.length)
		}
	}
	return str
}


function goto_port(lstPort){
var sel_index = lstPort.selectedIndex;
var sel_item_text = lstPort.options[sel_index].text;
var sel_item_value = lstPort.options[sel_index].value;
var nextPage = "/portfolio.asp?sub=projects&Proj=" + sel_item_value;  
//this function reloads the page to a new portfolio project
//input: list box object
//alert ("The Value Selected on The List Box is: " + sel_item_value)

//make sure there is a value before changing pages
if (sel_item_value != "")
   {
      document.location.href = nextPage
   }

}

//  End -->
function changeSelected(lstPort,strDirection) {
//input: list box object
//input: direction string ('+' = fwd, '-' = prev)
var sel_index = lstPort.selectedIndex;
var sel_length = lstPort.options.length;
var sel_next_index = sel_index;

//alert ("Length is" + sel_length);

if (strDirection=='-') {sel_next_index-- }
else {sel_next_index++};
//alert ("Selected nxt index is " + sel_next_index );



//if user clicks previous on first item, go to last item
// if user click next on last item go to first item
if (sel_next_index < 0) {sel_next_index = (sel_length - 1)}
else {
	if (sel_next_index == sel_length) {sel_next_index = 0}
	}

lstPort.selectedIndex = sel_next_index;
//alert ("Selected index is " + lstPort.selectedIndex );
goto_port(lstPort);
}


//this function prevents selecting text from the browser
function disableselect(e){ 
return false 
} 
function reEnable(){ 
return true 
} 



//this function prevents right clicks
function right(e) {
if (navigator.appName == 'Netscape' && 
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && 
(event.button == 2 || event.button == 3)) {
alert("Secured Page - Right Click Not Available.");
return false;
}
return true;
}
//include this <script> code in the page where u don't want right clicks
//document.onmousedown=right;
//document.onmouseup=right;
//if (document.layers) window.captureEvents(Event.MOUSEDOWN);
//if (document.layers) window.captureEvents(Event.MOUSEUP);
//window.onmousedown=right;
//window.onmouseup=right;


	   
	   
/****** CLOCK FUNCTIONS ***********************************************************/
//-- The JavaScript Source!! http://javascript.internet.com --
function datetime() {
        var day="";
        var month="";
        var myweekday="";
        var year="";
        newdate = new Date();
        mydate = new Date();
        dston =  new Date('April 4, 2004 2:59:59');
        dstoff = new Date('october 31, 2004 2:59:59');
        var myzone = newdate.getTimezoneOffset();
        newtime=newdate.getTime();

        var zone = 6;  // references your time zone

        if (newdate > dston && newdate < dstoff ) {
        zonea = zone - 1 ;
          //dst = "  CST Daylight Savings";
          dst = "  CST";
        }
        else {
          zonea = zone ; dst = "  CST";
        }
        var newzone = (zonea*60*60*1000);
        newtimea = newtime+(myzone*60*1000)-newzone;
        mydate.setTime(newtimea);
        myday = mydate.getDay();
        mymonth = mydate.getMonth();
        myweekday= mydate.getDate();
        myyear= mydate.getYear();
        year = myyear;

        if (year < 2000)    // Y2K Fix, Isaac Powell
        year = year + 1900; // http://onyx.idbsu.edu/~ipowell
        myhours = mydate.getHours();
        if (myhours >= 12) {
        myhours = (myhours == 12) ? 12 : myhours - 12; mm = " PM";
        }
        else {
        myhours = (myhours == 0) ? 12 : myhours; mm = " AM";
        }
        myminutes = mydate.getMinutes();
        if (myminutes < 10){
        mytime = ":0" + myminutes;
        }
        else {
        mytime = ":" + myminutes;
        };
        arday = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
        armonth = new Array("January ","February ","March ","April ","May ","June ","July ","August ","September ", "October ","November ","December ")
        ardate = new Array("0th","1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th","20th","21st","22nd","23rd","24th","25th","26th","27th","28th","29th","30th","31st");
        // rename locale as needed.

        var time = (myhours + mytime+ mm + ", " + arday[myday] +", " + armonth[mymonth] +" "+ardate[myweekday] + ", " + year+", " + dst);
        document.write(time);

}
	   
/* ******************************************************************************* */
//POP-UP CALENDAR FUNCTIONS
/* ********************************************************************
Softricks Popup Date Picker Calendar
Author : Kedar R. Bhave

# *************************************************************************
# COPYRIGHT NOTICE
# Copyright (c) 2000 Softricks.com, All rights reserved.
# This script may be used and modified free of charge by anyone as long as
# this copyright notice and the comments above are kept in their original 
# form. By using this script, you agree to the disclaimer notices as on the
# softricks.com site.
#
# Selling the code for this script, without prior written consent from the
# author, is not allowed. Redistributing this script over the internet or 
# in any medium should be done only with author's written permission.
#
# IN ALL CASES COPYRIGHT AND HEADERS MUST REMAIN INTACT.
#
# If you plan to use the script on a commercial site, we suggest that you
# provide a link or a reference to Softricks.com somewhere on your site.
#
# Distributed under the GNU General Public License.
# For more information visit: http://www.gnu.org/copyleft/lgpl.html
#
# Visit the website for more information on Softricks.com's Copyright, 
# Privacy, Disclaimer and Terms of use policies.
************************************************************************ */

function name_values(instring) {
	// Assumption: ';' is a restricted character in a value.
	// Returns an array of variable names set by this function.
	var vars = new Array();
	rc = "\235";
	instring = instring.replace(/\\\;/g, rc);

	var pattern = /[a-zA-Z0-9]+\=[\/:#a-zA-Z0-9\. \235]+/gi;
	var y = instring.match(pattern);
	for (i=0; i<y.length; i++) {
		var s = y[i].split("=");
		s[1] = s[1].replace(rc, ";");
		vars[i] = "v_" + s[0];
		eval(vars[i] + " = '" + s[1] + "'");
	}
	return vars;
}

var onClickFnCode = "";
var orig_onClickFnCode = "";

// This is a Dynamic function. Its function code is constructed 
// in onclickfn method and set in the show method.
// This function is here in the same way as the function we 
// construct in the calendar window in case of POPUP calendar.
// This is for the INLINE calendar - used to append selected dates

function onClickFn(pday) {
	var re = /pday/;
	onClickFnCode = orig_onClickFnCode;
	onClickFnCode = onClickFnCode.replace(re, "'" + pday + "'");
	eval(onClickFnCode);
}

// Custom parameters set by the 6th argument to show_calendar function.
// CUSTOM STRING
var v_CloseOnSelect, v_AppendOrReplace, v_AppendChar, v_ReturnData;
var v_InlineX, v_InlineY, v_Title, v_CurrentDate, v_AllowWeekends;
var v_Resizable, v_Width, v_Height, v_SelectAfter, v_NSHierarchy;

var weekend = [0,6];
var weekendColor = "#e0e0e0";
var fontface = "Courier New";
var fontsize = 2;

var gNow = new Date();
var ggWinCal;           // Really global variable pointing to the calendar window

// Drag-n-Drop Variables
var theLayer;
var theLayerStyle;		// Style used for positioning in IE.

var currX, currY;
var cx, cy;				// Client co-ords
var x, y;				// Co-ords of the point at first click
var incrX, incrY;

var mDown, mUp;
// ----------- VARIABLE DECLARATIONS END -----------

isNav = (navigator.appName.indexOf("Netscape") != -1) ? true : false;
isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;

// Month names in YOUR Language (French/Spanish..)
Calendar.Months = ["January", "February", "March", "April", "May", "June",
	"July", "August", "September", "October", "November", "December"];
// Month names in English
Calendar.EMonths = ["January", "February", "March", "April", "May", "June",
	"July", "August", "September", "October", "November", "December"];

// Non-Leap year Month days..
Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// Leap year Month days..
Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

Calendar.DOW = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

Calendar.supportedFormats = ["MM/DD/YYYY", "MM/DD/YY", "MM-DD-YYYY", "MM-DD-YY", "DD/MON/YYYY", "DD/MON/YY", "DD-MON-YYYY", "DD-MON-YY", "DD/MONTH/YYYY", "DD/MONTH/YY", "DD-MONTH-YYYY", "DD-MONTH-YY", "MONTH DD, YYYY", "DD/MM/YYYY", "DD/MM/YY", "DOW, DD-MON-YY"];

Calendar.count = 0;
Calendar.Format = null;

// For inline calendar, the default contents of the layer. (v1.3)
Calendar.gInitText = "Softricks.com Calendar";

function Calendar(p_item, p_WinCal, p_month, p_year, p_format, p_type) {

	// Argument p_type defines if the calendar is popup or inline
	// If p_type is INLINE, 
	//    you must pass p_inline parameter which specifies the name of the layer 
	//    which displays the calendar inline.
	//    --->

	if ((p_month == null) && (p_year == null))      return;

	if (p_WinCal == null)
		this.gWinCal = ggWinCal;
	else
		this.gWinCal = p_WinCal;

	if (p_month == null) {
		this.gMonthName = null;
		this.gMonth = null;
		this.gYearly = true;
	} else {
		this.gMonthName = Calendar.get_month(p_month);
		this.gMonth = new Number(p_month);
		this.gYearly = false;
	}
	
	if (p_type == null)
		this.gType = "POPUP";		// Default is popup
	else
		this.gType = p_type;

	if (this.gType == "INLINE") {
		this.WHO = "";
		this.INLINE = "Calendar";	// Inline Calendar Layer name
		this.codeINLINE = "";		// Calendar code will be constructed in this var
	} else
		this.WHO = "window.opener.";

	this.gYear = p_year;
	this.gFormat = p_format;
	this.gBGColor = "white";
	this.gFGColor = "black";
	this.gTextColor = "black";
	this.gHeaderColor = "black";
	this.gReturnItem = p_item;
	this.gTitle = "Softricks.com Calendar";
}

Calendar.get_month = Calendar_get_month;
Calendar.get_daysofmonth = Calendar_get_daysofmonth;
Calendar.get_dow = Calendar_get_dow;
Calendar.calc_month_year = Calendar_calc_month_year;
Calendar.print = Calendar_print;
Calendar.CreateCalendarLayer = Calendar_CreateCalendarLayer;
Calendar.Close = Calendar_Close;
Calendar.Lwwrite = Calendar_Lwwrite;
Calendar.MoveTo = Calendar_MoveTo;
Calendar.isWeekend = Calendar_isWeekend;

function Calendar_get_month(monthNo, pLanguage) {
if (!pLanguage || pLanguage=="E")
	return Calendar.EMonths[monthNo];
else
	return Calendar.Months[monthNo];
}

function Calendar_get_dow(dayNo) {
	return Calendar.DOW[dayNo];
}

function Calendar_get_daysofmonth(monthNo, p_year) {
	/* 
	Check for leap year ..
	1.Years evenly divisible by four are normally leap years, except for... 
	2.Years also evenly divisible by 100 are not leap years, except for... 
	3.Years also evenly divisible by 400 are leap years. 
	*/
	if ((p_year % 4) == 0) {
			if ((p_year % 100) == 0 && (p_year % 400) != 0)
					return Calendar.DOMonth[monthNo];

			return Calendar.lDOMonth[monthNo];
	} else
			return Calendar.DOMonth[monthNo];
}

function Calendar_calc_month_year(p_Month, p_Year, incr) {
	/* 
	Will return an 1-D array with 1st element being the calculated month 
	and second being the calculated year 
	after applying the month increment/decrement as specified by 'incr' parameter.
	'incr' will normally have 1/-1 to navigate thru the months.
	*/
	var ret_arr = new Array();

	if (incr == -1) {
		// B A C K W A R D
		if (p_Month == 0) {
			ret_arr[0] = 11;
			ret_arr[1] = parseInt(p_Year) - 1;
		}
		else {
			ret_arr[0] = parseInt(p_Month) - 1;
			ret_arr[1] = parseInt(p_Year);
		}
	} else if (incr == 1) {
		// F O R W A R D
		if (p_Month == 11) {
			ret_arr[0] = 0;
			ret_arr[1] = parseInt(p_Year) + 1;
		}
		else {
			ret_arr[0] = parseInt(p_Month) + 1;
			ret_arr[1] = parseInt(p_Year);
		}
	}

	return ret_arr;
}

function Calendar_print() {
	ggWinCal.print();
}

function Calendar_isWeekend(pday) {
	var i;

	for (i=0; i<weekend.length; i++) {
		if (pday == weekend[i])
			return true;
	}
	return false;
}

// This is for compatibility with Navigator 3, we have to create and discard one object before the prototype object exists.
new Calendar();

Calendar.prototype.setFormat = function(pFormat) {
	var j;
	for (j=0; j<Calendar.supportedFormats.length; j++) {
		if (Calendar.supportedFormats[j] == pFormat)
			Calendar.Format = pFormat;
	}
}

Calendar.prototype.getMonthlyCalendarCode = function() {
	var vCode = "";
	var vHeader_Code = "";
	var vData_Code = "";

	// Begin Table Drawing code here..
	vCode = vCode + "<TABLE WIDTH='237' BORDER=1 BGCOLOR=\"" + this.gBGColor + "\">";

	vHeader_Code = this.cal_header();
	vData_Code = this.cal_data();
	vCode = vCode + vHeader_Code + vData_Code;

	vCode = vCode + "</TABLE>";

	return vCode;
}

Calendar.prototype.onclickfn = function() {
	// This should return the code string for the onclickfn in the calendar document.
	
	// This is the reference to the return object
	// window.opener.document. / window.document. ... .value
	var whois = this.WHO + 
				((this.gType == "POPUP") ? 
				"document." + v_NSHierarchy : 
				"window.document." + v_NSHierarchy) + 
				this.gReturnItem + ".value";

	// apchar will turn out to be either " = " or " += ''" or " += ';'"
	var apchar = (this.returnMode == "Replace") ? " = " : " += ";

	var retCode = "apchar = ''" +
					((this.returnMode == "Replace") ? ";" : " + ") +
					"((" + whois + " == '') ? '' : '" + this.appendChar + "');\n" +
				whois + apchar + "apchar + pday;\n";

	return retCode;
}

Calendar.prototype.show = function() {
	var vCode = "";

	if (this.gType == "POPUP")
		this.gWinCal.document.open();

	// Setup the page...
	this.wwrite("<html>");
	this.wwrite("<head><title>Calendar</title>");
	
	if (this.gType == "POPUP")
		this.wwrite("<script language='javascript'>" + 
			"function onClickFn(pday) {\n" +
			this.onclickfn() + "}\n<\/script>");
	else
		orig_onClickFnCode = this.onclickfn();

	this.wwrite("</head>");

	this.wwrite("<body " + 
			"link=\"" + this.gLinkColor + "\" " + 
			"vlink=\"" + this.gLinkColor + "\" " +
			"alink=\"" + this.gLinkColor + "\" " +
			"text=\"" + this.gTextColor + "\">");

	this.wwrite("<TABLE WIDTH='237' BORDER=0 CELLPADDING=0 BGCOLOR='#000099'><TR><TD>" +  
	"<TABLE BORDER=0 WIDTH='100%' CELLPADDING=1 BGCOLOR='#B7B7C7'>" +  
	"<TR><TD BGCOLOR='#000099'>" + 
	"<FONT COLOR=white FACE='" + fontface + "' SIZE=2><B>" + this.gTitle + "</B></FONT>" + 
	"</TD><TD BGCOLOR='#000099' ALIGN=RIGHT>" + 
	"<FONT COLOR=white FACE='" + fontface + "' SIZE=2><B>" + 
	"<A HREF='javascript:" +
	this.WHO + "Calendar.Close(\"" + this.gType + "\", \"" + this.INLINE + "\");' " +
	"STYLE='color:white'>" + 
	"x</A></B></FONT></TR><TR>" + 
	"<TD BGCOLOR='#B7B7C7' COLSPAN=2>");

	this.wwriteA("<FONT FACE='" + fontface + "' SIZE=2><B>");
	this.wwriteA(this.gMonthName + " " + this.gYear);
	this.wwriteA("</B><BR>");

	// Show navigation buttons
	var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1);
	var prevMM = prevMMYYYY[0];
	var prevYYYY = prevMMYYYY[1];

	var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1);
	var nextMM = nextMMYYYY[0];
	var nextYYYY = nextMMYYYY[1];

	this.wwrite("<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");
	
	this.wwrite("<FONT COLOR=black FACE='" + fontface + "' SIZE=2>" + 
			"[<A HREF=\"" +
			"javascript:" + this.WHO + "Build(" + 
			"'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)-1) + "', '" + this.gFormat + "', '" + this.gType + "'" + 
			");\"><<<\/A>]</FONT></TD><TD ALIGN=center>");
	this.wwrite("<FONT COLOR=black FACE='" + fontface + "' SIZE=2>" + 
			"[<A HREF=\"" +
			"javascript:" + this.WHO + "Build(" + 
			"'" + this.gReturnItem + "', '" + prevMM + "', '" + prevYYYY + "', '" + this.gFormat + "', '" + this.gType + "'" + 
			");\"><<\/A>]</FONT></TD><TD ALIGN=center>");
	this.wwrite("<FONT COLOR=black FACE='" + fontface + "' SIZE=2>" + 
			"[<A HREF=\"javascript:window.print();\">" + 
			"Print</A>]</FONT></TD><TD ALIGN=center>");
	this.wwrite("<FONT COLOR=black FACE='" + fontface + "' SIZE=2>" + 
			"[<A HREF=\"" +
			"javascript:" + this.WHO + "Build(" + 
			"'" + this.gReturnItem + "', '" + gNow.getMonth() + "', '" + gNow.getFullYear() + "', '" + this.gFormat + "', '" + this.gType + "'" + 
			");\">Today<\/A>]</FONT></TD><TD ALIGN=center>");
	this.wwrite("<FONT COLOR=black FACE='" + fontface + "' SIZE=2>" + 
			"[<A HREF=\"" +
			"javascript:" + this.WHO + "Build(" + 
			"'" + this.gReturnItem + "', '" + nextMM + "', '" + nextYYYY + "', '" + this.gFormat + "', '" + this.gType + "'" + 
			");\">><\/A>]</FONT></TD><TD ALIGN=center>");
	this.wwrite("<FONT COLOR=black FACE='" + fontface + "' SIZE=2>" + 
			"[<A HREF=\"" +
			"javascript:" + this.WHO + "Build(" + 
			"'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)+1) + "', '" + this.gFormat + "', '" + this.gType + "'" + 
			");\">>><\/A>]</FONT></TD></TR></TABLE><BR>");

	// Get the complete calendar code for the month..
	vCode = this.getMonthlyCalendarCode();
	this.wwrite(vCode);

	this.wwrite("</TD></TR></TABLE></TD></TR></TABLE>");

	this.wwrite("</font></body></html>");
	
	if (this.gType == "POPUP")
		this.gWinCal.document.close();
		
	if (this.gType == "INLINE")
		Calendar.Lwwrite(this.codeINLINE, this.INLINE);
}

function Calendar_Close(pType, pINLINE) {
	if (pType == "POPUP")
		ggWinCal.close();
	if (pType == "INLINE")
		Calendar.Lwwrite(Calendar.gInitText, pINLINE)
}

Calendar.prototype.showY = function() {
	var vCode = "";
	var i;
	var vr, vc, vx, vy;             // Row, Column, X-coord, Y-coord
	var vxf = 285;                  // X-Factor
	var vyf = 200;                  // Y-Factor
	var vxm = 10;                   // X-margin
	var vym;                                // Y-margin
	if (isIE)       vym = 75;
	else if (isNav) vym = 25;

	this.gWinCal.document.open();

	this.wwrite("<html>");
	this.wwrite("<head><title>Calendar</title>");
	this.wwrite("<style type='text/css'>\n<!--");
	for (i=0; i<12; i++) {
		vc = i % 3;
		if (i>=0 && i<= 2)      vr = 0;
		if (i>=3 && i<= 5)      vr = 1;
		if (i>=6 && i<= 8)      vr = 2;
		if (i>=9 && i<= 11)     vr = 3;

		vx = parseInt(vxf * vc) + vxm;
		vy = parseInt(vyf * vr) + vym;

		this.wwrite(".lclass" + i + " {position:absolute;top:" + vy + ";left:" + vx + ";}");
	}
	this.wwrite("-->\n</style>");

	if (this.gType == "POPUP")
		this.wwrite("<script language='javascript'>" + 
			"function onClickFn(pday) {\n" +
			this.onclickfn() + "}\n<\/script>");
	else
		orig_onClickFnCode = this.onclickfn();

	this.wwrite("</head>");

	this.wwrite("<FONT FACE='" + fontface + "' SIZE=2><B>");

	this.wwrite("Year : " + this.gYear);
	this.wwrite("</B><BR>");

	// Show navigation buttons
	var prevYYYY = parseInt(this.gYear) - 1;
	var nextYYYY = parseInt(this.gYear) + 1;

	this.wwrite("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");
	this.wwrite("[<A HREF=\"" +
			"javascript:window.opener.Build(" + 
			"'" + this.gReturnItem + "', null, '" + prevYYYY + "', '" + this.gFormat + "'" +
			");" +
			"\" alt='Prev Year'><<<\/A>]</TD><TD ALIGN=center>");
	this.wwrite("[<A HREF=\"javascript:window.print();\">Print</A>]</TD><TD ALIGN=center>");
	this.wwrite("[<A HREF=\"" +
			"javascript:window.opener.Build(" + 
			"'" + this.gReturnItem + "', null, '" + nextYYYY + "', '" + this.gFormat + "'" +
			");" +
			"\">>><\/A>]</TD></TR></TABLE><BR>");

	// Get the complete calendar code for each month..
	var j;
	for (i=11; i>=0; i--) {
		if (isIE)
				this.wwrite("<DIV ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");
		else if (isNav)
				this.wwrite("<LAYER ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");

		this.gMonth = i;
		this.gMonthName = Calendar.get_month(this.gMonth);
		vCode = this.getMonthlyCalendarCode();
		this.wwrite(this.gMonthName + "/" + this.gYear + "<BR>");
		this.wwrite(vCode);

		if (isIE)
				this.wwrite("</DIV>");
		else if (isNav)
				this.wwrite("</LAYER>");
	}

	this.wwrite("</font><BR></body></html>");
	this.gWinCal.document.close();
}


Calendar.prototype.cal_header = function() {
	var vCode = "";

	vCode = vCode + "<TR>";
	vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Sun</B></FONT></TD>";
	vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Mon</B></FONT></TD>";
	vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Tue</B></FONT></TD>";
	vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Wed</B></FONT></TD>";
	vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Thu</B></FONT></TD>";
	vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Fri</B></FONT></TD>";
	vCode = vCode + "<TD WIDTH='16%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Sat</B></FONT></TD>";
	vCode = vCode + "</TR>";

	return vCode;
}

Calendar.prototype.cal_data = function() {
	var vDate = new Date();
	vDate.setDate(1);
	vDate.setMonth(this.gMonth);
	vDate.setFullYear(this.gYear);

	var vFirstDay = vDate.getDay();
	var vDay=1;
	var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear);
	var vOnLastDay=0;
	var vCode = "";
	
	var linkText = "";
	var linkCloseText = "";

	/*
	Get day for the 1st of the requested month/year..
	Place as many blank cells before the 1st day of the month as necessary. 
	*/
	vCode = vCode + "<TR>";
	for (i=0; i<vFirstDay; i++) {
			vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(i) + "><FONT SIZE='2' FACE='" + fontface + "'> </FONT></TD>";
	}

	// If closeable...
	if (this.closeable) {
		closecodeP = ((this.gType=="POPUP") ? "window.close();" : "");
		closecodeI = "Calendar.Close(\"" + this.gType + "\", \"" + this.INLINE + "\"); ";
	} else {
		closecodeP = "";
		closecodeI = "void(0);' ";
	}

	var whois = this.WHO + 
				((this.gType == "POPUP") ? "document." : "window.document.") + 
				this.gReturnItem + ".value";

	// Write rest of the 1st week
	for (j=vFirstDay; j<7; j++) {
		vDate.setDate(vDay);
		if ((this.gAllowWeekends == "No" && Calendar.isWeekend(j)) || 
			(vDate < v_SelectAfter)) {
					linkText = "";
					linkCloseText = "";
		} else {
			linkText = "<A HREF='javascript:" + closecodeI + "' " +
				"onClick=\"onClickFn('" + 
				
				((this.returnData == "Date") ? 
				this.format_data(vDay) : 
				this.format_dow(vDay)) + 
				
				"');" + 
				closecodeP +
				"\">";
			linkCloseText = "<\/A>";
		}

		vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + 
				"><FONT SIZE='2' FACE='" + fontface + "'>" + 
				linkText + 
				this.format_day(vDay) + 
				linkCloseText + 
				"</FONT></TD>";
		vDay = vDay + 1;
	}
	vCode = vCode + "</TR>";

	// Write the rest of the weeks
	for (k=2; k<7; k++) {
		vCode = vCode + "<TR>";

		for (j=0; j<7; j++) {
			vDate.setDate(vDay);
			if ((this.gAllowWeekends == "No" && Calendar.isWeekend(j)) || 
				(vDate < v_SelectAfter)) {
					linkText = "";
					linkCloseText = "";
			} else {
				linkText = "<A HREF='javascript:" + closecodeI + "' " +
					"onClick=\"onClickFn('" + 
				
					((this.returnData == "Date") ? 
					this.format_data(vDay) : 
					this.format_dow(vDay)) + 
				
					"');" + 
					closecodeP +
					"\">";
				linkCloseText = "<\/A>";
			}

			vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + 
					"><FONT SIZE='2' FACE='" + fontface + "'>" + 
					linkText + 
					this.format_day(vDay) + 
					linkCloseText + 
					"</FONT></TD>";
			vDay = vDay + 1;

			if (vDay > vLastDay) {
				vOnLastDay = 1;
				break;
			}
		}

		if (j == 6)
			vCode = vCode + "</TR>";
		if (vOnLastDay == 1)
			break;
	}

	// Fill up the rest of last week with proper blanks, so that we get proper square blocks
	for (m=1; m<(7-j); m++) {
		if (this.gYearly)
			vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j+m) + 
				"><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'> </FONT></TD>";
		else
			vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j+m) + 
				"><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'>" + m + "</FONT></TD>";
	}

	return vCode;
}

Calendar.prototype.format_day = function(vday) {
	var highDate;
	if (this.gCurrentDate != "NONE")
		highDate = this.gCurrentDate;
	else
		highDate = gNow;

	var vNowDay = highDate.getDate();
	var vNowMonth = highDate.getMonth();
	var vNowYear = highDate.getFullYear();

	if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear)
			return ("<FONT COLOR=\"RED\"><B>" + vday + "</B></FONT>");
	else
			return (vday);
}

Calendar.prototype.write_weekend_string = function(vday) {
	var i;

	// Return special formatting for the weekend day.
	if (Calendar.isWeekend(vday))
		return (" BGCOLOR=\"" + weekendColor + "\"");

	return "";
}

Calendar.prototype.format_data = function(p_day) {
	var vData;
	var vMonth = 1 + this.gMonth;
	vMonth = (vMonth.toString().length < 2) ? "0" + vMonth : vMonth;
	var vMon = Calendar.get_month(this.gMonth).substr(0,3).toUpperCase();
	var vFMon = Calendar.get_month(this.gMonth).toUpperCase();
	var vY4 = new String(this.gYear);
	var vY2 = new String(this.gYear.substr(2,2));
	var vDD = (p_day.toString().length < 2) ? "0" + p_day : p_day;
	var vDOW = Calendar.get_dow(new Date(vMonth + "/" + vDD + "/" + vY4).getDay());

	switch (this.gFormat) {
			case "MM\/DD\/YYYY" :
				vData = vMonth + "\/" + vDD + "\/" + vY4;
				break;
			case "MM\/DD\/YY" :
				vData = vMonth + "\/" + vDD + "\/" + vY2;
				break;
			case "MM-DD-YYYY" :
				vData = vMonth + "-" + vDD + "-" + vY4;
				break;
			case "MM-DD-YY" :
				vData = vMonth + "-" + vDD + "-" + vY2;
				break;

			case "DD\/MON\/YYYY" :
				vData = vDD + "\/" + vMon + "\/" + vY4;
				break;
			case "DD\/MON\/YY" :
				vData = vDD + "\/" + vMon + "\/" + vY2;
				break;
			case "DD-MON-YYYY" :
				vData = vDD + "-" + vMon + "-" + vY4;
				break;
			case "DD-MON-YY" :
				vData = vDD + "-" + vMon + "-" + vY2;
				break;

			case "DD\/MONTH\/YYYY" :
				vData = vDD + "\/" + vFMon + "\/" + vY4;
				break;
			case "DD\/MONTH\/YY" :
				vData = vDD + "\/" + vFMon + "\/" + vY2;
				break;
			case "DD-MONTH-YYYY" :
				vData = vDD + "-" + vFMon + "-" + vY4;
				break;
			case "DD-MONTH-YY" :
				vData = vDD + "-" + vFMon + "-" + vY2;
				break;
			case "MONTH DD, YYYY" :
				vData = vFMon + " " + vDD + ", " + vY4;
				break;
			case "DD\/MM\/YYYY" :
				vData = vDD + "\/" + vMonth + "\/" + vY4;
				break;
			case "DD\/MM\/YY" :
				vData = vDD + "\/" + vMonth + "\/" + vY2;
				break;
			case "DD-MM-YYYY" :
				vData = vDD + "-" + vMonth + "-" + vY4;
				break;
			case "DD-MM-YY" :
				vData = vDD + "-" + vMonth + "-" + vY2;
				break;
			case "DOW, DD-MON-YY" :
				vData = vDOW + ", " + vDD + "-" + vMon + "-" + vY2;
				break;
			default :
				vData = vMonth + "\/" + vDD + "\/" + vY4;
	}

	return vData;
}

Calendar.prototype.format_dow = function(p_day) {
	var vData;
	var vMonth = 1 + this.gMonth;
	
	vMonth = (vMonth.toString().length < 2) ? "0" + vMonth : vMonth;
	var vMon = Calendar.get_month(this.gMonth).substr(0,3).toUpperCase();
	var vFMon = Calendar.get_month(this.gMonth).toUpperCase();
	var vY4 = new String(this.gYear);
	var vDD = (p_day.toString().length < 2) ? "0" + p_day : p_day;

	var vDate = new Date(vMonth + "\/" + vDD + "\/" + vY4);
	vData = Calendar.get_dow(vDate.getDay());
	
	return vData;
}

/*
Calendar Writing Functions
*/
Calendar.prototype.wwrite = function(wtext) {
	if (this.gType == "POPUP")
		this.gWinCal.document.writeln(wtext);
	else {
		// Keep adding to the codeINLINE variable.
		this.codeINLINE += wtext;
	}
}

Calendar.prototype.wwriteA = function(wtext) {
	if (this.gType == "POPUP")
		this.gWinCal.document.write(wtext);
	else {
		// Keep adding to the codeINLINE variable.
		this.codeINLINE += wtext;
	}
}

function Calendar_CreateCalendarLayer(pLeft, pTop, pInitText) {
	/* IMPORTANT : 
	If you use relative positioning of this layer, use LAYER Tag for Netscape.
	If you want absolute positioning, use DIV tag for Netscape.
	*/
	if (pInitText == null)
		pInitText = Calendar.gInitText;
	else
		Calendar.gInitText = pInitText;

	v_InlineX = pLeft;
	v_InlineY = pTop;

	var Calendar_ID = "Calendar";

	if (isIE)
		document.writeln("<DIV ID=\"" + Calendar_ID + "\" STYLE=\"" + 
		"position:absolute;top:" + pTop + ";left:" + pLeft + ";" + 
		"\">" + pInitText + "<\/DIV>");
	else if (isNav)
		document.writeln("<DIV ID=\"" + Calendar_ID + "\" STYLE=\"" + 
		"position:absolute;top:" + pTop + ";left:" + pLeft + ";" + 
		"\">" + pInitText + "<\/DIV>");
}

function Calendar_Lwwrite(pText, pINLINE) {
	if (isIE) {
		document.all[pINLINE].innerHTML = pText;
	} else if (isNav) {
		var lyr = document.layers[pINLINE].document;
		lyr.open();
		lyr.write(pText);
		lyr.close();
	}
}

function Calendar_MoveTo(pX, pY, pINLINE) {
	if (isIE) {
		document.all[pINLINE].style.top = pY;
		document.all[pINLINE].style.left = pX;
	} else if (isNav) {
		document.layers[pINLINE].top = pY;
		document.layers[pINLINE].left = pX;
	}
}
/* ******************************************************************************* */
/*
Drag-n-Drop Functions
*/
mDown = false;
mUp = false;

function click(e) {
	mUp = false;
	mDown = true;
	if (isIE) {
		// Internet Explorer -
		x = event.clientX;
		y = event.clientY;
		cx = event.clientX - event.offsetX;
		cy = event.clientY - event.offsetY;
	} else if (isNav) {
		// Netscape Navigator -
		x = e.pageX;
		y = e.pageY;
		cx = theLayer.x;
		cy = theLayer.y;
	}
}

function unclick(e) {
	mUp = true;
	mDown = false;
}

function handleMove(e) {
	// Get page co-ords
	if (isIE) {
		// Internet Explorer -
		currX = event.clientX;
		currY = event.clientY;
	} else if (isNav) {
		// Netscape Navigator -
		currX = e.pageX;
		currY = e.pageY;
	}
	// Find out the shift in page co-ords
	incrX = currX - x;
	incrY = currY - y;

	// If it is dragging, move the layer by the same shift..
	if (mDown) {
		// Re-assign the v_Inline? co-ords so that the calendar layer
		// maintains it's new position later.
		v_InlineX = cx + incrX;
		v_InlineY = cy + incrY;
		
		window.status = "DRAGGGGGG : X=" + v_InlineX + ", Y=" + v_InlineY;
		MoveLayer(v_InlineX, v_InlineY, "myLayer");
	} else
		window.status = "X=" + currX + ", Y=" + currY;
}

function CalResize() {
	// Store these values 
	// so that subsequent calendar windows keep the same settings.
	v_Height = ggWinCal.innerHeight;
	v_Width = ggWinCal.innerWidth;
}

function initEvents() {
	if (isNav) {
		theLayer.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP | Event.MOUSEMOVE);
	}

	// Assign handlers for mouse activity
	theLayer.onmousemove = handleMove;
	theLayer.onmousedown = click;
	theLayer.onmouseup = unclick;
}

function MoveLayer(pX, pY) {
	theCSSLayer.top = pY;
	theCSSLayer.left = pX;
}

function drag_init(Leyer) {
	if (isIE) {
		theCSSLayer = document.all[Leyer].style;
		theLayer = document.all[Leyer];
	} else if (isNav) {
		theCSSLayer = document.layers[Leyer];
		theLayer = document.layers[Leyer];
	}

	initEvents();
}
function popWin(url,h,w,scroll,resize,toolbar,menubar){
  //general pop up window
  var page2call = url;
  h = (h==undefined?650:h);
  w = (w==undefined?700:w);
  scroll = (scroll==undefined?'yes':scroll);
  resize = (resize==undefined?'yes':resize);
  toolbar = (toolbar==undefined?'yes':toolbar);
  menubar = (menubar==undefined?'yes':menubar);
  var winsettings = 'width='+w+',height='+h+',scrollbars='+scroll+',resizable='+resize+',toolbar='+toolbar+',menubar='+menubar;
 	objWin = window.open(page2call, 'popwin', winsettings);
	objWin.focus();
	}

function ColorPicker(hexcolor,fldname){
  //called when the special extended property set to 'hexcolor'
  var page2call = 'f_/colorpicker/colorpicker.asp?fldname='+fldname+'&hexcolor='+hexcolor;
 	objWin = window.open(page2call, 'colorpicker', 'width=450,height=450,scrollbars=no,resizable=yes,toolbar=no,menubar=no');
	objWin.focus();
	}
function imglib(){
    //called to open up the image library
   
    var page2call = '/f_/dir_list/index.asp';
   	objWin = window.open(page2call, 'imglib', 'width=500,height=300,scrollbars=yes,resizable=yes,toolbar=no,menubar=yes,status=yes');
  	objWin.focus();
  	}	
function chartTest(site_chart_id){
  //called when testing a chart
    
  var page2call = '/f_/chart/testchart.asp?site_chart_id='+site_chart_id;
 	//alert(page2call);
 	objWin = window.open(page2call, 'site_chart', 'width=550,height=550,scrollbars=yes,resizable=yes,toolbar=no,menubar=yes');
	objWin.focus();
	}


function Notify(table_desc,identityKey_name,identityKey_val,link2send,f_ID,replyToEmail){
  //called from f_rec_lib to send a record detail page to a user via email
  replyToEmail=(replyToEmail==undefined)?"":replyToEmail;
  var page2call = 'f_/notify/?table_desc='+table_desc+'&identityKey_name='+identityKey_name+'&identityKey_val='+identityKey_val+'&link2send='+escape(link2send)+'&f_id='+f_ID+'&replyToEmail='+replyToEmail;
 	
	objWin = window.open(page2call, '_blank', 'width=600,height=660,scrollbars=no,resizable=yes,toolbar=no,menubar=yes');
	objWin.focus();
	}
	function NotifyLog(f_ID,rec_id,replyToEmail,db){
  //called from f_rec_lib to send a record detail page to a user via email
  var replyToEmail=(replyToEmail==undefined)?"":replyToEmail;
  var page2call = 'f_/notify/admin_mail_log_rpt.asp?rec_id='+rec_id+'&f_id='+f_ID+'&replyToEmail='+replyToEmail+'&db='+db;
 	
	objWin = window.open(page2call, '_blank', 'width=600,height=500,scrollbars=yes,resizable=yes,toolbar=no,menubar=yes');
	objWin.focus();
	}

function HTMLEditor(formname,fldname,css,basehref){
  //called when the special extended property set to 'HTMLContent'
  var page2call = 'f_/richedit/richedit.asp?formname='+formname+'&fldname='+fldname+'&css='+css+'&basehref='+basehref;
 	
	objWin = window.open(page2call, '_blank', 'width=600,height=600,scrollbars=no,resizable=yes,toolbar=no,menubar=yes');
	objWin.focus();
	}
	
	function Uploader(fldname,location){
  //called when the special extended property set to 'Upload'
  if (location == undefined){ location=''};
  
  var page2call = '/f_/upload/?fldname='+fldname+'&location='+location;
 	//alert(page2call);
 	objWin = window.open(page2call, 'uploader', 'width=375,height=275,scrollbars=no,resizable=yes,toolbar=no,menubar=yes');
	objWin.focus();
	}
	function OnetoM(parent_table_id,child_table_id,parent_value){
  //called when there are 1:Many Associations found it site_tableassoc
  //determine if we need to append the parent_value
  var parent_value_pair ='';
  if(parent_value !='')parent_value_pair ="&parent_value="+parent_value;
  
  var page2call = '/f_/1tomany/?parent_table_id='+parent_table_id+'&child_table_id='+child_table_id+parent_value_pair;
 	objWin = window.open(page2call, '1toM', 'width=590,height=500,scrollbars=no,resizable=yes,toolbar=no,addressbar=yes,menubar=yes');
	objWin.focus();
	}
	
	function logout(logoutpage){
  //called to launch logout page
  var page2call = logoutpage;
 	objWin = window.open(page2call, 'logout', 'width=450,height=175,scrollbars=no,resizable=yes,toolbar=no,menubar=no');
	objWin.focus();
	}
	
/* ******************************************************************************* */
/*
Calendar Build Function
*/
function Build(p_item, p_month, p_year, p_format, p_type, p_custom) {
	// Read Custom parameters from the custom string here..
	if (p_custom && p_custom != "") {
		// Reset the name/value variables 
		// which should not be carried forward to the next calendar..
		v_CurrentDate = "";

		var vvars = name_values(p_custom);
	} else
		v_CurrentDate = "";

	// If the current date is specified, 
	// split it & send it to the calendar...
	var vCurrentDate;
	if (v_CurrentDate || v_CurrentDate != "") {
		vCurrentDate = new Date(v_CurrentDate);
		p_month = vCurrentDate.getMonth();
		p_year = vCurrentDate.getFullYear().toString();
	} else
		vCurrentDate = "NONE";
	
	v_Resizable = (v_Resizable && v_Resizable != "") ? v_Resizable : "No";
	v_SelectAfter = new Date((v_SelectAfter && v_SelectAfter != "") ? v_SelectAfter : "01/01/0001");
	v_NSHierarchy = isNav ? 
					((v_NSHierarchy && v_NSHierarchy != "") ? (v_NSHierarchy + ".") : "")
					: "";

	var vHeight, vWidth;
	if (p_type == "POPUP") {
		vWidth = (v_Width && v_Width != "") ? v_Width : 260;
		
		if (isIE) vHeight = (v_Height && v_Height != "") ? v_Height : 265;
		else if (isNav) vHeight = (v_Height && v_Height != "") ? v_Height : 250;

		vWinCal = window.open("", "Calendar", 
				"width=" + vWidth + ",height=" + vHeight + 
				",status=no,resizable=" + v_Resizable);
		vWinCal.opener = self;
		ggWinCal = vWinCal;
		var p_WinCal = ggWinCal;

		if (isNav) ggWinCal.captureEvents(Event.RESIZE);
		ggWinCal.onresize = CalResize;
	}

	gCal = new Calendar(p_item, p_WinCal, p_month, p_year, p_format, p_type);
	
	gCal.gCurrentDate = vCurrentDate;
	gCal.gAllowWeekends = 
		(v_AllowWeekends && v_AllowWeekends != "" &&  
		v_AllowWeekends == "Yes") ? "Yes" : "No";

	// ############ CUSTOMIZE #############
	// Customize your Calendar here..
	gCal.gBGColor="white";
	gCal.gLinkColor="black";
	gCal.gTextColor="black";
	gCal.gHeaderColor="darkgreen";
	
	gCal.closeable = v_CloseOnSelect ? 
		((v_CloseOnSelect == "Yes") ? true : false)
		: false;

	gCal.returnMode = v_AppendOrReplace ?
		v_AppendOrReplace : "Replace";

	gCal.returnData = v_ReturnData ?
		v_ReturnData : "Date";

	// Character to be added For Append mode
	gCal.appendChar = (gCal.returnMode == "Append") ?
		v_AppendChar ? v_AppendChar : ";" 
		: "";
					
	// Position for INLINE Calendar
	// It either comes from the Calendar_CreateCalendarLayer function or 
	// from the 
	gCal.InlineX = v_InlineX ? v_InlineX : 100;
	gCal.InlineY = v_InlineY ? v_InlineY : 100;
	
	// Re-position INLINE Calendar now
	if (gCal.gType == "INLINE") {
		Calendar.MoveTo(gCal.InlineX, gCal.InlineY, gCal.INLINE);
	}

	gCal.gTitle = v_Title ? v_Title : gCal.gMonthName + "/" + gCal.gYear;
	// ############ CUSTOMIZE #############

	// Choose appropriate show function
	if (gCal.gYearly)	gCal.showY();
	else	gCal.show();

	if (gCal.gType == "INLINE") {
		// Initialize INLINE Calendar for drag-n-drop functionality
		drag_init(gCal.INLINE);
	}
}

/* ******************************************************************************* */
/*
Monthly Calendar Code Starts here
*/
function show_calendar() {
	/* 
		p_item  : Return Item.
		p_month : 0-11 for Jan-Dec; 12 for All Months.
		p_year  : 4-digit year
		p_format: Date format (mm/dd/yyyy, dd/mm/yy, ...)
		p_type	: POPUP/INLINE Calendar
		p_custom: String of customizable name/value pair parameters
					v_CloseOnSelect
					v_AppendOrReplace
					v_AppendChar
					v_ReturnData
					v_InlineX
					v_InlineY
					v_Title
					v_CurrentDate
					v_AllowWeekends
					v_Height
					v_Width
					v_Resizable
					v_SelectAfter
					v_NSHierarchy	: If the form calling calendar is in a layer
										(reqd only for Netscape)
	*/

	p_item = arguments[0];
	if (arguments[1] == null)
		p_month = new String(gNow.getMonth());
	else
		p_month = (typeof(arguments[1]) == "number") ? 
						arguments[1].toString() 
						: 
						arguments[1];
	if (arguments[2] == "" || arguments[2] == null)
		p_year = new String(gNow.getFullYear().toString());
	else
		p_year = (typeof(arguments[2]) == "number") ? 
						arguments[2].toString() 
						: 
						arguments[2];
	if (arguments[3] == null)
		p_format = "MM/DD/YYYY";
	else
		p_format = (typeof(arguments[3]) == "string") ? 
						arguments[3] 
						: 
						"MM/DD/YYYY";
	if (arguments[4] == null)
		p_type = "POPUP";
	else
		p_type = (typeof(arguments[4]) == "string" && 
					(arguments[4] == "POPUP" || arguments[4] == "INLINE")) ?
						arguments[4]
						:
						"POPUP";
	if (arguments[5] == null)
		p_custom = "CloseOnSelect=Yes;AppendOrReplace=Replace;AppendChar=';';ReturnData=Date;Title=Popup Date Picker;AllowWeekends=Yes;Resizable=No";
	else
		p_custom = typeof(arguments[5]) == "string" ?
					arguments[5]
					:
					"CloseOnSelect=Yes;AppendOrReplace=Replace;AppendChar=';';ReturnData=Date;Title=Popup Date Picker;AllowWeekends=Yes;Resizable=No";

	Build(p_item, p_month, p_year, p_format, p_type, p_custom);
}

/* ******************************************************************************* */
/*
Yearly Calendar Code Starts here
*/
function show_yearly_calendar(p_item, p_year, p_format) {
	// Load the defaults..
	if (p_year == null || p_year == "")
		p_year = new String(gNow.getFullYear().toString());
	else
		p_year = (typeof(p_year) == "number") ?
					p_year.toString()
					:
					p_year;

	if (p_format == null || p_format == "")
			p_format = "MM/DD/YYYY";

	var vWinCal = window.open("", "Calendar", "scrollbars=yes");
	vWinCal.opener = self;
	ggWinCal = vWinCal;

	Build(p_item, null, p_year, p_format);
}
/* *********************************EOF********************************* */




/* ***********************MACROMEDIA SCRIPTS********************* */

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/* *****END***************MACROMEDIA SCRIPTS*****END************** */

function getWinSize() {
//see http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=16
//  var myWidth = 0, myHeight = 0; -- made this a global var
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
      myHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
    }
  }
 // window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
}

//get browser window scroll bar offsets
function getScrollXY() {
  //var scrOfX = 0, scrOfY = 0; --made these global
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else {
    if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
      //DOM compliant
      scrOfY = document.body.scrollTop;
      scrOfX = document.body.scrollLeft;
    } else {
      if( document.documentElement &&
          ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
      	//IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
      }
    }
  }
  return [ scrOfX, scrOfY ];
}


/*** used to determine tab control support by browser **/

function hasTabSupport() {

   if (typeof hasSupport.support != "undefined")
      return hasSupport.support;

  var ie55 = /msie 5\.[56789]/i.test( navigator.userAgent );

   hasSupport.support = ( typeof document.implementation != "undefined" &&
         document.implementation.hasFeature( "html", "1.0" ) || ie55 )
         
   // IE55 has a serious DOM1 bug... Patch it!
   if ( ie55 ) {
      document._getElementsByTagName = document.getElementsByTagName;
      document.getElementsByTagName = function ( sTagName ) {
         if ( sTagName == "*" )
            return document.all;
         else
            return document._getElementsByTagName( sTagName );
      };
   }

   return hasSupport.support;
}
function openDialog(title,width,height,url){
   
       if (!window.win)
        {
         // window has not yet been defined
        var args="toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=yes,width=" + width + ",height=" + height;
           win = window.open(url, title,args);
           win.creator = self;
           win.focus();
         }
       else
        {  // has been defined
           if(!win.closed) 
           {  // still open 
               win.focus();                    
		    }
		    else
		    {
		     var args="toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=yes,width=" + width + ",height=" + height;
				win = window.open(url,title, args);
				win.creator = self;    
                win.focus();
             }                
     	 } 
   }
   
   
   
   