//<![CDATA[
  //var sResult;
	var sBodyHeight;
  var curifldispl=0;
  var curifldisplTimer;
	var scrOfX = 0; 
	var scrOfY = 0;
	var MouseX = 0; 
	var MouseY = 0;	
	var IMWin=null;
	var container;
	var RDCi;
	var lLastCalDate;
	var lPD_HGrpCode;
	var dispDayCalTimer;
	var DoNameSearchTimer;
	var DoTagSearchTimer;
	var lgk;
	var NewMsg;	
	var NewSubj;
	var NewId;
	var NewShortName;	
	var NewType;
	var NewDef;
	var NewTextEmail;
	var tid;
	var lCalFound;
	var CalAdjTimer;
	var bDayCalOpen;
	var gNum=0;
	var tids=Array();
	var aDraggables=Array();
	var iCnt=0;
	var sAllTids='';
	var sComma='';
	var bNeedDDWikiRefresh=0;	
	var ScrollTop;
	var bFileManagerFolderEdit=0;
	var gFMXid=-1;
	var gFMXCnt=0;
	var bNotReadyToEdit=1;
	var idLastSort;
	var SortingMode=0;
	var idLastSortText;
	var dragElem;
	var dragHandle;
	var BaseEditorObj;
	var svAid;
	var aNQ;
	var aNS;
	var iCurrOcc;
	var oSurvNav;
	var CurrDragObj;
	var CurrDroppable;
	var bWasLoggedIn;
	var bNowLoggedOff;
	var newday = new Date();
	var iCalSelmonth=newday.getMonth();
	var iCalSelYYYY=newday.getFullYear();
	var oSurveyErrors = new Array();
	var oComponents = new Array();
	var oCalJSON = new Array();
	var parDivs= new Array();
	var parDivsCnt= new Array();
	var parDivsJSON= new Array();
	var parDivsJSONIdx=0;
	var iDivCnt=0;
	var iHighId=0;
	var oNewsFeed=new Array();
	var oNewsFeedComments=new Array();
	var oPulseEvents=new Array();
	var oPulseAffSpaces=new Array();
	var oPulseAttachments=new Array();
	var bStreamSet=0;
	var sCC='';
	var sSp='';
	var oProgressBar='<div id=progressind class=Progress><span>Retrieving...</span></div>'
	var sort_by = function(field, reverse, primer){
	  reverse = (reverse) ? -1 : 1;
   return function(a,b){

       a = a[field];
       b = b[field];

       if (typeof(primer) != 'undefined'){
           a = primer(a);
           b = primer(b);
       }

       if (a<b) return reverse * -1;
       if (a>b) return reverse * 1;
       return 0;

	   }
	}
	var map;
	var geocoder;
    var mgr;
    var icons = {};
    var icon;
    var pointofmarker;
    var sOneCC;
    var sUrl;
    var LatLng;
    var icon;
    var iconMe;
    var iconAdd;
    var lnglatdisplayed;
    var MarkerPosInProcess;
    var lDCBLastFunction;
    
    var ajaxdate = new Date();
    var ajaxTimeStamp = ajaxdate.getTime();
    var ajaxIncrement=0;
    var ajaxIMCheck=0;
    var DCBajaxscript='';
    var urlDSeq;
    var RollOutTimer;
    var RollId;
    var RollType1;
    var RollType2;
    var PanelTimer;
    
		var PlusImg = new Image();
		PlusImg.src = "../dc_images/silk_icons/plusonly.gif";
		var MinusImg = new Image();
		MinusImg.src = "../dc_images/silk_icons/minusonly.gif";    
    
    var AdminBoxes = 1;
    
// Load standard images to reduce http traffic    

	var imgMailBox=0;
	var imgCalendar=1;
	var imgMap=2;
	
	var stdImageLibrary='/DC_Images/DC_MailBox.gif,/DC_Images/DC_CalendarBig.gif,/DC_Images/DC_Map.gif';
	var stdImgArray=stdImageLibrary.split(',');
	var stdImages = new Array();
	for (i=0; i< stdImgArray.length; i++) {
		stdImages[i]= new Image();
		stdImages[i].src=stdImgArray[i];
	}

function load(Zoom, ConfCode, AddMarkers) {
    
  icon = new GIcon();
  icon.image = lEventGoogleMarker;
  icon.iconAnchor = new GPoint(10, 33);
  icon.infoWindowAnchor = new GPoint(5, 1); 
	  
  icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
 	icon.iconSize = new GSize(20, 34);
  icon.shadowSize = new GSize(37, 34);
  icon.infoWindowAnchor = new GPoint(9, 2);
  icon.infoShadowAnchor = new GPoint(18, 25);	   
	  
	iconMe = new GIcon();
	iconMe.image = "http://www.digitalconcourse.com/GetDigi/images/GoogleMarkerMe.png";
	iconMe.iconAnchor = new GPoint(27, 26);
	iconMe.infoWindowAnchor = new GPoint(5, 1); 
  iconMe.shadow = "";
  iconMe.iconSize = new GSize(28, 27);
  iconMe.shadowSize = new GSize(0, 0);	  	
	 
	iconAdd = new GIcon(icon);
	iconAdd.image = "http://www.digitalconcourse.com/GetDigi/images/GoogleAddMarker.png";
	iconAdd.iconAnchor = new GPoint(10, 33);
	iconAdd.infoWindowAnchor = new GPoint(5, 1); 		  
	  
	if(Zoom==null) {Zoom=3}
	
	sOneCC=ConfCode;

  map = new GMap2(document.getElementById("map"));

	if (map!=null) {
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(40, -98), Zoom); 
		map.enableDoubleClickZoom();
		map.enableContinuousZoom();
		mgr = new GMarkerManager(map); 
     
		geocoder = new GClientGeocoder();
		
		if (AddMarkers=='1') {
			GEvent.addListener(map, "dragstart", function(marker, point) {
				var aM=marker;
				aM.enableDragging();
				document.getElementById('divlnglat').style.display='';  
				GEvent.addListener(aM, "drag", function()  {  
					document.getElementById("lnglat").value = aM.getPoint();
				});					
			});
			GEvent.addListener(map, "click", function(marker, point) { 
				if (marker) {  
					var aM=marker;
					var t=aM.getTitle();
					var ta=t.split('^');
												
					aM.enableDragging();
					document.getElementById('divlnglat').style.display='';
						
					if (t!=null) {
						document.getElementById("lnglat").value = t;
					}
					if (ta[2]!=null) {
						if (ta[2].length>0) {
						document.getElementById("lnglat").value = ta[1];
						}
					}

					document.getElementById("llAddress").value = ta[0];
					document.getElementById("EntityId").value = ta[2];
					document.getElementById("llType").value = ta[3];
					document.getElementById("llSeq").value = ta[4];
					GEvent.addListener(aM, "drag", function()  {  
						document.getElementById("lnglat").value = aM.getPoint();
					});
				} 
			else {  
				MarkerPosInProcess=1;
				//var aM=new GMarker(point, {icon:iconAdd,draggable:true});
				var aM=new GMarker(point, {icon:iconAdd});
				map.addOverlay(aM); 
							
				var t=aM.getTitle();
				var ta=t.split('^');
												
				document.getElementById('divlnglat').style.display='';
				if (ta[2].length>0) {
					document.getElementById("lnglat").value = ta[1];
				}
				else	{  
					document.getElementById("lnglat").value = t;
				}							

				document.getElementById("llAddress").value = ta[0];
				document.getElementById("EntityId").value = ta[2];
				document.getElementById("llType").value = ta[3];
				document.getElementById("llSeq").value = ta[4];
							
				//document.getElementById('divlnglat').style.display=''; 
				//GEvent.addListener(aM, "drag", function()  {  
				//	document.getElementById("lnglat").value = aM.getPoint();
				//	}
				//);
				//GEvent.addListener(aM, "dragend", function()  {  
				//	map.setCenter(aM.getPoint());
				//});		
			}
		});
	}
 }
}
function SaveMarker() {
	
		if (document.getElementById('llAddress').value.length==0) {
			alert ("You must enter a title for this function");
			document.getElementById('llAddress').select();
			document.getElementById('llAddress').focus();
			return false;
		}
	
		if (document.getElementById('llAddress').value.length>500) {
			alert ("Title may not exceed 500 characters");
			document.getElementById('llAddress').select();
			document.getElementById('llAddress').focus();
			return false;
		}
		if (document.getElementById('lnglat').value.length==0) {
			alert ("Longtitude/Latitude is required, try dragging the selected marker");
			document.getElementById('lnglat').select();
			document.getElementById('lnglat').focus();
			return false;
		}		
		
		MarkerPosInProcess=0;
		document.getElementById('divlnglat').style.display='none';		
	
		ValidatefEmpApprov("formLongLat","llUpd","llUpdMsg","RefreshGoogleMap()");	
		return false;	
}
function RefreshGoogleMap() {
	$('divGoogleGroupList').highlight();
	DisplayAjaxPage(0,'divGoogleGroupList','CP6GOOGLEGROUPLIST','','','&'+urlRequestQueryString,1)
}
function SubmitSFPage(formname,ind) {
	
	if ($('SFUpdProgressBar')!=null) {
		$('SFUpdProgressBar').style.display='';
	}
	
	ValidatefEmpApprov(formname,ind,"divSuperFind");
	return false;
}
function CancelMarker(marker) {
	var x=window.confirm("You are about to delete the selected marker\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}
		map.removeOverlay(marker);
		MarkerPosInProcess=0  ;
		document.getElementById('divlnglat').style.display='none';		
		alert ('Deleted');    
    }
	function ZoomGoogle (point,zoom) {
		map.setZoom(zoom);
	} 
	function dcGetPointOfMarker(addr,Zoom) {
			if (Zoom==null) {
				var Zoom=10;
			}
			geocoder.getLatLng(addr,
			function(point){map.setCenter(point, Zoom);}
		);
	}
	function showAddress(address) {  
		geocoder.getLatLng(    
			address,    
			function(point) {      
				if (!point) {        
					alert(address + " not found");      
				} 
				else {        
					map.setCenter(point, 13);        
					var marker = new GMarker(point, icon);        
					map.addOverlay(marker);        
					marker.openInfoWindowHtml(address);      
				}   
			}  
		);
	} 
	
	function MapPoints(addr1, addr2) {
		var pointa;
		var pointb;
		
		geocoder.getLatLng(addr1,
			function(point){pointa=point;}
			);
			
		geocoder.getLatLng(addr2,
			function(point){pointb=point;}
		);
	
		var polyline = new GPolyline([  
			new GLatLng(pointa),  
			new GLatLng(pointb)
			], "#ff0000", 10);
		
		map.addOverlay(polyline);
	}	
	
	function GetLL(address,Title, sDate, sEvent,bZoom,Cntxt,SpecIcon,Interact,ToolTip) {  
		if (Cntxt==null) {
			Cntxt=0;
		}
		if (ToolTip==null) {
			var ToolTip='';
		}
		
	//	if (SpecIcon!=null) {
	//		icon.image=SpecIcon;
	//		}
	//	else	{
	//		icon.image=lEventGoogleMarker;
    // 		}
    
    var lTa=ToolTip.split('^');
    
		if (lTa[1]!=null) {
				if (lTa[1].length>10) {
						address=lTa[1];
				}		
		}      

		geocoder.getLatLng(    
			address,    
			function(point) {      
				if (!point) {        
					//alert(address + " not found");      
				} 
				else { 
					pointofmarker=point;

					
					if (Interact==1) {
							if (Cntxt==1) {
									var marker=new GMarker(pointofmarker, {icon:iconMe,draggable:true,title:ToolTip});
				       		map.addOverlay(marker,0,17);
			       		}
			       	else	{
			       			var marker=new GMarker(pointofmarker, {icon:icon,draggable:true,title:ToolTip});
				       		map.addOverlay(marker,0,17);
			       	}
			       }
			    else {
			    		switch (Cntxt) {
								case 1:
									var marker=new GMarker(pointofmarker, {icon:iconMe,draggable:false});
				       		map.addOverlay(marker,0,17);
			       			break;
								case 2:
									var marker=new GMarker(pointofmarker, {icon:icon,draggable:false});
				       		map.addOverlay(marker,0,17);
			       			break;			       			
			       		case 0:
			       			var marker=new GMarker(pointofmarker, {icon:icon,draggable:false});
				       		map.addOverlay(marker,0,17);
				       		break;
			       	}			    	
			    }

					if (bZoom!=0) {map.setCenter(pointofmarker);}
					
			    if (Interact!=1) {   	
					GEvent.addListener(marker, "click", 
						function() { 
						
							switch (Cntxt) {
								case 1 :
									marker.openInfoWindowHtml('<b>' + lTa[0] + '</b><br \>' + address + '</b><br \>');
									break;
								case 2 :
									marker.openInfoWindowHtml('<b>' + lTa[0] + '</b><br \>' + sDate + '<br /><b>' + address + '</b><br \>');
									break;									
								case 0 :
									marker.openInfoWindowHtml('<b>' + lTa[0] + '</b><br \>' + sDate + '<br /><b>' + address + '</b><br \><br /><br /><a class=StdLink href=?p=210&confcode=' + sEvent + '><img src=/DC_Images/silk_icons/application_go.png class=DCGoogleImg>Navigate to Event Page >></a><br /><a href=/DC_PublicPages/DC_BuildCalEntry.asp?ConfCode=' + sEvent + ' class=StdLink><img src=/DC_Images/DC_CalendarBig.gif class=DCGoogleImg>Add to your Calendar</a><br /><br />');
									break;
							}
						}   
					);
					}
				}  
			}
		)
	}
    // addAddressToMap() is called when the geocoder returns an
    // answer.  It adds a marker to the map with an open info window
    // showing the nicely formatted version of the address and the country code.
    function addAddressToMap(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Sorry, we were unable to geocode that address");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        marker = new GMarker(point);
        map.addOverlay(marker);
        marker.openInfoWindowHtml(place.address + '<br>' +
          '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);
      }
    }

    // showLocation() is called when you click on the Search button
    // in the form.  It geocodes the address entered into the form
    // and adds a marker to the map at that location.
    function showLocation() {
      var address = document.getElementById('GoogleAddress').value;
      geocoder.getLocations(address, addAddressToMap);
    }

   // findLocation() is used to enter the sample addresses into the form.
    function findLocation(address) {
      document.getElementById('GoogleAddress').value = address;
      showLocation();
    }
    function getIcon(images) {
      var icon = null;
      if (images) {
        if (icons[images[0]]) {
          icon = icons[images[0]];
        } else {
          icon = new GIcon();
          icon.image = "markermanager/" + images[0] + ".png";
          var size = iconData[images[0]];
          icon.iconSize = new GSize(size.width, size.height);
          icon.iconAnchor = new GPoint(size.width >> 1, size.height >> 1);
          icon.shadow = "markermanager/" + images[1] + ".png";
          size = iconData[images[1]];
          icon.shadowSize = new GSize(size.width, size.height);
          icons[images[0]] = icon;
        }
      }
      return icon;
    }
    
	function AdminToggleBoxOn(id) {
		if (AdminBoxes==1 && document.getElementById(id).className=="AdminEditBox") {
			document.getElementById(id).className="AdminEditBoxOn";
		}
	}	
	
	function AdminToggleBoxOff(id) {
		if (AdminBoxes==1 && document.getElementById(id).className=="AdminEditBoxOn") {
			document.getElementById(id).className="AdminEditBox";
		}
	}	

    function CloseMyConcourse() {
		document.getElementById('divMyConcoursePage').style.display="none";
		
	} 
	
	function OpenMyConcourse() {
		document.getElementById('divMyConcoursePage').style.display="inline";
		
	} 
	function addAddressToMap(response) {  
		map.clearOverlays();  
		if (!response || response.Status.code != 200) {    
			alert("\"" + address + "\" not found");  
			} 
		else {    
			place = response.Placemark[0];    
			point = new GLatLng(place.Point.coordinates[1],
			place.Point.coordinates[0]);    
			marker = new GMarker(point);    
			map.addOverlay(marker);    
			marker.openInfoWindowHtml(place.address + '<br>' + '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);  
		}
	}
	
	function DispMiscAddr(GroupName, ListName, Items) {
		
		//--- Function:GetLL(address,Title, sDate, sEvent,bZoom,Cntxt,SpecIcon,Interact,ToolTip
		
		if (map==null) {
			//var map = new google.maps.Map2(document.getElementById("map"));
		}
		
		if(typeof map.clearOverlays== 'function') {
			map.clearOverlays();
		}
		var itemsArray=Items.split('~');
		for (i=0;i<itemsArray.length;i++) {
			
			var lta=itemsArray[i].split("^");
			
			GetLL(lta[0], GroupName+': '+lta[0],ListName, '', '',0,'',1,itemsArray[i]);
		}
	}
var oPortletPosition;
var oPortletwidth;
var oPortletheight;
var oZIndex;
var oPortletTdContent;
function MaxPortlet(id) {

	sPortletTDId='Portlet'+id;
	sPortletImgMaxId='PortletImgMax'+id;
	sPortletImgMinId='PortletImgMin'+id;
	
	var portletId = "PortletContent" + id;
	var imgId = "FolderImg" + id;	

	oPortletPosition=document.getElementById(sPortletTDId).style.position;
	oPortletwidth=document.getElementById(sPortletTDId).style.width;
	oPortletheight=document.getElementById(sPortletTDId).style.height;
	oZIndex=document.getElementById(sPortletTDId).style.zIndex;
	
	document.getElementById(sPortletTDId).style.position="absolute";
	document.getElementById(sPortletTDId).style.left='0px';
	document.getElementById(sPortletTDId).style.top='0px';
	
	if (document.getElementById('RC2')==null) {
		document.getElementById(sPortletTDId).style.width=document.getElementById('RC1').offsetWidth;
		document.getElementById(sPortletTDId).style.height=document.getElementById('RC1').offsetHeight;
	}
	else	{
		document.getElementById(sPortletTDId).style.width=document.getElementById('RC2').offsetWidth;
		document.getElementById(sPortletTDId).style.height=document.getElementById('RC2').offsetHeight;
	}
	
	oPortletTdContent=document.getElementById(portletId).style.display;
	
	if (document.getElementById(portletId).style.display=="none") {
		if (document.getElementById(imgId)!=null) {
			document.getElementById(imgId).src="../dc_images/silk_icons/minusonly.gif";
		}
		new Effect.BlindDown(portletId);
	}
	
	if (document.getElementById(sPortletImgMaxId)!=null) {		
		document.getElementById(sPortletImgMaxId).style.display="none";
	}		
	if (document.getElementById(sPortletImgMinId)!=null) {
		document.getElementById(sPortletImgMinId).style.display="";
	}

	self.location="#DCTop";

}
function MinPortlet(id,keepopen) {

	sPortletTDId='Portlet'+id;
	sPortletImgMaxId='PortletImgMax'+id;
	sPortletImgMinId='PortletImgMin'+id;
	
	
	var portletId = "PortletContent" + id;
	var imgId = "FolderImg" + id;		
	
	if (keepopen!='1') {
		document.getElementById(sPortletImgMinId).style.display="none";
		document.getElementById(sPortletImgMaxId).style.display="";	
	
		document.getElementById(portletId).style.zindex=-1;

		document.getElementById(sPortletTDId).style.position=oPortletPosition;
		document.getElementById(sPortletTDId).style.width=oPortletwidth;
		document.getElementById(sPortletTDId).style.height=oPortletheight;
		document.getElementById(portletId).style.display=oPortletTdContent;
	
		if (document.getElementById(portletId).style.display=="none") {
			if (document.getElementById(imgId)!=null) {
				document.getElementById(imgId).src="../dc_images/silk_icons/plusonly.gif";
			}
		}	
		self.location="#DCTop";
		}
	else	{
		document.getElementById(portletId).style.display='none';
	}
}

function ValidateCFForm() {

	if (document.getElementById('FirstName').value.length==0) {
		alert ("You must enter a first name");
		document.getElementById('FirstName').select();
		document.getElementById('FirstName').focus();
		return false;
	}
	if (document.getElementById('FirstName').value.length>50) {
		alert ("First Name cannot exceed 50 characters");
		document.getElementById('FirstName').select();
		document.getElementById('FirstName').focus();
		return false;
	}
	if (document.getElementById('LastName').value.length==0) {
		alert ("You must enter a last name");
		document.getElementById('LastName').select();
		document.getElementById('LastName').focus();
		return false;
	}
	if (document.getElementById('LastName').value.length>50) {
		alert ("Last Name cannot exceed 50 characters");
		document.getElementById('LastName').select();
		document.getElementById('LastName').focus();
		return false;
	}
	if (document.getElementById('eMail').value.length==0) {
		alert ("You must enter an eMail");
		document.getElementById('eMail').select();
		document.getElementById('eMail').focus();
		return false;
	}
	if (document.getElementById('eMail').value.length>255) {
		alert ("eMail cannot exceed 255 characters");
		document.getElementById('eMail').select();
		document.getElementById('eMail').focus();
		return false;
	}
	if (!isValidEmail(document.getElementById('eMail').value)) {
		alert ("Must be a valid email format");
		document.getElementById('eMail').select();
		document.getElementById('eMail').focus();
		return false;
	}		
	
	if (document.getElementById('CompanyName').value.length>255) {
		alert ("Company Name cannot exceed 50 characters");
		document.getElementById('CompanyName').select();
		document.getElementById('CompanyName').focus();
		return false;
	}
	if (document.getElementById('Country').value.length>50) {
		alert ("Country cannot exceed 50 characters");
		document.getElementById('Country').select();
		document.getElementById('Country').focus();
		return false;
	}
	if (document.getElementById('Addr1').value.length>255) {
		alert ("Addr1 cannot exceed 255 characters");
		document.getElementById('Addr1').select();
		document.getElementById('Addr1').focus();
		return false;
	}
	if (document.getElementById('Addr2').value.length>255) {
		alert ("Addr2 cannot exceed 255 characters");
		document.getElementById('Addr2').select();
		document.getElementById('Addr2').focus();
		return false;
	}
	if (document.getElementById('Addr2').value.length>255) {
		alert ("Addr3 cannot exceed 255 characters");
		document.getElementById('Addr2').select();
		document.getElementById('Addr2').focus();
		return false;
	}
	if (document.getElementById('City').value.length>255) {
		alert ("City cannot exceed 255 characters");
		document.getElementById('City').select();
		document.getElementById('City').focus();
		return false;
	}
	if (document.getElementById('State').value.length>50) {
		alert ("State/Region cannot exceed 50 characters");
		document.getElementById('State').select();
		document.getElementById('State').focus();
		return false;
	}
	if (document.getElementById('ZipCode').value.length>50) {
		alert ("Postal Code cannot exceed 50 characters");
		document.getElementById('ZipCode').select();
		document.getElementById('ZipCode').focus();
		return false;
	}												
	if (document.getElementById('ZipCode').value.length>50) {
		alert ("Postal Code cannot exceed 50 characters");
		document.getElementById('ZipCode').select();
		document.getElementById('ZipCode').focus();
		return false;
	}
	if (document.getElementById('Phone').value.length>50) {
		alert ("Phone cannot exceed 50 characters");
		document.getElementById('Phone').select();
		document.getElementById('Phone').focus();
		return false;
	}
	if (document.getElementById('Fax').value.length>50) {
		alert ("Fax cannot exceed 50 characters");
		document.getElementById('Fax').select();
		document.getElementById('Fax').focus();
		return false;
	}	
	if (document.getElementById('Cell').value.length>50) {
		alert ("Cell cannot exceed 50 characters");
		document.getElementById('Cell').select();
		document.getElementById('Cell').focus();
		return false;
	}
	
	document.getElementById('CFUpd').value='1';
	
	ValidatefEmpApprov('formContact','CFUpd','UpdMsg');	
	return false;
	
}
function fValidateGroupContactConsForm() {
	if ((document.getElementById('CFProcessMode').value=="0" || document.getElementById('CFProcessMode').value=="1" 
		|| document.getElementById('CFProcessMode').value=="3")
		&& document.getElementById('NSource').value.length<1) {
				alert("You must supply a new source name to consolidate to");
				document.getElementById('NSource').select();
				document.getElementById('NSource').focus();
				return false;
	}
	var sProcFunction=document.getElementById('ProcFunction').value;
	document.getElementById('UpdProgressBarContacts').style.display='';
	ValidatefEmpApprov('DCFormUpload','Upd','UpdMsg',sProcFunction);	
	return false;	
	
}	
function ValidateContactConsForm() {
	if (document.getElementById('CFProcessMode')!=null) {
		if ((document.getElementById('CFProcessMode').value=="0" || document.getElementById('CFProcessMode').value=="1" 
			|| document.getElementById('CFProcessMode').value=="3")
			&& document.getElementById('NSource').value.length<1) {
					alert("You must supply a new source name to consolidate to");
					document.getElementById('NSource').select();
					document.getElementById('NSource').focus();
					return false;
		}
	}
	if (document.getElementById('UpdProgressBarContacts')!=null) {
		document.getElementById('UpdProgressBarContacts').style.display='';
	}
	ValidatefEmpApprov('DCFormUpload','Upd','UpdMsg','ShowContactsSource(0)');	
	return false;	
	
}
function SaveCF() {
	if (ValidateCFForm()!=false) {
		document.getElementById('formContact').submit();
	}
}
function OpenClosePortlet(id) {
	var portletId = "PortletContent" + id;
	var imgId = "FolderImg" + id;
	var endBr = "spanEndBr" + id;
	var portletdisplay=0;
	//document.getElementById(endBr).style.display='none';
	
	if (document.getElementById(portletId).style.display=="none") {
		if (document.getElementById(imgId)!=null) {
			document.getElementById(imgId).className="PortletPlusMinus PortletClose";
		}
		if (document.getElementById('PortletPage_'+id)!=null) {
			if (document.getElementById('PortletPage_'+id).value.length>0) {
				ajaxscript=document.getElementById('PortletPage_'+id).value;
				ajaxDest=document.getElementById('PortletPageDest_'+id).value+id;
				if (ajaxDest.indexOf('divCalendar')!=-1) {
					AjaxSimpleCheck(ajaxscript, '', ajaxDest,1,'true','fAdjustCalendar()');
					}
				else {
					AjaxSimpleCheck(ajaxscript, '', ajaxDest,1);
				}
				document.getElementById('PortletPage_'+id).value='';
				}		
			}
		new Effect.BlindDown(portletId);
		portletdisplay=1;
		}
	else	{
		if (document.getElementById(imgId)!=null) {
			document.getElementById(imgId).className="PortletPlusMinus PortletOpen";
		}
		new Effect.BlindUp(portletId);
		portletdisplay=2;
	}

	if (lPD_PersistAttEmail.length>0) {
		var ajaxscript = '/dc_includes/CP_PersonalPortletSetting.asp?id=' + id + '&ocp=' + portletdisplay + '&xc=' + ajaxTimeStamp;
		AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
		if (document.getElementById('divGnrlAjax').innerHTML.indexOf('Personalized') > 0) {
			document.getElementById('PortletLeft'+id).className='DCPortletHeaderLeft Personal';
		}
	}		
}
function ContactForm(id,dest,mifl) {
	if (mifl==null) {
		var mifl=''
	}	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/cp5_contactform.asp?mifl='+mifl+'&sp='+l_sp+'&pid='+id+'&xc='+ajaxTimeStamp+ajaxIncrement;
	ajaxDest=dest;
	AjaxSimpleCheck(ajaxscript, '', ajaxDest,1);
}
function ContactFormGrp(id,dest) {
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/cp5_contactformgroups.asp?sp='+l_sp+'&pid='+id+'&xc='+ajaxTimeStamp+ajaxIncrement;
	ajaxDest=dest;
	AjaxSimpleCheck(ajaxscript, '', ajaxDest,1);
}
function ContactFormUpload(id,dest,grpcode,type) {
	if (id==null) {
		var id=0;
	}
	if (dest==null) {
		var dest='ContactOptionsContainer';
	}

	if (grpcode==null) {
		var grpcode='';
	}
	if (type==null) {
		var type=0;
	}	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/cp5_SimpleListJoin.asp?sp='+l_sp+'&g='+grpcode+'&t='+type+'&pid='+id+'&xc='+ajaxTimeStamp+ajaxIncrement;
	ajaxDest=dest;
	AjaxSimpleCheck(ajaxscript, '', ajaxDest,1);
}
function DelContactForm(id,dest) {
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/cp5_Delcontactform.asp?pid='+id+'&xc='+ajaxTimeStamp+ajaxIncrement;
	ajaxDest=dest;
	AjaxSimpleCheck(ajaxscript, '', ajaxDest,1);
}
function DeletePersonalization(id) {
	var ajaxscript = '/dc_includes/CP_PersonalPortletSetting.asp?id=' + id + '&m=d&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	document.getElementById('PortletLeft'+id).className='DCPortletHeaderLeft';
}	

function OpenPortlet(id) {
	var portletId = "PortletTDContent" + id;
	var imgId = "FolderImg" + id;
	var endBr = "spanEndBr" + id;
	
	if (document.getElementById(imgId)!=null) {
		document.getElementById(imgId).src="../dc_images/silk_icons/minusonly.gif";
	}
	if (document.getElementById(portletId).style.display=="none") {
		//new Effect.BlindDown(portletId);
		document.getElementById(portletId).style.display="";
	}
	//document.getElementById(portletId).style.display="";
	//document.getElementById(endBr).style.display='';
}

function ClosePortlet(id,keepopen) {
	var portletId = "PortletTDContent" + id;
	var imgId = "FolderImg" + id;
	var endBr = "spanEndBr" + id;
	
	if (document.getElementById(imgId)!=null) {
		document.getElementById(imgId).src="../dc_images/silk_icons/plusonly.gif";
	}
	//new Effect.BlindUp(portletId)
	document.getElementById(portletId).style.display="none";
	//document.getElementById(endBr).style.display='none';
}
function Max(id) {
	var portletId = "PortletTDContent" + id;
	document.getElementById(portletId).style.position="absolute";
	//document.getElementById(portletId).width="100%";
	document.getElementById(portletId).height="100%";
	
}	

var SlideShowTimer = null;
var SlideShowPointer = 0;
var SlideShowDelay = 5000;
var SlideShowImages = new Array();
var SlideShowImage;
var SlideShowOriginal = null;

function SlideShowInit(scrollToId) {
	
	eval(document.getElementById('SlideShowEval').value);
	
	if (scrollToId!=null) {
		fScrollTo(scrollToId);
	}
}
function SlideShow_Select(ptr) {
	document.getElementById('SlideMainPicture').style.display='block';
	
	SlideShowPointer = ptr;
	SlideShow_SetImage();
	SlideShow_Toggle("pause");
}

function SlideShow_SetPointer(ptr) {
	if(ptr > SlideShowImages.length -1) {
		ptr = 0;
	}
	
	if(ptr < 0) {
		ptr = SlideShowImages.length -1;
	}
	
	SlideShowPointer = ptr;
	SlideShow_Toggle("pause");
	
	SlideShow_SetImage();
}

function SlideShow_IncPointer() {
	SlideShowPointer++;
	
	if(SlideShowPointer > SlideShowImages.length -1) {
		SlideShowPointer = 0;
	}
	
	SlideShow_SetImage();
}

function SlideShow_DecPointer() {
	SlideShowPointer--;
	
	if(SlideShowPointer < 0) {
		SlideShowPointer = SlideShowImages.length -1;
	}
	
	SlideShow_SetImage();
}

function SlideShow_Slide() {
	
	SlideShow_IncPointer();
	
}

function SlideShow_NextImage() {
	var elm;
	
	SlideShow_IncPointer();
	SlideShow_Toggle("pause");
}
		
function SlideShow_PreviousImage() {
	var elm;
	
	SlideShow_DecPointer();
	SlideShow_Toggle("pause");
}
		
function SlideShow_SetImage() {
	var elm, oImg;
	
	if (document.getElementById("SlideShowImage")!=null) {
		elm = document.getElementById("SlideShowImage");
		elmTitle = document.getElementById("SlideShowTitle");
		elmShortDesc = document.getElementById("SlideShowShortDesc");
		oImg = SlideShowImages[SlideShowPointer];
		elm.src = oImg.path + oImg.fileMed;
		elmTitle.innerHTML=oImg.title;
		elmShortDesc.innerHTML=oImg.shortdesc;
	}
}

function SlideShow_Toggle(state) {
	var elm, curState;
	
	elm = document.getElementById("SlideShowToggle");
	if(elm.src.indexOf("pause") > 0) {
		curState = "pause";
	} else {
		curState = "play";
	}
	
	if(state == undefined) {
		state = curState;
	}
	
	if(state == "play") {
		elm.src = "/dc_images/silk_icons/control_pause_blue.png";
		SlideShowTimer = window.setInterval('SlideShow_Slide()', SlideShowDelay);			
	} else {
		elm.src = "/dc_images/silk_icons/control_play_blue.png";
		window.clearInterval(SlideShowTimer);
	}
}
			
function SlideShow_Delay(delay) {
	SlideShowDelay = delay;
			
	SlideShowTimer = window.setInterval('SlideShow_Slide()', SlideShowDelay);
}

function SlideShow_Original() {
	var oImg = SlideShowImages[SlideShowPointer];
	
	window.open(oImg.path + oImg.file);
}

function ValidateLoginForm() {
	if (document.getElementById('AttEMail').value.length==0) {
		alert ('You must enter an Email as part of your credentials');
		document.getElementById('AttEMail').focus();
		document.getElementById('AttEMail').select();
		return false;
	}
	if (document.getElementById('AttPassword').value.length==0) {
		alert ('You must enter a Password as part of your credentials');
		document.getElementById('AttPassword').focus();
		document.getElementById('AttPassword').select();
		return false;
	}
	ajaxIncrement=ajaxIncrement+1
	AjaxSimpleCheck('../dc_ajax/DCVALIDPWDCheck.asp?AttEMail=' + document.getElementById('AttEMail').value + '&pwd='+document.getElementById('AttPassword').value+'&marketcode='+lPD_MarketCode+'&Confcode='+lPD_ConfCode+'&xc='+ajaxTimeStamp, '', 'divBoolean',1,'false');
	if (document.getElementById('divBoolean').innerHTML=='EMailNotApproved') {
		alert ('Invalid Email, please check that you entered correctly or you may build a new profile');
		document.getElementById('AttEMail').focus();
		document.getElementById('AttEMail').select();
		return false;	
	}	
	
	if (document.getElementById('divBoolean').innerHTML=='NotApproved') {
		alert ('Invalid Password');
		document.getElementById('AttPassword').focus();
		document.getElementById('AttPassword').select();
		return false;	
	}
}
function ValidateRegLoginForm() {
	if (document.getElementById('AttEMail').value.length==0) {
		alert ('You must enter an Email as part of your credentials');
		document.getElementById('AttEMail').focus();
		document.getElementById('AttEMail').select();
		return false;
	}
	if (document.getElementById('AttPassword').value.length==0) {
		alert ('You must enter a Password as part of your credentials');
		document.getElementById('AttPassword').focus();
		document.getElementById('AttPassword').select();
		return false;
	}
	ajaxIncrement=ajaxIncrement+1
	AjaxSimpleCheck('../dc_ajax/DCVALIDPWDCheck.asp?AttEMail=' + document.getElementById('AttEMail').value + '&pwd='+document.getElementById('AttPassword').value+'&marketcode='+lPD_MarketCode+'&Confcode='+lPD_ConfCode+'&xc='+ajaxTimeStamp, '', 'divREGBoolean',1,'false');
	if (document.getElementById('divREGBoolean')!=null) {
		if (document.getElementById('divREGBoolean').innerHTML=='EMailNotApproved') {
			alert ('Invalid Email, please check that you entered correctly or you may build a new profile');
			document.getElementById('AttEMail').focus();
			document.getElementById('AttEMail').select();
			return false;	
		}	
		
		if (document.getElementById('divREGBoolean').innerHTML=='NotApproved') {
			alert ('Invalid Password');
			document.getElementById('AttPassword').focus();
			document.getElementById('AttPassword').select();
			return false;	
		}
	}
}
function ValidateSimpleLoginFormInd() {
	ValidateSimpleLoginForm();
}
function ValidateSimpleLoginForm() {
	if (document.getElementById('SLAttEMail').value.length==0) {
		alert ('You must enter an Email as part of your credentials');
		document.getElementById('SLAttEMail').focus();
		document.getElementById('SLAttEMail').select();
		return false;
	}
	if (document.getElementById('SLAttPassword').value.length==0) {
		alert ('You must enter a Password as part of your credentials');
		document.getElementById('SLAttPassword').focus();
		document.getElementById('SLAttPassword').select();
		return false;
	}
	ajaxIncrement=ajaxIncrement+1
	AjaxSimpleCheck('../dc_ajax/DCVALIDPWDCheck.asp?AttEMail=' + document.getElementById('SLAttEMail').value + '&pwd='+document.getElementById('SLAttPassword').value+'&marketcode='+lPD_MarketCode+'&Confcode='+lPD_ConfCode+'&xc='+ajaxTimeStamp, '', 'divSLBoolean',1,'false');
	if (document.getElementById('divSLBoolean').innerHTML=='EMailNotApproved') {
		alert ('Invalid Email, please check that you entered correctly or you may build a new profile');
		document.getElementById('SLAttEMail').focus();
		document.getElementById('SLAttEMail').select();
		return false;	
	}	
	
//	if (document.getElementById('divSLBoolean').innerHTML=='NotApproved') {
//		alert ('Invalid Password');
//		document.getElementById('SLAttPassword').focus();
//		document.getElementById('SLAttPassword').select();
//		return false;	
//	}
	$('slUpdProgressBar').style.display='';
	$('SimpleLoginUpd').value=1;

	//ValidatefEmpApprov('DCLogin','FPWDUpd','divIFrame');	
	//return false;			
}
function CheckForCredValue(id) {
	document.getElementById('hourglass').style.display='none';
	if ((document.getElementById('BliAttEMail').value.length==0 
		&& document.getElementById('BliAttPassword').value.length==0 
		&&  document.getElementById('divCustomerInfo').innerHTML.length==0)
			|| (document.getElementById('divCustomerInfo').innerHTML.length>0
				&&document.getElementById('hpwd')==null)) {
				document.getElementById('ContinueButton').disabled=true;
				document.getElementById('divPasswordId').style.display='none';
				document.getElementById('divSvPasswordId').style.display='none';
				document.getElementById('divFrgtPasswordId').style.display='none';
				
		}
	else	{
			if (document.getElementById('BliAttPassword').value.length==0) {
				document.getElementById('ContinueButton').disabled=true;
				}
			else	{
				document.getElementById('ContinueButton').disabled=false;
			}
			
			document.getElementById('divPasswordId').style.display='';
			document.getElementById('divSvPasswordId').style.display='';
			document.getElementById('divFrgtPasswordId').style.display='';
	}
}	
function disablePassword() {
	document.getElementById('divCustomerInfo').innerHTML='';
	document.getElementById('divPasswordId').style.display='none';
	document.getElementById('ContinueButton').disabled=true;
	document.getElementById('divFrgtPasswordId').style.display='none';
	document.getElementById('hourglass').style.display='';
}

function HMOver(id) {

	if (id != oID) {
		document.getElementById(id).className=lBaseTDRollOverClass;
	}	
}

function HMOut(id) {

	if (id != oID) {
			document.getElementById(id).className=lBaseTDClass;
		}
}
function fout(id) {
	
	if (document.getElementById(id)!=null) {
		document.getElementById(id).style.display='none';
	}
}
function fover(id) {
	if (document.getElementById(id)!=null) {
		document.getElementById(id).style.display='';
	}
}
function CloseEmailWindow (OutsideWin,event) {
	if (OutsideWin!=null) {
		var x=window.confirm("You clicked outside of the edit window (inside), do you want to close this inside window\n\n if correct, press OK, else CANCEL");
		if (!x) {
			return false;
		}
	}
	
	if (document.getElementById('MailDisplay')!=null) {
		document.getElementById('MailDisplay').style.display='';
	}
	
	if (document.getElementById('divMailBGContainer')!=null) {
		document.getElementById('divMailBGContainer').style.display='none';
	}
	
	$('DCMainBG').style.overflow='auto';
	
	EnableBleeds()
	
	if (document.getElementById('__divEditing')!=null) {
		document.getElementById('__divEditing').style.display='none';
		try{oEditorUtil.boxopen=false}catch(e){;}	
		try{oEditorUtil.onBoxClosed()}catch(e){;}	
	}
	
	if (event!=null) {
		event.cancelBubble=true;
	}
	
	if ($('divSBEval')!=null) {
		if ($('divSBEval').value.length>0) {
			eval($('divSBEval').value);
			$('divSBEval').value='';
		}
	}
}
function EnableBleeds() {
	document.getElementById('DCCurtain').style.display='none';
	var pars = document.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].className
		if (sCN.indexOf('divSBanner2')==0 || sCN.indexOf('Advertiser')==0) {
			pars[i].style.display='';
		}
	}
	var pars = document.getElementsByTagName('embed');
	for (var i=0;i<pars.length;i++) {
			pars[i].style.display='';
	}
	var pars = document.getElementsByTagName('object');
	for (var i=0;i<pars.length;i++) {
			pars[i].style.display='';
	}	
	if (document.getElementById('DCMainBG')!=null) {
		document.getElementById('DCMainBG').style.overflow='auto';		
	}
	if (document.getElementById('objectMyMusic')!=null) {
		document.getElementById('objectMyMusic').style.display='';
	}	
}
function ChangeAlternateClass(CSSSrc) {
	document.getElementById('DC4CssIdAlternate').href=CSSSrc;
}
function ChangeBG(ImgSrc) {

	document.getElementById('DCMainBG').style.backgroundImage='url(' + ImgSrc + ')';
}
	
function ShowDetails() {

	if (document.getElementById('ShowSchedule').style.display=="") {
		document.getElementById('ShowSchedule').style.display="none";
		}
	else	{
		document.getElementById('ShowSchedule').style.display="";
	}
}
function fShowMenus (m) {
	document.getElementById('ShowMenus').value=m;
}	
function ClearSimDate (d) {

	var dSel;

	if (d==0 || d==null) {
		dSel=lDC_Date_MDY;
		}
	else if (d==1) {
		dSel=lDC_Date_MDYPlus1;
		}
	else {
		dSel=lDC_Date_MDYPlus1;
	}
	document.getElementById('SimDate').value=dSel;

}
function SubmitScenario() {

	if (!isDate(document.getElementById('SimDate').value)) {
		return;
	}
	document.getElementById('DCSimFormUpd').value="1";
	document.getElementById('DCSimButton').value="Please Wait...";
	document.getElementById('DCSimButton').disabled=true;
	self.location="?" + urlRequestQueryString;
}

function onPrint () {
	bV = parseInt(navigator.appVersion);
   if (bV >= 4) window.print();
}
	
function ChangeTheme(theme) {
	document.getElementById('ThemeSet').value="1";
	document.getElementById('Theme').value=theme;
	document.ThemeForm.submit();

}	
dayName = new Array("", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
monName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

now = new Date;
function showAmPm() {

	if (now.getHours() < 12) {
		document.write ("Good Morning");
		return;
	}
	
	if (now.getHours() < 18) {
		document.write ("Good Afternoon");
		return;
	}
	
	document.write ("Good Evening")
	}
function showTheTime() {
	
	return showAmPm();

}
function showNow() {

newday = new Date();
day = newday.getDay();
month = newday.getMonth();
year = (newday.getFullYear) ? newday.getFullYear() : newday.getYear();

date = newday.getDate();

	switch (month) {
		 case 0 : month = "January"; break;
		 case 1 : month = "February"; break;
		 case 2 : month = "March"; break;
         case 3 : month = "April"; break;
		 case 4 : month = "May"; break;
		 case 5 : month = "June"; break;
		 case 6 : month = "July"; break;
		 case 7 : month = "August"; break;
		 case 8 : month = "September"; break;
		 case 9 : month = "October"; break;
		 case 10 : month = "November"; break;
		 case 11 : month = "December"; break;
	 }
	switch (day) {
		 case 0 : day = "Sunday"; break;
		 case 1 : day = "Monday"; break;
		 case 2 : day = "Tuesday"; break;
		 case 3 : day = "Wednesday"; break;
		 case 4 : day = "Thursday"; break;
		 case 5 : day = "Friday"; break;
		 case 6 : day = "Saturday"; break;
	 }
	hours = newday.getHours();
	if (hours<12)  greeting = 'Good morning!';
	if (hours<18 && hours>11)  greeting = 'Good afternoon!';
	if (hours<20 && hours>17)  greeting = 'Good evening!';
	if (hours>19)  greeting = 'Good evening!';
	
	hour = (hours>12) ? (hours-12) : hours;
	halfDay = (hours>11 && hours<24) ? 'PM' : 'AM';
	minutes = newday.getMinutes();
	dayStr =  day+ ', ' +date+ '&nbsp;' +month+ ',&nbsp;' +year;
	timeStr = (minutes<10) ? hour+ ':0' +minutes+ ' ' +halfDay : hour+ ':' +minutes+ ' ' +halfDay;
	
	document.write (dayStr + " - " + timeStr );
}

var tleOrigClassName;
var treOrigClassName;
var tlleOrigClassName;

function movSelected(id) {
	tlid="tl" + id;
	trid="tr" + id;	
	tllid="tll" + id;	
	
	if (document.getElementById(tlid)!=null) {	
		tleOrigClassName=document.getElementById(tlid).className;
		document.getElementById(tlid).className="TTBOverLSelected";
	}
	
	if (document.getElementById(trid)!=null) {	
		treOrigClassName=document.getElementById(trid).className;
		document.getElementById(trid).className="TTBOverRSelected";	
	}
	
	if (document.getElementById(trid)!=null) {	
		tlleOrigClassName=document.getElementById(tllid).className;
		document.getElementById(tllid).className="TTPLinkOverSelected";	
	}		
}

function movr(id) {
	tlid="tdl" + id;
	trid="tdr" + id;	
	tllid="tll" + id;
}
function mout(id) {

	tlid="tdl" + id;
	trid="tdr" + id;	
	tllid="tll" + id;
}


var lmIDClassName;
var lmLIDClassName;
function movrLmenu(id) {

	ltdid="td" + id;
	ltdLid="LML" + id;	

	if (document.getElementById(ltdid) != null) {
		lmIDClassName=document.getElementById(ltdid).className;	
		document.getElementById(ltdid).className="LMOvr";
	}		
	if (document.getElementById(ltdLid) != null) {
		lmLIDClassName=document.getElementById(ltdLid).className;	
		document.getElementById(ltdLid).className="LMOvrL";	
	}
}

function moutLmenu(id) {

	ltdid="td" + id;
	ltdLid="LML" + id;	
	
	document.getElementById(ltdid).className=lmIDClassName;
	document.getElementById(ltdLid).className=lmLIDClassName;	
}
function ChangeColor(RowId) {
	try {
		LastRptRow=RowId;
		var Row=document.getElementById(RowId);
	
		CurrRptClassName=document.getElementById(RowId).className;
	
		Row.className = "RowHighlight";
	}catch(e){}

}
function ChangeColorBack(RowId) {
	try{
		var Row=document.getElementById(RowId);
		Row.className = CurrRptClassName;
	}catch(e){}

}
function ChangeColorV5(RowId) {
	try {
		LastRptRow=RowId;
		var Row=document.getElementById(RowId);
	
		CurrRptClassName=document.getElementById(RowId).className;
	
		Row.className = "v5RowHighlight";
	}catch(e){}

}
function ChangeColorBackV5(RowId) {
	try{
		var Row=document.getElementById(RowId);
		Row.className = CurrRptClassName;
	}catch(e){}

}
// Browser Detection

	var lBrowser;
	lBrowser=9
	if (navigator.appName.toUpperCase().match(/MICROSOFT INTERNET EXPLORER/) != null)
	  lBrowser=0;
	if (navigator.appName.toUpperCase().match(/NETSCAPE/) != null)
	  lBrowser=1;


function NextPullDown(uid) {

	if (document.getElementById(uid).selectedIndex == document.getElementById(uid).length-1) {
		document.getElementById(uid).selectedIndex=0;
		}
	else	{
		document.getElementById(uid).selectedIndex = document.getElementById(uid).selectedIndex + 1
	}
}	
function FlipNext(uid) {
	eid='Events' + uid;
	if (document.getElementById(eid).selectedIndex == document.getElementById(eid).length-1) {
		document.getElementById(eid).selectedIndex=0;
		}
	else	{
		document.getElementById(eid).selectedIndex = document.getElementById(eid).selectedIndex + 1
	}
	
	NextEvent(uid);
}	
function NextEvent(uid) {
	eid='Events' + uid;
	self.location="?P=210&confcode=" + document.getElementById(eid).options[document.getElementById(eid).selectedIndex].value;
}


// Color Picker Script from Flooble.com
// For more information, visit 
//	http://www.flooble.com/scripts/colorpicker.php
// Copyright 2003 Animus Pactum Consulting inc.
// You may use and distribute this code freely, as long as
// you keep this copyright notice and the link to flooble.com
// if you chose to remove them, you must link to the page
// listed above from every web page where you use the color
// picker code.
//---------------------------------------------------------
     var perline = 9;
     var divSet = false;
     var curId;
     var colorLevels = Array('0', '3', '6', '9', 'C', 'F');
     var colorArray = Array();
     var ie = false;
     var nocolor = 'none';
	 if (document.all) { ie = true; nocolor = ''; }
	 function getObj(id) {
		if (ie) { return document.all[id]; } 
		else {	return document.getElementById(id);	}
	 }

     function addColor(r, g, b) {
     	var red = colorLevels[r];
     	var green = colorLevels[g];
     	var blue = colorLevels[b];
     	addColorValue(red, green, blue);
     }

     function addColorValue(r, g, b) {
     	colorArray[colorArray.length] = '#' + r + r + g + g + b + b;
     }
     
     function setColor(color) {
     	var link = getObj(curId);
     	var field = getObj(curId + 'field');
     	var picker = getObj('colorpicker');
     	field.value = color;
     	if (color == '') {
	     	link.style.background = nocolor;
	     	link.style.color = nocolor;
	     	color = nocolor;
     	} else {
	     	link.style.background = color;
	     	link.style.color = color;
	    }
     	picker.style.display = 'none';
	    eval(getObj(curId + 'field').title);
     }
        
     function setDiv() {     
     	if (!document.createElement) { return; }
        var elemDiv = document.createElement('div');
        if (typeof(elemDiv.innerHTML) != 'string') { return; }
        genColors();
        elemDiv.id = 'colorpicker';
	    elemDiv.style.position = 'absolute';
        elemDiv.style.display = 'none';
        elemDiv.style.border = '#000000 1px solid';
        elemDiv.style.background = '#FFFFFF';
        elemDiv.innerHTML = '<span style="margin-left:3px;">Choose: ' 
          	+ '(<a href="javascript:setColor(\'\');">None</a>)<br>' 
        	+ getColorTable() 
        	+ '</span>';

        document.body.appendChild(elemDiv);
        divSet = true;
     }
     
     function pickColor(id) {
     	if (!divSet) { setDiv(); }
     	var picker = getObj('colorpicker');     	
		if (id == curId && picker.style.display == 'block') {
			picker.style.display = 'none';
			return;
		}
     	curId = id;
     	var thelink = getObj(id);
     	picker.style.top = getAbsoluteOffsetTop(thelink) + 20;
     	picker.style.left = getAbsoluteOffsetLeft(thelink);     
	picker.style.display = 'block';
     }
     
     function genColors() {
        addColorValue('0','0','0');
        addColorValue('3','3','3');
        addColorValue('6','6','6');
        addColorValue('8','8','8');
        addColorValue('9','9','9');                
        addColorValue('A','A','A');
        addColorValue('C','C','C');
        addColorValue('E','E','E');
        addColorValue('F','F','F');                                
			
        for (a = 1; a < colorLevels.length; a++)
			addColor(0,0,a);
        for (a = 1; a < colorLevels.length - 1; a++)
			addColor(a,a,5);

        for (a = 1; a < colorLevels.length; a++)
			addColor(0,a,0);
        for (a = 1; a < colorLevels.length - 1; a++)
			addColor(a,5,a);
			
        for (a = 1; a < colorLevels.length; a++)
			addColor(a,0,0);
        for (a = 1; a < colorLevels.length - 1; a++)
			addColor(5,a,a);
			
			
        for (a = 1; a < colorLevels.length; a++)
			addColor(a,a,0);
        for (a = 1; a < colorLevels.length - 1; a++)
			addColor(5,5,a);
			
        for (a = 1; a < colorLevels.length; a++)
			addColor(0,a,a);
        for (a = 1; a < colorLevels.length - 1; a++)
			addColor(a,5,5);

        for (a = 1; a < colorLevels.length; a++)
			addColor(a,0,a);			
        for (a = 1; a < colorLevels.length - 1; a++)
			addColor(5,a,5);
			
       	return colorArray;
     }
     function getColorTable() {
         var colors = colorArray;
      	 var tableCode = '';
         tableCode += '<table border="0" cellspacing="1" cellpadding="1">';
         for (i = 0; i < colors.length; i++) {
              if (i % perline == 0) { tableCode += '<tr>'; }
              tableCode += '<td bgcolor="#000000"><a style="outline: 1px solid #000000; color: ' 
              	  + colors[i] + '; background: ' + colors[i] + ';font-size: 10px;" title="' 
              	  + colors[i] + '" href="javascript:setColor(\'' + colors[i] + '\');">&nbsp;&nbsp;&nbsp;</a></td>';
              if (i % perline == perline - 1) { tableCode += '</tr>'; }
         }
         if (i % perline != 0) { tableCode += '</tr>'; }
         tableCode += '</table>';
      	 return tableCode;
     }
     function relateColor(id, color) {
     	var link = getObj(id);
     	if (color == '') {
	     	link.style.background = nocolor;
	     	link.style.color = nocolor;
	     	color = nocolor;
     	} else {
	     	link.style.background = color;
	     	link.style.color = color;
	    }
	    eval(getObj(id + 'field').title);
     }
     function getAbsoluteOffsetTop(obj) {
     	var top = obj.offsetTop;
     	var parent = obj.offsetParent;
     	while (parent != document.body) {
     		top += parent.offsetTop;
     		parent = parent.offsetParent;
     	}
     	return top;
     }
     
     function getAbsoluteOffsetLeft(obj) {
     	var left = obj.offsetLeft;
     	var parent = obj.offsetParent;
     	while (parent != document.body) {
     		left += parent.offsetLeft;
     		parent = parent.offsetParent;
     	}
     	return left;
     }
var jsStates = new Array("Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming");
var jsStateCode = new Array("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY");

var jsCAProvs = new Array("Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland and Labrador","Northwest Territories","Nova Scotia","Nunavut","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon");
var jsCAProvCode = new Array("AB","BC","MB","NB","NL","NT","NS","NU","ON","PE","QC","SK","YT");

/**
 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

var CurrRptClassName;
var LastRptRow;

function OpenHelp(Page) {
	x=window.open(Page,'DC4AuxWin2','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=500,left=150,top=150');
}

function ChangeColor(RowId) {
	try {
		LastRptRow=RowId;
		var Row=document.getElementById(RowId);
	
		CurrRptClassName=document.getElementById(RowId).className;
	
		Row.className = "RowHighlight";
	}catch(e){}

}
function ChangeColorBack(RowId) {
	try{
		var Row=document.getElementById(RowId);
		Row.className = CurrRptClassName;
	}catch(e){}

}

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 hasSpecChar(s){
	var i;
	var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?_";
	
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        
        if (c==" ") return false;
        
        if (iChars.indexOf(c) != -1) return false;
    }
    // characters are ok.
    return true;
}


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 (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month");
		return false;
	}
	if (strDay.length<1 || 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 removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return tstring;
}

function UpdateCheckValueID(FormFieldID,val,noPostVal,postValChecked, postValNotChecked) {

	var TrueVal;
	var x=document.getElementById(FormFieldID);
	
	if (postValChecked!=null) {
		if (x.checked) {
			x.value=postValChecked;
			x.checked='checked';
			return;
			}
		else	{
			x.value=postValNotChecked;
			x.checked='';
			return;				
			}
		}
	else	{
		if (val!=null) {
			TrueVal=val;
		}
		else {
			TrueVal='1';
		}
	
		if (val!=null && val.length>0) {
			if (x.checked) {
				x.value = TrueVal+'.Approved';
				}
			else {
				x.value = TrueVal+'.Denied';
			}
		}	
		else {
			if (x.checked) {
				x.value = '1';
				x.checked='checked'
				}
			else {
				x.value = '0';
				x.checked=''
			}	
		}
	}
}
function UpdateCheckValueIDWithValue(FormFieldID, Value) {
	var x=document.getElementById(FormFieldID);
	if (x.checked) {
		x.value = Value;
		}
	else {
		x.value = '';
	}	
}
function SetDefaultAvatar(avatar) {
	if (document.getElementById('Avatar')!=null) {
		document.getElementById('Avatar').value=avatar;
	}
}
function DCUpdateBoxes(SelectorBox_v, Form_v, FirstElem) {

	SelectorBox=document.getElementById(SelectorBox_v);
	Form=document.getElementById(Form_v);

	if (SelectorBox.checked) {
		SelectorBox.value = "1";
		}
	else
		{
		SelectorBox.value = "0";
	}
	OnOff = SelectorBox.value
	for (var i = 0; i < Form.length; ++i)
	{
		var DCSurvArray = Form.elements[i].id.split("_");
		if (DCSurvArray.length > 0) {

			if (DCSurvArray[0] == FirstElem)  {
				if (Form.elements[i].style.display !=  "none") {
					if (OnOff == "1") {
						Form.elements[i].checked = true;
						
						}
					else {
						Form.elements[i].checked = false;
						
					}				
				}
			}
		}
	}
}
function fGetIDFromBox(SelectorBox_v, Form_v, FirstElem) {

	SelectorBox=document.getElementById(SelectorBox_v);
	Form=document.getElementById(Form_v);
	
	var sIds=""
	var sComma=""

	if (SelectorBox.checked) {
		SelectorBox.value = "1";
		}
	else
		{
		SelectorBox.value = "0";
	}
	OnOff = SelectorBox.value
	for (var i = 0; i < Form.length; ++i)
	{
		var DCSurvArray = Form.elements[i].id.split("_");
		if (DCSurvArray.length > 0) {

			if (DCSurvArray[0] == FirstElem)  {
				if (Form.elements[i].style.display !=  "none") {
					if (Form.elements[i].checked == true && DCSurvArray[1].length>0) {
						sIds = sIds + sComma + "'" + DCSurvArray[1] + "'";
						sComma=",";
					}				
				}
			}
		}
	}
	return sIds
}
function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.isIPAD  = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "iPad";
  if ((i = ua.indexOf(s)) >= 0) {
  	
    this.isIPAD = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }   

  // Treat any other "Gecko" browser as NS 6.1.
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}
function init() {
  if (!isIE) {
	if (window.Event) {
	    //document.captureEvents(Event.MOUSEMOVE);
	}
  }
}

function dispMousePos(e) {

	x = (window.Event) ? e.pageX : event.clientX;
	y = (window.Event) ? e.pageY : event.clientY;

	var x = (x + document.getElementById('SchedPanel').offsetLeft + 5) + "px";
	var y = (y - document.getElementById('SchedPanel').offsetTop + 5) + "px";	

	document.getElementById('divDescPanel').style.left=x;
	document.getElementById('divDescPanel').style.top=y;	
}
function HideDesc() {
	document.getElementById('divDescPanel').style.display="none";
}
function popupon(Tip,event) {

//	var browser = new Browser();
//
// assume average font pixel width of 10, add 10 pixels as buffer
//
//	var l = (Tip.length * 4.5) +10
//
//	document.getElementById('PopUpToolTipField').value=Tip.replace(/'/," ")
//  document.getElementById('PopUpToolTipField').style.left=event.clientX - window.scrollX;
//	document.getElementById('PopUpToolTipField').style.top=event.clientY + window.scrollY;
//
//	
//	document.getElementById('PopUpToolTipField').style.display="";
//	document.getElementById('PopUpToolTipField').style.width=l+"px";
//	document.getElementById('PopUpToolTipField').width=Tip.length+100+"px";		
}

function popupoff() {
document.getElementById('PopUpToolTipField').style.display="none";
}
function SubmitPostSearch(dest,cs) {
	if (dest==null) {
		dest='divPostSearch'
	}
	if (cs==1) {
		var m=document.getElementById('m').value;
		var c=document.getElementById('ST').value;				
	}
	else {
		var m=document.getElementById('m').value;
		var c=document.getElementById('c').value;		
	}
	
	if (c.length==0) {
		alert ("You must enter search criteria to continue");
		document.getElementById('c').focus();
		document.getElementById('c').select();
		return false;
	}

	var ajaxscript = '/dc_includes/cp5_PostSearch.asp?m='+m+'&c='+c+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', dest,1);
	return false;
}

function GetMM(year,mode) {
	var ajaxscript = '/dc_includes/cpx_CommStats.asp?confcode=' + lPD_ConfCode + '&MarketCode=' + lPD_MarketCode + '&mm=' + mode + '&yy=' + year +'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divCommStats',1);
}

function OpenCal(formField, dirFac, leftFac, selDate) {
	
	var evt = (evt) ? evt : ((window.event) ? event : null);
	var objectID = (evt.target) ? evt.target.id : ((evt.srcElement) ? evt.srcElement.id : null);
	
	if (objectID.indexOf('CalButt')!=-1) object = document.getElementById(objectID);
	
	var oCLeftPos = evt.clientX +  20;
	
	if (leftFac) {
		var oCTopPos = evt.clientY + 70 + object.offsetParent.offsetHeight;
		}
	else	{
		var oCTopPos = evt.clientY + 250;
	}	
	var oCVar = "dialog=yes, modal=yes,titlebar=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=280,height=150, left=" + oCLeftPos + ", top=" + oCTopPos;
	MyWindow = window.open(dirFac + 'DC_CalObj.asp?field=' + formField + '&ConfCode=' + lPD_ConfCode , 'DCCal', '' + oCVar );
	MyWindow.moveTo(oCLeftPos,oCTopPos);
	

}
// Calendar Script
//var re = /\n\r|\n|\r|\r\n/gi;

var re = /\n\r|\n|\r|\r\n/gi;

var lSaveClass;
var lSaveColor;

var lLst_Title =  new Array();
var lLst_Description =  new Array();
var lLst_StartDate =  new Array();
var lLst_EndDate =  new Array();
var lLst_Type =  new Array();
var lLst_AttEMail =  new Array();
var lLst_GrpCode =  new Array();
var lLst_Seq =  new Array();
var lLst_ShareW = new Array();
var lLst_ShareWList = new Array();
var lLst_OptLink = new Array();
var lLst_SubClass = new Array();
var lLst_SHH = new Array();
var lLst_SMM = new Array();
var lLst_SAMPM = new Array();
var lLst_EHH = new Array();
var lLst_EMM = new Array();
var lLst_EAMPM = new Array();

var l_Cnt = 0;

function ChangeType() {
	if ($('CalType').options[$('CalType').selectedIndex].value=='200') {
		$('GrpCodeTR').style.display='';
		}
	else	{
		$('GrpCodeTR').style.display='none';
	}
}

function MakeNewInstance() {

	document.getElementById('Seq').value="0";
	document.getElementById('idTR').style.display="none";
}
function DelSchedItem(SSid) {
	var x=window.confirm('You are about to delete a scheduled item on the Community Calendar\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_AddCalendarItemDelete.asp?ssid='+SSid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divErCont_'+SSid)	

}	
function SaveSchedInd(mode) {
	SaveSched(mode)
}
function fSimpleEditorFix() {
	
	var sClickEvent='';
	var sRE = /__div[0-9]src/ig; // Find any links associated w/ editor - compensate for editor bug and adjust window back to WYSIWYG
	var re = new RegExp(sRE);
	pars=document.getElementsByTagName('a');
	for (i=0;i<pars.length;i++) {
		if (pars[i].id.match(re)) {
			if (pars[i].firstChild.nodeValue!='View HTML') {
				sClickEvent=$(pars[i].id).getAttribute("href").replace('javascript:','');
			}	
		}
	}

	if (sClickEvent.length>0) {
		eval(sClickEvent);
	}		
}
function SaveSched(mode) {
	
	try {fSimpleEditorFix();}catch(E){};
	
	try {I_FinishEditing()}catch(E){;}
	
	if ($('spanEndDate')!=null) {
		if ($('spanEndDate').style.display=='none') {
			$('EndDate').value=$('StartDate').value;
		}
	}
		
	var sTitle=$('Title').value
	if (document.getElementById('Title').value.length == 0 || sTitle.toUpperCase().indexOf('WHAT ARE YOU PLANNING?')!=-1) {
		alert ("Title is required");
		document.getElementById('Title').focus();
		document.getElementById('Title').select();
		return false;
	}

	if (document.getElementById('Title').value.length > 200) {
		alert ("Title cannot exceed 200 characters");
		document.getElementById('Title').focus();
		document.getElementById('Title').select();
		return false;
	}

	if (document.getElementById('StartDate').value.length == 0) {
		alert ("Start Date is required");
		document.getElementById('StartDate').focus();
		document.getElementById('StartDate').select();
		return false;
	}	

	if (isDate(document.getElementById('StartDate').value)==false){
		document.getElementById('StartDate').focus();
		document.getElementById('StartDate').select();	
		return false;
	}	
	if (document.getElementById('EndDate').value.length == 0) {
		document.getElementById('EndDate').value = document.getElementById('StartDate').value;
	}	
	
	l_StartDate_x= new Date(document.getElementById('StartDate').value)
	l_EndDate_x= new Date(document.getElementById('EndDate').value)
	
	if (l_StartDate_x > l_EndDate_x) {
		alert ("Start Date cannot be greater then End Date");
		document.getElementById('StartDate').focus();
		document.getElementById('StartDate').select();	
		return false;
	}
	
	if (document.getElementById('StartTime').selectedIndex>document.getElementById('EndTime').selectedIndex) {
		alert ("Start time cannot be before end time");
		document.getElementById('StartTime').focus();
		document.getElementById('StartTime').select();
		return false;
	}				
	
	if (document.getElementById('Where').value.length >500) {
		alert ("Where cannot exceed 500 characters");
		document.getElementById('Where').focus();
		document.getElementById('Where').select();
		return false;
	}

	if (document.getElementById('OptLink').value.length > 255) {
		alert ("OptLink cannot exceed 255 characters");
		document.getElementById('OptLink').focus();
		document.getElementById('OptLink').select();
		return false;
	}
	
	if (document.getElementById('OptLink').value.length > 0 && $('OptLink').value.toUpperCase().indexOf('HTTP')!=0) {
		alert ("Optional Destination Link must begin with http:// or https://");
		document.getElementById('OptLink').focus();
		document.getElementById('OptLink').select();
		return false;
	}	
	
	document.getElementById('OptLink').value=document.getElementById('OptLink').value.toLowerCase();

	if (document.getElementById('CalType').selectedIndex == 0) {
		alert ("You must select the type of schedule item this will be");
		document.getElementById('CalType').focus();
		return false;
	}	
	
	if (document.getElementById('CalType').options[document.getElementById('CalType').selectedIndex].value == 200) {
		if (document.getElementById('GrpCode').selectedIndex==0) {
			alert ("You must select a group for this schedule item");
			document.getElementById('GrpCode').focus();
			return false;
		}
	}		
	if (document.getElementById('ShareW').selectedIndex == 0) {
		alert ("You must select who to share this schedule item with");
		document.getElementById('ShareW').focus();
		return false;
	}	

	if (document.getElementById('ShareWList').value.length > 1000) {
		alert ("Share With List cannot exceed 1000 characters");
		document.getElementById('ShareWList').focus();
		document.getElementById('ShareWList').select();
		return false;
	}	
	
	$('UpdProgressBar').style.display='';
	document.getElementById('UpdMode').value=2;
	if ($('CIDest')!=null) {
		var sDest=$('CIDest').value;
		}
	else {
		var sDest='divDayCalendarContainer';
	}
	ValidatefEmpApprov('formCalendarItem','DCUpd',sDest,'fSetUpDayCal()');	
	return false;			

}
function ResetCalFields() {
	document.getElementById('idTR').style.display='none';
	document.getElementById('Seq').value=0;
}
function GetContent() {
	NewMsg=document.getElementById("TempPage").innerHTML;
	//NewMsg=NewMsg.replace(/{DCLF}/g, "\n");
	//NewMsg=NewMsg.replace(/DCVARQuote/g,'"');
	NewMsg=NewMsg.replace(/DCVARHyphen/g,"'");
	nma=NewMsg.split('~~~');
	NewTextEmail=nma[6];
	NewMsg=nma[3];
	NewSubj=nma[2];
	NewShortName=nma[1];
	NewId=nma[0];
	NewType=nma[4];
	NewDef=nma[5];
}	
function MoveEditItem(Row, Seq) {
	
	document.getElementById('idTR').style.display="";	
	document.getElementById('Title').value= lLst_Title[Row];
	//document.getElementById('Description').value= lLst_Description[Seq].replace(/{DCLF}/g, "\n");
	
//	var NewMsg=lLst_Description[Seq].replace(/{DCLF}/g, "\n");
//	oEdit1.putHTML(NewMsg);
	
	oEdit1.putHTML('<img src=/dc_images/silk_icons/AjaxProcesLarge.gif />');
	document.getElementById('DCWEBPAGE').action='/dc_includes/CP5_GetSchedPageForAJAX.asp?Seq='+Seq
	ValidatefEmpApprov('DCWEBPAGE','DCWPUpd','TempPage','false');
	document.getElementById('TempPage').style.display='none';
	
	window.setTimeout('oEdit1.putHTML(document.getElementById("TempPage").innerHTML);',1000);
	
	document.getElementById('StartDate').value=lLst_StartDate[Row];
	for (i=0;i<document.getElementById('StartTimeHH').options.length;i++) {
		if (document.getElementById('StartTimeHH').options[i].value==lLst_SHH[Row]) {
			document.getElementById('StartTimeHH').selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById('StartTimeMM').options.length;i++) {
		if (document.getElementById('StartTimeMM').options[i].value==lLst_SMM[Row]) {
			document.getElementById('StartTimeMM').selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById('StartTimeAMPM').options.length;i++) {
		if (document.getElementById('StartTimeAMPM').options[i].value==lLst_SAMPM[Row]) {
			document.getElementById('StartTimeAMPM').selectedIndex=i;
		}
	}
	document.getElementById('EndDate').value=lLst_EndDate[Row];
	for (i=0;i<document.getElementById('EndTimeHH').options.length;i++) {
		if (document.getElementById('EndTimeHH').options[i].value==lLst_EHH[Row]) {
			document.getElementById('EndTimeHH').selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById('EndTimeMM').options.length;i++) {
		if (document.getElementById('EndTimeMM').options[i].value==lLst_EMM[Row]) {
			document.getElementById('StartTimeMM').selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById('EndTimeAMPM').options.length;i++) {
		if (document.getElementById('EndTimeAMPM').options[i].value==lLst_EAMPM[Row]) {
			document.getElementById('EndTimeAMPM').selectedIndex=i;
		}
	}							
	
	for (i=0;i<document.getElementById('Type').length;i++) {
		if (document.getElementById('Type').options[i].value==lLst_Type[Row]) {
			document.getElementById('Type').selectedIndex=i;
		}
	}
	
	for (i=0;i<document.getElementById('ShareW').length;i++) {
		if (document.getElementById('ShareW').options[i].value==lLst_ShareW[Row]) {
			document.getElementById('ShareW').selectedIndex=i;
		}
	}
		
	document.getElementById('AttEmail').value= lLst_AttEMail[Row];
	
	document.getElementById('Seq').value= lLst_Seq[Row];
	document.getElementById('ShareWList').value= lLst_ShareWList[Row];
	document.getElementById('OptLink').value= lLst_OptLink[Row];
	if (document.getElementById('OptLink').value.length == 0) {
		document.getElementById('OptLink').value="http://";
	}
	//document.getElementById('SubClass').value= lLst_SubClass[Row];
	for (i=0;i<document.getElementById('GrpCode').length;i++) {
		if (document.getElementById('GrpCode').options[i].value==lLst_GrpCode[Row]) {
			document.getElementById('GrpCode').selectedIndex=i;
		}
	}
	ChangeType();
	
	
	
}
function UpdateCheckValue(FormField) {
	if (FormField.checked) {
		FormField.value = "1";
		}
	else {
		FormField.value = "0";
	}		
}
function dispAddEdit() {
	if (document.getElementById('VisCalAddEditTR').style.display=="") {
		document.getElementById('VisCalAddEditTR').style.display="none";
		document.getElementById('VisCalAddEdit').style.display="none";
		document.getElementById('VisCalOptionsTR').style.display="none";		
		}
	else	{
		document.getElementById('VisCalAddEditTR').style.display="";
		document.getElementById('VisCalAddEdit').style.display="";
		document.getElementById('VisCalYYYYCalTR').style.display="none";
		document.getElementById('VisCalOptionsTR').style.display="none";
	}
}
function dispFY() {
	if (document.getElementById('VisCalYYYYCalTR') != null) {
		if (document.getElementById('VisCalYYYYCalTR').style.display == "none") {
			document.getElementById('VisCalYYYYCalTR').style.display = "";
			document.getElementById('VisCalDispFullCal').value="1";
			document.getElementById('VisCalAddEdit').style.display="none";
			document.getElementById('VisCalAddEditTR').style.display="none";
			}
		else	{
			document.getElementById('VisCalYYYYCalTR').style.display = "none";
			document.getElementById('VisCalDispFullCal').value="";
			document.getElementById('VisCalAddEdit').style.display="none";
			document.getElementById('VisCalAddEditTR').style.display="none";
		}
	}
}
function SaveOptions() {
	document.getElementById('UpdTools').value="1";
	document.DCForm2.submit();
}

function dispTools() {

	if (document.getElementById('VisCalOptionsTR').style.display=="") {
		document.getElementById('VisCalOptionsTR').style.display="none";
		document.getElementById('VisCalAddEditTR').style.display="none";
		} 
	else {
		document.getElementById('VisCalOptionsTR').style.display="";
		document.getElementById('VisCalAddEditTR').style.display="none";
		}
}
// Left Menu Script
var MenuOpen = "";
var LastMenuOpen = "";
var lLastRowOpen = "";


function hightLight(Obj, type) {
	
	lSaveClass = document.getElementById(Obj).className;
	lSaveColor = document.getElementById(Obj).color;
	var lIdArray = Obj.split("_");
	
	if (type != 2) {
		if (lIdArray[0] != "ConfDays" && type != 2) {
			if (document.getElementById("Lnk_" + lIdArray[1])!=null) {
				document.getElementById("Lnk_" + lIdArray[1]).className="MMCDLinks";
			}
		}
	}
	if (type == 2) {
		if (document.getElementById("Lnk_" + Obj)!=null) {
			document.getElementById("Lnk_" + Obj).className="MMCDLinks";
		}
	}	

	if (document.getElementById(Obj)!=null && document.getElementById(Obj).className.indexOf('DaySelHighlight')<1) {
		document.getElementById(Obj).className = "MMHighLight";
	}
}
function CloseDayCal(id) {
	
	if (document.getElementById(id)!=null) {
		document.getElementById(id).style.display='none';
	}
	
	//if (document.getElementById(id)!=null) {
	//	RDCi=window.setTimeout("document.getElementById('"+id+"').style.display='none';",300);
	//}
}
function RenewDayCal(id) {
	window.clearTimeout(RDCi);
}
function dispDayCal(calDate,id,ParentId,am) {
	
	var nCalDate=calDate;
	var nId=id;
	var nParentId=ParentId;
	var nAm=am;

	window.clearTimeout(dispDayCalTimer);
	dispDayCalTimer=window.setTimeout("dispDayCalContent('"+nCalDate+"','"+nId+"','"+nParentId+"','"+nAm+"')",1000);
}
function dispProjectDayCal(pid,calDate,id,ParentId,am) {
	
	var nCalDate=calDate;
	var nId=id;
	var nParentId=ParentId;
	var nAm=am;

	window.clearTimeout(dispDayCalTimer);
	dispDayCalTimer=window.setTimeout("dispProjDayCalContent('"+pid+"','"+nCalDate+"','"+nId+"','"+nParentId+"','"+nAm+"')",1000);
}
function dispProjDayCalContent(pid,calDate,id,ParentId,am) {

	window.clearTimeout(RDCi);
	if (lLastCalDate==calDate) {
		return;
	}
	lLastCalDate=calDate
//	var x=document.getElementById(ParentId).offsetLeft;
//	var y=document.getElementById(ParentId).offsetTop;
//	var w=document.getElementById(ParentId).offsetWidth;
// var h=document.getElementById(ParentId).offsetHeight;
	
	//document.getElementById(id).style.display='';	
	//document.getElementById(id).style.left=x+(w-10);
	//document.getElementById(id).style.top=(y+10)+'px';
	
	nPId=ParentId.split('_');
	
	cElem=document.getElementById(id);
	pElem=document.getElementById('vCalCont_'+nPId[1]+'_'+nPId[2]);
	
	pElem.appendChild(cElem);
	
		
	var ajaxscript = '/dc_includes/cp5_ProjDayCalendar.asp?am='+am+'&SpecDate='+calDate+'&i=0&ConfCode=' + lPD_ConfCode+ '&sd=0&t=0&a=0&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', id,1);
}

function dispDayCalContent(calDate,id,ParentId,am) {

	window.clearTimeout(RDCi);
	if (lLastCalDate==calDate) {
		return;
	}
	lLastCalDate=calDate
//	var x=document.getElementById(ParentId).offsetLeft;
//	var y=document.getElementById(ParentId).offsetTop;
//	var w=document.getElementById(ParentId).offsetWidth;
// var h=document.getElementById(ParentId).offsetHeight;
	
	//document.getElementById(id).style.display='';	
	//document.getElementById(id).style.left=x+(w-10);
	//document.getElementById(id).style.top=(y+10)+'px';
	
	nPId=ParentId.split('_');
	
	cElem=document.getElementById(id);
	pElem=document.getElementById('vCalCont_'+nPId[1]+'_'+nPId[2]);
	
	pElem.appendChild(cElem);
	
	var ajaxscript = '/dc_includes/cp_activeevents.asp?am='+am+'&SpecDate='+calDate+'&i=0&ConfCode=' + lPD_ConfCode+ '&sd=0&t=0&a=0&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', id,1);
}
function fDispAgendaDetail(aid,parentId,updMode,event) {
	
	if (aid==svAid) {
		if (event!=null) {
			event.cancelBubble=true;
		}		
		return;
	}
	if (updMode==null) {
		updMode=0;
	}
	svAid=aid;
	cElem=document.getElementById('divAgendaViewContainer');
	pElem=document.getElementById(parentId);
	$('divAgendaViewContainer').style.display='none';
	pElem.appendChild(cElem);
	
	var ajaxscript = '/dc_includes/cp6_AGENDAView.asp?aid='+aid+'&um='+updMode+'&xc='+ajaxTimeStamp;
	window.clearTimeout(dispDayCalTimer);
	dispDayCalTimer=window.setTimeout("AjaxSimpleCheck('"+ajaxscript+"', '','divAgendaViewContainer',1)",1000);	
	
	if (event!=null) {
		event.cancelBubble=true;
	}	
}
function fCloseAgendaDetail(aid) {
	if (aid==svAid || svAid==0) {
		return;
	}		
	$('divAgendaViewContainer').style.display='none';
	svAid=0;
}
function noHightLight(Obj, type) {
	
	if (document.getElementById(Obj).className.indexOf('DaySelHighlight')>0) {
		return;
	}
	
	var lIdArray = Obj.split("_")

	if (document.getElementById(Obj)!=null) {
		document.getElementById(Obj).className = lSaveClass;
		document.getElementById(Obj).color = lSaveColor;
		document.getElementById(Obj).className=document.getElementById(Obj).className.replace('MMHighLight','');
	}
	
	if (type != 2) {
		if (lIdArray[0] != "ConfDays" && type != 2) {
			if (document.getElementById("Lnk_" + lIdArray[1])!=null) {
				document.getElementById("Lnk_" + lIdArray[1]).className="MMLinks";	
			}
		}
	}
	if (type == 2) {
		if (document.getElementById("Lnk_" + Obj)!=null) {
			document.getElementById("Lnk_" + Obj).className="MMLinks";	
		}
	}	
}
function SelectRow(Row, Target, dType, LinkLevel) {

	var lRowName = "Row_" + Row;
	var lLinkName = "Mnu_" + Row;
	lLastRowOpen = "Row_" + LastMenuOpen;	
	lLastLinkOpen = "Mnu_" + LastMenuOpen;	
		
	if (dType<3) {
		if (document.getElementById(lRowName)!=null) {
			document.getElementById(lRowName).className = "RollSel MenuChildTDClass" + LinkLevel;
			//document.getElementById(lLinkName).className = "RollOutLink ";			
		}		
	}
	else	{	
		if (document.getElementById(lRowName)!=null) {
			document.getElementById(lRowName).className = "RollSel MenuChildTDClass" + LinkLevel;
			//document.getElementById(lLinkName).className = "RollOutLink MenuChildLinkClass" + LinkLevel;			
		}		
	}	

	if (Target==1) {
		document.getElementById('RightContentPane').style.display="none";
	}
	
	if (dType>2)  {
		if (document.getElementById(lLastRowOpen)!=null) {	
			document.getElementById(lLastRowOpen).className = "RollOut MenuChildTDClass" + LinkLevel;
			//document.getElementById(lLastLinkOpen).className = "NavMenuTopLevel MenuChildLinkClass" + LinkLevel;	
		}
	}
	else	{
		if (document.getElementById(lLastRowOpen)!=null) {
			document.getElementById(lLastRowOpen).className = "RollOut MenuChildTDClass" + LinkLevel;
			//document.getElementById(lLastLinkOpen).className = "NavMenuTopLevel";	
		}
	}	
	
	//LastMenuOpen=Row;				
}	
function HighlightRow(Row, dType) {

	var lRowName = "Row_" + Row;
	var lLinkName = "Mnu_" + Row;
	lLastRowOpen = "Row_" + LastMenuOpen;	
	lLastLinkOpen = "Mnu_" + LastMenuOpen;	
	
	if (dType>2) {
		if (document.getElementById(lRowName).className!="RollSel") {	
			document.getElementById(lRowName).className = "RollOver MenuChildTDClass" + dType;
			//document.getElementById(lLinkName).className = "RollOutLink MenuChildLinkClass" + dType;
		}	
	}
	else	{
		if (document.getElementById(lRowName).className!="RollSel") {
			document.getElementById(lRowName).className = "RollOver MenuChildTDClass" + dType;
			//document.getElementById(lLinkName).className = "RollOutLink";	
		}
	}
}
function NoHighlightRow(Row, dType) {

	var lRowName = "Row_" + Row;
	var lLinkName = "Mnu_" + Row;
		
	if (dType>2) {
		if (document.getElementById(lRowName).className!="RollSel") {
			document.getElementById(lRowName).className = "RollOut MenuChildTDClass" + dType;
			//document.getElementById(lLinkName).className = "NavMenuTopLevel MenuChildLinkClass" + dType;			
		}
	}
	else	{
		if (document.getElementById(lRowName).className!="RollSel") {
			document.getElementById(lRowName).className = "RollOut MenuChildTDClass" + dType;
			//document.getElementById(lLinkName).className = "NavMenuTopLevel";			
		}
	}
}	
LastMenuOpen=urlDSeq;

function OpenURL(ouUrl, ouTarget, SimpleAuth, paths) {
	
	//RollSelSubMenu	(ouRow);
	var url=ouUrl;
	if (SimpleAuth=='True') {
		//url=url+ '&dcso=1'
	}
	
	if (ouTarget == 2) {
		self.location = urlQS + "&paths=" + paths + "&sp=1&ifc=" + url;
		return;
	}
	
	if (ouTarget == 1) {
		x=window.open(url);
		return;
	}	
	
	if (ouTarget == 0) {
		self.location = url;
		return;
	}
}
function ChangeStyle(css) {
	document.getElementById('DC4CssId').href=css;
	self.location.href="#DCTop";
}
now = new Date
function BannerModeToggle(mode) {

	document.getElementById('BannerMode').value=mode;
	document.ToggleForm.action="?"+urlRequestQueryString;
	document.ToggleForm.submit();
}
function FindNextZoom(dir) {
var iNextSi;
var i2;

	for (i=document.getElementById('ZoomQuestID').selectedIndex; i<document.getElementById('ZoomQuestID').length;i++) {
	
		if (i+1==document.getElementById('ZoomQuestID').length - 1) {
			i=0;
		}
		
//		i2=i-1
//		if (i2==0) {
//			i=document.getElementById('ZoomQuestID').length-2
//		}
					
		if (document.getElementById('ZoomQuestID').options[i+1].value=="-10" || document.getElementById('ZoomQuestID').options[i+1].value=="-11") {
			if (dir==1) {

				iNextSi = i + 2;
				//i=999
				}
			else	{
				iNextSi = i - 1;
				//i=999
			}
		}
		else {
			if (dir==1) {

				iNextSi = i + 1;
				i=999;
				}
			else	{
				iNextSi = i - 1;
				i=999;
			}		
		}
	}
	return (iNextSi);
}	

function NextZoom(dir) {

	if (dir==1) {
		//var iNextSi=document.getElementById('ZoomQuestID').selectedIndex + 1;
		var iNextSi=FindNextZoom(dir);
	}
	
	if (dir==2) {
		var iNextSi=document.getElementById('ZoomQuestID').selectedIndex - 1;
		var iNextSi=FindNextZoom(dir);
	}

	if (dir==3) {
		var iNextSi=document.getElementById('ZoomQuestID').selectedIndex;
	}	

	if (iNextSi > document.getElementById('ZoomQuestID').length-1) {
		iNextSi=0;
	}
		
	if (iNextSi < 0) {
		iNextSi=document.getElementById('ZoomQuestID').length-1;
	}		

	document.getElementById('ZoomQuestID').selectedIndex=iNextSi;
	
	DispQuest(1);	
}
function toggleTab(On) {

	document.getElementById('CommTable_Tab').className= "FPPortletTabNotSel";
	document.getElementById('StatTable_Tab').className= "FPPortletTabNotSel";
	
	if (document.getElementById('EmpTable_Tab') != null) {
		document.getElementById('EmpTable_Tab').className= "FPPortletTabNotSel";
	}
	
	if (document.getElementById('MktTable_Tab') != null) {			
		document.getElementById('MktTable_Tab').className= "FPPortletTabNotSel";
	}
	
	document.getElementById('CommTable').style.display="none";
	document.getElementById('StatTable').style.display="none";
	
	if (document.getElementById('EmpTable') != null) {
		document.getElementById('EmpTable').style.display="none";
	}
	
	if (document.getElementById('MktTable') != null) {
		document.getElementById('MktTable').style.display="none";	
	}		
	
	if (document.getElementById(On) != null) {
		document.getElementById(On).style.display = "";
		document.getElementById(On).style.zIndex = 100;
	}		
	
	document.getElementById(On + "_Tab").className= "FPPortletTabSel"
	

}	
function DispQuestFromMenu(id) {
	var elem=document.getElementById(id);
	self.location="#" + elem.options[elem.selectedIndex].value;
}

var tleOrigClassName;
var treOrigClassName;
var tlleOrigClassName;


function SaveOrder(theIdOfSelect, theIdOfTarget) {
var nSelect;
var oSelect;
var i;

	oSelect = document.getElementById(theIdOfSelect)
	if (oSelect.options.length != 0) {
		alert ("You need to move ALL of the elements to the \'New Order\' column\n\nYou have " + oSelect.options.length + " left" );
		return;
	}
	 
	nSelect = document.getElementById(theIdOfTarget)
	document.OrderForm.NewOrder.value="";
	for (i=0; i < nSelect.options.length; i++) {
		if (i > 0) {
			document.OrderForm.NewOrder.value = document.OrderForm.NewOrder.value + ",";
		}			
		document.OrderForm.NewOrder.value = document.OrderForm.NewOrder.value + nSelect.options[i].value;
		document.OrderForm.submit();
	}
}

function MoveToTwo(theIdOfSelect, theIdOfTarget) {
var oSelect;
var nSelect;
var i;
var aExistingOptions = new Array();
var aNewOptions = new Array();

var iIndexToMove;
var iLastIndex;
var iHighIndex;

	oSelect = document.getElementById(theIdOfSelect);
	nSelect = document.getElementById(theIdOfTarget);

	iIndexToMove = oSelect.selectedIndex;
	for (i=0; i < oSelect.options.length; i++) {
		aExistingOptions[i] = new Option(oSelect.options[i].text, oSelect.options[i].value);
	}
	
	iHighIndex = nSelect.options.length
	nSelect.options[iHighIndex] = new Option(oSelect.options[oSelect.selectedIndex].text, oSelect.options[oSelect.selectedIndex].value);
	
	oSelect.options[oSelect.selectedIndex] = null;		
}
function  movecol(direction, theIdOfSelect) {

var oSelect;
var i;
var aExistingOptions = new Array();
var iIndexToMove;
var iLastIndex;

oSelect = document.getElementById(theIdOfSelect);


if (oSelect.selectedIndex == -1) {
	alert ("You must choose an element to move");
	return;
}
//Build Array
iIndexToMove = oSelect.selectedIndex;
for (i=0; i < oSelect.options.length; i++) {
	aExistingOptions[i] = new Option(oSelect.options[i].text, oSelect.options[i].value);
}

switch (direction) {

case 1:
	if (oSelect.selectedIndex == 0) {
		return;
	}

	oSelect.options[0] = aExistingOptions[iIndexToMove];
	oSelect.selectedIndex = 0
	for (i=0; i < aExistingOptions.length; i++) {
		if (i < iIndexToMove) {
			oSelect.options[i+1] = aExistingOptions[i];
		}
	}
	break;
	
case 2:
	if (oSelect.selectedIndex == 0) {
		return;
	}
	
	oSelect.options[iIndexToMove - 1] = aExistingOptions[iIndexToMove];
	oSelect.options[iIndexToMove] = aExistingOptions[iIndexToMove - 1];
	
	oSelect.selectedIndex = iIndexToMove - 1;

	break;
	
case 3:
	if (oSelect.selectedIndex == (oSelect.options.length -1)) {
		return;
	}
	
	oSelect.options[iIndexToMove + 1] = aExistingOptions[iIndexToMove];
	oSelect.options[iIndexToMove] = aExistingOptions[iIndexToMove + 1];

	oSelect.selectedIndex = iIndexToMove + 1;

	break;
	
case 4:
	if (oSelect.selectedIndex == (oSelect.options.length - 1)) {
		return;
	}

	oSelect.options[oSelect.options.length - 1] = aExistingOptions[iIndexToMove];
		oSelect.selectedIndex = (oSelect.options.length - 1)
		for (i=0; i < aExistingOptions.length; i++) {
		if (i < iIndexToMove) {
			oSelect.options[i-1] = aExistingOptions[i];
		}
	}
	break;
	
default:
	return

	}
}
function UpdateSingleCheckValue(theIdOfSelect) {

	var ObjField = document.getElementById(theIdOfSelect);
	if (ObjField.checked) {
		ObjField.value = 1;
		}
	else {
		ObjField.value = 0;
	}
}	

function UpdateCheckValue(theIdOfSelect, theIdOfText, Desc) {

ObjField=document.getElementById(theIdOfSelect);

	if (theIdOfText)  {
		TextField=document.getElementById(theIdOfText);
		if (ObjField.value != "Other") {
			TextField.value=Desc;
		}
	}
		
	if (Desc == "") {
		Desc = "1";
	}
		
	if (ObjField.value != "Other") {		
		if (ObjField.checked) {
			TextField.value = Desc;
			}
		else {
			TextField.value = "";
		}
	}
		
	if (theIdOfText) {
		if (ObjField.value == "Other") {
			if (ObjField.checked) {
			 	TextField.style.display="";
			 	TextField.style.visibility="visible";			 	
			 	TextField.value="";
				}
			else {
			 	TextField.style.visibility="hidden";			
				TextField.style.display="none";
				TextField.value="";
			}
		}
	}
}
function UpdateRadioValue(Field, TargetField, OtherText) {

		TargetField.value=Field;
		
}	
function UpdateListValue(Field, TargetField) {
	

	
	try {
		if (lDriverArray.length > 0) {

			for (i=0;i<lDriverArray.length;i++) {
		
				if(lDriverArray[i] == null) {
					break;
				}

				// Cat Class Array
				// 0 = DriverID
				// 1 = Category
				// 2 = Sub Category
				// 3 = Driver Value
				// 4 = DispDriverDefault
				
				var lCatClassArray = lDriverArray[i].split(":");
			
				var ObjName = "tbl_" + lCatClassArray[2].replace(' ', '');
				var CatObjName = "tbl_" + lCatClassArray[1].replace(' ', '');
				var lDValue=lCatClassArray[3];
				var lDCat=lCatClassArray[2];

				ObjName = ObjName.replace(' ', '');	
			
//	Driver id and questid must match

				idOfFieldArray = Field.name.split("_");
				idOfField = idOfFieldArray[3];
				
				if (lCatClassArray[0] == idOfField) {	
					if (document.getElementById(ObjName)!=null) {
						document.getElementById(ObjName).style.display = "none";
					}
				
					if (lCatClassArray[4] == 1) {
						CatObjName = CatObjName.replace(' ', '');				
						if (document.getElementById(CatObjName) != null) {
							document.getElementById(CatObjName).style.display = "none";
						}
					}
				}
			
			
				if (Field[Field.selectedIndex].value == lCatClassArray[3]) {
					var CatDisp = lCatClassArray[3] + ":" + lCatClassArray[1] + ":" + lCatClassArray[2] + ":" + lCatClassArray[4] + ":" + lCatClassArray[0] ;

					// Driver Cat Array
					//   0 Value
					//   1 Category
					//   2 Sub Category
					//   3 DriverDispDefault

					var lQArray = CatDisp.split(':');
					var ObjName = "tbl_" + lQArray[2].replace(' ', '');
					var CatObjName = "tbl_" + lQArray[1].replace(' ', '');

					ObjName = ObjName.replace(' ', '');
					CatObjName = CatObjName.replace(' ', '');				

//	Driver id and questid must match

					idOfFieldArray = Field.name.split("_");
					idOfField = idOfFieldArray[3];
				
					if (idOfField == lQArray[4]) {

						document.getElementById(CatObjName).style.display = ""		
				
						if (Field[Field.selectedIndex].text == lQArray[0]) {
							if (document.getElementById(ObjName)!=null) {
								document.getElementById(ObjName).style.display = "";
							}
							if (lQArray[3] == 1) {
								if (document.getElementById(CatObjName)!=null) {
									document.getElementById(CatObjName).style.display = "";				
									}
								}					
							}
						else {
							if (document.getElementById(ObjName)!=null) {
								document.getElementById(ObjName).style.display = "none";
							}
							if (lQArray[3] == 0) {
								if (document.getElementById(CatObjName)!=null) {
									document.getElementById(CatObjName).style.display = "none";					
								}
							}
						}
					}
				}
			}	
		}
	}catch(E){};
	
	TargetField.value = Field[Field.selectedIndex].text;
}
function UpdateRadioListValue(FieldId, TargetField) {

	var Field=document.getElementById(FieldId);
	if (lDriverArray==null) {
		return;
	}
	
	if (lDriverArray.length > 0) {

		for (i=0;i<lDriverArray.length;i++) {
		
			if(lDriverArray[i] == null) {
				break;
			}

			// Cat Class Array
			// 0 = DriverID
			// 1 = Category
			// 2 = Sub Category
			// 3 = Driver Value
			// 4 = DispDriverDefault
				
			var lCatClassArray = lDriverArray[i].split(":");
			
			var ObjName = "tbl_" + lCatClassArray[2].replace(' ', '');
			var CatObjName = "tbl_" + lCatClassArray[1].replace(' ', '');
			var lDValue=lCatClassArray[3];
			var lDCat=lCatClassArray[2];

			ObjName = ObjName.replace(' ', '');	
			
//	Driver id and questid must match

			idOfFieldArray = Field.name.split("_");
			idOfField = idOfFieldArray[3];
				
			if (lCatClassArray[0] == idOfField) {	
				if (document.getElementById(ObjName)!=null) {
					document.getElementById(ObjName).style.display = "none";
				}
				
				if (lCatClassArray[4] == 1) {
					CatObjName = CatObjName.replace(' ', '');				
					if (document.getElementById(CatObjName) != null) {
						document.getElementById(CatObjName).style.display = "none";
					}
				}
			}
			
			if (Field.value == lCatClassArray[3]) {
				var CatDisp = lCatClassArray[3] + ":" + lCatClassArray[1] + ":" + lCatClassArray[2] + ":" + lCatClassArray[4] + ":" + lCatClassArray[0] ;

				// Driver Cat Array
				//   0 Value
				//   1 Category
				//   2 Sub Category
				//   3 DriverDispDefault

				var lQArray = CatDisp.split(':');
				var ObjName = "tbl_" + lQArray[2].replace(' ', '');
				var CatObjName = "tbl_" + lQArray[1].replace(' ', '');

				ObjName = ObjName.replace(' ', '');
				CatObjName = CatObjName.replace(' ', '');				

//	Driver id and questid must match

				idOfFieldArray = Field.name.split("_");
				idOfField = idOfFieldArray[3];
				
				if (idOfField == lQArray[4]) {

					document.getElementById(CatObjName).style.display = "";		
				
					if (Field.value == lQArray[0]) {
						if (document.getElementById(ObjName)!=null) {
							document.getElementById(ObjName).style.display = "";
						}
						if (lQArray[3] == 1) {
							if (document.getElementById(CatObjName)!=null) {
								document.getElementById(CatObjName).style.display = "";					
								}
							}					
						}
					else {
						if (document.getElementById(ObjName)!=null) {
							document.getElementById(ObjName).style.display = "none";
							}
						if (lQArray[3] == 0) {
							if (document.getElementById(CatObjName)!=null) {
								document.getElementById(CatObjName).style.display = "none";					
							}
						}
					}
				}
			}
		}	
	}
	
	//TargetField.value = Field[Field.selectedIndex].text;
}
function DisplayFormElements() {
var l_SvId;
var l_SvStyle;
var l_Comma;

	l_SvId = 0;
	l_SvStyle = 0;
	l_Comma = "";
	
	if (document.DCForm.QuestAnswers!=null) {
		document.DCForm.QuestAnswers.value = '';
	}
	for (var i = 0; i < document.DCForm.length; ++i)
	{
				//Array - DCSurv:Type:Style:ID(If Type = 2 and Style = 0)
		//DCSurv_4_0_1608
		var DCSurvArray = document.DCForm.elements[i].name.split("_");
		if (DCSurvArray.length > 0) {
			if (DCSurvArray[0] == "DCSurv") {
			
				//if (document.DCForm.elements[i].value != "") {
				//	alert ("Alert "  + document.DCForm.elements[i].name + " - " + document.DCForm.elements[i].id + " - " + document.DCForm.elements[i].value)
				//}
								
				switch (DCSurvArray[1])
				{
					case "3":
				
						switch (DCSurvArray[2])
						{
						case "0":
							if (DCSurvArray[3] != l_SvId) {
								var elmValue = document.DCForm.elements[i].value;
								elmValue = elmValue.replace(/:/g, "-");
								elmValue = elmValue.replace(/|/g, "");
								
								//if  (DCSurvArray[2] != l_SvStyle)
								document.DCForm.QuestAnswers.value = document.DCForm.QuestAnswers.value + l_Comma + elmValue;
								l_SvId = DCSurvArray[3];
								l_SvStyle = DCSurvArray[2];
								l_Comma = "|"
							
								if ((DCSurvArray[2] == 0) || (DCSurvArray[2] == 1)) {
									if (document.DCForm.elements[i].checked) {
									document.DCForm.elements[i].value = "";
									}
								}
							}

							else {
								var elmValue = document.DCForm.elements[i].value;
								elmValue = elmValue.replace(/:/g, "-");
								elmValue = elmValue.replace(/|/g, "");
								
								document.DCForm.QuestAnswers.value = document.DCForm.QuestAnswers.value + ":" + elmValue;
								l_SvId = DCSurvArray[3];
								l_SvStyle = DCSurvArray[2];			
								l_Comma = "|";				
							}
							
							break;

						
						default:
							var elmValue = document.DCForm.elements[i].value;
							elmValue = elmValue.replace(/:/g, "-");
							elmValue = elmValue.replace(/|/g, "");
							
							document.DCForm.QuestAnswers.value = document.DCForm.QuestAnswers.value + l_Comma + elmValue; 
							l_Comma = "|";
							break;
						}
						break;
					
					case "5":
						l_Value="DCSurv_5_0_" + DCSurvArray[3];
						l_List="DCSurvRankResult_5_0_" + DCSurvArray[3];	
		
						l_RankValue = document.getElementById(l_Value);	
						l_RankList = document.getElementById(l_List);
					
						l_Colon="";
						if (l_RankValue != null) {
							l_RankValue.value=""
							
							for (i2=0; i2<l_RankList.length; i2++) {
								if (l_RankList[i2].text != "") {
									l_RankValue.value = l_RankValue.value + l_Colon + l_RankList[i2].text;
									l_Colon = ":"
								}
							}
						}
						else {
						alert ("Can not find this element: " + l_Value);	
						}
					
				
						document.DCForm.QuestAnswers.value = document.DCForm.QuestAnswers.value + l_Comma + l_RankValue.value;  
						l_Comma = "|";
						break;
				
					case "8":
								
						l_YYYY_Value = "DCSurvDateYYYY_8_0_" + DCSurvArray[2];
						l_MM_Value = "DCSurvDateMM_8_0_" + DCSurvArray[2];
						l_DD_Value = "DCSurvDateDD_8_0_" + DCSurvArray[2];										

						l_YYYY_Field = document.getElementById(l_YYYY_Value);
						l_MM_Field = document.getElementById(l_MM_Value);
						l_DD_Field = document.getElementById(l_DD_Value);					
									
						if (document.getElementById("DCSurvDateMM_8_0_" + DCSurvArray[2]) != null) {
							document.DCForm.QuestAnswers.value = document.DCForm.QuestAnswers.value + l_Comma + document.getElementById(l_MM_Value)[document.getElementById(l_MM_Value).selectedIndex].value;
						}	
					
						if (document.getElementById("DCSurvDateMM_8_0_" + DCSurvArray[2]) != null) {
							document.DCForm.QuestAnswers.value = document.DCForm.QuestAnswers.value + "/" + document.getElementById(l_DD_Value)[document.getElementById(l_DD_Value).selectedIndex].value;
						}
					
						if (document.getElementById("DCSurvDateYYYY_8_0_" + DCSurvArray[2]) != null) {
							document.DCForm.QuestAnswers.value = document.DCForm.QuestAnswers.value + "/" + document.getElementById(l_YYYY_Value)[document.getElementById(l_YYYY_Value).selectedIndex].value;
						}
					
						l_Comma = "|";
						break;
															
					default:

						var elmValue = document.DCForm.elements[i].value;
						
						//alert (elmValue)
					
						elmValue = elmValue.replace(/:/g, "-");
						elmValue = elmValue.replace(/|/g, "");
					
						if (elmValue.length > 2000) {
							document.DCForm.QuestAnswers.value = document.DCForm.QuestAnswers.value + l_Comma + elmValue.substr(0, 2000);
							}
						else	{						
							document.DCForm.QuestAnswers.value = document.DCForm.QuestAnswers.value + l_Comma + elmValue; 
						}
						l_Comma = "|"
						break;
					}
				}
			}
		}
	}
function ToggleElems(Val,event) {
var lForce=0;
if (Val!=null) {
	lForce=1
	if (Val==0) {
		AdminBoxes=1;
		}
	else	{
		AdminBoxes=0;
	}
	if (event!=null) {
		event.cancelBubble=true;
	}
}	

var pars = document.getElementsByTagName('div');
var editAnchors = document.getElementsByTagName('span');
var editAnchorsMenu = document.getElementsByTagName('img');

var sAdminClassName;

	if (AdminBoxes==1) {
		AdminBoxes=0;
		sAdminClassName='AdminEditBoxOff';
		sEditAnchorsClassName='sEditAnchorsOff';
		sEditAnchorsMenuClassName='sEditAnchorsOff';
		sEditTopMenuClassName='TopTabsOff';
		document.getElementById('simmEditBoxes').src='../dc_images/silk_icons/page_white_noedit.png';
		}
	else	{
		AdminBoxes=1;
		sAdminClassName='AdminEditBox';
		sEditAnchorsClassName='sEditAnchorsOn';
		sEditAnchorsMenuClassName='imgMaxMinPortlet';
		sEditTopMenuClassName='TopTabs';
		document.getElementById('simmEditBoxes').src='../dc_images/silk_icons/page_white_edit.png';
	}
	
	if (lForce==0) {
		var ajaxscript = '../dc_ajax/dc5_SetAdminPersist.asp?ifl=' + lPD_LoggedInIdForLife + '&kt=30&kn=EditBoxes&v=' + AdminBoxes + '&xc=' + ajaxTimeStamp;
		AjaxSimpleCheck(ajaxscript, '', 'divAdminSettings');	
	}
		
	for (var i=0;i<pars.length;i++) {
		sId=pars[i].id;
		if (sId.indexOf('AdminEditBox_')==0) {
			pars[i].className=sAdminClassName;
		}
	}
	
	for (var i=0;i<pars.length;i++) {
		sId=pars[i].id;
		if (sId.indexOf('AdminEditBoxMenu_')==0) {
			pars[i].className=sAdminClassName;
		}
	}	
	
	for (var i=0;i<pars.length;i++) {
		sId=pars[i].id;
		if (sId.indexOf('AdminEditBoxTabMenu_')==0) {
			pars[i].className=sEditTopMenuClassName;
		}
	}		
	
	for (var i=0;i<editAnchors.length;i++) {
		sId=editAnchors[i].id;
		if (sId.indexOf('aAdminBoxEditLink_')==0) {
			editAnchors[i].className=sEditAnchorsClassName;
		}
	}  
	
	for (var i=0;i<editAnchorsMenu.length;i++) {
		sId=editAnchorsMenu[i].id;
		if (sId.indexOf('imgAdminBoxEditMenu_')==0) {
			editAnchorsMenu[i].className=sEditAnchorsMenuClassName;
		}
	} 
} 

function CleanUpPortlets() {
// This function cleans up the portlets (IE mostly) after an ajax call may have altered an innerhtml height.  The effect
// on subsequent portlets was to skew the relative top position relative to the new size increase (yuck).  Simply touching the div
// with a visibility change seems to solve te problem.

// This has been removed due to n/a
}

//SuckerTree Horizontal Menu (Sept 14th, 06)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

var menuids=["treemenu1"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_horizontal(){
for (var i=0; i<menuids.length; i++){
	if (document.getElementById(menuids[i])!=null) {
		var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul");
			for (var t=0; t<ultags.length; t++){
				if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
					ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px"; //dynamically position first level submenus to be height of main menu item
					if (ultags[t].parentNode.getElementsByTagName("a")[0].className!='mainfoldericonselected') {
						ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon";
					}
				}
				else{ //else if this is a sub level menu (ul)
		  			ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px"; //position menu to the right of menu item that activated it
    				ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon";
				}
				ultags[t].parentNode.onmouseover=function(){
    				this.getElementsByTagName("ul")[0].style.visibility="visible";
    				//this.getElementsByTagName("ul")[0].style.display="inline";
		    	}
			    ultags[t].parentNode.onmouseout=function(){
	    			this.getElementsByTagName("ul")[0].style.visibility="hidden";
	    			//this.getElementsByTagName("ul")[0].style.display="none";
			    }
			}
		}
	}
}	
function SetHorzMenu() {
	if (document.getElementById('treemenu1')==null) {
		return false;
	}
	
	var lNMenuWidth = 0;
	var pars = $('treemenu1').getElementsByTagName('li');

	for (var i=0;i<pars.length;i++) {
		sId=pars[i].id;
		sClassName=pars[i].className;
		if (sClassName.indexOf('TopMenu')!=-1) {
			lNMenuWidth=lMenuWidth+pars[i].offsetWidth;
		}
	}
	document.getElementById('treemenu1').style.width=lNMenuWidth+10;
}	
function Initializesubmenus_horizontal() {

	if (menuids!=null) {
		for (var i=0; i<menuids.length; i++){
			if (document.getElementById(menuids[i])!=null) {
				var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul");
				for (var t=0; t<ultags.length; t++){
					var tClassName=ultags[t].className;
		//			if  (tClassName.indexof('Level1')==0) {
		//				//ultags[t].style.visibility="hidden";
		//			}
				}
			}
		}
	}
}
function NewPostSel(forum) {
	var parray=forum.split('.')
	if (parray[0]!='-1'){
		if (parray[0]!='-2') {
			self.location="?p=210&sp=7&ff=80&forum=" + parray[0] + "&dcso=&nt=1&ConfCode=" + lPD_ConfCode + "&dSeq=" + urlDSeq + "&DCMessage=Continue with your new post";
			}
		else {
			self.location="?p=210&sp=7&group=" + parray[1] + "&dcso=&nt=1&ConfCode=" + lPD_ConfCode + "&dSeq=" + urlDSeq + "&DCMessage=You have chosen a Category, now select an available Forum for your post";
		}
	}
}
function ChoosePosts(iMax,i, ShowForums, SortOrder, mode,nr,AllMode) {
	var lExtQS='';
	if (mode!=null) {
		lExtQS='&r='+mode;
	}
	if (nr==null) {
		var nr=0;
	}
	if (AllMode==null) {
		var AllMode='';
	}
	
	var pid='divMBPosts'+i
	if (document.getElementById(pid)==null) {
		pid='divMBPosts0';
	}	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/cp_MessageBoards.asp?marketcode='+lPD_MarketCode+'&Grpcode='+lPD_GrpCode+'&confcode='+lPD_ConfCode+'&all='+AllMode+'&nr='+nr+'&i=' + i + '&m=' + iMax + '&sf=' + ShowForums + '&so=' + SortOrder + '&xc=' + ajaxTimeStamp + ajaxIncrement + lExtQS;
	AjaxSimpleCheck(ajaxscript, '', pid,1);
	
	if (document.getElementById('PortletPage_'+i)!=null) {
		//document.getElementById('PortletPage_'+i).value=ajaxscript;
	}
}
function DeleteFullCampaign(cid) {
	var x=window.confirm('You are about to delete the selected campaign ('+cid+')\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_DelFullCampaignAX.asp?cid=' + cid + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('cid_'+cid)
}	
function fDelFileSetItems(fileSetId,uid) {
	
	//Check for selected item
	var bFoundSelected=0;
	var pars = $('divPictListContainer').getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].name=='FileItem' && pars[i].checked) {
			bFoundSelected=1;
		}
	}	
	
	if (bFoundSelected==0) {
		alert ('You must select an image to delete, no images were selected');
		return false;
	}
	
	var x=window.confirm('You are about to delete the selected pictures \n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}	
	
	if (uid==null) {
		uid=''
	}
	
	var sComma='';
	sPictureIds='';
	var pars = $('divPictureList').getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf('FileItem_')>=0 && pars[i].value.length>0) {
			sPictureIds=sPictureIds + sComma + pars[i].value; 
			sComma=','
		}
	}
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP6_GalleryFileSetItemDelete.asp?uid='+uid+'&filesetid='+fileSetId+'&fids=' + sPictureIds + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true','fProcessDeletedFileSetItems(\''+sPictureIds+'\')');
}
function fProcessDeletedFileSetItems(PictureIds) {
	sA=PictureIds.split(',');
	for (i=0;i<sA.length;i++) {
		new Effect.Puff('divFileItem_'+sA[i])
	}
}
function fDelFileSet(fileSetId,mode,gid,dest,uid) {
	
	if (mode==null) {
		mode=0;
	}
		
	var x=window.confirm('You are about to delete the File Set('+fileSetId+')\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}	
	
	if (uid==null) {
		uid='';
	}
	
	if (mode==0) {
		ajaxIncrement=ajaxIncrement+1;
		var ajaxscript = '/dc_includes/CP6_GalleryFileSetDelete.asp?uid='+uid+'&filesetid=' + fileSetId + '&xc=' + ajaxTimeStamp+ajaxIncrement;
		AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
		new Effect.Puff('gRow_'+fileSetId);
	}
	else	{
		ajaxIncrement=ajaxIncrement+1;
		var ajaxscript = '/dc_includes/CP6_GalleryFileSetDelete.asp?uid='+uid+'&filesetid=' + fileSetId + '&xc=' + ajaxTimeStamp+ajaxIncrement;
		AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true','fRedisplayGalleryList(\''+gid+'\',\''+dest+'\')');		
	}
}
function fRedisplayGalleryList(gid,dest) {
	DisplayAjaxPage(1,'AdminArea','DCGALLERYLIST','','&gid='+gid+'&dest='+dest);	
}	
function MoveThread(Move, CT) {
	var x=window.confirm('You are about to Move this thread to a new group/forum\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	var sNewGFArray=Move.split('');
	ajaxIncrement=ajaxIncrement+1
	var ajaxscript = '/dc_includes/cp5_MoveThread.asp?i='+i+'&CT='+CT+'&NG='+sNewGFArray[0]+'&NF='+sNewGFArray[1]+'&xc=' + ajaxTimeStamp+ajaxIncrement	
	AjaxSimpleCheck(ajaxscript, '', 'divThreadRow'+CT,1,'');
	
	new Effect.Puff('ulThread'+CT)
}
function MoveAuthor(NA,CP) {
	if (NA.length<1) {
		alert ("You must specify the valid email of the new author");
	}

	var x=window.confirm('You are about to change the author of this post/forum\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	//document.getElementById('Author'+CP).innerHTML='<img src="/DC_Images/silk_icons/DCWhiteProgressBar.gif" />';
	ajaxIncrement=ajaxIncrement+1
	var ajaxscript = '/dc_includes/cp5_MoveAuthor.asp?i='+i+'&NA='+NA+'&CP='+CP+'&xc=' + ajaxTimeStamp+ajaxIncrement;	
	AjaxSimpleCheck(ajaxscript, '', 'Author'+CP,1,'');	
}
function ShowEventDetails(i, ShowDetails, t, a, SortOrder) {
	ajaxIncrement=ajaxIncrement+1;
	if (document.getElementById('divActiveEvents'+i)==null) {
		alert ('Can not find - divActiveEvents'+i);
	}
	var ajaxscript = '/dc_includes/cp_activeevents.asp?marketcode='+lPD_MarketCode+'&i=' + i + '&sd=' + ShowDetails + '&t=' + t + '&a=' + a + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divActiveEvents'+i,1);
}
function ConnectionRequest(cid,mode,sm,np) {
	var noprofile;
	if (np!=null) {
		noprofile=np;
	}
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/cp_ConnectionRequest.asp?sm='+sm+'&rid='+cid+'&r='+mode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divActiveEvents'+i,1)
	
	
	alert('Your connection request has been processed');
	if (mode!=0) {
		DisplayAjaxPage(0,'AjxContent','JAWSMYFRIENDSSEARCH',1);
	}
	if (noprofile!=1) {
		dIProfile(cid,1,'1');
	}
	if (mode==0 && document.getElementById('friend'+cid)!=null) {
		PuffId('friend'+cid);
	}
}
function ConnectionRequestMessage() {
	alert ("Connect Request Processed");
}
function NextCalendarDate(i, Params,uid) {
	
	if (!i) {
		i=1;
	}
	if (!uid) {
		uid=1;
	}	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/cp_CommunityCalendar.asp' + Params + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	if (document.getElementById('divCalendar'+i)!=null || document.getElementById('divCalendar999')!=null) {
		if (document.getElementById('divCalendar'+i)!=null) {
			AjaxSimpleCheck(ajaxscript, '', 'divCalendar'+i,1,'true','fAdjustCalendar()');
			//AjaxSimpleCheck(ajaxscript, '', 'divCalendar'+i,1,'true','alert(\''+uid+'\',\''+uid+'\')');
		}
		else {
			if (document.getElementById('divCalendar999')!=null) {
				AjaxSimpleCheck(ajaxscript, '', 'divCalendar999',1,'true','fAdjustCalendar(999)');
				}	
			else {
				if (document.getElementById('divCalendar999')!=null) {
					AjaxSimpleCheck(ajaxscript, '', 'divCalendar999',1,'true','fAdjustCalendar(999)');
					}	
				else {
					self.location=Params;
				}
			}
		}
	}
	else {
		self.location=Params;
	}
}	
function NextProjectDate(i, Params,uid) {
	
	if (!i) {
		i=1;
	}
	if (!uid) {
		uid=1;
	}	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/cp5_ProjCalendarContainer.asp' + Params + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	if (document.getElementById('divCalendar'+i)!=null || document.getElementById('divCalendar999')!=null) {
		if (document.getElementById('divCalendar'+i)!=null) {
			AjaxSimpleCheck(ajaxscript, '', 'divCalendar'+i,1,'true','fAdjustCalendar()');
			//AjaxSimpleCheck(ajaxscript, '', 'divCalendar'+i,1,'true','alert(\''+uid+'\',\''+uid+'\')');
		}
		else {
			if (document.getElementById('divCalendar999')!=null) {
				AjaxSimpleCheck(ajaxscript, '', 'divCalendar999',1,'true','fAdjustCalendar(999)');
				}	
			else {
				if (document.getElementById('divCalendar999')!=null) {
					AjaxSimpleCheck(ajaxscript, '', 'divCalendar999',1,'true','fAdjustCalendar(999)');
					}	
				else {
					self.location=Params;
				}
			}
		}
	}
	else {
		self.location=Params;
	}
}	
function dispCal(i, Parms,uid) {
	
	var lNextDate = document.getElementById('SelMM'+i).options[document.getElementById('SelMM'+i).selectedIndex].value + "/01/" +  document.getElementById('SelYYYY'+i).options[document.getElementById('SelYYYY'+i).selectedIndex].value;
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/cp_CommunityCalendar.asp' + Parms + '&SessionDate='+ lNextDate + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	if (document.getElementById('divCalendar'+i)!=null) {
		AjaxSimpleCheck(ajaxscript, '', 'divCalendar'+i,1,'true','fAdjustCalendar()');
	//	AjaxSimpleCheck(ajaxscript, '', 'divCalendar'+i,1,'true','fAdjustCalendar()');
		}	
	else {
		self.location=Params;
	}
}
function UpdateMonthYear(idx, MM, YYYY) {

	for (i=0;i<document.getElementById('SelMM').length;i++) {
		if (document.getElementById('SelMM').options[i].value == MM) {
			document.getElementById('SelMM').selectedIndex = i;
		}
	}
	for (i=0;i<document.getElementById('SelYYYY').length;i++) {
		if (document.getElementById('SelYYYY').options[i].value == YYYY) {
			document.getElementById('SelYYYY').selectedIndex = i;
		}
	}	
}
function dispCalFromFY(i, mm) {
	document.getElementById('SelMM').selectedIndex = mm - 1 ;
	dispCal(i);
}
function InitMoreAnalytic (mcc,sz) {
	if (mcc==null) {
		var mcc='';
	}
	if (sz==null) {
		var sz='';
	}	
	var ajaxscript = '/dc_includes/cpx_CommStats.asp?sz='+sz+'&mcc='+mcc+'&confcode=' + lPD_ConfCode + '&MarketCode=' + lPD_MarketCode + '&context=m&top=' + lAnalTop + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divCommStats',1);
}
function InitBaseAnalytic() {
	var ajaxscript = '/dc_includes/cpx_CommStats.asp?confcode=' + lPD_ConfCode + '&MarketCode=' + lPD_MarketCode + '&mm=&yy=&top=' + lAnalTop + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divCommStats',1);
}	
function NextAnalytic(id, Mode,mcc,sz) {
	
	var aoptions=document.getElementById('AnalyticAttr1');
	var CurrAnalIndex=aoptions.selectedIndex;
	
	var pars = document.getElementsByTagName('img');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i];
		
		if (sCN.src.indexOf('ChartFXInt62')>=0) {
			sCN.style.display='none';
			sCN.width='32';
			sCN.height='32';
			sCN.src='/dc_images/dc_spacer.gif';
			var gImg=sCN;
			sCN.style.display='';
		}
	}
	if (mcc==null) {
			var mcc='';
	}
	if (sz==null) {
			var sz='';
	}	
	
	if (Mode=='N') {
		CurrAnalIndex=CurrAnalIndex+1;
	
		if (CurrAnalIndex==aoptions.options.length) {
			CurrAnalIndex=0;
		}
		aoptions.selectedIndex=CurrAnalIndex;
	}
	var CurrAnal=aoptions.options[CurrAnalIndex].value;
	var ajaxscript = '/dc_includes/cpx_CommStats.asp?sz='+sz+'&mcc='+mcc+'&confcode=' + lPD_ConfCode + '&MarketCode=' + lPD_MarketCode + '&context=M&top=' + lAnalTop + '&qid=' + CurrAnal + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divCommStats',1);
	
	if (gImg!=null) {
		gImg.src='/dc_images/silk_icons/AjaxProcesLarge.gif';
	}
}
function UpdateTop(id) {
	var aoptions=document.getElementById('AnalyticAttr1');
	var CurrAnalIndex=aoptions.selectedIndex;
	
	lAnalTop=document.getElementById('topList').options[document.getElementById('topList').selectedIndex].value;
	
	var CurrAnal=aoptions.options[CurrAnalIndex].value;
	var ajaxscript = '/dc_includes/cpx_CommStats.asp?confcode=' + lPD_ConfCode + '&MarketCode=' + lPD_MarketCode + '&context=M&top=' + lAnalTop + '&qid=' + CurrAnal + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divCommStats',1);
}

function DispEventTypes(i, ShowDetails, t, a, SortOrder) {
									
	var ajaxscript = '/dc_includes/cp_activeevents.asp?i=' + i + '&ConfCode=' + lPD_ConfCode+ '&sd=' + ShowDetails + '&t=' + t + '&a=' + a + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divActiveEvents'+i,1);
}
function OpenCloseHelp(id) {
	var HelpWin=document.getElementById('PortletHelpContent' + id)
	if (HelpWin.style.display=='none') {
		HelpWin.style.display='';
		}
	else
		{
		HelpWin.style.display='none';
	}
}
function displayLargeImg(lid, sid) {
	
	//var iWidth=document.getElementById(sid).offsetWidth;
	//var iHeight=document.getElementById(sid).offsetHeight;

	document.getElementById(lid).style.display='';
}	
function CloseLargeImg(id) {

	document.getElementById(id).style.display='none';
}

function LoginAdminFromList(url,si,mc,gc) {
	var list=document.getElementById(si)
	var formid=list.options[list.selectedIndex].value;
	var eform=document.getElementById(formid);
	document.getElementById(formid).action=document.getElementById(formid).action+url;
	document.getElementById(formid).submit();
}
function ToggleCalSel(i) {
	if (document.getElementById('divSelMM'+i).style.display=='none') {
		document.getElementById('divSelMM'+i).style.display='';
		}
	else {
		document.getElementById('divSelMM'+i).style.display='none';
	}		
}
function QueryEmployees(ci,mode) {
	
	if (mode==null) {
			mode=0;
}			
	if (mode==0) {
		if (document.getElementById('tr'+ci).style.display=='none' || document.getElementById('tr'+ci).style.display==null) {
			document.getElementById('divEmp'+ci).innerHTML='';
			AjaxSimpleCheck('../dc_ajax/DC5GetCompanyEmployees.asp?ci='+ci+'&marketcode=' + lPD_MarketCode, 'No Employees Found', 'divEmp'+ci,0);
			document.getElementById('tr'+ci).style.display="";
			document.getElementById('divEmp'+ci).style.display="";
			document.getElementById('Img'+ci).src='../dc_images/silk_icons/minusonly.gif';
			}
		else	{
			
			document.getElementById('Img'+ci).src='../dc_images/silk_icons/plusonly.gif';
			document.getElementById('tr'+ci).style.display='none';
			document.getElementById('divEmp'+ci).style.display='none';
		}
	}		
	else	{
		
			var pars = document.getElementsByTagName('div');
			for (var i=0;i<pars.length;i++) {
				sCN=pars[i].id;
				if (sCN.indexOf('divEmp')==0) {
					pars[i].style.display='none';
				}
			}		
			document.getElementById('divEmp'+ci).innerHTML='';
			AjaxSimpleCheck('../dc_ajax/DC5GetCompanyEmployees.asp?ci='+ci+'&marketcode=' + lPD_MarketCode, 'No Employees Found', 'divEmp'+ci,0);
			document.getElementById('divEmp'+ci).style.display='';
	}
}
function DispMailBoxes(id,bt,nr,ob,obd,dest) {
	
	if (dest==null) {
		dest='divDMailInBox'
	}
	if (nr==null) {
		var nr=0;
	}
	if (ob==null) {
		var ob='';
	}
	if (obd==null) {
		var obd='';
	}	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/cp_EmailInBox.asp?ob='+ob+'&obd='+obd+'&nr='+nr+'&i='+id+'&bt='+bt+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest,1);
}
							
function DoNothing() {}	
function ShowStartNewThread(id) {

	var sel=document.getElementById(id);
	if (sel.style.display=='') {
		sel.style.display='none';
		}
	else	{
		sel.style.display='';
	}
}
function ChooseCompany(f_CompanyID, f_CompanyName, f_Addr1, f_Addr2, f_City, f_State, f_Zip) {
var l_Delta_Msg;

	var x
	if (window.opener.document.DCForm != null) {
		xWin=window.opener.document.DCForm;
		}
	else	
		{
		xWin=window.opener.document.FrontPage_Form1;
	}
	if (xWin.CompanyName.value != f_CompanyName) {
		l_Delta_Msg = "Company Name";
	}	
	if (xWin.Addr1.value != f_Addr1) {
		l_Delta_Msg = l_Delta_Msg + ", " + "Address1";
	}	
	if (xWin.Addr2.value != f_Addr2) {
		l_Delta_Msg = l_Delta_Msg + ", " + "Address2";
	}
	if (xWin.City.value != f_City) {
		l_Delta_Msg = l_Delta_Msg + ", " + "City";
	}
	if (xWin.value != f_State) {
		l_Delta_Msg = l_Delta_Msg + ", " + "State";
	}
	if (xWin.ZipCode.value != f_Zip) {
		l_Delta_Msg = l_Delta_Msg + ", " + "ZipCode";
	}	
	
var x=window.confirm("You have chosen: " + f_CompanyName + " (" + f_CompanyID + ")\n\n if correct, press OK, else CANCEL");
if (!x) {
	return;
}

	if (l_Delta_Msg != "") {
		var x1=window.confirm("The following items: \n\n" + l_Delta_Msg + " are different on your Personal Profile vs. the " + f_CompanyName + " Profile.\n\n Would you like to update your Personal Profile?");
		if (x1) {
			xWin.CompanyName.value=f_CompanyName;
			xWin.CompanyID.value=f_CompanyID;	
			xWin.Addr1.value=f_Addr1;	
			xWin.Addr2.value=f_Addr2;	
			xWin.City.value=f_City;	
			xWin.ZipCode.value=f_Zip;
			for (i=0;i<xWin.StateCode.options.length;i++) {
				if (xWin.StateCode.options[i].value==f_State) {
					xWin.StateCode.selectedIndex=i;
				}
			}
			window.close();
			}
		else {
			xWin.CompanyID.value=f_CompanyID;		
			window.close();
		}
	}
}
function OpenBox(id) {
	var box=document.getElementById(id);
	if (box.style.display=='none') {
		box.style.display='';
		}
	else {
		box.style.display='none';
	}
	
	if (document.getElementById('BoxCont'+id)!=null) {
		var boxCont=document.getElementById('BoxCont'+id);
		var nClassName=boxCont.className;
		nClassName=nClassName.replace(' Opened', '');
		nClassName=nClassName.replace(' Closed', '');
		if (box.style.display=='') {
			nClassName=nClassName+' Opened';
			boxCont.className=nClassName;
			}
		else	{
			nClassName=nClassName+' Closed';
			boxCont.className=nClassName;
		}
	}
}
function ToggleBox(id,mode) {
	var box=document.getElementById(id);
	if (mode==0) {
		if (box.style.display=='none') {
			document.getElementById(id).style.display='';
			}
		else {
			document.getElementById(id).style.display='none';
		}
	}
	else {
		if (box.style.display=='none') {
			new Effect.Grow(id);
			}
		else {
			new Effect.Puff(id);
		}
	}
}
function fDisableBleedThroughs(curtain) {
	
	if (curtain==null) {
		var curtain=1
	}

	//document.getElementById('DCMainBG').className='DCMainBG NoScroll';
	document.getElementById('divMailBGContainer').style.display='none';
	document.getElementById('divIFrame').style.display='';
	
	document.getElementById('DCCurtain').style.display='';
	
	if (curtain==1) {
		if(window.pageYOffset) {
			var h = document.getElementById('DCMainBG').scrollHeight;
				}
	 	else {
			var h = document.body.scrollHeight+ document.body.scrollTop+20;	
		}		
		document.getElementById('DCCurtain').style.height=h;
	}
	
	var pars = document.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].className
		if (sCN.indexOf('divSBanner2')==0 || sCN.indexOf('Advertiser')==0) {
			//pars[i].style.display='none';
		}
	}
	var pars = document.getElementsByTagName('embed');
	for (var i=0;i<pars.length;i++) {
			pars[i].style.display='none';
	}
	
	var pars = document.getElementsByTagName('object');
	for (var i=0;i<pars.length;i++) {
			pars[i].style.display='none';
	}
	
	if (document.getElementById('objectMyMusic')!=null) {
		document.getElementById('objectMyMusic').style.display='none';
	}
	
	//window['MailDisplay'].document.body.innerHTML='<img src="/DC_Images/silk_icons/DCWhiteProgressBar.gif" />';
	document.getElementById('divIFrame').innerHTML='';
	
	if (document.getElementById('MailDisplay')!=null) {
		document.getElementById('MailDisplay').style.height='100%';
		document.getElementById('MailDisplay').style.width='100%';
	}
}

function fAdjustCalendar(i,uid) {

	if (i=='888') {
		return;
	}
	
	if (!i) {
		i=1;
	}
	
	if (!uid) {
		uid=1;
	}	
	
	if (document.getElementById('VCal'+uid)!=null) {
		if (document.getElementById('VCal'+uid).parentNode.parentNode.id=='divCalendar888') {
			return;
		}
	}
	
	var pars = document.getElementsByTagName('table');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('tblVCal')==0 && sCN.indexOf('tblVCal888')!=0) {
			if (pars[i].parentNode.offsetWidth>0) {
				pars[i].style.width=pars[i].parentNode.offsetWidth;
			}
		}
	}	

	var pars=null;
	var pars = document.getElementsByTagName('td');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('MM_')==0) {
			try {
				pars[i].style.height=pars[i].offsetWidth-10;
			}catch(E){};
		}
	}
}
function ClearAllRSSForms() {
	var pars=null;
	var pars = document.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if ((sCN.indexOf('RSSF')!=-1) ) {
			pars[i].innerHTML='';
		}
	}	
}
function CheckForLogin(m) {

	if (lPD_LoggedInIdForLife=='') {
		alert ("You must be signed-in with a valid profile to access this function.  Please Sign-in");
		CloseEmailWindow();
		return false;
	}
}
function DLoginHistory(r) {
	var ajaxscript = '/dc_includes/cp_LoginHistory.asp?r='+r+'&cc=' + lPD_ConfCode + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divLOGINHISTORY',1);
}
function DConnections(f) {

	if (document.getElementById('iConnectionsPage')!=null) {
		var ajaxscript = '/dc_includes/cp_ConnectionsMenu.asp?xc=' + ajaxTimeStamp;
		AjaxSimpleCheck(ajaxscript, '', 'divIConnectionsMenu',1);	
		return;
	}
	if (document.getElementById('divKeyInfo')!=null) {
		document.getElementById('divKeyInfo').style.display='';
	}
	if (document.getElementById('divKeyInfoBox').style.display=='none') {
		DCBSetDisplay();
	}
		
	ajaxIncrement=ajaxIncrement+1;
	DCBajaxscript = '/dc_includes/cp_Connections.asp?confcode=' + lPD_ConfCode + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	var x=window.setTimeout("AjaxSimpleCheck(DCBajaxscript, '', 'divKeyUpdateComponentContainer',1)",1000);
}
function dStateBreakdown(s,vid,mydiv) {
	if (mydiv!=null) {
		sDiv='divMyCompanies';
		}
	else	{
		sDiv='divStateBreakDownContent';
	}
	if (document.getElementById(sDiv).style.display=='block') {
		document.getElementById(sDiv).style.display='none';
		}
	else	{
		document.getElementById(sDiv).style.display='';
	}
	var ajaxscript = '/dc_includes/CP5_StateBreakDown.asp?states='+s+'&vid='+vid+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', sDiv,1);	
}
function DUploadMusic() {
	fDisableBleedThroughs();
	DUploadFiles(lPD_LoggedInMIFL,'210','500','',0,0,'audio/mpeg,audio/x-mpeg,video/mp4,audio/mp4a-latm');
}	
function DUploadPictures(mode,p,sp,sid,dest,rt) {
	if (p==null) {
		p='210';
	}
	if (sp==null) {
		sp='500';
	}	
	
	if (dest==null) {
		dest='divIFrame';
	}

	if (rt==null) {
		rt='inpImgURL';
	}
	
	if (mode==2) {
		DUploadFiles(lPD_LoggedInMIFL,p,sp,rt,1,1,'','','',sid,dest);
		return;
	}
	
	if (mode==1) {
		DUploadFiles(lPD_LoggedInMIFL,p,sp,rt,1,1,'image/jpeg,image/gif,image/bmp, image/bmp,image/png,image/pjpeg','','',sid,dest);
	}
	else	{
		DUploadFiles(lPD_LoggedInMIFL,p,sp,'',0,0,'image/jpeg,image/gif,image/bmp, image/bmp,image/png,image/pjpeg','','',sid,dest);
	}
}
function DUploadPicturesSimple(dest) {

	DUploadFiles(lPD_LoggedInMIFL,'210','500','',0,0,'image/jpeg,image/gif,image/bmp, image/bmp,image/png,image/pjpeg','','','',dest);

}
function DUploadMusicSimple(dest) {
	DUploadFiles(lPD_LoggedInMIFL,'210','500','',0,0,'audio/mpeg,audio/x-mpeg,video/mp4,audio/mp4a-latm','','','',dest);
}
function DUploadFilesALL(nid) {
	if (nid==null) {
		var nid=''
	}
	DUploadFiles(lPD_LoggedInMIFL,'210','500','',0,0,'','',nid);
}
function DUploadVideoSimple(dest) {
	DUploadFiles(lPD_LoggedInMIFL,'210','500','',0,0,'video/x-ms-wmv,video/3gpp,video/mp4,video/mpeg','','','',dest);
}
function DUploadVideo() {
	DUploadFiles(lPD_LoggedInMIFL,'210','500','',0,0,'video/x-ms-wmv,video/3gpp');
}
function dVideo(fid,dest,mimetype) {
	document.getElementById(dest).style.display='';
	document.getElementById(dest).style.width=document.getElementById(dest).offsetWidth;
	document.getElementById(dest).style.height=document.getElementById(dest).offsetWidth * .7;

	var ajaxscript = '/dc_includes/cp5_PlayVideo.asp?fid='+fid+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', dest,1);
}
function playVideo(asset) {
   var vlc = document.getElementById("myVLC");
   vlc.playlist.add(asset, null, Array());
	   vlc.playlist.play();
}
function DisplayFullVideo(fid) {
	window.open ('?p=210&sp=700&fid='+fid);
}
function CloseVideoElement(dest) {
	
	ToggleElement(dest);
	document.getElementById(dest).style.width='0px';
	document.getElementById(dest).style.height='0px';
	if (document.getElementById('divPlayVideo')!=null) {
		document.getElementById('divPlayVideo').style.height='0px';	
	}
}	

function DUploadFiles(ifl,ip,isp,rt,UseId,Ret,uclass,nr,nid,sid,dest) {
	if (nr==null) {
		nr=0;
	}
	if (sid==null) {
		sid='';
	}	

	if (rt==null || rt==0) {
		rt='inpImgURL';
	}
	if (isp==null) {
		isp=500;
	}
	if (ip==null) {
		ip=210;
	}
	if (UseId==null) {
		UseId=1;
	}
	if (Ret==null) {
		Ret=0;
	}
	if (nid==null) {
		nid='';
	}							

	if (CheckForLogin()==false) {
		DCBLogin();return;
	}

	if (document.getElementById('divMailBGContainer')!=null && dest==null) {
		fDisableBleedThroughs();

		// calculate display location
		if(window.pageYOffset) {
			posY = window.pageYOffset;
		} else {
			posY = document.body.scrollTop;
		}
		
		document.getElementById('divMailBGContainer').style.top=posY+'px';
		document.getElementById('divMailBGContainer').style.display='';	
		dest='divIFrame'
	}
	
	var sGrpCode='';
	if ($('sCurrGrpCode')!=null) {
		sGrpCode=$('sCurrGrpCode').value;
	}	
	
	var sLetter='';
	if ($('UploadFilesLetter')!=null) {
		sLetter=$('UploadFilesLetter').value;
	}
	
	ajaxIncrement=ajaxIncrement+1
	var ajaxscript = '/DC_Includes/CP5_UploadedFiles.asp?gc='+sGrpCode+'&sid='+sid+'&marketcode='+lPD_MarketCode+'&letter='+sLetter+'&nr='+nr+'&t='+uclass+'&nid='+nid+'&xc=' + ajaxTimeStamp+ajaxIncrement+'&ip='+ip+'&isp='+isp+'&LPDOVRMC=1&UseId='+UseId+'&Ret='+Ret+'&rt='+rt+'&dest='+dest;
	AjaxSimpleCheck(ajaxscript, '', dest,1);	
}



function DNextWebSites(nr,d, lf1,lf2,mr,c) {
		if (mr==null) {
				var mr=10;
		}
		if (c==null) {
				var c=0;
		}		
		var ajaxscript = '/dc_includes/CP5_PWebSites.asp?c='+c+'&mr='+mr+'&sp='+l_sp+'&d='+d+'&lf1='+lf1+'&lf2='+lf2+'&nr='+nr+'&xc=' + ajaxTimeStamp;
		AjaxSimpleCheck(ajaxscript, '', 'divPWebSites',1);
}
function DNextFriendsSimple(nxr,ifl,sf,reqemail) {
		if (reqemail==null) {
				reqemail='';
		}
		ajaxIncrement=ajaxIncrement+1
		var ajaxscript = '/dc_includes/CP5_PFriendsSimple.asp?reqemail=' + reqemail + '&ifl='+ifl+'&sf='+sf+'&nxr='+nxr+'&xc=' + ajaxTimeStamp+ajaxIncrement;
		AjaxSimpleCheck(ajaxscript, '', 'divPFriendsSimple',1);
}
function DNextUploadFiles(ifl,ip,isp,rt,UseId, Ret, uclass,nr,nid,dest,sid) {
	
	if (dest==null) {
		dest='divIFrame'
	}
	
	var ajaxscript = '/DC_Includes/CP5_UploadedFiles.asp?sid='+sid+'&marketcode='+lPD_MarketCode+'&xx=x&nxr='+nr+'&nid='+nid+'&t='+uclass+'&xc=' + ajaxTimeStamp+'&ip='+ip+'&isp='+isp+'&LPDOVRMC=1&UseId='+UseId+'&Ret='+Ret+'&rt='+rt+'&dest='+dest;
	AjaxSimpleCheck(ajaxscript, '', dest,1);	
}			
function DForumManager(fid, id, grpcode,mc) {
	
	if (grpcode=='-1') {
		return false;
	}
	
	if (fid.length==0) {
		alert ('Use must choose a community to proceed');
		return false;
	}
	
	if (mc==null) {
		mc=lPD_MarketCode;
	}
	
	var tgrpcode;

	if (CheckForLogin()==false) {
		DCBLogin();return;
	}
	if (grpcode==null) {
		tgrpcode='';
		}
	else	{	
		tgrpcode=grpcode;
	}
	
	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame();
	}
	
	fDisableBleedThroughs();

	
	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';	

	var h = document.getElementById('DCMainBG').clientHeight;
	$('divMailDisplay').style.height=h*.8;
	$('DCMainBG').style.overflow='hidden';

	$('divIFrame').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	if ($('divIFrameBlankPage').innerHTML.length>0) {
		$('divIFrameBlankPage').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	}

	var ajaxscript = '/dc_includes/CP5_ManageMessageBoards.asp?forumid=' + fid + '&mc='+mc+'&confcode='+lPD_ConfCode+'&GrpCode=' + tgrpcode + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divIFrame',1);	
	
	MMOCModerator();

}
function DisplayFullScreen (c,pn,params,funcs) {

	if (c==1) {
		if (CheckForLogin()==false) {
			DCBLogin();return;	
		}
	}
	if (params==null) {
		var params='';
	}
	if (funcs==null) {
		funcs='';
	}
	
	fDisableBleedThroughs(0);
	
	if(window.pageYOffset) {
		posY = window.innerHeight;
	} else {
		posY = window.document.body.clientHeight;
	}	
	var internalObjectHeight=posY-40;
	params=params.replace('h=100%','h='+internalObjectHeight+'px');

	document.getElementById('DCFullScreen').style.height=posY;
	document.getElementById('DCCurtain').style.display='none';
	DisplayAjaxPage (0,'DCFullScreen',pn,'',params,0,funcs);	
	document.getElementById('DCMainDiv').style.display='none';	
}
function CloseFullScreen() {
	document.getElementById('DCFullScreen').style.display='none';
	document.getElementById('DCFullScreen').innerHTML='';
	document.getElementById('DCMainDiv').style.display='';
	EnableBleeds(); 
	
}
function fResetShadowBox () {
	var wwStandard=.6;
	var hh=.8;
	
	$('divOpaqueSideLeft').style.display='';
	$('divOpaqueSideRight').style.display='';	
	$('divOpaqueTop').style.display='';
	var h = document.getElementById('DCMainBG').clientHeight;
	var w = document.getElementById('DCMainBG').clientWidth;

	$('divMailDisplay').style.height=h*hh;
	$('divMailDisplay').style.width=w*wwStandard;		
	
	//$('divOpaqueSideLeft').style.width=w-(w*wwStandard)/2;	
	//$('divOpaqueSideRight').style.width=w-(w*wwStandard)/2;
	
}
function DisplayShadowBox (c,pn,params,JSParams) {
	
	fResetShadowBox();


	if (c==1) {
		if (CheckForLogin()==false) {
			DCBLogin();return;	
		}
	}
	
	if (params==null) {
		var params='';
	}
	if (JSParams==null) {
		var JSParams='';
	}
	
	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame();
	}

	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}			

	fDisableBleedThroughs(1);
	if (window['MailDisplay'].document.body!=null) {
		window['MailDisplay'].document.body.innerHTML='';
	}

	DisplayAjaxPage (0,'divIFrame',pn,'',params,0,'',JSParams);	
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';

	var h = document.getElementById('DCMainBG').clientHeight;
	$('divMailDisplay').style.height=h*.8;
	$('DCMainBG').style.overflow='hidden';

	$('divIFrame').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	if ($('divIFrameBlankPage').innerHTML.length>0) {
		$('divIFrameBlankPage').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	}
}
function DContactForm (id,mode) {
	
	if (CheckForLogin()==false) {
		DCBLogin();return;
	}
	
	if (mode==null) {
			mode=0;
	}
	
	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame();
	}
	
	fDisableBleedThroughs();
	window['MailDisplay'].document.body.innerHTML='';
	
	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';	
	
	if (mode==1) {
			ContactFormGrp(id,'divIFrame');
		}
	else	{
			ContactForm(id,'divIFrame');	
	}			
}			

function DP5WebPage() {
	if (CheckForLogin()==false) {
		DCBLogin();return;
	}

	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame();
	}
	
	fDisableBleedThroughs();
	window['MailDisplay'].document.body.innerHTML='';
	
	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';	
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/p5_webpage.asp?xc='+ajaxTimeStamp+ajaxIncrement;
	
	AjaxSimpleCheck(ajaxscript, '', 'divIFrame',1);		
}
function DPost(bid, tid) {
	
//	if (document.getElementById('MailDisplay')==null) {
//		BuildIFrame();
//	}
	
//	fDisableBleedThroughs();
//	window['MailDisplay'].document.body.innerHTML='';
	
	// calculate display location
//	if(window.pageYOffset) {
//		posY = window.pageYOffset;
//	} else {
//		posY = document.body.scrollTop;
//	}
	
//	document.getElementById('divMailBGContainer').style.top=posY+'px';
//	document.getElementById('divMailBGContainer').style.display='';
	
	var dest='Blog'+tid	
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_DisplayPost.asp?nohead=1&tid='+tid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest,1);		
}
function fDisplayAffinityPage(apid,threadId,socMode,Press) {
	if (threadId==null) {
		threadId=-1;
	}
	if (socMode==null) {
		socMode='';	
	}
	if (Press==null) {
		Press=0;
	}
	
	if ($('divSpecialOps')!=null ) {
		fSpecialFunction('My Account','btin1300','a_SB_Comm');
		DisplayAjaxPage(0,'divSpecialOps','DCAffinityPage',1,'','&press='+Press+'&socmode='+socMode+'&fpid='+apid+'&threadid='+threadId+'&postid='+threadId+'&forumid='+threadId)
	}
	else	{
		DisplayShadowBox(0,'DCAffinityPage','&press='+Press+'&socmode='+socMode+'&fpid='+apid+'&threadid='+threadId+'&postid='+threadId+'&forumid='+threadId);
	}		
}
function DProfile(ifl,mode,ovrconfcode,mifl) {
var smode=mode;
var sovrconfcode;

	fResetShadowBox();
	
	if (ovrconfcode!=null) {
		sovrconfcode=ovrconfcode;
		}
	else	{
		sovrconfcode=lPD_ConfCode;
	}
	if (CheckForLogin()==false) {
		DCBLogin();return;
	}
	if (mifl==null) {
		var mifl=''
	}

	if (($('divSpecialOps')!=null && lPD_PersistIdForLife==ifl) || $('divPulsePortal')!=null) {
		
		if ($('divPulsePortal')!=null) {
			//$('HidePanel').innerHTML='<div class=Progress><span>Retrieving...</span></div>'
			$('divSpecialOps').innerHTML=oProgressBar;
			$('HidePanel').style.display='none';
			$('divSpecialOps').style.display='';
		}
		
		var sTargetDiv='divSpecialOps';
		ChangeClass('SpecButtonLeftSel','SpecButtonLeftNoSel','div',0);
		fSpecialFunction('My Account','btin1300','a_SB_Comm');
		ChangeClass('sb_Comm','SpecButtonLeftSel','div',1);		
		var ajaxscript = '/dc_includes/CP_IndProfile.asp?mifl='+mifl+'&ifl=' + ifl + '&surveytype='+smode+'&confcode='+sovrconfcode+'&xc=' + ajaxTimeStamp;
		AjaxSimpleCheck(ajaxscript, '', sTargetDiv,1,true,'fCapClick(\''+ifl+'\',1)');	
		$('divSpecialOps').style.visibility='';
		return;
	}
	else	{
		var sTargetDiv='divIFrame';
	}	
		
	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame();
	}
	
	fDisableBleedThroughs();

	
	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';	

	var h = document.getElementById('DCMainBG').clientHeight;
	$('divMailDisplay').style.height=h*.8;
	$('DCMainBG').style.overflow='hidden';

	$('divIFrame').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	if ($('divIFrameBlankPage').innerHTML.length>0) {
		$('divIFrameBlankPage').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	}
	
	var ajaxscript = '/dc_includes/CP_IndProfile.asp?mifl='+mifl+'&ifl=' + ifl + '&surveytype='+smode+'&confcode='+sovrconfcode+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', sTargetDiv,1,true,'fCapClick(\''+ifl+'\',1)');
}
function dSortWiki(wid,dest,o,d) {
		
		ajaxIncrement=ajaxIncrement+1
		var ajaxscript = '/dc_includes/CP5_WikiSpaceAssets.asp?wid='+wid+'&ob='+o+'&d='+d+'&xc=' + ajaxTimeStamp+ajaxIncrement;
		AjaxSimpleCheck(ajaxscript, '',dest,1);		
}
function dSortAllWiki(dest,o,d,wq) {
		if (wq==null) {
			var wq='';
		}
		
		ajaxIncrement=ajaxIncrement+1
		var ajaxscript = '/dc_includes/CP5_Wikilist.asp?wq='+wq+'&ob='+o+'&d='+d+'&xc=' + ajaxTimeStamp+ajaxIncrement;
		AjaxSimpleCheck(ajaxscript, '',dest,1);		
}
function fDeleteWikiArticle() {
	var x=window.confirm("You are about to delete this WIKI Article\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}	
	document.getElementById('WikiUpd').value=2;
	document.getElementById('formWiki').submit();
}
function deleteWikiFile (dest,id,wid,wcid) {
	
		if (CheckForLogin()==false) {
			DCBLogin();return;
		}
		var x=window.confirm("You are about to delete a File\n\n if correct, press OK, else CANCEL");
		if (!x) {	
			return;
		}
	
		new Effect.Puff('wf'+id);		
		
		ajaxIncrement=ajaxIncrement+1
		var ajaxscript = '/dc_includes/CP5_WikiDelFile.asp?wid='+wid+'&wcid='+wcid+'&fid='+id+'&xc=' + ajaxTimeStamp+ajaxIncrement;
		AjaxSimpleCheck(ajaxscript, '','dest',1);		

}
function DeleteWIKIWorkspace(wid,mode,nextOp) {
		if (CheckForLogin()==false) {
			DCBLogin();return;
		}
		
		if (nextOp==null) {
			var nextOp=0;
		}
		if (nextOp==1) {
			var x=window.confirm("You are about to delete a Project\n\n if correct, press OK, else CANCEL");
			if (!x) {	
				return;
			}				
			ajaxIncrement=ajaxIncrement+1
			var ajaxscript = '/dc_includes/CP5_WikiDelete.asp?wid='+wid+'&r='+mode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
			AjaxSimpleCheck(ajaxscript, '','divGnrlAjax',1,true,'redisplayAfterWikiDelete()');					
			}
		else	{
			var x=window.confirm("You are about to delete a WIKI\n\n if correct, press OK, else CANCEL");
			if (!x) {	
				return;
			}				
			if ($('wikiRow'+wid)!=null) {
				new Effect.Puff('wikiRow'+wid);		
			}
			ajaxIncrement=ajaxIncrement+1
			var ajaxscript = '/dc_includes/CP5_WikiDelete.asp?wid='+wid+'&r='+mode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
			AjaxSimpleCheck(ajaxscript, '','dest',1);		
		}
}
function redisplayAfterWikiDelete() {
	top.location='?p=210&confcode='+lPD_ConfCode+'&DCMessage=Project Deleted';
}
function DWikiFormWiz(dest) {

	if (CheckForLogin()==false) {
		DCBLogin();return;
	}
	
	if (dest==null) {
		if (document.getElementById('MailDisplay')==null) {
			BuildIFrame();
		}
		fDisableBleedThroughs();
		if(window.pageYOffset) {
			posY = window.pageYOffset;
		} else {
			posY = document.body.scrollTop;
		}
		document.getElementById('divMailBGContainer').style.top=posY+'px';
		document.getElementById('divMailBGContainer').style.display='';
		var dest='divIFrame';
	}
		
	var ajaxscript = '/dc_includes/CP5_WikiHeader.asp?xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', dest,1);		
}
function ShowCompanyInfo(cn,dest) {
	if (cn.length==0) {
			alert ("You must enter a company name to search");
			return ;
	}	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ContactMatchCompanyName.asp?cn='+cn+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	
}
function ShowDomainInfo(dn,dest) {
	if (dn.length==0) {
			alert ("You must enter a domain to search");
			return ;
	}
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ContactMatchCompanyDomain.asp?dn='+dn+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	
}
function ShowMoreProfiles(nxr,l,dest,order,dir) {
	
	if (order==null) {
			order='Name';
	}
	if (dir==null) {
			dir='';
	}	
	var srch=$('ExistingSearch').value;
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_MarketProfilesList.asp?dest='+dest+'&srch='+srch+'&cc='+lPD_ConfCode+'&mc='+lPD_MarketCode+'&dir='+dir+'&order='+order+'&nxr='+nxr+'&l='+l+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	

}	
function ShowContacts(m,dnsn,dest,nxr,gc,l,s,sem,wem) {
	if (sem==null) {
		var sem='';
	}
	if (wem==null) {
		var wem='';
	}	
	if (wem='Search..') {
			var wem='';
	}
	if (dest==null) {
		var dest='ContactOptionsContainer';
	}
	if (document.getElementById('ContactOptionsContainer')!=null) {
		//document.getElementById('ContactOptionsContainer').innerHTML='<img src=/DC_Images/silk_icons/AjaxProcesBar.gif />';
	}
	ajaxIncrement=ajaxIncrement+1
	var ajaxscript = '/dc_includes/CP5_ContactMatchContactList.asp?wem='+wem+'&sem='+sem+'&d='+dest+'&l='+l+'&gc='+gc+'&m='+m+'&nxr='+nxr+'&dnsn='+dnsn+'&s='+s+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	
}
function ShowContactStatsBoard(dest) {

	if (dest==null) {
		var dest='ContactOptionsContainer';
	}
	if (document.getElementById('ContactOptionsContainer')!=null) {
		document.getElementById('ContactOptionsContainer').innerHTML='<img src=/DC_Images/silk_icons/AjaxProcesBar.gif />';
	}
	ajaxIncrement=ajaxIncrement+1
	var ajaxscript = '/dc_includes/CP5_ContactStats.asp?xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	
}
function ShowDomains(m,dnsn,dest,nxr,gc,l,s) {
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ContactMatchContactListDomains.asp?d='+dest+'&l='+l+'&gc='+gc+'&m='+m+'&nxr='+nxr+'&dnsn='+dnsn+'&s='+s+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	
}
function DownloadEventSA (ec,dest,m,st) {
	ajaxIncrement=ajaxIncrement+1;
	document.getElementById(dest).innerHTML='<img src=/DC_Images/silk_icons/AjaxProcesBar.gif />';
	var ajaxscript = '/dc_includes/CP5_SurveyAnswer_TSV.asp?&st='+st+'&m='+m+'&ec='+ec+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	
}
function DownloadEventCQ (sid,gid,queryid,dest,pid,st) {
	ajaxIncrement=ajaxIncrement+1;
	document.getElementById(dest).innerHTML='<img src=/DC_Images/silk_icons/AjaxProcesBar.gif />';
	document.getElementById(dest).style.display='';
	var ajaxscript = '/dc_includes/CP5_PowerQuery_Excel.asp?st='+st+'&pid='+pid+'&sid='+sid+'&gid='+gid+'&queryid='+queryid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	
}		
	
function DownloadEventAttendees (ec,dest) {
	ajaxIncrement=ajaxIncrement+1;
	document.getElementById(dest).innerHTML='<img src=/DC_Images/silk_icons/AjaxProcesBar.gif />';
	var ajaxscript = '/dc_includes/CP5_ConferenceRepor_CSV.asp?ec='+ec+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	
}
function DownloadContacts(dnsn,dest,gc,m) {
	ajaxIncrement=ajaxIncrement+1;
	document.getElementById(dest).innerHTML='<img src=/DC_Images/silk_icons/AjaxProcesBar.gif />';
	var ajaxscript = '/dc_includes/CP5_ContactMatchContactList_CSV.asp?m='+m+'&d='+dest+'&gc='+gc+'&dnsn='+dnsn+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	
}
function ShowTerrActivities(e,o,d,m,nxr) {
	document.getElementById('divTerritoryActivitiesContainer').innerHTML='<img src=/DC_Images/silk_icons/AjaxProcesLarge.gif />';
	ajaxIncrement=ajaxIncrement+1
	var ajaxscript = '/dc_includes/cp5_TerritoryActivities.asp?e='+e+'&o='+o+'&d='+d+'&m='+m+'&nxr='+nxr+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divTerritoryActivitiesContainer' ,1);	
}
function dActiveGroups(dest) {
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ActiveGroups.asp?xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	
}

function dSimpleAjax(dest,aURL, xfunc) {
	ajaxIncrement=ajaxIncrement+1;
	AjaxSimpleCheck(aURL, '', dest ,1);		
}

function ShowContactStats(email,dest) {
	if (email.length==0) {
			alert ("You must enter an email to search");
			return ;
	}	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ContactMatch.asp?em='+email+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest,1);	
	
}	
function ShowContactsAnalysis(r,order,dir) {
	if (order==null) {
		var order='';
	}
	if (dir==null) {
		var dir='';
	}	
	
	if (lPDGC_GC!='') {
		var gc=lPDGC_GC
	}
	else	{
		var gc=lPD_HGrpCode
	}
	
	if (l_sp=='1') {
		//gc=lPD_GrpCode;
	}
	
	document.getElementById('ContactOptionsContainer').innerHTML='<img src=/DC_Images/silk_icons/AjaxProcesBar.gif />';
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ContactMatchBatch.asp?order='+order+'&dir='+dir+'&sp='+l_sp+'&r='+r+'&v='+gc+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'ContactOptionsContainer',1);	
}
function fShowGroupContactsSource(r,order,dir,gid) {
	
	var dest='divWeb';
	
	if (order==null) {
		var order='Source';
	}
	if (dir==null) {
		var dir='';
	}
	if (lPDGC_GC!='') {
		var gc=lPDGC_GC
	}
	else	{
		var gc=lPD_HGrpCode
	}
	
	if (lPD_HGrpCode!=null) {
		if (lPD_HGrpCode.length>0) {
			gc=lPD_HGrpCode
		}
	}
	
	if (l_sp=='1') {
		//gc=lPD_GrpCode;
	}	
	
	document.getElementById(dest).innerHTML='<b>Processing...</b><img src=/DC_Images/silk_icons/AjaxProcesBar.gif />';
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_GroupContactMatchSource.asp?gid='+gid+'&order='+order+'&dir='+dir+'&r='+r+'&v='+gc+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest,1);	
}
function ShowContactsSource(r,order,dir) {
	
	var dest='ContactOptionsContainer';
	
	if (order==null) {
		var order='Source';
	}
	if (dir==null) {
		var dir='';
	}
	if (lPDGC_GC!='') {
		var gc=lPDGC_GC
	}
	else	{
		var gc=lPD_HGrpCode
	}
	
	if (lPD_HGrpCode!=null) {
		if (lPD_HGrpCode.length>0) {
			gc=lPD_HGrpCode
		}
	}
	
	if (l_sp=='1') {
		//gc=lPD_GrpCode;
	}	
	
	document.getElementById(dest).innerHTML='<b>Processing...</b><img src=/DC_Images/silk_icons/AjaxProcesBar.gif />';
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ContactMatchSource.asp?&order='+order+'&dir='+dir+'&r='+r+'&v='+gc+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest,1);	
}
function DelHTMLTemplate(tid) {
	
	var x=window.confirm("You are about to delete Mail Template: " + tid + "\n\n if correct, press OK, else CANCEL")
	if (!x) {
		return;
	}
	new Effect.Puff('divTid'+tid);
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_Email_DeleteTemplate.asp?tid='+tid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1);			
}
function DelMarketProfile(ifl,mc,rid) {
	var x=window.confirm('You are about to delete this userid/email: '+$('spanEmail_'+ifl).innerHTML+'\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	new Effect.Puff(rid);
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_MarketProfilesDelete.asp?ifl='+ifl+'&mc='+mc+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1);			
}
function DeleteContacts(mode,gc,dnsn,s) {
	if (mode=='sd') {
		var x=window.confirm('You are about to delete domain(s)\n\n if correct, press OK, else CANCEL');
	}
	else {
		var x=window.confirm('You are about to delete contact(s)\n\n if correct, press OK, else CANCEL');
	}
	if (!x) {
		return;
	}
	var pars = document.getElementsByTagName('input');
	var emails='';
	var sComma='';
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('ContactCB_')==0) {
			if (pars[i].checked) {
				var nid=sCN.replace('ContactCB', 'divCB');
				pars[i].checked=false;
				new Effect.Puff(nid);
				nEmail=nid.replace('divCB_','')
				emails=emails+sComma+nEmail;
				sComma=','
			}
		}
	}
	ajaxDeleteContact(emails,mode,gc,dnsn,s)
}
function ajaxDeleteContact(email,mode,gc,dnsn,s) {
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ContactDeleteContact.asp?m='+mode+'&em='+email+'&gc='+gc+'&dnsn='+dnsn+'&s='+s+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1);		
}
function DCompany(cid) {

	if (CheckForLogin()==false) {
		DCBLogin();return;
	}
	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame();
	}
	
	fDisableBleedThroughs();
	window['MailDisplay'].document.body.innerHTML='';
	
	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';	
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP_CompanyEmployeeList.asp?cid='+cid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divIFrame',1);		
}

function DUploads(Types) {
var sTypes=Types

	if (CheckForLogin()==false) {
		DCBLogin();return;
	}
	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame();
	}
	fDisableBleedThroughs();
	window['MailDisplay'].document.body.innerHTML='';
	
	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';	
	
	var ajaxscript = '/dc_includes/CP5_UploadedFiles.asp?t='+sTypes+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divIFrame',1);		
}
function BuildIFrame(op) {
	//alert (document.getElementById('adivCloseWin').href)
	if (op!=null) {
		document.getElementById('adivCloseWin').href="javascript:document.getElementById('divIFrameBlankPage').innerHTML=null;CloseEmailWindow();"+op
		}
	else	{
		document.getElementById('adivCloseWin').href='javascript:CloseEmailWindow();'
	}
	
	if (document.getElementById('MailDisplay')!=null) {
		//return false;
	}
	var iframeContent='<iframe name="MailDisplay" style="width:100%;height:100%;" id="MailDisplay" frameborder="no" src="/DCBlank.asp">';
	iframeContent=iframeContent+'Your browser does not support inline frames or is currently configured not to display inline frames.';
	iframeContent=iframeContent+'</iframe>';
	if (document.getElementById('divIFrameBlankPage')!=null) {
		document.getElementById('divIFrameBlankPage').innerHTML=iframeContent;
	}
	document.getElementById('MailDisplay').style.height='100%';
	document.getElementById('MailDisplay').style.width='100%';
}
function BuildInstantMsgIFrame(imids,sid,force) {
	if ((sid==null || sid==0) && force!=1) {
		return;
	}
	fDisableBleedThroughs(0);
	var iframeContent='<iframe name="iiM" id="iiM" frameborder="no" src="/DCIM.asp?imids='+imids+'&lDCIMS='+sid+'">';
	iframeContent=iframeContent+'Your browser does not support inline frames or is currently configured not to display inline frames.';
	iframeContent=iframeContent+'</iframe>';
	document.getElementById('IMInner').innerHTML=iframeContent;
	$('IMContent').style.display='';
	//new Effect.BlindDown('IMContent');
}
function DSimpSched(Seq) {

//	if (CheckForLogin()==false) {
//		DCBLogin();return;
//	}		
	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame()
	}
	if (document.getElementById('MailDisplay')!=null) {
		document.getElementById('MailDisplay').style.display='';
	}
	
	fDisableBleedThroughs();
	//window['MailDisplay'].document.body.innerHTML='';
	
	var ajaxscript = '/dc_includes/CP_DSimpSchedule.asp?s=' + Seq + '&confcode='+lPD_ConfCode+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divIFrame',1);	
	
	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	//new Effect.BlindDown('divMailBGContainer')
	document.getElementById('divMailBGContainer').style.display='';
	
	var h = document.getElementById('DCMainBG').clientHeight;
	$('divMailDisplay').style.height=h*.8;
	$('DCMainBG').style.overflow='hidden';
	$('divIFrame').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	
	//document.getElementById('divIFrame').innerHTML=document.getElementById('divGnrlAjax').innerHTML;
}	
function fProcessMoreLessSetupFullPage(divId,elemType) {

	if (divId==null) {
		divId='RC2Container';
	}	
	if (elemType==null) {
		elemType='p';
	}
	if ($(divId)==null) {
		return;
	}
	var pars = $(divId).getElementsByTagName(elemType);
	for (var i=0;i<pars.length;i++) {		
		if(pars[i].className.indexOf('DCMoreOrLessPX')==0) {
			pars[i].style.display='none';
		}
	}		
}
function fProcessMoreLessSetup(divId, parentId,elemType) {
	if (divId==null) {
		divId='divIFrame'
	}
	if (elemType==null) {
		elemType='p';
	}	
	
	var bMLFound=0;
	var iCSeq='';
	
	var pars = document.getElementsByTagName(elemType);
	var sTestClass;
	var oSvObj;
	for (var i=0;i<pars.length;i++) {	
		sTestClass=pars[i].className.toUpperCase()
		if(sTestClass.indexOf('DCMOREORLESSPX')==0) {
			pars[i].style.display='none';
			bMLFound=1;
			oSvObj=pars[i];
		}
	}	
	if (bMLFound==1) {
		if ($('divMoreOrLessControl')==null) {
			if (oSvObj!=null) {
				elm=oSvObj;
				var nParentObj;
				while(elm.id.indexOf('divCC_')!=0 && elm.parentNode!=null) {
					elm = elm.parentNode;
					if (elm.id.indexOf('divCC_')==0) {
						nParentObj=elm;
					}
				}				
			}
			if (nParentObj!=null) {
				parentId=nParentObj.id;
				var iA=parentId.split('_');
				iCSeq=iA[1];
			}
			if ($('divMoreOrLessControl'+iCSeq)==null) {
				var newMLCtrl = document.createElement('div');
				newMLCtrl.setAttribute('id','divMoreOrLessControl'+iCSeq);
  			newMLCtrl.className='WizRow Options';
  			newMLCtrl.innerHTML='<a id="aTML'+iCSeq+'" href="javascript:void(0);" onclick="fProcessMoreLessOpen(\''+parentId+'\',this.id,\'inpPMLMode'+iCSeq+'\');">More</a><input type="hidden" id="inpPMLMode'+iCSeq+'" value="0"/>'
  			$(parentId).appendChild(newMLCtrl);
  		}
		}
		else	{
			$(parentId).appendChild($('divMoreOrLessControl'));
		}
		$('divMoreOrLessControl'+iCSeq).style.display='';
	}
}
function fProcessMoreLessSetupInd(divId,elemType,DeckId) {
	if (divId==null) {
		divId='divIFrame'
	}
	if (elemType==null) {
		elemType='p';
	}	
	
	if (DeckId==null) {
		var sA=divId.split('_');
		DeckId=sA[1];
	}
	
	var pars = $(divId).getElementsByTagName(elemType);
	var sTestClass;
	for (var i=0;i<pars.length;i++) {	
		sTestClass=pars[i].className.toUpperCase()
		if(sTestClass.indexOf('DCMOREORLESSPX')==0) {
			pars[i].style.display='none';
		}
	}	

	if ($('divMoreOrLessControl'+DeckId)==null) {
		var newMLCtrl = document.createElement('div');
		newMLCtrl.setAttribute('id','divMoreOrLessControl'+DeckId);
		newMLCtrl.className='WizRow Options';
		newMLCtrl.innerHTML='<a id="aTML'+DeckId+'" href="javascript:void(0);" onclick="fProcessMoreLessOpen(\''+divId+'\',this.id,\'inpPMLMode'+DeckId+'\');">More</a><input type="hidden" id="inpPMLMode'+DeckId+'" value="0"/>'
		$(divId).appendChild(newMLCtrl);
	}
}
function fProcessMoreLessOpen(divId, aId, inpMode,elemType) {
	if (divId==null) {
		divId='divIFrame'
	}
	if (aId==null) {
		aId="aTML"
	}
	if (inpMode==null) {
		inpMode='inpPMLMode'
	}
	
	if (elemType==null) {
		elemType='p';
	}
	
	var pars = $(divId).getElementsByTagName('p');
	var sTestClass
	for (var i=0;i<pars.length;i++) {
		sTestClass=pars[i].className.toUpperCase()
		if(sTestClass.indexOf('DCMOREORLESSPX')==0) {		
			if ($(inpMode).value==0) {
				pars[i].style.display='';
			}
			else	{
				pars[i].style.display='none';
			}
		}
	}	
	var pars = $(divId).getElementsByTagName('div');
	var sTestClass
	for (var i=0;i<pars.length;i++) {
		sTestClass=pars[i].className.toUpperCase()
		if(sTestClass.indexOf('DCMOREORLESSPX')==0) {		
			if ($(inpMode).value==0) {
				pars[i].style.display='';
			}
			else	{
				pars[i].style.display='none';
			}
		}
	}
	var pars = $(divId).getElementsByTagName('span');
	var sTestClass
	for (var i=0;i<pars.length;i++) {
		sTestClass=pars[i].className.toUpperCase()
		if(sTestClass.indexOf('DCMOREORLESSPX')==0) {		
			if ($(inpMode).value==0) {
				pars[i].style.display='';
			}
			else	{
				pars[i].style.display='none';
			}
		}
	}			
	if ($(inpMode).value=='0') {
		$(inpMode).value='1';
		$(aId).firstChild.nodeValue='Less';
	}
	else	{
		$(inpMode).value='0';
		$(aId).firstChild.nodeValue='More';
	}
}
function DNotes(e,o,s,t) {

	if (CheckForLogin()==false) {
		DCBLogin();return;
	}		
	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame();
	}	
	if (document.getElementById('MailDisplay')!=null) {
		document.getElementById('MailDisplay').style.display='';
	}
	
	fDisableBleedThroughs();
	window['MailDisplay'].document.body.innerHTML='';
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_Note.asp?seq='+s+'&ownerkey='+o+'&type='+t+'&e='+e+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divIFrame',1);	

	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';
	
	var h = document.getElementById('DCMainBG').clientHeight;
	$('divMailDisplay').style.height=h*.8;
	$('DCMainBG').style.overflow='hidden';
	$('divIFrame').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	}
function DMail(MailSeq,MktOption,opts,id,ifl) {
	
	alert('This function is temporarily disabled. Please check back.');
	return;
	
	fResetShadowBox();

	if (CheckForLogin()==false) {
		DCBLogin();return false;
	}	
	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame();
	}
		
	if (document.getElementById('MailDisplay')!=null) {
		document.getElementById('MailDisplay').style.display='';
	}	

	if (MailSeq=='0') {
		MailSeq='';
	}
	
	if (MktOption==null) {
		MktOption=0;
	}
	
	fDisableBleedThroughs()

	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';
	document.getElementById('divIFrame').style.display='none';
	
	var h = document.getElementById('DCMainBG').clientHeight;
	$('divMailDisplay').style.height=h*.8;
	$('divMailDisplay').style.height=h*.8;
	$('DCMainBG').style.overflow='hidden';
	
	$('divIFrame').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	if ($('divIFrameBlankPage').innerHTML.length>0) {
		$('divIFrameBlankPage').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	}			

	top.MailDisplay.location='../dc_publicpages/DC5_MailForm.asp?i='+id+'&MarketCode='+lPD_MarketCode+'&ConfCode='+lPD_ConfCode+'&RcpToken='+ifl+'&tonly=' + opts + '&DestTop=1&att='+MktOption+'&M=CC&ID='+MailSeq;
}
function DUploadFileForm(cc,gc,ifl,mode,wid,wcid,lPostFunc) {
	
	if (mode==null) {
		var mode='';
	}
	if (wid==null) {
		wid=0;
	}
	if (wcid==null) {
		wcid=0;
	}
	if (CheckForLogin()==false) {
		DCBLogin();return false;
	}
	
	//var lFinalSay="dWikiArchives('divWikiFileContainer','"+wid+"','"+wcid+"');"
	
	if (lPostFunc!=null) {
		var lFinalSay=lPostFunc;
	}
	else	{
		//var lFinalSay="self.location='?p=210&confcode="+lPD_ConfCode+"&sp=62&wid="+wid+"&wcid="+wcid+"&DCMessage=You changed a File(s) in the WIKI, please complete the process by summarizing your change';"
	}
	BuildIFrame(lFinalSay);
		
	if (document.getElementById('MailDisplay')!=null) {
		document.getElementById('MailDisplay').style.display='';
	}	

	fDisableBleedThroughs()

	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';
	document.getElementById('divIFrame').style.display='none';

	top.MailDisplay.location='../DC_Administrator_Pages/Upload/dc_filePublish.asp?confcode='+cc+'&grpcode='+gc+'&ifl='+ifl+'&mode='+mode+'&wid='+wid+'&wcid='+wcid;
}
function DSimpleFileUploadForm(cc,gc,ifl,mode) {
	
	if (mode==null) {
		var mode='';
	}

	if (CheckForLogin()==false) {
		DCBLogin();return false;
	}
	
	//var lFinalSay="dWikiArchives('divWikiFileContainer','"+wid+"','"+wcid+"');"
	//var lFinalSay="self.location='?p=210&confcode="+lPD_ConfCode+"&sp="+l_sp+"&DCMessage=You changed a File(s) in the WIKI, please complete the process by summarizing your change';"
	BuildIFrame();
		
	if (document.getElementById('MailDisplay')!=null) {
		document.getElementById('MailDisplay').style.display='';
	}	

	fDisableBleedThroughs()

	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';
	document.getElementById('divIFrame').style.display='none';

	top.MailDisplay.location='../DC_Administrator_Pages/Upload/dc_filePublish.asp?confcode='+cc+'&grpcode='+gc+'&ifl='+ifl+'&mode='+mode;
}
function DPreferences(ifl) {

	if ($('divSpecialOps')!=null && lPD_MIFL==6882) {
		var sTargetDiv='divSpecialOps';
		fSpecialFunction('My Account','btin1300','a_SB_Comm');
		var ajaxscript = '/dc_includes/CP_IndProfile.asp?Tab=Pref&mifl='+mifl+'&ifl=' + ifl + '&surveytype='+smode+'&confcode='+sovrconfcode+'&xc=' + ajaxTimeStamp;
		AjaxSimpleCheck(ajaxscript, '', sTargetDiv,1,true,'fCapClick(\''+ifl+'\',1)');		
		return;
	}
	else	{
		DisplayShadowBox(0,'DCPERSONALPREFMAINT','&mode=0');
		var sTargetDiv='divIFrame';
	}	
		
	return;
	
	// Below is now obsolete for preferences... the above code is now standard.

	fDisableBleedThroughs();
	
	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame();
	}
		
	if (document.getElementById('MailDisplay')!=null) {
		document.getElementById('MailDisplay').style.display='';
	}	
	
	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';
	document.getElementById('divIFrame').style.display='none';
	
	var h = document.getElementById('DCMainBG').clientHeight;
	$('divMailDisplay').style.height=h*.8;
	$('divMailDisplay').style.height=h*.8;
	$('DCMainBG').style.overflow='hidden';
	
	$('divIFrame').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	if ($('divIFrameBlankPage').innerHTML.length>0) {
		$('divIFrameBlankPage').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	}			
	
	top.MailDisplay.location='/dc_includes/forums/DC_ForumProfile.asp?id='+ifl;
}
function DAdminPage(Page,hh,ww) {
	
	var wwStandard=.6;

	fResetShadowBox()	

	if (hh==null) {
		hh=.8;
	}

	fDisableBleedThroughs();

	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame()
	}	
	if (document.getElementById('MailDisplay')!=null) {
		//document.getElementById('MailDisplay').style.display='none';
	}	
	
	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset;
	} else {
		posY = document.body.scrollTop;
	}
	
	document.getElementById('divMailBGContainer').style.top=posY+'px';
	document.getElementById('divMailBGContainer').style.display='';
	document.getElementById('divIFrame').style.display='none';
	
	var h = document.getElementById('divMailBGContainer').clientHeight;
	var w = document.getElementById('divMailBGContainer').clientWidth;

	$('divMailDisplay').style.height=h*hh;
	$('divMailDisplay').style.width=w*wwStandard;
	
	if (ww!=null) {
		$('divMailDisplay').style.width=w*ww;
		$('divOpaqueSideLeft').style.display='none';
		$('divOpaqueSideRight').style.display='none';
		$('divOpaqueTop').style.display='none';
	}
	
	$('DCMainBG').style.overflow='hidden';
	
	$('divIFrame').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	if ($('divIFrameBlankPage').innerHTML.length>0) {
		$('divIFrameBlankPage').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	}				
	top.MailDisplay.location=Page;
}
function DThreads(f,t,p,vt) {

	if (vt==1) {
		self.location='#dcf'+t;
		}
	else	{
	
		if (document.getElementById('MailDisplay')==null) {
			BuildIFrame();
		}	
		if (document.getElementById('MailDisplay')!=null) {
			document.getElementById('MailDisplay').style.display='';
		}	

		fDisableBleedThroughs();
		// calculate display location
		if(window.pageYOffset) {
			posY = window.pageYOffset;
		} else {
			posY = document.body.scrollTop;
		}
	
		document.getElementById('divMailBGContainer').style.top=posY+'px';
		//new Effect.BlindDown('divMailBGContainer')
		document.getElementById('divMailBGContainer').style.display='';
		document.getElementById('divIFrame').style.display='none';
		
	var h = document.getElementById('DCMainBG').clientHeight;
	$('divMailDisplay').style.height=h*.8;
	$('divMailDisplay').style.height=h*.8;
	$('DCMainBG').style.overflow='hidden';
	
	$('divIFrame').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	if ($('divIFrameBlankPage').innerHTML.length>0) {
		$('divIFrameBlankPage').style.height=$('divMailDisplay').clientHeight-$('divCloseWin').offsetHeight-($('divMailDisplay').offsetHeight-$('divMailDisplay').clientHeight);
	}					
		if (p==0) {
			top.MailDisplay.location='?p=210&sp=7&ff=82&forum='+f+'&dcso=1';
			}
		else	{
			//top.MailDisplay.location='?p=210&sp=7&ff=84&forum='+f+'&thread='+t+'&dcso=1#dcf'+p;
			top.MailDisplay.location='?p=210&sp=7&ff=84&forum='+f+'&thread='+t+'&dcso=1';
		}		
		//x=window.setTimeout("self.location='#DCTop'", 1000);
	}
}
function dWikiArchives(dest, wid, wcid) {
// Need to add code here... duh!
}
function DeleteAdmin(ifl, em,e,type,g,vid) {
	var rId='Row'+ifl;
	new Effect.Puff(rId);
	AjaxSimpleCheck('../dc_ajax/DCDeleteSecAdmin.asp?em='+em+'&g='+g+'&vid='+vid+'&e='+e+'&type='+type, 'Deleted', 'divAdminMessage',1);	
}
function DeleteMail(MailSeq, id, Box) {
	var x=window.confirm('You are about to delete an email\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}	
	new Effect.Puff(id);
	AjaxSimpleCheck('../dc_ajax/DCDeleteCyberMail.asp?seq=' + MailSeq +'&box='+Box, 'Deleted', 'divEmailMessage',1);	
}
function MassDeleteMail() {
	
	var pars = document.getElementsByTagName('input');
	var lStrSeq='';
	var lComma='';
	var Box='0'
	
	for (var i=0;i<pars.length;i++) {		
		if(pars[i].id.indexOf('dm_')==0 && isNum(pars[i].value) && pars[i].value>0) {
			var puffId='CIB'+pars[i].id.replace('dm_','');
			try {new Effect.Puff(puffId)}
				catch(E) {};
			lStrSeq=lStrSeq+lComma+pars[i].value
			lComma=','
		}
	}
	AjaxSimpleCheck('../dc_ajax/DCDeleteCyberMail.asp?seq=' + lStrSeq +'&box='+Box, 'Deleted', 'divEmailMessage',1);		
	window.setTimeout('DispMailBoxes("","INBOX",0," d.createdate"," desc")',500);
}
function DelConnection(cxid, id) {
	var x=window.confirm('You are about to delete a connection\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	if ($(id)!=null) {
		new Effect.Puff(id);
		CloseEmailWindow();
	}
	AjaxSimpleCheck('/dc_includes/CP_DelConnections.asp?cx=' + cxid, 'Deleted', 'divCXMessage',1);	
}
function AddConnection(cxid) {
	var x=window.confirm("You are about to connect with the selected person\n\n if correct, press OK to continue, else CANCEL");
	if (!x) {
		return;
	}	
	AjaxSimpleCheck('/dc_includes/CP_AddConnections.asp?cx=' + cxid, 'Added', 'divCXMessage',1);	
	alert ("Connection Request was sent, you will be notified when approved");
}

function NewMailMouseOver() {
	window.clearTimeout(SNMSearchTimer);
}
	
function NewMailMouseOut(evt) {
	var elm;
	try {
		elm = window.event.srcElement;
	} catch(E) {
		elm = evt.currentTarget;
	}
	if(elm.id != 'divSearchNewMail') {
		while(elm.id != 'divSearchNewMail') {
			elm = elm.parentNode;
			if(elm.nodeType == 9) {
				SNMSearchTimer = window.setTimeout("new Effect.Fade('divSearchNewMail')", 5000);
				break;
			}
		}
	} else {
		SNMSearchTimer = window.setTimeout("new Effect.Fade('divSearchNewMail')", 5000);
	}
}
function displayNewMailMessage(NewMailText) {
	var elm;
	var bData;
	var posY;
	
	bData = NewMailText.indexOf('{DATAFOUND}');
	elm = document.getElementById('divSearchNewMail');
	
	if (document.getElementById('MailDisplay')==null) {
		BuildIFrame();
	}	
	
	if (document.getElementById('MailDisplay')!=null) {
		//document.getElementById('MailDisplay').style.display='none';
	}	
	
	// calculate display location
	if(window.pageYOffset) {
		posY = window.pageYOffset + window.innerHeight;
	} else {
		posY = document.body.scrollTop + window.document.body.clientHeight;
	}
	
	elm.style.top = posY - 100;	//height of divSearchNewMail
	

	if(bData > 0) {
		NewMailText = NewMailText.replace('STATUS:0,', '');
		NewMailText = NewMailText.replace('{DATAFOUND}', '');
		
		elm.innerHTML = NewMailText;
		
		new Effect.Appear('divSearchNewMail');
		SNMSearchTimer = window.setTimeout("new Effect.Fade('divSearchNewMail')", 5000);
		
		// Update Inbox if div is available
		if (document.getElementById('divDMailInBox')!=null) {
			ajaxIncrement=ajaxIncrement+1
			var ajaxscript = '/dc_includes/cp_EmailInBox.asp?bt=INBOX&MarketCode=' + lPD_MarketCode + '&xc=' + ajaxTimeStamp+ajaxIncrement;
			AjaxSimpleCheck(ajaxscript, '', 'divDMailInBox',1);
		}			
		
	} else {
		elm.innerHTML = "";
		elm.style.display = "none";
	}
}
function displayNewIM(ims) {
	var imsarray=ims.split(',');
	if (lPD_IMParticipant=='1') {
		for (i=0;i<imsarray.length;i++) {
			if (imsarray[i].length>0 && imsarray[i]!='0') {
				OpenIM(0, imsarray[i]);
			}
		}
	}
}
function NewMailTimer(bMode) {
	
	if (bMode==null) {
		bMode=0;
	}
	// Check for New Mail
	var oXmlHttp;
	ajaxIncrement=ajaxIncrement+1;
	var url = '../DC_Ajax/DC5_SearchNewMail.asp?MarketCode='+lPD_MarketCode+'&GrpCode='+lPD_GrpCode+'&ConfCode='+lPD_ConfCode+'&AttEmail='+lPD_PersistAttEmail+'&xc='+ajaxTimeStamp+ajaxIncrement;
	
	if (1==0) {
		try {
			oXmlHttp = zXmlHttp.createRequest();
			ActiveXIsAvailable = 1;
			} 
		catch(err) {
			ActiveXIsAvailable = 0;
		}
	
		if(ActiveXIsAvailable == 1 && oXmlHttp!=null) {
			oXmlHttp.open("get",url,true);
			if (oXmlHttp!=null) {
				oXmlHttp.onreadystatechange = function() {
				if(oXmlHttp.readyState == 4) {
					if(oXmlHttp.status == 200) {
						// Only display new mail if we need to
						try {
							displayNewMailMessage(oXmlHttp.responseText);
						}
						catch(err) {
						}
					}
				}
			}
		}
			
			oXmlHttp.send(null);
		}
	
		if (ajaxTimeStamp==null) {
			var url = '/dc_includes/DC5_SearchIM.asp?xc=123';
			}
		else {
			var url = '/dc_includes/DC5_SearchIM.asp?xc='+ajaxTimeStamp+ajaxIncrement;	
		}
		try {
			oXmlHttp2 = zXmlHttp.createRequest();
			ActiveXIsAvailable = 1;
		} catch(err) {
			ActiveXIsAvailable = 0;
		}
	
		if(ActiveXIsAvailable == 1 && oXmlHttp2!=null) {
			oXmlHttp2.open("get",url,true);
			if (oXmlHttp2!=null) {
				oXmlHttp2.onreadystatechange = function() {
				if(oXmlHttp2.readyState == 4) {
					if(oXmlHttp2.status == 200) {
						// Only display new mail if we need to
						try {
							displayNewIM(oXmlHttp2.responseText);
						}
						catch(err) {
						}
					}
				}
			}
		}
			
			oXmlHttp2.send(null);
		}	
	}
	// Display Active Users if div is available
	ajaxIncrement=ajaxIncrement+1;
	
	if (document.getElementById('divActiveUsersContainer')!=null) {
		//var ajaxscript = '/dc_includes/cp_ActiveUsers.asp?ConfCode='+lPD_ConfCode+'&MarketCode=' + lPD_MarketCode + '&xc=' + ajaxTimeStamp+ajaxIncrement;
		//AjaxSimpleCheck(ajaxscript, '', 'divActiveUsersContainer',1);
	}
	if (document.getElementById('divKeyUpdateContainer')!=null && lPD_Domain != 'LOCALHOST') {
		var ajaxscript = '/dc_includes/cp_CheckKeyUpdates.asp?ConfCode='+lPD_OrigConfCode+'&MarketCode=' + lPD_OrigMarketCode + '&xc=' + ajaxTimeStamp+ajaxIncrement;
		AjaxSimpleCheck(ajaxscript, '', 'divKeyUpdateContainer',1,'true','fCheckForImDisplay()');
	}	
	if (document.getElementById('divActiveUsers')!=null) {
		//var ajaxscript = '/dc_includes/cp_ActiveUsers.asp?MarketCode=' + lPD_MarketCode + '&xc=' + ajaxTimeStamp+ajaxIncrement;
		//AjaxSimpleCheck(ajaxscript, '', 'divKeyUpdateComponentContainer',1);
	}
	if (document.getElementById('divActiveUsers6Container')!=null && bMode!=1) {
		fRefreshOnline();
	}	
	if (document.getElementById('divTagSearchResultsAlertsContainer')!=null && bMode!=1 && document.getElementById('divNFContainer')==null) {
		fRefreshAlerts();
	}		
	if (document.getElementById('divDCBInboxFunctions')!=null) {
		var ajaxscript = '/dc_includes/cp_EmailInBox.asp?i=-1&bt=INBOX&dcb=1&xc=' + ajaxTimeStamp+ajaxIncrement;
		AjaxSimpleCheck(ajaxscript, '', 'divKeyUpdateComponentContainer',1);
	}	
	
	if (document.getElementById('divNFContainer')!=null) {
		DisplayAjaxPage(-1,'divNFContainer','DCNEWSFEEDPULSE','','&refresh=1&C='+lPD_OrigConfCode+'&xc='+ajaxTimeStamp+ajaxIncrement,'','1','fCountNews()');
	}	
		
	if (document.getElementById('iConnectionsPage')!=null) {
		//var ajaxscript = '/dc_includes/cp_ConnectionsMenu.asp?xc=' + ajaxTimeStamp+ajaxIncrement;
		//AjaxSimpleCheck(ajaxscript, '', 'divIConnectionsMenu',1);	
	}	
	if (document.getElementById('divIMDialogues')!=null) {	
		//ajaxscript = '/dc_includes/cp_OpenIMDialogues.asp?i=-1&confcode=' + lPD_ConfCode + '&MarketCode='+lPD_MarketCode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
		//AjaxSimpleCheck(ajaxscript, '', 'divKeyUpdateComponentContainer',1);
	}
	
	pars=document.getElementsByTagName('div')
	for (i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf('PortletPage_')!=-1) {
			ajaxscript=pars[i].value;
			var sA=pars[i].value.split('_');
			ajaxDest=document.getElementById('PortletPageDest_'+sA[1]).value+sA[1];
			if (ajaxDest.indexOf('divCalendar')!=-1) {
				AjaxSimpleCheck(ajaxscript, '', ajaxDest,1,'true','fAdjustCalendar()');
				}
			else {
				AjaxSimpleCheck(ajaxscript, '', ajaxDest,1);
			}
		}
	}
	if (lPD_MIFL==6882) {
		if ($('divMainPanelTiles')!=null) {
			//fPostCachedPortal();
		}
	}
	

	if (document.getElementById('divIConnectionsMenu')!=null) {	
		//qAlpaConnections('');
	}	
	
	bFoundMsgContainer=0
	if ($('AjxContent')!=null) {
		pars=$('AjxContent').getElementsByTagName('div')
		for (i=0;i<pars.length;i++) {
			if (pars[i].id.indexOf('WallMsgsContainer_')==0) {
				bFoundMsgContainer=1;
			}
		}
	}
	if (bFoundMsgContainer==1 && $('AjxContent')!=null) {
		DisplayAjaxPage(0,'AjxContent','DCMYMESSAGES',1,'','','1')
	}
	if ($('divMyMessages')!=null) {
		DisplayAjaxPage(0,'divMyMessages','DCMYMESSAGESONLY',1,'','','1')
	}
}
function fCheckForImDisplay() {
	
	if ($('LOEval')!=null) {
		eval($('LOEval').value);
//		if (bWasLoggedIn==1 && bNowLoggedOff==1) {
//			var x=window.confirm('You are currently logged off, would you like to log in?\n\n if yes, press OK, else CANCEL');
//			if (!x) {
//				bWasLoggedIn=0;
//				return;
//			}	
//				bWasLoggedIn=0;		
//				DCBLogin();
//		}
		if (bWasLoggedIn==1 && bNowLoggedOff==1) {
			bWasLoggedIn=0;
			self.location='?p=2100&sp=999&LO=1&confcode='+lPD_OrigConfCode+'&DCMessage=You have been logged off due to inactivity';
		}
		return;
	}
	
	if (document.getElementById('DCIMInd')!=null) {
		if (document.getElementById('DCIMInd').className.indexOf('Alert')>0) {
			if (document.getElementById('IMContent')!=null) {
				if (document.getElementById('IMContent').style.display!='') {
					ajaxIncrement=ajaxIncrement+1;
					ajaxscript='/dc_includes/cp5_ToggleIMFormDisplay.asp?m=1&xc='+ajaxTimeStamp+ajaxIncrement;
					ajaxDest='divGnrlIMInd';
					//AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1);
					var x=window.setTimeout("AjaxSimpleCheck('"+ajaxscript+"', '', '"+ajaxDest+"',1)",2000);
					if (document.getElementById('divGnrlIMInd').innerHTML.indexOf('NOIM')!=0 && document.getElementById('divGnrlIMInd').innerHTML.indexOf('IM~0')!=0) {
						lImIds=document.getElementById('divGnrlIMInd').innerHTML.split('~');
						BuildInstantMsgIFrame(lPD_MIFL,lImIds[1],0);
					}
					//alert (document.getElementById('divGnrlIMInd').innerHTML.indexOf('NOIM'))
				}
			}
		}
	}
}	
			
function qConnections(row, letter,mx,m,ifl,mode) {
	if(mode==null){
		var ajaxscript = '/dc_includes/cp_ConnectionsMenu.asp?ifl='+ifl+'&mx='+mx+'&m='+m+'&r='+row+'&ltr='+letter+'&xc=' + ajaxTimeStamp+ajaxIncrement;
		}
	else {
		var ajaxscript = '/dc_includes/cp_ConnectionsUnit.asp?ifl='+ifl+'&mx='+mx+'&m='+m+'&r='+row+'&ltr='+letter+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	}
	AjaxSimpleCheck(ajaxscript, '', 'divIConnectionsMenu',1);
}

function qAlpaConnections(letter,mx,m,ifl,mode) {
	if(mode==null){
			var ajaxscript = '/dc_includes/cp_ConnectionsMenu.asp?ifl='+ifl+'&mx='+mx+'&m='+m+'&ltr='+letter+'&xc=' + ajaxTimeStamp+ajaxIncrement;
		}
	else {
		var ajaxscript = '/dc_includes/cp_ConnectionsUnit.asp?ifl='+ifl+'&mx='+mx+'&m='+m+'&ltr='+letter+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	}		

	AjaxSimpleCheck(ajaxscript, '', 'divIConnectionsMenu',1);
}		

function timedQ() {
	var NMResponse = "";
	var posY = 0;
	var elm;
	
	elm = document.getElementById('divSearchNewMail');
	
	if(elm.style.display == "none") {
		//elm.innerHTML = "";
		AjaxSimpleCheck('../DC_Ajax/DC5_SearchNewMail.asp?ConfCode='+lPD_ConfCode, 'No New Mail', 'divSearchNewMail',0);
		
		if(window.pageYOffset) {
			posY = window.pageYOffset + window.innerHeight;
		} else {
			posY = document.body.scrollTop + window.document.body.clientHeight;
		}
		
		elm = document.getElementById('divSearchNewMail');
		//elm.style.bottom = 0;
		elm.style.top = posY - 100;	//height of divSearchNewMail;
		
	
		//if(elm.getElementsByTagName("div").length > 0)
		if (document.getElementById('divSearchMail')!=null) {
			new Effect.Appear('divSearchNewMail');
			SNMSearchTimer = window.setTimeout("new Effect.Fade('divSearchNewMail')", 5000);
		}
	}
	
}
function GetIMM(SI,dest) {
	if (dest==null) {
		var dest='IMMessageDisplay';
	}
	ajaxIMCheck=ajaxIMCheck+1;
//	if (ajaxIMCheck==100) {
//		IMMQTimer=window.clearInterval(IMMQTimer)
//		IMMQTimer = window.setInterval('GetIMM('+SI+')', 10000);
//	}
//	if (ajaxIMCheck==500) {
//		IMMQTimer=window.clearInterval(IMMQTimer)
//		IMMQTimer = window.setInterval('GetIMM('+SI+')', 60000);
//	}				
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = 'DC_Ajax/DC5_IMMQ.asp?SI='+SI+'&confcode=' + lPD_ConfCode + '&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest,1);
}

function DCBMySimpleAccount(f) {
	DCBSetDisplay();
	ajaxIncrement=ajaxIncrement+1;
	DCBajaxscript = '/dc_includes/cp_MySimpleAccount.asp?i=-1&confcode=' + lPD_ConfCode + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	var x=window.setTimeout("AjaxSimpleCheck(DCBajaxscript, '', 'divKeyUpdateComponentContainer',1)",1000);
	lDCBLastFunction=f;
}

function DCBInbox(f) {
	DCBSetDisplay();
	ajaxIncrement=ajaxIncrement+1;
	DCBajaxscript = '/dc_includes/cp_EmailInBox.asp?i=-1&bt=INBOX&confcode=' + lPD_ConfCode + '&dcb=1&xc=' + ajaxTimeStamp+ajaxIncrement;
	var x=window.setTimeout("AjaxSimpleCheck(DCBajaxscript, '', 'divKeyUpdateComponentContainer',1)",1000);
	lDCBLastFunction=f;
}
function DCBIMDialogues(f) {
	DCBSetDisplay();
	ajaxIncrement=ajaxIncrement+1;
	DCBajaxscript = '/dc_includes/cp_OpenIMDialogues.asp?i=-1&confcode=' + lPD_ConfCode + '&MarketCode='+lPD_MarketCode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	var x=window.setTimeout("AjaxSimpleCheck(DCBajaxscript, '', 'divKeyUpdateComponentContainer',1)",1000);
	lDCBLastFunction=f;
}	
function DCBActiveUsers(f) {
	DCBSetDisplay();
	ajaxIncrement=ajaxIncrement+1;
	DCBajaxscript = '/dc_includes/cp_ActiveUsers.asp?i=-1&confcode=' + lPD_ConfCode + '&MarketCode='+lPD_MarketCode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	var x=window.setTimeout("AjaxSimpleCheck(DCBajaxscript, '', 'divKeyUpdateComponentContainer',1)",1000);
	lDCBLastFunction=f;
}	
function DCBMyEvents(f) {
	DCBSetDisplay();
	ajaxIncrement=ajaxIncrement+1;
	DCBajaxscript = '/dc_includes/cp_MyEventsSA.asp?i=-1&confcode=' + lPD_ConfCode + '&MarketCode='+lPD_MarketCode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	var x=window.setTimeout("AjaxSimpleCheck(DCBajaxscript, '', 'divKeyUpdateComponentContainer',1)",1000);
	lDCBLastFunction=f;
}
function DCBLogin(f) {
//	if (document.getElementById('divKeyInfo')!=null) {
//		document.getElementById('divKeyInfo').style.display='';
//	}
//	DCBSetDisplay();
//	ajaxIncrement=ajaxIncrement+1;
	
	DisplayShadowBox(0,'DCSimpleLogin','&i=-1&confcode=' + lPD_ConfCode);
//DCBajaxscript = '/dc_includes/cp_SimpleLogin.asp?i=-1&confcode=' + lPD_ConfCode + '&xc=' + ajaxTimeStamp+ajaxIncrement;
//var x=window.setTimeout("AjaxSimpleCheck(DCBajaxscript, '', 'divKeyUpdateComponentContainer',1)",1000);
//lDCBLastFunction=f;
}
function DCBSetDisplay () {
	if (document.getElementById('divKeyInfoBox')!=null) {
		if (document.getElementById('divKeyInfoBox').style.display=='none') {
			new Effect.BlindDown('divKeyInfoBox');
			var sHTML='<img src=/GetDigi/images/MSCOMM/images/DCBlackProgressBar.gif style=margin-top:30px;margin-left:30px />';
			document.getElementById('divKeyUpdateComponentContainer').innerHTML=sHTML;	
			}
		}
	else	{
		var x=window.confirm('Would you like to login at this time?\n\n if yes, press OK, else CANCEL');
		if (!x) {
			return;
		}
		window.open('./dc4main.asp?p=210&confcode='+lPD_ConfCode+'&sop=OLI&DCMessage=Once%20you%20login with your valid user id and password,%20you%20may%20return%20to%20the%20web%20page%20you%20%20were%20on');
	}
		
}
function DCBFlashMenus () {
	DCBSetDisplay();
	ajaxIncrement=ajaxIncrement+1;
	DCBajaxscript = '/dc_includes/cp5_FlashMenus.asp?confcode=' + lPD_ConfCode + '&MarketCode='+lPD_MarketCode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	var x=window.setTimeout("AjaxSimpleCheck(DCBajaxscript, '', 'divKeyUpdateComponentContainer',1)",1000);
	//lDCBLastFunction=f;
}
function DCBFlashMenusCarousel () {
	DCBSetDisplay();
	ajaxIncrement=ajaxIncrement+1;
	DCBajaxscript = '/dc_includes/cp5_FlashMenusCarousel.asp?confcode=' + lPD_ConfCode + '&MarketCode='+lPD_MarketCode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	var x=window.setTimeout("AjaxSimpleCheck(DCBajaxscript, '', 'divKeyUpdateComponentContainer',1)",1000);
	//lDCBLastFunction=f;
}
function DCBHelpText (page,f) {
	DCBSetDisplay();
	ajaxIncrement=ajaxIncrement+1;
	DCBajaxscript = '/dc_includes/cp_HelpText.asp?page='+page+'&i=-1&confcode=' + lPD_ConfCode + '&MarketCode='+lPD_MarketCode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	var x=window.setTimeout("AjaxSimpleCheck(DCBajaxscript, '', 'divKeyUpdateComponentContainer',1)",1000);
	lDCBLastFunction=f;
}
function DCBHelpTextNewpage (page,retPage) {
	if (retPage==null) {
		var retPage='';
	}
	ajaxIncrement=ajaxIncrement+1;
	DCBajaxscript = '/dc_includes/cp_HelpText.asp?page='+page+'&retPage='+retPage+'&i=-1&confcode=' + lPD_ConfCode + '&MarketCode='+lPD_MarketCode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	var x=window.setTimeout("AjaxSimpleCheck(DCBajaxscript, '', 'divKeyUpdateComponentContainer',1)",1000);
}	
function DCBCloseWin() {
	new Effect.BlindUp('divKeyInfoBox');	
	document.getElementById('divKeyUpdateComponentContainer').innerHTML='';
	lDCBLastFunction=-1;
}
function OpenIM(imids,sid,force) {
var bForce=force;
//	var x=window.confirm('You have an instant message, would you like to answer the message?\n\n if correct, press OK, else CANCEL');
//		if (!x) {
//			return;
//		}
//	}
	if (CheckForLogin()==false) {
		DCBLogin();
		return;
	}

	BuildInstantMsgIFrame(imids,sid,1)
	
//	document.getElementById('IMInner').innerHTML='';
//	document.getElementById('IMContent').style.display='none';
//	if (!IMWin || bForce==1) {
//		IMWin=window.open('/DCIM.asp?imids='+imids+'&lDCIMS='+sid,'DCIM'+imids,'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=500,left=150,top=150');
//		IMWin.focus;
//	}
}
function CloseMyIm (id,sid) {
		ajaxIncrement=ajaxIncrement+1;
		var ajaxscript = '/dc_includes/cp_DeleteMyIm.asp?id='+id+'&sid='+sid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
		AjaxSimpleCheck(ajaxscript, '', 'divUpdateBox',1);
		//RollOutTimer=window.setTimeout('window.close()', 1000);
		
		try {
			RollOutTimer=window.setTimeout('window.parent.CloseIMWindow()', 1000);
			}
		catch(err) {
		}		
		//RollOutTimer=window.setTimeout('CloseIMWindow()', 1000);
		
}

function openClosePost(thread) {
	if (document.getElementById(thread).style.display=="none") {
		document.getElementById(thread).style.display="";
		}
	else {
		document.getElementById(thread).style.display="none";
	}
}
function ApprovePost(PostId, mode,PostAddr, fId) {
	
	if (mode==4 || mode==5) {
		var x=window.confirm('You are about to delete a item\n\n if correct, press OK, else CANCEL');
		if (!x) {
			return;
		}
	}
	if (mode==3) {
		var x=window.confirm('You are about to approve this post\n\n if correct, press OK, else CANCEL');
		if (!x) {
			return;
		}
	}	
	ajaxIncrement=ajaxIncrement+1
	var ajaxscript = '../dc_ajax/DCAdminForum.asp?upd='+mode+'&afid='+PostId+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	if (mode==5) {
		lPostAddr='spanAfUpd'+PostId;
		}
	else	{
		lPostAddr='spanApUpd'+PostAddr;
	}
	AjaxSimpleCheck(ajaxscript, '', lPostAddr,1);
	if (fId!=null) {
		AdminOpenThread(fId,1);
	}
	if (mode==5) {
		if (document.getElementById('RowContainer'+PostId)!=null) {
			document.getElementById('RowContainer'+PostId).style.display='none';
		}
		if (document.getElementById('divAf'+PostId)!=null) {
			document.getElementById('divAf'+PostId).style.display='none';
		}
	}
	if (mode==4) {
		if (document.getElementById('divAf'+PostId)!=null) {
			PuffId('divAf'+PostId)
		}		
	}
}
function AdminOpenThread(id,mode) {
	var t=document.getElementById('divAf'+id)
	if (t!=null) {
		if (t.style.display=='none' || mode=='1') {
			if (mode!=1) {
				var pars = document.getElementsByTagName('span');
				for (var i=0;i<pars.length;i++) {
					sCN=pars[i].className;
					if (sCN.indexOf('divAf')==0) {
						pars[i].style.display='none';
					}
				}
				var pars = document.getElementsByTagName('span');
				for (var i=0;i<pars.length;i++) {
					sCN=pars[i].className;
					if (sCN.indexOf('Name Opened')==0) {
						pars[i].className='Name Closed';
					}
				}		
				t.style.display='';
				t.innerHTML='<img src="/DC_Images/silk_icons/DCWhiteProgressBar.gif" />';
			}
			var ajaxscript = '/dc_includes/CP_ModerateForumSP.asp?m='+lPD_MarketCode+'&forumid='+id;
			AjaxSimpleCheck(ajaxscript, '', 'divAf'+id,1);
			document.getElementById('spanAfName'+id).className='Name Opened';
			}
		else	{
			document.getElementById('spanAfName'+id).className='Name Closed';
			t.style.display='none';
		}
	}
}
function fRemoveChildren(did) {
	//Temporary
	return;
	var elem = document.getElementById(did);
	if ( elem.hasChildNodes() ) {
    while ( elem.childNodes.length >= 1 ) {
        elem.removeChild( elem.firstChild );       
    } 
	}
}
function fShowPoolPerson(val,dest) {
	
	if (dest==null) {
		dest='divResPoolChartInfo';
		aRArray=val.split('_');
		sDArray=aRArray[1].split('.');
		sDLastArray=sDArray[2].split(' ');
		var sDate=sDArray[0]+'/'+sDArray[1]+'/'+sDLastArray[0];
		bClose=0;
	}
	else	{
		aRArray=val.split('_');
		var sDate=aRArray[1];
		bClose=1;
	}
	
	DisplayAjaxPage(0,dest,'DCPROJRESOURCEPOOLBYPERSON',1,'','&dest='+dest+'&close='+bClose+'&pid='+aRArray[2]+'&mifl='+aRArray[0]+'&d='+sDate,'',1);
}
function DisplayAjaxPage	(seq,dest,pn,archives,params,i,NoImage,MoreParams,event) {
	
	if (NoImage==null) {
		NoImage='';
	}
	
	if (document.getElementById(dest)==null || SortingMode==3 || SortingMode==1) {
		return false;
	}
	// params must be in standard format (i.e. &x=1)
	if (pn==null) {
		var pn='';
	}
	if (i==null) {
		var i='';
	}	
	if (MoreParams==null) {
		var MoreParams=''
	}
	if (params==null) {
		var params='';
	}
	var x=document.getElementById(dest).offsetHeight;
	var y=document.getElementById(dest).offsetWidth;
	
	fRemoveChildren(dest);
	
	if (NoImage.length<1) {
		document.getElementById(dest).innerHTML='<div id="progressind" class="Progress"><span>Retrieving...</span></div>';	
		if (document.getElementById('progressind').offsetHeight>x) {
			document.getElementById('progressind').style.height=x+30;
		}
	}
	if (seq==-1) {
		$(dest).style.display='';
	}
	if (seq==-2) {
		if (CheckForLogin()==false) {
			DCBLogin();
			return;
		}
	}	
	ajaxIncrement=ajaxIncrement+1;
	if (archives!=9) {
		ajaxTimeStamp=ajaxTimeStamp+ajaxIncrement
	}
	if (seq==-2) {
		var ajaxscript = '/dc_includes/CP_WebResource.asp?pn='+pn+'&seq='+seq+'&i='+i+'&xc=' + ajaxTimeStamp+params;
		}	
	else	{
		var ajaxscript = '/dc_includes/CP_WebResource.asp?confcode='+lPD_ConfCode+'&pn='+pn+'&seq='+seq+'&i='+i+'&xc=' + ajaxTimeStamp+params;
	}
	
	if (pn=='DCLargeCal' || pn=='DCSmallCalendar') {
		AjaxSimpleCheck(ajaxscript, '',dest,1,'true','fAdjustCalendar()');
	}
	else	{
		AjaxSimpleCheck(ajaxscript, '',dest,1,'true',MoreParams);
	}
	
	if (event!=null) {
		event.cancelBubble=true;
	}
}
function DisplayAjaxWIKIPage(wid,wcid,dest,wn,params) {
	
	if (document.getElementById(dest)==null) {
		return false;
	}
	// params must be in standard format (i.e. &x=1)
	if (params==null) {
		var params='';
	}
	var x=document.getElementById(dest).offsetHeight;
	var y=document.getElementById(dest).offsetWidth;
	
	document.getElementById(dest).innerHTML='<div id="progressind" class="Progress">Retrieving...</div>';	
	if (document.getElementById('progressind').offsetHeight>x) {
		document.getElementById('progressind').style.height=x+30;
	}

	ajaxIncrement=ajaxIncrement+1;
	ajaxTimeStamp=ajaxTimeStamp+ajaxIncrement
	var ajaxscript = '/dc_includes/CP5_WIKIViewer.asp?wid='+wid+'&wcid='+wcid+'&wn='+wn+'&xc=' + ajaxTimeStamp+params;
	AjaxSimpleCheck(ajaxscript, '', dest,1,'true');
	
}
function AdjustIframe() {
	if (document.getElementById('MailDisplay')!=null) {
			document.getElementById('MailDisplay').style.height=document.getElementById('divIFrameBlankPage').offsetHeight;
			document.getElementById('MailDisplay').style.width=document.getElementById('divIFrameBlankPage').offsetWidth;
	}
}	
function DisplayPost(pid,dest) {
	document.getElementById(dest).innerHTML='<div class="Progress">Retrieving...</div>';
	var ajaxscript = '/dc_includes/CP5_DisplayPostMessage.asp?postid='+pid+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', dest,1,'true');	
}
function QueryForum	(sf, so, gid) {
	if (gid==null) {
		gid='';
	}
	var ajaxscript = '/dc_includes/CP_AdministerForumSP.asp?gid='+gid+'&sf='+sf+'&so='+so+'&M=' + lPD_MarketCode + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', $('divAdminForums').parentNode.id,1,'true');
}
function CheckForEmail(email) {
	disablePassword();
	//document.getElementById('hourglass').style.display='none';
	//alert (document.getElementById('BliAttEMail').value)
	if (document.getElementById('BliAttEMail').value.length==0) {
		alert ("You must enter a valid email to proceed");
		document.getElementById('BliAttEMail').select();
		document.getElementById('BliAttEMail').focus();		
		return false;
	}
	if (!isValidEmail(document.getElementById('BliAttEMail').value)) {
		document.getElementById('BliAttEMail').select();
		document.getElementById('BliAttEMail').focus();		
		return false;
	}	
	//document.getElementById('hourglass').style.display='' 
	ajaxIncrement=ajaxIncrement+1;
	AjaxSimpleCheck('../dc_ajax/DCEmailCheck.asp?AttEMail=' + document.getElementById('BliAttEMail').value + '&marketcode='+lPD_MarketCode+'&mode=1&xc='+ ajaxTimeStamp + ajaxIncrement, '', 'divCustomerInfo',1,'false');
	CheckForCredValue('BliAttPassword');
}
function CloseDCSOWindow() {
	
	try {
		window.parent.DCBCloseWin();
		}
	catch(err) {
	}
	window.close();
}	
function RollDCMessage(id,type1,type2) {
	RollId=id;
	RollType1=type1;
	RollType2=type2;
	
	RollOutTimer=window.setTimeout('RollDCMessageDo(RollId,RollType1,RollType2)', 500);
}
function RollDCMessageDo(id,type1,type2) {
// Roll Message Content
	var pars = document.getElementsByTagName(type1);
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('DCRollMsg_')==0) {
			pars[i].style.display='none';
		}
	}
// Rollover Object - highlight	
	var pars = document.getElementsByTagName(type2);
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('DCRM_')==0) {
			pars[i].className=sCN;
		}
	}	
	document.getElementById(id).className=id + ' RollDCMSelect';
	var dcRid='DCRollMsg_'+id;
	if (document.getElementById(dcRid)!=null) {
		document.getElementById(dcRid).style.display='';
	}
}
function CloseFlyMsg(type) {

	window.clearTimeout(RollOutTimer);
	if (type!=null || (type!=null && type.length<1)) {
		type='spanx';
	}
	var pars = document.getElementsByTagName(type);
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('DCRollMsg_')==0) {
			pars[i].style.display='none';
		}
	}
}
function jsDCFunctions (a) {
	var actionarray=a.split('');
	
	switch (actionarray[0]) {
	
		 case 'S' :
			var u='?p=210&sp=1&wp=7&dseq='+actionarray[1]+'&confcode='+lPD_ConfCode+'&reqpage=%3Fp%3D210%26confcode%3D'+lPD_ConfCode+'%26dseq%3d'+actionarray[1]
			self.location=u;
			break;
			
		 case 'T' :
			var u='?p=210&amp;sp=1&amp;wp=7&amp;confcode='+lPD_ConfCode+'&amp;title='+actionarray[1];
			self.location=u;
			break;
			
		 case 'CC' :
			var u='?p=210&amp;sp=200&amp;confcode='+lPD_ConfCode+'&amp;title='+actionarray[1];
			self.location=u;
			break;			
			
		 case 'U' :
			self.location=actionarray[1];
			break;
	 }
}

function dispProfileWin(ifl) {

}
function ValidatefEmpApprov(fid,uid,mid,f,field,mode,bHTML) {
	if (mode==null) {
		var mode='true'
	}
	
	if (bHTML==null) {
		bHTML=0;
	}
	
		document.getElementById(uid).value=1;
    var oForm =document.getElementById(fid);
    if (oForm==null) {
    	alert ('Error on page:'+fid)
    	return;
    }
    var sBody = getRequestBody(oForm,bHTML);
    
    var oXmlHttp = zXmlHttp.createRequest();
    oXmlHttp.open("post", oForm.action, mode);
    oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    
    oXmlHttp.onreadystatechange = function () {
        if (oXmlHttp.readyState == 4) {
            if (oXmlHttp.status == 200) {
                saveResult(oXmlHttp.responseText, mid,f,field,bHTML);
            } else {
                saveResult("An error occurred: " + oXmlHttp.statusText, mid,field);
            }
        }            
    };
    oXmlHttp.send(sBody);
    if (document.getElementById(mid)!=null) {
			document.getElementById(mid).value='';
		}
}
function saveResult(sText,mid,f,field) {
	var ts = new Date();
	if (document.getElementById(mid)!=null) {
		document.getElementById(mid).innerHTML='Processed Transaction (id:' + ts.getTime() + ')';
	}
	if (document.getElementById(mid)!=null) {
		document.getElementById(mid).innerHTML=sText
	}
	if (f!=null) {
		eval(f);
	}
}
function getRequestBody(oForm,bHTML) {

    var aParams = new Array();
    
    // Add radio buttom processing - currently ignoring "checked" status
    
    for (var i=0 ; i < oForm.elements.length; i++) {
        var sParam = encodeURIComponent(oForm.elements[i].name);
        sParam += "=";
        //oForm.elements[i].value=oForm.elements[i].value.replace('\n','~','g')
        if (bHTML==1) {
        	oForm.elements[i].value=oForm.elements[i].value.replace(/\r/g,'~')
        }
        else	{
      		oForm.elements[i].value=oForm.elements[i].value.replace(/\n/gi,'~')
      	}

        sParam += encodeURIComponent(oForm.elements[i].value);
        aParams.push(sParam);
    } 
    
    return aParams.join("&");
   
}
function dIProfile(id,conn,ct,mifl) {
var sConn;

	if (conn!=null) {
		sConn=1;
		}
	else	{
		sConn=0;
	}
	if (mifl==null) {
		var mifl=''
	}
	document.getElementById('divIProfile').innerHTML='Retrieving... <img style=""vertical-align:middle;"" src=/DC_Images/silk_icons/AjaxProcesLarge.gif />';
	var ajaxscript = '/dc_includes/cp_IndProfile.asp?mifl='+mifl+'&ifl='+id+'&c='+sConn+'&ct='+ct+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divIProfile',1);
}
function MTerritoryForm() {

	ValidatefEmpApprov('formTerritoryActivities','UpdInd','UpdMsg');
}
function MMBLOGUpdateForm() {

	if (document.getElementById('FName').value.length==0) {
		alert ("Forum Name is required");
		document.getElementById('FName').focus();
		document.getElementById('FName').select();
		return false;
	}
	
	if (document.getElementById('FName').value.length>255) {
		alert ("Forum Name may not exceed 255 characters");
		document.getElementById('FName').focus();
		document.getElementById('FName').select();
		return false;
	}
		
	if (document.getElementById('Description').value.length>2048) {
		alert ("Forum Description may not exceed 255 characters");
		document.getElementById('Description').focus();
		document.getElementById('Description').select();
		return false;
	}	
	document.getElementById('UpdInd').value="1";
	return true;
}
function MMBLOGUpdateFormSS() {
	if (MMBLOGUpdateForm()) {
		document.getElementById('MMDCForm').submit();
	}
}	
function MMUpdateFormInd () {
	MMUpdateForm();
}
function MMUpdateForm() {

	if (document.getElementById('FName').value.length==0) {
		alert ("Forum Name is required");
		document.getElementById('FName').focus();
		document.getElementById('FName').select();
		return false;
	}
	
	if (document.getElementById('FName').value.length>255) {
		alert ("Forum Name may not exceed 255 characters");
		document.getElementById('FName').focus();
		document.getElementById('FName').select();
		return false;
	}
		
	if (document.getElementById('Description').value.length>2048) {
		alert ("Forum Description may not exceed 255 characters");
		document.getElementById('Description').focus();
		document.getElementById('Description').select();
		return false;
	}	
	if (document.getElementById('FT').selectedIndex==0) {
		alert ("You must choose a Message Board Type");
		document.getElementById('FT').focus();
		return false;
	}
	if (document.getElementById('FT').selectedIndex==0) {
		alert ("You must choose a Message Board Type");
		document.getElementById('FT').focus();
		return false;
	}
	if (document.getElementById('gid').selectedIndex==0) {
		alert ("You must choose or make a group");
		document.getElementById('gid').focus();
		return false;
	}
	if (document.getElementById('gid').options[document.getElementById('gid').selectedIndex].value==0) {
		if (document.getElementById('nGroupName').value.length==0) {
			alert ("You must enter a name for this group");
			document.getElementById('nGroupName').focus();
			document.getElementById('nGroupName').select();
			return false;
		}	
		if (document.getElementById('nGroupName').value.length>50) {
			alert ("Group name may not exceed 50 characters");
			document.getElementById('nGroupName').focus();
			document.getElementById('nGroupName').select();
			return false;
		}
		if (document.getElementById('nGroupDesc').value.length>250) {
			alert ("Group description may not exceed 250 characters");
			document.getElementById('nGroupDesc').focus();
			document.getElementById('nGroupDesc').select();
			return false;
		}				
	}

	document.getElementById('FPUpdProgressBar').style.display='';
	document.getElementById('DCForumUpdInd').value="1";
	ValidatefEmpApprov('MMDCForm','Upd','divForumManager');
	
}

function MMSaveForm() {
	MMUpdateForm();
}
function MMGroupCheck() {
	if (document.getElementById('gid').options[document.getElementById('gid').selectedIndex].value==0) {
		document.getElementById('nGroupIdDiv').style.display="inline";
		}
	else	{
		document.getElementById('nGroupIdDiv').style.display="none";
		document.getElementById('nGroupName').value='';
	}
}
function MMDeleteForum(fid, fname) {
var x=window.confirm("You are about to delete Forum: " + fname + "\n\n if correct, press OK, else CANCEL");
if (!x) {
	return;
}
	document.getElementById('Upd').value="2";
	document.getElementById('ForumId').value=fid;	
	document.DCForm.submit();	
}
function MMDeleteModerator(uid,fid) {
var fname=$('name_'+uid).innerHTML.replace('&nbsp;','');	
var x=window.confirm("You are about to delete Moderator: " + fname + "\n\n if correct, press OK, else CANCEL");
if (!x) {
	return;
}
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP6_ManageMBModerator.asp?cc='+lPD_ConfCode+'&uid='+uid+'&fid='+fid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '','divGnrlAjax',1);	
	PuffId('mod_'+uid)
}
function MMOCModerator() {
	
	if ($('FT')==null) {
		return false;
	}
	if ($('FT').options[$('FT').options.selectedIndex].value=='1') {
		document.getElementById('ModeratorDIV').style.display="";
		return false;
	}
	if (document.getElementById('IsModerated')!=null) {
		if (document.getElementById('IsModerated').checked==true) {
			document.getElementById('ModeratorDIV').style.display="";
			}
		else	{
			document.getElementById('ModeratorDIV').style.display="none";
		}
	}
}
function UpdateClass(id,rid) {

	if (document.getElementById(id).checked==true) {
		document.getElementById(rid).className='';
		document.getElementById(id).checked=true;
		}
	else	{
		document.getElementById(rid).className='NotNotified';
		document.getElementById(id).checked=false;
	}
}
function CheckAll(type, id, On, Off,JustValue) {
var pars = document.getElementsByTagName('input');
var kid=document.getElementById(id);
var sId;
var sValOn='';
var sValOff='';

	for (var i=0;i<pars.length;i++) {
		sId=pars[i].id;
		sVal=pars[i].id.replace(type,'')
		sValOff=''
		sValOn=''
		if (JustValue==1) {
			sValOn=sVal;
			sValOff='';
			}
		else {
			if (On) {
				sValOn=sVal+On;
				sValOff=sVal+Off;
				}
			else	{
				sValOn=1;
				sValOff=0;
			}
		}
		if (sId.indexOf(type)==0) {
			if (kid.checked==true) {
				pars[i].checked=false;
				pars[i].value=sValOff;
				}
			else	{
				pars[i].checked=true;
				pars[i].value=sValOn;
			}
		}
	}
	if (kid.checked==true) {
		kid.checked=false;
		kid.value=0;
		}
	else	{
		kid.checked=true;
		kid.value=1;	
	}
}
function NextRotateResource(elem,lid,max,arrayStr) {
	
	lSeqArray=arrayStr.split(',');
	lField=document.getElementById(lid);
	lFV=Number(lField.value);
	lLast=lFV+1;
	if (lLast>max) {
		lLast=0;
	}
	lField.value=lLast;
	DoAjaxCall('w'+elem,'/dc_includes/CP_WebResource.asp?i='+elem+'&ConfCode='+lPD_ConfCode+'&seq='+lSeqArray[lLast],1);
}
function PrevRotateResource(elem,lid,max,arrayStr) {
	
	lSeqArray=arrayStr.split(',');
	lField=document.getElementById(lid);
	if (lField.value.length==0) {
		lField.value=max;
	}
	lFV=Number(lField.value);
	lLast=lFV-1;
	if (lLast==0) {
		lLast=max;
	}
	lField.value=lLast;
	DoAjaxCall('w'+elem,'/dc_includes/CP_WebResource.asp?i='+elem+'&ConfCode='+lPD_ConfCode+'&seq='+lSeqArray[lLast],1);
}
function DoAjaxCall (div,url,inc) {
	//document.getElementById(div).style.visibility='hidden';
	if (inc==0) {
		var ajaxscript = url;
		}
	else	{
		ajaxIncrement=ajaxIncrement+1;
		var ajaxscript = url+'&xc='+ajaxTimeStamp;
	}
	
	AjaxSimpleCheck(ajaxscript, '',div,1);
	
	//window.setTimeout("document.getElementById('"+div+"').style.visibility='visible';",400);

}
function CancelTimeOut(id) {
	window.clearTimeout(curifldisplTimer);
}
function RenewTimeOut(id) {
	curifldisplTimer=window.setTimeout("document.getElementById(container).style.display='none';",2500);
}
function UpdateMousePos(ifl,mode,ovrconfcode,id,idtop,DestParent,DestId,oSL,w,h,page) {
container=DestParent;
var containerContent=DestId;
var smode=mode;
var sovrconfcode;

	if (ovrconfcode!=null) {
		sovrconfcode=ovrconfcode;
		}
	else	{
		sovrconfcode=lPD_ConfCode;
	}

	window.clearTimeout(curifldisplTimer);
	x=document.getElementById(id).offsetLeft+document.getElementById(document.getElementById(id).offsetParent.id).offsetLeft;
	y=document.getElementById(document.getElementById(id).offsetParent.id).offsetTop;
	
	x=x+10;
	y=y+10;
	
	document.getElementById(container).style.left=x;
	document.getElementById(container).style.top=y;
	
	document.getElementById(container).style.display='';
	document.getElementById(container).style.width=w;
	document.getElementById(container).style.height=h;
	
	if (page==0) {
		var ajaxscript = '/dc_includes/CP_IndProfile.asp?ifl=' + ifl + '&surveytype='+smode+'&confcode='+sovrconfcode+'&xc=' + ajaxTimeStamp;
		AjaxSimpleCheck(ajaxscript, '', containerContent,1);	
	}

	curifldispl=ifl;
}
function CloseMousePos() {
	//var curifldisplTimer=window.setTimeout("document.getElementById('divOptionsContainer').style.display='none';document.onmousemove = null;",2500);
	document.getElementById('divOptionsContainer').style.display='none';
}
function dispFloatingBox(e) {
	document.getElementById('divOptionsContainer').style.display='';
	if (isIE) {
		x=window.event.clientX+document.getElementById('DCMainBG').scrollLeft;
		y=window.event.clientY+document.getElementById('DCMainBG').scrollTop;
		}
	else	{
		x = (window.Event) ? e.pageX : event.clientX;
		y = (window.Event) ? e.pageY : event.clientY;
	}
	MouseX=x;
	MouseY=y;

	document.getElementById('divOptionsContainer').style.left=x;
	document.getElementById('divOptionsContainer').style.top=y;		

	document.onmousemove = null;
}
function DeleteNote(Seq,t) {
	document.getElementById('Seq').value=Seq;
	document.getElementById('Del').value=1;
	ValidatefEmpApprov('formNote','Upd','UpdMsgNotes');
	DNotes(document.getElementById('lrConfCode').value,document.getElementById('OwnerKey').value,0,t);
}
function CloseNote(t) {
	document.getElementById('Priority').selectedIndex=0;
	SubmitNoteForm(t);
}
function ClearNoteForm() {
	document.getElementById('Seq').value=0;
	document.getElementById('Regarding').value='';
	document.getElementById('Note').value='';
	document.getElementById('NoteName').value='';
	document.getElementById('NextActionDate').value='';
	document.getElementById('Priority').selectedIndex=2;
	document.getElementById('CurrAction').selectedIndex=0;
	document.getElementById('NextAction').selectedIndex=0;
}
function SubmitNoteForm(t) {
 
	if (document.getElementById('NoteName').value.length == 0) {
		alert ("You must enter a name for your note");
		document.getElementById('NoteName').focus();
		document.getElementById('NoteName').select();
		return false;
	}
	if (document.getElementById('NoteName').value.length > 50) {
		alert ("A note name cannot exceed 50 characters");
		document.getElementById('NoteName').focus();
		document.getElementById('NoteName').select();
		return false;
	}	
	if (document.getElementById('Note').value.length == 0) {
		alert ("You must enter a note");
		document.getElementById('Note').focus();
		document.getElementById('Note').select();
		return false;
	}		
	if (document.getElementById('Note').value.length > 1000) {
		alert ("A note name cannot exceed 1000 characters");
		document.getElementById('Note').focus();
		document.getElementById('Note').select();
		return false;
	}	
	ValidatefEmpApprov('formNote','Upd','UpdMsgNotes');
	DNotes(document.getElementById('lrConfCode').value,document.getElementById('OwnerKey').value,0,t);
	//var ft=window.setTimeout("DNotes(document.getElementById('lrConfCode').value,document.getElementById('OwnerKey').value,0,t);",1000);
	//DNotes(document.getElementById('lrConfCode').value,document.getElementById('OwnerKey').value,0,t);
	return false;
}
function fSubmitNoteForm6Ind (sForm) {
	if (sForm==null) {
		sForm='formNote_'+$('oKey').value+'_'+$('Seq').value;
	}

	$(sForm).onsubmit();
}
function fSubmitNoteForm6(sForm) {

	//try {I_FinishEditing()}catch(e){alert(E);}
	
	if (document.getElementById('Note').value.length == 0) {
		alert ("You must enter a note");
		document.getElementById('Note').focus();
		document.getElementById('Note').select();
		return false;
	}		
	if (document.getElementById('Note').value.length > 4000) {
		alert ("A note name cannot exceed 4000 characters");
		document.getElementById('Note').focus();
		document.getElementById('Note').select();
		return false;
	}	
	//document.getElementById('UpdProgressBarNotes').style.display='';
	document.getElementById('UpdNoteInd').value=1;
	//fProcessNoteForURL('Note');
	
	var oKey=$('oKey').value;
	var Sid=$('Sid').value;
	//var sDest=$('Dest').value;
	//fRedisplayNotes(oKey,Sid,$('NType').value,$('divNotesContainer').parentNode.id,closeOpt)
	var sDest=$('divNotesContainer').parentNode.id;
	if (sForm==null) {
		sForm='formNote_'+$('oKey').value+'_'+$('Seq').value;
	}
	
	
	if ($('NType').value==11 || $('NType').value==10 || $('NType').value==12 || $('NType').value==112 || $('NType').value==115 || $('NType').value==20 || $('NType').value==21 ) {
		sDest=$('divNoteRowsUnique_'+$('NType').value).parentNode.parentNode.id;
	}
	
	//if (lPD_MIFL==6882) {alert (sDest)}
	
	if ($('NType').value=='115') {
		var msgid='Note';
		fTweet(msgid,115,$('Seq').value);		
		ValidatefEmpApprov(sForm,'UpdInd',sDest);
	}
	else 	{
		if ($('NType').value==12 || $('NType').value==112) {
			ValidatefEmpApprov(sForm,'UpdInd',sDest);
		} else {
			//ValidatefEmpApprov(sForm,'UpdInd',sDest,'fRedisplayNotes()',null,1);
			ValidatefEmpApprov(sForm,'UpdInd',sDest);
		}
	}
		
	//ValidatefEmpApprov(sForm,'UpdInd',sDest,'fRedisplayNotes()',null,1);
	//ValidatefEmpApprov(sForm,'UpdInd',sDest);
	
	return false;
}
function fSubmitNoteForm6INIT() {
 
	if (document.getElementById('NoteINIT').value.length == 0) {
		alert ("You must enter a note");
		document.getElementById('NoteINIT').focus();
		document.getElementById('NoteINIT').select();
		return false;
	}		
	if (document.getElementById('NoteINIT').value.length > 4000) {
		alert ("A note name cannot exceed 4000 characters");
		document.getElementById('NoteINIT').focus();
		document.getElementById('NoteINIT').select();
		return false;
	}	
	//document.getElementById('UpdProgressBarNotes').style.display='';
	document.getElementById('UpdNoteIndINIT').value=1;
	
	var oKey=$('oKeyINIT').value;
	var Sid=$('SidINIT').value;
	var sDest=$('DestINIT').value;
	
	var sForm='formNote_'+$('oKeyINIT').value+'_'+$('SeqINIT').value;
	
	ValidatefEmpApprov(sForm,'UpdIndINIT',sDest,'fRedisplayNotes()');
	
	return false;
}
function fRedisplayNotes(oKey,Sid,iType,dest,closeOpt) {
	
	if (oKey==null) {
		if ($('oKey')!=null) {
			var oKey=$('oKey').value;
			var Sid=$('Sid').value;
			var iType=$('NType').value;
		}
		else	{
			var oKey=$('oKeyINIT').value;
			var Sid=$('SidINIT').value;
			var iType=$('TypeINIT').value;			
		}
	}

	if ($('divDetailNotes')!=null && dest==null) {
		var dest=$('divDetailNotes').parentNode.id;
	}
	
	if ($('divNoteRows')!=null && dest==null) {
		if ($('divNoteRows').parentNode.id!=null) {
			var dest=$('divNoteRows').parentNode.id;
		}
	}	
		
	if (dest==null) {
		if ($('divWeb')!=null) {
			dest='divWeb';
		}
		else	{
			dest='divNoteRows';
		}
	}
	
	if (iType==15) {
		dest='divNoteRows';
	}
	
	DisplayAjaxPage(0,dest,'CP6NOTEROW','','','&type='+iType+'&sid='+Sid+'&rid='+oKey+'&co='+closeOpt,'',1,'')
}
function fCheckForEdit(dest) {
	if (dest==null) {
		dest='divNoteRows';
	}
	if ($(dest)!=null) {
		if ($(dest).innerHTML.indexOf('{HTMLEDIT}')>0) {
			$(dest).innerHTML=$(dest).innerHTML.replace('{HTMLEDIT}','');
			fSimpleEditInit();
		}
	}
	fCreateSimpleEditor();
}
function UpdateProjectType(val) {
	if (val==0 || val==1 || val==2 || val==3 || val==5) {
		document.getElementById('isProject').value=1;
		document.getElementById('ProjectList').style.display='';
	}
 	else	{
		document.getElementById('isProject').value='';
		document.getElementById('ProjectList').style.display='none';
	}
}
function ToggleClass (fid) {
	
	var elem=document.getElementById(fid)
	if (elem.className.indexOf('DCCLASSOFF')<0) {
		elem.className=elem.className+'DCCLASSOFF';
	}
	else {
		elem.className=elem.className.replace('DCCLASSOFF','');
	}
}
function fSetFolderOptions(mode) {
	if (mode==0) {
		$('aSaveOption').style.display='';
		$('aCancelOption').style.display='';
		$('aSortOption').style.display='none';
	}
	else	{
		$('aSaveOption').style.display='none';
		$('aCancelOption').style.display='none';
		$('aSortOption').style.display='';		
	}
}
function ToggleElement(elem,uclass,uClassType,event) {
if (SortingMode==1) {
		return;
}
if (SortingMode==2) {
		SortingMode=0;
		return;
}
if (uClassType==null) {
	uClassType='div';
}
if (uclass=='') {
	uclass=null;
	uClassType=null;
}
	
if (uclass!=null) {
	var pars = document.getElementsByTagName(uClassType);
	for (var i=0;i<pars.length;i++) {
		sID=pars[i].id;
		sCN=pars[i].className;
		if (sID.indexOf(uclass+'_')==0 || sCN.indexOf(uclass)==0) {
			pars[i].style.display='none';
		}
	}
	var e=document.getElementById(elem);
	e.style.display='';
	
	}	

else {
	if (document.getElementById(elem)!=null) {
		var e=document.getElementById(elem);
			if (e.style.display=='none') {
				e.style.display='';
				}
			else	{
				e.style.display='none';
			}
			if (event!=null) {
				event.cancelBubble=true;
			}		
		}
	}
}	
function SubCompanySearch(cn,url) {
	var n=document.getElementById(cn);
	self.location=url+'&cn='+n.value;
}
function vApproveForm(Mode) {
	document.getElementById('Upd').value=Mode;
	document.getElementById('DCApprovedPeople').submit();
}
function DoNameSearch(objId,dest,targetId,bTargetId,Options,Mode,iflEmailMode) {
	var iOptions;
	var iMode;
	var iIflEmailMode;
	
	if (iflEmailMode!=null) {
		iIflEmailMode=iflEmailMode;
		}
	else	{
		iIflEmailMode=0;
	}
	if (Options!=null) {
		iOptions=document.getElementById(Options).value;
		}
	else	{
		iOptions=0;
	}
	if (Mode!=null) {
		iMode=document.getElementById(Mode).value;
		}
	else	{
		iMode=0;
	}	
	obj=document.getElementById(objId);
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_NameSearch.asp?marketcode=' + lPD_MarketCode + '&confcode='+lPD_ConfCode + '&ns='+obj.value+'&t='+targetId+'&bt='+bTargetId+'&o='+iOptions+'&m='+iMode+'&iflEmailMode='+iIflEmailMode+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	
	clearTimeout(DoNameSearchTimer);
	if (obj.value.length>0 && obj.value!='Leave a comment...') {
		DoNameSearchTimer=window.setTimeout("AjaxSimpleCheck('"+ajaxscript+"', '','"+dest+"',1,'true');",500);
	}
}
function DoTagSearch(objId,WhatType,dest,mc) {
	
	if (mc==null) {
		mc=lPD_MarketCode;
	}
	
	obj=document.getElementById(objId);
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_TagSearch.asp?parId='+dest+'&dest='+objId+'&mc=' + mc + '&ns='+obj.value+'&Wt='+WhatType+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	
	$(objId).setAttribute( "autocomplete", "off" )
	clearTimeout(DoTagSearchTimer);
	if (obj.value.length>0 && obj.value!='Add a Tag?') {
		DoTagSearchTimer=window.setTimeout("AjaxSimpleCheck('"+ajaxscript+"', '','"+dest+"',1,'true');",500);
	}
}
function navContacts(a,cs,dir,type,ct) {

	var lCP=0;

	var myc=document.getElementById('MyContacts').innerHTML.split(',');
	for (i=0;i<myc.length;i++) {
		if (myc[i]==cs) {
			lCP=i;
		}
	}

	if (dir==1) {
		if (lCP-1<1) {
			lCP=myc.length;
		}
		else	{
			lCP=lCP-1;
			}	
		}
	else	{
		if (lCP+1==myc.length) {
			lCP=0;
		}
		else	{
			lCP=lCP+1;
		}
	}
	if (type==1) {
		dIProfile(myc[lCP],1,ct);	
		}
	else	{
		ContactForm(myc[lCP],'divIProfile')	;
	}
}
function DSelectProfile(ifl,name,tdest,bdest) {
	obj=document.getElementById(tdest);
	obj.value=name;
	obj2=document.getElementById(bdest);
	obj2.value=ifl;
}
function ClearField(id) {
	document.getElementById(id).value='';
}
function UploadContacts() {
	if (document.getElementById('ContactsList').value.length<1) {
		alert ("You must enter at least one email to add");
		document.getElementById('ContactsList').select();
		document.getElementById('ContactsList').focus();
		return false;
	}
		
	document.getElementById('SJUpd').value='1';
}
function UpdateWallMsg(mifl,mtype,uniqueid,gmifl,WhoFrom,Friend,MyDoing) {
	
		if (Friend==null) {
		var Friend=''
	}
	
	if (mifl==null) {
		var mifl=''
	}
	if (mtype==null) {
		var mtype=0
	}	
	
	var fid="formDCWallMsg"+mtype+uniqueid
	var uid="UpdInd"+mtype+uniqueid
	var umid="UpdMsg"+mtype+uniqueid
	tid="Type"+mtype+uniqueid
	var msgid="WMessage"+mtype+uniqueid
	var CBid="CBID"+mtype+uniqueid
	var usid="UpdInd"+mtype+uniqueid
	var iSeqId="Seq"+mtype+uniqueid
	
	if (document.getElementById(msgid).value.length==0) {
		alert ('You did not enter a message ('+msgid+')');
		document.getElementById(msgid).select();
		document.getElementById(msgid).focus();
		return false;		
	}
	if (document.getElementById(msgid).value.length>5000) {
		alert ('Your Message cannot exceed 5000 characters');
		document.getElementById(msgid).select();
		document.getElementById(msgid).focus();
		return false;		
	}

	document.getElementById(uid).value=1;
	
	if (document.getElementById(CBid).value.length>0) {
		umid='SerIDContainer_'+uniqueid;
		iCbid=document.getElementById(CBid).value;
		}
	else {
		iCbid=-1;
	}
	
	if (WhoFrom==4) {
		if (Friend=='1' || Friend=='2') {
			ValidatefEmpApprov(fid,usid,'LeaveMessage');	
		}
		else	{
			ValidatefEmpApprov(fid,usid,umid,"dDoing('"+document.getElementById(tid).value+"','"+gmifl+"','"+uniqueid+"','"+iCbid+"','"+MyDoing+"')");	
		}
	}
	else	{
		if (Friend=='1' || Friend=='2') {
			ValidatefEmpApprov(fid,usid,'LeaveMessage');	
		}
		else	{
			if (mtype==1) {
				ValidatefEmpApprov(fid,usid,umid,"dDoing('"+document.getElementById(tid).value+"','"+gmifl+"','"+uniqueid+"','"+iCbid+"','"+MyDoing+"')");	
			}
			else	{
				if (document.getElementById(msgid).value.length>140) {
					alert ('Your Status Update Message cannot exceed 140 characters');
					document.getElementById(msgid).select();
					document.getElementById(msgid).focus();
					return false;		
				}					
				ValidatefEmpApprov(fid,usid,umid,"dDoing('"+document.getElementById(tid).value+"','"+mifl+"','"+uniqueid+"','"+iCbid+"','"+MyDoing+"')");	
				fTweet(msgid,0,$(iSeqId).value);
			}
		}
	}
	
	return false;	
}
function fTweet(msgid,tweetType,tID) {
	
	if ($('tweet_type')==null || $('tweet_ID')==null || $('tweet_textarea')==null ||$('sign_out_container')==null) {
		return false;
	}
	$('tweet_type').value=tweetType;
	$('tweet_ID').value=tID;
	if ($('sign_out_container').style.display!='none') {
		$('tweet_textarea').value=$(msgid).value;
		$('tweet_tools_button').click();
	}
}		
function DelWikiAutoVersionRecord(seq,mifl) {
	var x=window.confirm("You are about to delete the selected versioning record\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}	
	var rid="WAV_" + seq
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_WikiAutoVersionDelete.asp?seq='+seq+'&mifl='+mifl+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '','divGnrlAjax',1);	
	PuffId(rid)
}
function DelWallMsg(seq,mtype,cid) {
	
	if (cid==null) {
		cid='liIDContainer_'+seq;
	}
	var rid='WM'+seq;
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_DeleteWallMsg.asp?seq='+seq+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '','divGnrlAjax',1);	
	if ($(cid)!=null) {
		PuffId(cid);
		$(cid).parentNode.removeChild($(cid));
	}
	else	{
		PuffId(rid)
		$(rid).parentNode.removeChild($(rid));
	}
}
function delContributor(wid,cid) {
	var rid="WM" + cid
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_WikiDeleteContributor.asp?wid='+wid+'&cid='+cid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '','divGnrlAjax',1);	
	PuffId(rid)	
}
function PuffId(id) {
	new Effect.Puff(id);
}
function EditWallMsg(seq,mtype) {
	var sid='Seq'+mtype
	var msgid='Message'+mtype
	var fid="formDCWallMsg"+mtype
	document.getElementById(sid).value=seq;
	document.getElementById(msgid).value=document.getElementById('Message'+seq).innerHTML;
}
function ClearWallMsg(seq,mtype) {
	var sid='Seq'+mtype
	var msgid='Message'+mtype	
	var fid="formDCWallMsg"+mtype

	document.getElementById(sid).value=0;
	document.getElementById(msgid).value='';
}
function dDoing(ftype,mifl,uniqueid,iCbid,MyDoing) {
	if (ftype==null) {
		var ftype=0;
	}
	var nForm=1
	if (mifl==null) {
		var mifl='';
	}	
	if (uniqueid==null) {
		var uniqueid=0
	}
	if (iCbid!=-1) {
		var ldo='SerIDContainer_'+iCbid;
	}
	else	{
		var ldo='WhatAmIDoing';
	}
	var tempid='divDoing0'+uniqueid
	if (document.getElementById(tempid)!=null) {
		if (document.getElementById(tempid).parentNode.id=='divDoing1') {
			var ldo='LeaveMessage';
			var ldo='divDoing0'+uniqueid
			ftype=1;
			nForm=0;
		}
	}

	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_WallMsgMaint.asp?uid='+uniqueid+'&mm=1&nform='+nForm+'&mifl='+mifl+'&t='+ftype+'&cbid='+iCbid+'&MyDoing='+MyDoing+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '',ldo,1,'true','fCheckForTwitter(\''+uniqueid+'\')');
}
function fCheckForTwitter(uid) {
	if ($('EvaloAuth'+uid)!=null) {
		eval ($('EvaloAuth'+uid).value);
	}
}
function UploadFilesAjax() {
	ValidatefEmpApprov('formDCUploads','DCUUpd','DCUUpdMsg');	
	return false;	
}
function UploadContactsAjax() {
	if (document.getElementById('ContactsList').value.length<1) {
		alert ("You must enter at least one email to add");
		document.getElementById('ContactsList').select();
		document.getElementById('ContactsList').focus();
		return false;
	}
	
//	if (l_sp!='54' && lPDGC_GCAdminType!=2) {
//		var caa=document.getElementById('ContactsList').value.split('\n');
//		if (caa.length>100) {
//			alert ("Sorry, you have exceeded the maximum contacts to add at one time, you are limited to 100 contacts at one time");
//			document.getElementById('ContactsList').select();
//			document.getElementById('ContactsList').focus();
//			return false;	
//		}
//	}
		
	if (document.getElementById('AjaxInd')!=null) {
		document.getElementById('AjaxInd').innerHTML='<img src=/DC_Images/silk_icons/AjaxProcesBar.gif />';
	}
	if (l_sp!='54') {
		ValidatefEmpApprov('formDCContact','SJUpd','divJoinGroupContacts');	
	}
	else {
		ValidatefEmpApprov('formDCContact','SJUpd','UpdMsg','ShowContactsSource(0)');	
	}
	
	return false;	
}
function NewCssRotate(id) {
	var dd=document.getElementById(id);
	var cnt;
	cnt=dd.selectedIndex+1;
	if (cnt==dd.options.length) {
		cnt=0;
		dd.selectedIndex=0;
		}
	else	{
		dd.selectedIndex=cnt;
	}
	var x=NewCSS(dd.options[dd.selectedIndex].value);
}	
		
function NewCSS (Style) {
	document.getElementById('DC4CssIdAlternate').href=Style;
}
function P5_SubForm() {
	document.getElementById('EditWebPage').onsubmit();
	P5_WebPageEditForm();
	document.getElementById('EditWebPage').submit();
}	
function P5_WebPageEditForm () {

	if (document.getElementById('Title').value.length <1) {
		alert ("You must enter a name for your web page");
		return false;
	}
	if (document.getElementById('Title').value.length >250) {
		alert ("Your web page name may not exceed 250 characters");
		return false;
	}	

	if (document.getElementById('PageHTML').value.length <1) {
		alert ("You have not entered data for a web page");
		return false;
	}	
		
	document.getElementById('P5Upd').value="1";
}
function ChooseSuperFind(val) {
	document.getElementById('FindCollaborations').style.display='none';
	document.getElementById('FindPages').style.display='none';
	document.getElementById('FindPeople').style.display='none';
	document.getElementById('FindWeb').style.display='none';
	document.getElementById('FindWIKI').style.display='none';

	document.getElementById('divPostSearch').innerHTML='';
	document.getElementById(val).style.display='';
}
function SendToSearchEngine(val) {
	window.open('http://search.msn.com/results.aspx?q='+val+'&FORM=MSNH');
}
function CP5UpdateMimeTypeCB(id) {

	mtid="MT" + id;
	if (document.getElementById(mtid).checked) {
		document.getElementById(mtid).value=id;
		}
	else	{
		document.getElementById(mtid).value="";	
	}
}	
function CP5submitDirs() {

	if (document.getElementById('dGrpAssets').value=="0" && document.getElementById('dSiteAssets').value=="0") {
		alert ("You must have at least one type of assets set (Site or Group or both)");

		document.getElementById('dSiteAssets').focus();

		
		return;
	}
	document.MimeTypeForm.submit();
}
function CP5OpenPublish(cc,gc,ifl,mc) {
	if (mc==null || mc=='') {
		mc=lPD_MarketCode;
	}
	var x=window.open('/DC_Administrator_Pages/Upload/dc_filePublish.asp?marketcode='+mc+'&confcode='+cc+'&grpcode='+gc+'&ifl='+ifl,'DCAuxWinPublish','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=600,height=400,left=120,top=120');
}
function CP5ReturnFile(File,Dest) {
	x1=document.getElementById(Dest).value=File;
	
	if (document.getElementById('inpImgURL')!=null) {
		document.getElementById('divIFrame').style.display='none';
		document.getElementById('aCloseAvail').style.display='none';
		document.getElementById('aListAvail').style.display='';
	}
	else	{
		if ($('divAvailableFiles')!=null) {
			document.getElementById('divAvailableFiles').style.display='none';
			document.getElementById('aCloseAvail').style.display='none';
			document.getElementById('aListAvail').style.display='';
		}
		else	{
			CloseEmailWindow();
		}
	}
}
function CP5deleteFile(fid,rid) {
	var x=window.confirm("You are about to delete the selected picture\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}
	var ajaxscript = '/dc_includes/CP_DeleteMyPicture.asp?fid=' + fid + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	new Effect.Puff(rid);
	
}
function DelRSSFunc(id) {
	var x=window.confirm("You are about to delete the selected RSS Feed\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/cp5_DelRSS.asp?fid='+id+'&xc=' + ajaxTimeStamp+ajaxIncrement	;
	AjaxSimpleCheck(ajaxscript, '', 'divRSS',1,'');
	
	new Effect.Puff('rssContainer'+id);
	
	
}
function ValidateRSSFormInd(fid) {
	ValidateRSSForm(fid);
}
function ValidateRSSForm(fid) {
	if (document.getElementById('Title').value.length==0) {
		alert('Title is required');
		document.getElementById('Title').focus();
		document.getElementById('Title').select();
		return false;
	}
	if (document.getElementById('Title').value.length>50) {
		alert('Title may not exceed 50 characters');
		document.getElementById('Title').focus();
		document.getElementById('Title').select();
		return false;
	}
	if (document.getElementById('Description').value.length>500) {
		alert('Description may not exceed 500 characters');
		document.getElementById('Description').focus();
		document.getElementById('Description').select();
		return false;
	}	
	if (document.getElementById('Feed').value.length==0) {
		alert('Feed is required');
		document.getElementById('Feed').focus();
		document.getElementById('Feed').select();
		return false;
	}
	if (document.getElementById('Feed').value.length>2048) {
		alert('Feed may not exceed 2048 characters');
		document.getElementById('Feed').focus();
		document.getElementById('Feed').select();
		return false;
	}
	document.getElementById('Upd').value='1';
	document.getElementById('UpdProgressBar').style.display='';	
	//var nDest='RSSF'+fid
	var nDest='divRSSListContainer'
	
	ValidatefEmpApprov('formRSS','UpdInd',nDest);
	return false;
}	
	function DoGoogleJS() {
	   var e = document.createElement("script");
	   e.src = 'http://maps.google.com/maps?file=api&amp;v=2&amp;key='+lgk;
	   e.type="text/javascript";
	   document.getElementsByTagName("head")[0].appendChild(e);
	}
// Favicon.js - Change favicon dynamically [http://ajaxify.com/run/favicon].
// Copyright (c) 2006 Michael Mahemoff. Only works in Firefox and Opera.
// Background and MIT License notice at end of file, see the homepage for more.

// USAGE:
// * favicon.change("/icon/active.ico");  (Optional 2nd arg is new title.)
// * favicon.animate(new Array("icon1.ico", "icon2.ico", ...));
//     Tip: Use "" as the last element to make an empty icon between cycles.
//     To stop the animation, call change() and pass in the new arg.
//     (Optional 2nd arg is animation pause in millis, overwrites the default.)
// * favicon.defaultPause = 5000;

var favicon = {

// -- "PUBLIC" ----------------------------------------------------------------

defaultPause: 2000,

change: function(iconURL, optionalDocTitle) {
  clearTimeout(this.loopTimer);
  if (optionalDocTitle) {
    document.title = optionalDocTitle;
  }
  this.addLink(iconURL, true);
},

animate: function(iconSequence, optionalDelay) {
  this.preloadIcons(iconSequence);
  this.iconSequence = iconSequence;
  this.sequencePause = (optionalDelay) ?  optionalDelay : this.defaultPause;
  favicon.index = 0;
  favicon.change(iconSequence[0]);
  this.loopTimer = setInterval(function() {
    favicon.index = (favicon.index+1) % favicon.iconSequence.length;
    favicon.addLink(favicon.iconSequence[favicon.index], false);
  }, favicon.sequencePause);
},

// -- "PRIVATE" ---------------------------------------------------------------

loopTimer: null,

preloadIcons: function(iconSequence) {
  var dummyImageForPreloading = document.createElement("img");
  for (var i=0; i<iconSequence.length; i++) {
    dummyImageForPreloading.src = iconSequence[i];
  }
},

addLink: function(iconURL) {
  var link = document.createElement("link");
  link.type = "image/x-icon";
  link.rel = "shortcut icon";
  link.href = iconURL;
  this.removeLinkIfExists();
  this.docHead.appendChild(link);
},

removeLinkIfExists: function() {
  var links = this.docHead.getElementsByTagName("link");
  for (var i=0; i<links.length; i++) {
    var link = links[i];
    if (link.type=="image/x-icon" && link.rel=="shortcut icon") {
      this.docHead.removeChild(link);
      return; // Assuming only one match at most.
    }
  }
},

docHead:document.getElementsByTagName("head")[0]
}

// BACKGROUND
// The main point of this script is to give you a means of alerting the user
// something has happened while your application is in a background tab. Serves
// a similar task to notifications in the operating system taskbar. A secondary
// function is to support favicon animation.
//
// This script works by DOM manipulation. After a call, there will be exactly one
// "rel='icon'" link and one "rel='shortcut icon'" link under the head element.
// Both of these are required for portability reasons. It would be nice  (from
// a performance perspective) if we could just update an existing link, if it
// already exists, but it turns out we can't. Firefox (and others?) will ignore
// changes to the link's attributes; it's only interested in a new link being
// added. So we have to delete and re-add in all cases.

// LEGAL
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights 
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
// copies of the Software, and to permit persons to whom the Software is 
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE.

function copy_clip(meintext){
if (window.clipboardData){ 
window.clipboardData.setData("Text", meintext);
}else if (window.netscape){
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
if (!clip) return;

var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
if (!trans) return;

trans.addDataFlavor('text/unicode');

var str = new Object();
var len = new Object();

var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); 
var copytext=meintext; 
str.data=copytext; 
trans.setTransferData("text/unicode",str,copytext.length*2); 
var clipid=Components.interfaces.nsIClipboard;

if (!clip) return false; 
clip.setData(trans,null,clipid.kGlobalClipboard);

}
alert("Following info was copied to your clipboard:\n\n" + meintext);
return false;
}
function CP5WebPresence_DeleteForm() {
	var x=window.confirm("You have are about to delete this web page\n\n if correct, press OK, else CANCEL")
	if (x) {
		document.getElementById('Upd').value="2";
		document.EditWebPage.submit();
	}
}
function CP5WebPresence_EditForm () {

	document.EditWebPage.onsubmit();

	if (document.getElementById('Title').value.length < 1) {
		alert ("You Must Specify Title for this page");
		document.getElementById('Title').select();
		document.getElementById('Title').focus();		
		return;
	}	

	if (document.getElementById('Title').value.length > 250) {
		alert ("Title may not exceed 250 characters");
		document.getElementById('Title').select();
		document.getElementById('Title').focus();				
		return;
	}
	if (document.getElementById('PageHTML').value.length < 1) {
		alert ("You have not entered data for a web page");
		return;
	}	
	
	if (document.getElementById('Category').value.length>50) {		
		alert ("Category may not exceed 50 characters");
		document.getElementById('Category').select();
		document.getElementById('Category').focus();				
		return;
	}	
	if (document.getElementById('Title').value!=document.getElementById('OrigTitle').value && document.getElementById('Seq').value!='0') {
		var x=window.confirm("You have changed the title of this page, do you want to save this as a new page?\n\n if correct, press OK, else CANCEL")
		if (x) {
			document.getElementById('Seq').value='0';
		}	
	}
		
	document.getElementById('Upd').value="1";
	document.getElementById('SaveButton').disabled=true;
	document.getElementById('SaveButton').value="Please Wait...";
	
	document.EditWebPage.submit();
}	
function CP5WebPresence_GoToContent () {
	
	var url="?p=<%=l_p%>&af="+l_af+"&ConfCode=" + lPD_ConfCode + "&GrpCode=" + lPD_GrpCode + "&MarketCode="+lPD_MarketCode+"&NavDir=A&dcso="+lDC_DCSO+"&Seq=" + document.getElementById('GoTo').options[document.getElementById('GoTo').selectedIndex].value;
	self.location=url;
}
function CP5WebPresence_GoToNext () {
	
	if (document.getElementById('GoTo').selectedIndex == document.getElementById('GoTo').length-1) {
		document.getElementById('GoTo').selectedIndex=0;
		}
	else	{
		document.getElementById('GoTo').selectedIndex = document.getElementById('GoTo').selectedIndex + 1
	}

	CP5WebPresence_GoToContent();
}	
function CXTab(tab) {
	if (tab==0) {
		document.getElementById('divIProfile').style.display='none';
		document.getElementById('divDex').style.display='';
	}
	else	{
		document.getElementById('divIProfile').style.display='';
		document.getElementById('divDex').style.display='none';		
	}
}
function fHighlightSpecificRow (RowId,CBID) {
	if (document.getElementById(CBID).checked==true) {
		document.getElementById(RowId).className=document.getElementById(RowId).className.replace('fHSRClassOn','')
		document.getElementById(RowId).className=document.getElementById(RowId).className+' fHSRClassOn';
		}
	else {
		document.getElementById(RowId).className=document.getElementById(RowId).className.replace('fHSRClassOn','')
	}
}
function HidePanel(id) {
	if (document.getElementById(id)!=null) {
		document.getElementById(id).style.display='none';
	}
}	
function ShowPanel(id) {
	if (document.getElementById(id)!=null) {
		document.getElementById(id).style.display='';
	}
}
function ChangeEmailNotificationClass() {
	var lCibId;	
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		sCNClassName=pars[i].className;
		if (sCNClassName.indexOf('dmCheckBox')==0 && sCN.indexOf('dm_All')!=0) {
			lCibId='CIB'+sCN.replace('dm_','')
			if (pars[i].checked==true) {
				document.getElementById(lCibId).className='WizContainer fHSRClassOn';
			}
			else {
				document.getElementById(lCibId).className='WizContainer'				
			}
		}
	}
}

function ChangeClass (ClassIdPattern,NewClass,TType, Mode, btClassOut, btPat) {
	
	if (btPat==null) {
		btPat='';
	}

	if (Mode==1) {
		if (document.getElementById(ClassIdPattern)!=null) {
			document.getElementById(ClassIdPattern).className=NewClass;
		}
	}
	else {
		var pars = document.getElementsByTagName(TType);
		for (var i=0;i<pars.length;i++) {
			sCN=pars[i].className;
			sId=pars[i].id
			if ((btPat.length>0 && sId.indexOf(btPat)!=-1) || btPat.length==0) {
				if (sCN.indexOf(ClassIdPattern)>=0) {
					pars[i].className=NewClass;
				}
			}
		}
	}
}	
function ChangeClassCommBts (idBase,btPat,btClass) {
	
	if (btPat==null) {
		var btPatInId='btin';
		var btPatOutId='btout';
		var spBt=0;
		var spIdClass='';
	}
	else	{
		var btPatInId=btPat+'in';
		var btPatOutId=btPat+'out';
		var spBt=2;
	}
	
	if (btClass==null || btClass.length==0) {
		var btClassIn='BtIn';
		var btClassOut='BtOut';	
	}
	else	{
		var btClassIn=btClass+'In';
		var btClassOut=btClass+'Out';
	}	
	
	var outId=btPatOutId+idBase;
	var inId=btPatInId+idBase;
	
	ChangeClass (btClassOut,btClassOut+'NS','div', spBt, btClassOut, btPat)
	ChangeClass (btClassIn,btClassIn+'NS','div', spBt, btClassIn, btPat)
	
	ChangeClass (outId,btClassOut+'S','div', 1)
	ChangeClass (inId,btClassIn+'S','div', 1)
}
function isNumOrChar (InString)  {
	if(InString.length < 1) 
		return true;

  var iChars = "!@#$%^&*()+=[]\\\';,./{}|\":<>?";
  var l_SpecialCharacterFound = 0
  
  for (var i = 0; i < InString.length; i++) {
  	if (iChars.indexOf(InString.charAt(i)) != -1) {
	  	l_SpecialCharacterFound = 1;
	}
  }
	if (l_SpecialCharacterFound ) {
  		return false;
	 	}
	else {
		return true;
	}
}
function isNum (InString)  {
if(InString.length < 1) 
		return true;

  var iChars = "1234567890";
  var l_NonNumericFound = 0;
  
  for (var i = 0; i < InString.length; i++) {
  	if (iChars.indexOf(InString.charAt(i)) == -1) {
	  	l_NonNumericFound = 1;
	}
  }
	if (l_NonNumericFound) {
  		return false;
	 	}
	else {
		return true;
	}
}
function isValidEmail(InString)
{
if(InString.length < 1) 
		return true;
  var result = false
  var theStr = new String(InString)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function isValidPhoneNumber(InString)
{
	// Assume the phone number will be correct until proven otherwise...
//	var result = true;
//
//	if (InString.length != 0) {
//		if (InString.length != 12) {
//			result = false;
//		} else {
//			// Look for first "-". It must be at 4th position, which is index 3.
//			if (InString.indexOf("-", 3) != 3) {
//				result = false;
//			}
//			else{
//				// Look for the second "-". It must be at 8th position, which is index 7.
//				if (InString.indexOf("-", 7) != 7) {
//					result = false;
//				}
//				else {
//					// Make sure the rest of the input are numbers..
//					for (i=0; i < InString.length; i++) {
//						if ((i != 3) && (i != 7)) {
//							if (isNum(InString.charAt(i)) == false) {
//								result = false;
//							} // if (isNum(InString.charAt(i)) == false)
//						} // if ((i != 3) && (i != 7))
//					} // for (i=0; i < InString.length; i++)
//				} // if (InString.indexOf("-", 7) != 7)
//			} // if (InString.indexOf("-", 3) != 3)
//		} // if (InString.length != 12)
//	} // if (InString.length != 0)
//
//	return result;
}
function CloseIMWindow() {
	
	if (document.getElementById('IMInner')!=null) {
		document.getElementById('IMInner').innerHTML='';
	}
	//document.getElementById('IMContent').style.display='none';
	new Effect.BlindUp('IMContent');
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/cp5_ToggleIMFormDisplay.asp?xc='+ajaxTimeStamp+ajaxIncrement;
	ajaxDest='divGnrlIMInd';
	AjaxSimpleCheck(ajaxscript, '', ajaxDest,1);	
	//document.getElementById('divGnrlIMInd').innerHTML='NOIM';
	EnableBleeds(); 
}

/*
Floating Menu script-  Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"
var verticalpos="fromtop"

if (!document.layers)
document.write('</div>')

function DCFloatTopDiv()
{
	var startX = 0,
	startY = 0;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function()
	{
		if (verticalpos=="fromtop"){
		var pY = ns ? pageYOffset : document.body.scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y);
		}
		else{
		var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		ftlObj.y += (pY - startY - ftlObj.y);
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 0);
	}
	try {
		ftlObj = ml("divMailBGContainer");
	}
	catch(E) {
	}
	stayTopLeft();
}
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function fDisplaySmallCalSel(id,rdate) {
	if (rdate==null) {
		rdate='';
	}
	fHideSmallCalSel();
	sId='SMC_'+id;
	if (document.getElementById(sId)!=null) {
		document.getElementById(sId).style.display='';
		document.getElementById(sId).style.left=document.getElementById(id).offsetLeft + (document.getElementById(id).offsetWidth-1);
		document.getElementById(sId).style.top=document.getElementById(id).offsetTop-5;
		DisplayAjaxPage	(0,'SMC_'+id,'DCSmallCalendar','1','&SelCal=1&sessiondate='+rdate+'&SelId='+id,888,1,'fHighLightSmallCal(\'SMC_'+id+'\')')
	}
}
function fHighLightSmallCal(cid) {
	document.getElementById(cid).highlight();
}
function fHideByClass(hType,classn) {
		var pars = document.getElementsByTagName(hType);
		for (var i=0;i<pars.length;i++) {
			sCN=pars[i].className;
			if (sCN.indexOf(classn)==0) {
				pars[i].style.display='none';
				pars[i].innerHTML='';
			}
		}	
}
function fHideSmallCalSel() {
		var pars = document.getElementsByTagName('div');
		for (var i=0;i<pars.length;i++) {
			sCN=pars[i].className;
			if (sCN.indexOf('SMC')==0) {
				pars[i].style.display='none';
				pars[i].innerHTML='';
			}
		}	
}
function fHideSmallCalSel() {
		var pars = document.getElementsByTagName('div');
		for (var i=0;i<pars.length;i++) {
			sCN=pars[i].className;
			if (sCN.indexOf('SMC')==0) {
				pars[i].style.display='none';
				pars[i].innerHTML='';
			}
		}	
}
function fEditWikiForm1() {
	
	if (document.getElementById('Title').value.length==0) {
		alert ("Title is required");
		document.getElementById('Title').select();
		document.getElementById('Title').focus();
		return false;
	}	
	
	if (document.getElementById('Title').value.length>500) {
		alert ("Title may not exceed 500 characters");
		document.getElementById('Title').select();
		document.getElementById('Title').focus();
		return false;
	}

	if (document.getElementById('Purpose').value.length>2000) {
		alert ("Purpose may not exceed 2000 characters");
		document.getElementById('Purpose').select();
		document.getElementById('Purpose').focus();
		return false;
	}
	
	document.getElementById('WikiUpd').value='1';
}
function fEditWikiForm2() {
	
	document.getElementById('WikiUpd').value='1';
	var dest=$('wcdest').value;
	if (dest.length==0) {
		dest='divWeb';
	}
	
	if (document.getElementById('AjaxMode').value=='1') {
		document.getElementById('UpdProgressBar').style.display='';
		ValidatefEmpApprov('formWiki','WikiUpd',dest);
		return false;		
	}
}
function fEditWikiForm3Ind() {
	
	document.getElementById('formWiki').onsubmit();
	fEditWikiForm3();
	if (document.getElementById('WikiUpd').value=='1') {
		document.getElementById('formWiki').submit();
	}
}
function fEditWikiForm3() {

	if (document.getElementById('WikiPageTitle').value.length==0) {
		alert ("You must enter a title");
		document.getElementById('WikiPageTitle').select();
		document.getElementById('WikiPageTitle').focus();
		return false;
	}
	if (document.getElementById('WikiPageTitle').value.length>500) {
		alert ("Title cannot exceed 500 characters");
		document.getElementById('WikiPageTitle').select();
		document.getElementById('WikiPageTitle').focus();
		return false;
	}	
	
	if (document.getElementById('Content').value.length==0) {
		alert ("You must add content to your WIKI");
		document.getElementById('Content').select();
		document.getElementById('Content').focus();
		return false;
	}
	if (document.getElementById('Summary').value.length==0) {
		alert ("You must add a summary for your changes");
		document.getElementById('Summary').select();
		document.getElementById('Summary').focus();
		return false;
	}
	if (document.getElementById('Summary').value.length>2000) {
		alert ("Summary may not exceed 2000 characters");
		document.getElementById('Summary').select();
		document.getElementById('Summary').focus();
		return false;
	}						
	if (document.getElementById('isProject').value==1) {
		if (document.getElementById('DCProjectId').selectedIndex==0) {
			alert ("You must select a project for this WIKI special type");
			document.getElementById('isProject').select();
			return false;			
		}
	}	
	
	document.getElementById('WikiUpd').value='1';

}
function fEditGroupStep1() {

	if (document.getElementById('GroupName').value.length==0) {
		alert ("Group Name is required");
		document.getElementById('GroupName').select();
		document.getElementById('GroupName').focus();
		return false;
	}
	
	if (document.getElementById('GroupName').value.length>200) {
		alert ("Group Name cannot exceed 200 characters");
		document.getElementById('GroupName').select();
		document.getElementById('GroupName').focus();
		return false;
	}
	
	if (document.getElementById('Description').value.length>500) {
		alert ("Group Description may not exceed 500 characters");
		return false;
	}										

	document.getElementById('UpdInd').value='1';
}
function fEditGroupFeatures(am) {
	
	if (am==1) {
		document.getElementById('UpdProgressBar').style.display='';
		ValidatefEmpApprov('formGroupFeaturesp','UpdInd','GroupStep');
		return false;
	}
	else	{
		document.getElementById('UpdInd').value='1';
	}	
}
function fSortWikiArticles(wid) {
	// Temporary
	
	sId='divWikiPageList' 
	var sObject=document.getElementById(sId)
	
	var url='/dc_includes/cp5_wikisortupdate.asp?wid='+wid
	
	Sortable.create('ulSortWikiPageList',{tag:'li',
   onUpdate: function() {
   	new Ajax.Request(url, {
	   	method: "get",
     	parameters: {data:Sortable.serialize('ulSortWikiPageList','Tab_')}
     });
   }
	});
}
function serialize(container, name){
	alert(Sortable.serialize( container,{ name:name} ));
}
function SaveWIKITabMenus() {
	if ($('TabLayout').innerHTML.length==0) {
		alert ("You have not added any tabs... How can you eat your meat if you haven't finished your tabs? :-)");
		return false;
	}

	serializWikiTabs('TabLayout', 'divTab')
	
	$('WikiTabUpd').value='1';
}

function serializWikiTabs (container, name){
	var lCarrot='';
	$('TabMenuOrder').value=''
	
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('Tab_')==0) {
			document.getElementById('TabMenuOrder').value=document.getElementById('TabMenuOrder').value+lCarrot+sCN+'~'+Sortable.serialize( 'ul'+sCN,{name:name} )
			lCarrot='^';
			iCnt++;
		}
	}		
}
function removeTabElement(divNum) {
  var d = document.getElementById('TabLayout');
  var olddiv = document.getElementById(divNum);
  Sortable.destroy(olddiv);
  d.removeChild(olddiv);
}	
function addTabElement(Id1,eClass) {
  var ni = document.getElementById('TabLayout');
 
 	gNum=gNum+1;
  var num=gNum;
  
  var newdiv = document.createElement('div');
  var IdName = Id1+'_'+num;

//Create Tab Area  
  newdiv.setAttribute('id','div'+IdName);
  newdiv.className='Tab';
  newdiv.innerHTML='<input class="Title" title="You can change the name of the tab by simply typing the new name in the edit box" onmouseout="javascript:this.className=\'Title\'" onmouseover="javascript:this.className=\'Title Editing\'" onfocus="javascript:this.className=\'Editing\'" onblur="javascript:this.className=\'Title\'" type=text id="'+IdName+'" name=Tab value="New '+IdName+'"/>';
  ni.appendChild(newdiv);
  
//Create Function Area
  var newTooldiv = document.createElement('div');
  newTooldiv.setAttribute('id','divTool'+IdName);
  newTooldiv.className='Tool'+eClass; 
	lTools='<a href="javascript:removeTabElement(\''+ 'div'+IdName + '\');">[Delete]</a>'; 
	newTooldiv.innerHTML=lTools;
  newdiv.appendChild(newTooldiv);
  
//Create Menu DropArea Area  
  
  var newMenuContainerdiv = document.createElement('ul');
  newMenuContainerdiv.setAttribute('id','ul'+IdName);
  newMenuContainerdiv.className='MenuContainer';
  newdiv.appendChild(newMenuContainerdiv);
  
// Need at least one li to drop to  
  var newMenuContainerli = document.createElement('li');
  newMenuContainerli.setAttribute('id','li'+IdName);
  newMenuContainerli.className='ArticleItem FirstOne';
  newMenuContainerdiv.appendChild(newMenuContainerli);  
  
  Sortable.create('TabLayout',{tag:'div',overlap:'horizontal',constraint:'horizontal',Hoverclass:'TabRoll'});
	ManageWIKIMenuLists(1);
}
function addSiteTabElement(Id1,eClass) {
  var ni = document.getElementById('TabLayout');
 
 	gNum=gNum+1;
  var num=gNum;
  
  var newdiv = document.createElement('div');
  var IdName = Id1+'_'+num;

//Create Tab Area  
  newdiv.setAttribute('id','div'+num);
  newdiv.className='Tab';
  sInnerHTML='<input class="Title" title="You can change the name of the tab by simply typing the new name in the edit box" onmouseout="javascript:this.className=\'Title\'" onmouseover="javascript:this.className=\'Title Editing\'" onfocus="javascript:this.className=\'Editing\'" onblur="javascript:this.className=\'Title\'" type=text id="div'+IdName+'" name=Tab value="New '+IdName+'"/>';
  sInnerHTML=sInnerHTML+'<input id="lid_'+num+'" name="lid" value="0" type="hidden"/>'
  newdiv.innerHTML=sInnerHTML;
  ni.appendChild(newdiv);
  
//Create Function Area
  var newTooldiv = document.createElement('div');
  newTooldiv.setAttribute('id','divTool'+num);
  newTooldiv.className='Tool'+eClass; 
	lTools='<a href="javascript:removeTabElement(\''+ 'div'+num+ '\');">[Delete]</a>'; 
	newTooldiv.innerHTML=lTools;
  newdiv.appendChild(newTooldiv);
  
	ManageTabsOrder();
	SaveLinkTabMenus();
}
function ManageTabsOrder() {
	Sortable.destroy('TabLayout')
	var pars = document.getElementsByTagName('ul');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('ulTab_')==0) {
			Sortable.destroy(sCN);
			iCnt++;
		}
	}	
	Sortable.create('TabLayout',{tag:'div',overlap:'horizontal',constraint:'horizontal',Hoverclass:'TabRoll'});
}	
function ManageWIKIMenuLists(f) {
	
	var pars = document.getElementsByTagName('ul');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('ulTab_')==0) {
			tids[iCnt]=sCN;
			iCnt++;
		}
	}
	
	for (i=0;i<iCnt;i++) {
		sAllTids=sAllTids+sComma+'\''+tids[i]+'\'';
		sComma=',';
	}
	
	for (i=0;i<iCnt;i++) {
		Sortable.create(tids[i], 
			{containment: ['+sAllTids+','ulSortWikiPageList'], dropOnEmpty: true});
	}			
	var nExec="Sortable.create('ulSortWikiPageList', {containment: ["+sAllTids+",'ulSortWikiPageList'], dropOnEmpty: true});"
	eval(nExec);
	
	if (f==null) {
		alert ('You are ready to begin organizing your tab categories.  Simply drag and drop from the list to a tab or move items between tabs')
	}
}
function EditChooseWebTemplate(f) {
	if (document.getElementById('LayOut').value.length==0) {
		alert("You Must Choose A Template by clicking one of the available images");
		return false;
	}
	
	document.getElementById('LOUpdInd').value='1';
	f.submit();
	
}
function ChooseWebTemplate(pid) {
	
	document.getElementById('LayOut').value=pid;
	
}
function SubmitGroupWizStep2Form(am) {

	if (document.getElementById('MarketCode')!=null) {
		if (document.getElementById('MarketCode').value.length<1) {
			alert ("Market Code is required")
			document.getElementById('MarketCode').select();
			document.getElementById('MarketCode').focus();
			return false;
		}
	}
	if (document.getElementById('MarketCode')!=null) {	
		if (document.getElementById('MarketCode').value.length>16) {
			alert ("Market Code cannot exceed 16 characters")
			document.getElementById('MarketCode').select();
			document.getElementById('MarketCode').focus();
			return false;
		}
	}

	if (document.getElementById('GrpCode').value.length<1) {
		alert ("Group Code is required")
		document.getElementById('GrpCode').select();
		document.getElementById('GrpCode').focus();
		return false;
	}
	
	if (document.getElementById('GrpCode').value.length>16) {
		alert ("Grp Code cannot exceed 16 characters")
		document.getElementById('GrpCode').select();
		document.getElementById('GrpCode').focus();
		return false;
	}	
	
	if (document.getElementById('GroupName').value.length<1) {
		alert ("Group Name is required")
		document.getElementById('GroupName').select();
		document.getElementById('GroupName').focus();
		return false;
	}
	
	if (document.getElementById('GroupName').value.length>200) {
		alert ("Group Name cannot exceed 200 characters")
		document.getElementById('GroupName').select();
		document.getElementById('GroupName').focus();
		return false;
	}
	
	if (document.getElementById('Addr1').value.length<1) {
		alert ("Address 1 is required")
		document.getElementById('Addr1').select();
		document.getElementById('Addr1').focus();
		return false;
	}	
	if (document.getElementById('Addr1').value.length>255) {
		alert ("Address 2 may not exceed 255 characters")
		document.getElementById('Addr1').select();
		document.getElementById('Addr1').focus();
		return false;
	}		
	if (document.getElementById('Addr2').value.length>255) {
		alert ("Address 2 may not exceed 255 characters")
		document.getElementById('Addr2').select();
		document.getElementById('Addr2').focus();
		return false;
	}	
	if (document.getElementById('Addr3').value.length>255) {
		alert ("Address 3 may not exceed 255 characters")
		document.getElementById('Addr3').select();
		document.getElementById('Addr3').focus();
		return false;
	}			
	
	if (document.getElementById('City').value.length<1) {
		alert ("City 1 is required")
		document.getElementById('City').select();
		document.getElementById('City').focus();
		return false;
	}	
	if (document.getElementById('City').value.length>255) {
		alert ("City cannot exceed 255 characters")
		document.getElementById('City').select();
		document.getElementById('City').focus();
		return false;
	}	
	
	
	if (document.getElementById('ContactEmail1').value.length<1) {
		alert ("Contact Email is required")
		document.getElementById('ContactEmail1').select();
		document.getElementById('ContactEmail1').focus();
		return false;
	}
	
	if (document.getElementById('ContactEmail1').value.length>255) {
		alert ("Contact Email 1 cannot exceed 128 characters")
		document.getElementById('ContactEmail1').select();
		document.getElementById('ContactEmail1').focus();
		return false;
	}	
	
	if (document.getElementById('ContactEmail2').value.length>255) {
		alert ("Contact Email 2 cannot exceed 50 characters")
		document.getElementById('ContactEmail2').select();
		document.getElementById('ContactEmail2').focus();
		return false;
	}		
	
	if (document.getElementById('MasterCommunityTitle').value.length>50) {
		alert ("Master Community Title cannot exceed 50 characters")
		document.getElementById('MasterCommunityTitle').select();
		document.getElementById('MasterCommunityTitle').focus();
		return false;
	}
	if (document.getElementById('MasterCommunityDest').value.length>255) {
		alert ("DC Site Template cannot exceed 255 characters")
		document.getElementById('MasterCommunityDest').select();
		document.getElementById('MasterCommunityDest').focus();
		return false;
	}
	var sURL=document.getElementById('MasterCommunityDest').value.toUpperCase();
	if (sURL.length>0 && sURL.indexOf('HTTP')!=0) {
		alert ("You must begin the NON DC URL with: http or https")
		document.getElementById('MasterCommunityDest').select();
		document.getElementById('MasterCommunityDest').focus();
		return false;
	}			
	if (document.getElementById('MasterCSS').value.length>255) {
		alert ("Master Style/CSS cannot exceed 255 characters")
		document.getElementById('MasterCSS').select();
		document.getElementById('MasterCSS').focus();
		return false;
	}	
	
	if (document.getElementById('MasterCommunityTemplateCode').value.length>16) {
		alert ("Master Template cannot exceed 16 characters")
		document.getElementById('MasterCommunityTemplateCode').select();
		document.getElementById('MasterCommunityTemplateCode').focus();
		return false;
	}				

	if (am==1) {
		document.getElementById('UpdProgressBar').style.display='';
		ValidatefEmpApprov('formGroupEdit','UpdInd','divGroupEdit');
		return false;
	}
	else	{
		document.getElementById('UpdInd').value='1';
	}
}
function DelSecurityFunc(seq) {
	var x=window.confirm("You are about to delete an Administrator\n\n if correct, press OK, else CANCEL")
	if (!x) {
		return;
	}
	var sRowId='AdminRow_'+seq;
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/cp5_TenantDeleteAdmin.asp?seq='+seq+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff(sRowId);	
}

function EditSecurityFunc(AttEMail, RingLevel,PrimeContact) {
	
	document.getElementById('AttEMail').value=AttEMail;
	
	for (i=0;i<document.getElementById('UserRingLevel').options.length;i++) {
		if (document.getElementById('UserRingLevel').options[i].value==RingLevel) {
			document.getElementById('UserRingLevel').selectedIndex=i;
		}
	}
	
	if (PrimeContact=='True') {
		document.getElementById('PrimeContact').value=1;
		document.getElementById('PrimeContact').checked=true;
		}
	else	{
		document.getElementById('PrimeContact').value=0;
		document.getElementById('PrimeContact').checked=false;
	}
	
	alert ("You are ready to edit your selected Administrator");
	document.getElementById('formSecurity').highlight();
	
}

function ValidateSecurityLoginForm(am) {

	if (document.getElementById('AttEMail').value.length < 1) {
		alert ("You must enter a valid Digital Concourse email address to continue");
		document.getElementById('AttEMail').focus();
		document.getElementById('AttEMail').select();
		return false;
	}
	
//	if (!isValidEmail(document.getElementById('AttEMail').value)) {
//		alert ("You must enter a valid Digital Concourse email address to continue (xxx@.com)");
//		document.getElementById('AttEMail').focus();
//		document.getElementById('AttEMail').select();
//		return false;
//	}	

	if (document.getElementById('UserRingLevel').value == 0) {
		alert ("You must select a security level for this user to continue");
		document.getElementById('UserRingLevel').focus();
		return false;
	}
	if (am==1) {
		document.getElementById('UpdProgressBar').style.display='';
		ValidatefEmpApprov("formSecurity","UpdInd","divCAContainer");	
		return false;			
	}
	else	{
		document.getElementById('SaveButton').disabled=true;
		document.getElementById('SaveButton').value="Please Wait...";
		document.getElementById('UpdInd').value="1";
	}

}
function ClearSecurityFields() {
	document.getElementById('AttEMail').value='';
	document.getElementById('UserRingLevel').selectedIndex=0;
	document.getElementById('PrimeContact').checked=false;
	document.getElementById('PrimeContact').value=0;
}
function UpdateCCV(val,cid,rid) {
	
	var CCode=document.getElementById(cid);
	var row=document.getElementById(rid);
	if (val==-1) {
		row.style.display='';
		CCode.value='';
	}
	else	{
		row.style.display='none';
		CCode.value=val;
		}
}
function SwitchCSS (ctrl) {
	var Style=document.getElementById(ctrl).options[document.getElementById(ctrl).selectedIndex].value;
	document.getElementById('DC4CssIdAlternate').href=Style;
	Initializesubmenus_horizontal();
	if (isIE!=1) {
		SetHorzMenu();
	}	
}
function NextCss(ctrl) {

	if (document.getElementById(ctrl).selectedIndex<document.getElementById(ctrl).options.length-1) {
		document.getElementById(ctrl).selectedIndex=document.getElementById(ctrl).selectedIndex+1;
		}
	else {
		document.getElementById(ctrl).selectedIndex=document.getElementById(ctrl).selectedIndex=0;
	}
	var Style=document.getElementById(ctrl).options[document.getElementById(ctrl).selectedIndex].value;
	document.getElementById('DC4CssIdAlternate').href=Style;
	
	Initializesubmenus_horizontal();
	if (isIE!=1) {
		SetHorzMenu();
	}
}
function WebSiteValidate(xMode) {
	if (xMode==null) {
		var xMode=0;
	}
	
	if (document.getElementById('NewTitle').value.length>500) {
		alert ("Title cannot exceed 500 characters")
		document.getElementById('NewTitle').select();
		document.getElementById('NewTitle').focus();
		return false;
	}
	if (document.getElementById('NewTitle').value.length==0) {
		alert ("You must enter a Title")
		document.getElementById('NewTitle').select();
		document.getElementById('NewTitle').focus();
		return false;
	}	
					
	if (document.getElementById('GrpCode').value.length<1) {
		alert ("You must choose a valid group to add your site to")
		return false;
	}
	
	document.getElementById('UpdInd').value='1';	

}
function WebProjectBasicValidate(xMode) {
	if (xMode==null) {
		var xMode=0;
	}
	
	if (document.getElementById('DCProjectTitle').value.length>500) {
		alert ("Title cannot exceed 500 characters")
		document.getElementById('DCProjectTitle').select();
		document.getElementById('DCProjectTitle').focus();
		return false;
	}
	
	if (!isNum(document.getElementById('IssueLogId').value)) {
		alert ("Project Issues Log Id must be numeric");
		document.getElementById('IssueLogId').select();
		document.getElementById('IssueLogId').focus();
		return false;	
	}					
	
	if (xMode=1) {
		document.getElementById('UpdProgressBar').style.display='';
		ValidatefEmpApprov("formDCProjManage","UpdInd","divProjBasics");	
		return false;		
	}
	else	{
		document.getElementById('UpdInd').value='1';	
	}
}
function SelectWebWizGrp(val) {
	if (val.indexOf('~')==0) {
		return;
	}
	sArray=val.split('~');
	document.getElementById('GrpCode').value=sArray[0];
	document.getElementById('GrpId').value=sArray[1];
}
function WebSiteWiz0Validate() {
	if (document.getElementById('GrpCode').value.length<1) {
		alert ("You must choose a valid group to add your site to")
		document.getElementById('selGrps').focus();
		return false;
	}			
}
function WebPageListDelWebPage(ConfCode, Seq) {

var x=window.confirm("You are about to delete Web Page: " + Seq + "\n\n if correct, press OK, else CANCEL");
if (!x) {
	return;
}
	document.getElementById('Upd').value="1";
	document.getElementById('Seq').value=Seq;
	if (document.getElementById('Type').value=="1") {
		document.getElementById('ConfCode').value="";
	}
	document.DCForm.submit();

}
function WebPageListSortOrder(SO,Dir,sid,gid,l) {
	DisplayAjaxPage(0,'divWeb','DCWEBPAGELISTAtom','','','&l='+l+'&sid='+sid+'&gid='+gid+'&so='+SO+'&dir='+Dir,'1');
}
function WebPageListByLetter(SO,Dir,sid,gid,l) {
	DisplayAjaxPage(0,'divWeb','DCWEBPAGELISTAtom','','','&l='+l+'&sid='+sid+'&gid='+gid+'&so='+SO+'&dir='+Dir,'1');
}

function DeckPageListByLetter(SO,Dir,sid,gid,l,did) {
	DisplayAjaxPage(0,'divAvailPages','DCDeckPageListAtom','','','&l='+l+'&sid='+sid+'&gid='+gid+'&so='+SO+'&did='+did+'&dir='+Dir,'1','fPageDeckDragDropInit()');
}
function WebLinkListByLetter(SO,Dir,sid,gid,l,oSid) {
	
	if (document.getElementById('LetterDest')!=null) {
		if (document.getElementById('LetterDest').value.length>0) {
			var sDest=document.getElementById('LetterDest').value;
		}
	}
	if (sDest==null) {
		var sDest='divWeb';
	}
	if (sDest=='divWeb') {
		DisplayAjaxPage(0,sDest,'DCWEBLinkLISTAtom','','','&dest='+sDest+'&l='+l+'&oSid='+oSid+'&sid='+sid+'&gid='+gid+'&so='+SO+'&dir='+Dir,'1');
	}
	else	{
		DisplayAjaxPage(0,sDest,'DCWEBLINKLISTDUPFUNCTION','','','&dest='+sDest+'&l='+l+'&oSid='+oSid+'&sid='+sid+'&gid='+gid+'&so='+SO+'&dir='+Dir,'1');
	}
}
function WebPageListForm() {
	ValidatefEmpApprov("WPLForm","wplfUpd","divWeb");	
	return false;		
}	
function WebPageListSearch(mode) {
	if (mode==1) {
		document.getElementById('Search').value='';
	}	
	
	ValidatefEmpApprov("WebPageSearchForm","wpsupd","divWeb");	
	return false;		
}
function WebSiteValidateBasicSave() {
	WebSiteValidateBasic();
}
function WebSiteValidateBasic() {
	
	if (document.getElementById('NewTitle').value.length<1) {
		alert ("You must have a title for your site")
		document.getElementById('NewTitle').select();
		document.getElementById('NewTitle').focus();
		return false;
	}
	
	if (document.getElementById('NewTitle').value.length>500) {
		alert ("Title may not exceed 500 characters")
		document.getElementById('NewTitle').select();
		document.getElementById('NewTitle').focus();
		return false;
	}

	if (document.getElementById('Description').value.length>500) {
		alert ("Description may not exceed 2000 characters")
		document.getElementById('Description').select();
		document.getElementById('Description').focus();
		return false;
	}
	if (document.getElementById('Style').value==0 && document.getElementById('EventType')==0) {
		if (document.getElementById('Location').value.length > 255) {
			alert ("Location cannot exceed 255 characters");
			document.getElementById('Location').focus();
			document.getElementById('Location').select();	
			return false;
		}
		if (document.getElementById('BuildingName').value.length > 128) {
			alert ("Building Name cannot exceed 128 characters");
			document.getElementById('BuildingName').focus();
			document.getElementById('AdBuildingNamedr1').select();	
			return false;
		}	
		if (document.getElementById('Addr1').value.length > 128) {
			alert ("Addr1 cannot exceed 128 characters");
			document.getElementById('Addr1').focus();
			document.getElementById('Addr1').select();	
			return false;
		}
		if (document.getElementById('Addr2').value.length > 128) {
			alert ("Addr2 cannot exceed 128 characters");
			document.getElementById('Addr2').focus();
			document.getElementById('Addr2').select();	
			return false;
		}	
		if (document.getElementById('Addr3').value.length > 128) {
			alert ("Addr3 cannot exceed 128 characters");
			document.getElementById('Addr3').focus();
			document.getElementById('Addr3').select();	
			return false;
		}		
		if (document.getElementById('City').value.length > 128) {
			alert ("City cannot exceed 128 characters");
			document.getElementById('City').focus();
			document.getElementById('City').select();	
			return false;
		}
		if (document.getElementById('State').value.length > 50) {
			alert ("State cannot exceed 50 characters");
			document.getElementById('State').focus();
			document.getElementById('State').select();	
			return false;
		}
		
		if (document.getElementById('ZipCode').value.length > 16) {
			alert ("Zip Code cannot exceed 16 characters");
			document.getElementById('ZipCode').focus();
			document.getElementById('ZipCode').select();	
			return false;
		}
	
		if (document.getElementById('AcceptCC')!=null) {
			if (document.getElementById('AcceptCC').checked) {
				if (document.getElementById('PayPalID').value.length < 1) {
					if (document.getElementById('MerchantID').value.length < 1 && document.getElementById('MerchantPWD').value.length < 1){
						alert("PayPal ID or DC Payment Information must be provided");
						document.getElementById('PayPalID').focus();
						document.getElementById('PayPalID').select();	
						return false;
					}
					if (document.getElementById('MerchantID').value.length > 1) {
						if (document.getElementById('MerchantPWD').value.length < 1){
							alert("DC Payment Password Information must be provided");
							document.getElementById('MerchantPWD').focus();
							document.getElementById('MerchantPWD').select();
							return false;
						}
					}
					if (document.getElementById('MerchantPWD').value.length > 1) {
						if (document.getElementById('MerchantID').value.length < 1){
							alert("DC Payment User Information must be provided");
							document.getElementById('MerchantID').focus();
							document.getElementById('MerchantID').select();
							return false;
						}
					}	
				}	
			}	
		}
		
		if (document.getElementById('PostDestinationURL')!=null) {
			if (document.getElementById('PostDestinationURL').value.length>250) {
				alert ("Post Destination URL may not exceed 250 characters")
				document.getElementById('PostDestinationURL').select();
				document.getElementById('PostDestinationURL').focus();
				return false;
			}		
		}
		
		if (document.getElementById('StartDate')) {
			splitDate = document.getElementById('StartDate').value.split("/");
			l_StartDate_x= new Date(splitDate[2],splitDate[0],splitDate[1]);
		
			splitDate = document.getElementById('EndDate').value.split("/");
			l_EndDate_x= new Date(splitDate[2],splitDate[0],splitDate[1])	;
	
			if (l_StartDate_x > l_EndDate_x) {
				alert ("Start Date cannot be greater then End Date");
				document.getElementById('StartDate').focus();
				document.getElementById('StartDate').select();	
				return false;
			}
	
			if (document.getElementById('RegStart')!=null) {
				splitDate = document.getElementById('RegStart').value.split("/");
				l_RegStart_x= new Date(splitDate[2],splitDate[0],splitDate[1]);
			
				splitDate = document.getElementById('RegEnd').value.split("/");
				l_RegEnd_x= new Date(splitDate[2],splitDate[0],splitDate[1])	;
		
				if (l_RegStart_x > l_RegEnd_x) {
					alert ("Registration Start Date cannot be greater then Registration End Date");
					document.getElementById('RegStart').focus();
					document.getElementById('RegStart').select();	
					return false;
				}
				if (l_RegStart_x > l_EndDate_x) {
					alert ("Registration Start Date cannot be greater then Event End Date");
					document.getElementById('RegStart').focus();
					document.getElementById('RegStart').select();	
					return false;
				}			
				if (l_RegEnd_x > l_EndDate_x) {
					alert ("Registration End Date cannot be greater then Event End Date");
					document.getElementById('RegEnd').focus();
					document.getElementById('RegEnd').select();	
					return false;
				}			
			}
		}
	}
	if (document.getElementById('DailyTime')!=null) {
		if (document.getElementById('DailyTime').value.length>500) {
			alert ("Daily Time cannot exceed 500 characters");	
			document.getElementById('DailyTime').focus();
			document.getElementById('DailyTime').select();	
			return false;		
		}
	}

	if (document.getElementById('LocnURL')!=null) {
		var sURL=document.getElementById('LocnURL').value.toUpperCase();
		if (sURL.length>0 && sURL.indexOf('HTTP')!=0) {	
			alert ("Location URL must begin with http or https and must be a valid URL");	
			document.getElementById('LocnURL').focus();
			document.getElementById('LocnURL').select();	
			return false;					
		}
	}
	
	if (document.getElementById('MapURL')!=null) {
		var sURL=document.getElementById('MapURL').value.toUpperCase();
		if (sURL.length>0 && sURL.indexOf('HTTP')!=0) {			
			alert ("Map URL must begin with http or https and must be a valid URL");	
			document.getElementById('MapURL').focus();
			document.getElementById('MapURL').select();	
			return false;					
		}
	}	
	
	if (document.getElementById('LocalWeatherURL')!=null) {
		var sURL=document.getElementById('LocalWeatherURL').value.toUpperCase();
		if (sURL.length>0 && sURL.indexOf('HTTP')!=0) {				
			alert ("Local Weather URL must begin with http or https and must be a valid URL");	
			document.getElementById('LocalWeatherURL').focus();
			document.getElementById('LocalWeatherURL').select();	
			return false;					
		}
	}		
		
	if (document.getElementById('DefSiteAccessCode').value.length>16) {
		if (document.getElementById('AdvContainer').style.display=='none') {
			document.getElementById('AdvContainer').style.display='';
		}		
		alert ("Default Site Access Code cannot exceed 16 characters")
		document.getElementById('DefSiteAccessCode').select();
		document.getElementById('DefSiteAccessCode').focus();
		return false;
	}
	if (document.getElementById('AltEgoPrefix').value.length>50) {
		if (document.getElementById('AdvContainer').style.display=='none') {
			document.getElementById('AdvContainer').style.display='';
		}		
		alert ("Alter Ego/Alter User Id cannot exceed 50 characters")
		document.getElementById('AltEgoPrefix').select();
		document.getElementById('AltEgoPrefix').focus();
		return false;
	}	
					
	if (document.getElementById('AlternateCSS').value.length>2000) {
		if (document.getElementById('AdvContainer').style.display=='none') {
			document.getElementById('AdvContainer').style.display='';
		}		
		alert ("Alternate CSS may not exceed 2000 characters")
		document.getElementById('AlternateCSS').select();
		document.getElementById('AlternateCSS').focus();
		return false;
	}
	
	if (document.getElementById('MetaTags').value.length>4000) {
		if (document.getElementById('AdvContainer').style.display=='none') {
			document.getElementById('AdvContainer').style.display='';
		}		
		alert ("Meta Tags may not exceed 2000 characters")
		document.getElementById('MetaTags').select();
		document.getElementById('MetaTags').focus();
		return false;
	}
	
	if (document.getElementById('GoogleAnalyticSrc').value.length>1000) {
		if (document.getElementById('AdvContainer').style.display=='none') {
			document.getElementById('AdvContainer').style.display='';
		}		
		alert ("Google Analytic Source may not exceed 1000 characters")
		document.getElementById('GoogleAnalyticSrc').select();
		document.getElementById('GoogleAnalyticSrc').focus();
		return false;
	}	
	
	if (document.getElementById('FavIcoSrc').value.length>255) {
		if (document.getElementById('AdvContainer').style.display=='none') {
			document.getElementById('AdvContainer').style.display='';
		}
		alert ("FAVICO may not exceed 1000 characters")
		document.getElementById('FavIcoSrc').select();
		document.getElementById('FavIcoSrc').focus();
		return false;
	}
	if (document.getElementById('FavIcoSrc').value.indexOf('.ico')==-1 && document.getElementById('FavIcoSrc').value.length>0) {
		if (document.getElementById('AdvContainer').style.display=='none') {
			document.getElementById('AdvContainer').style.display='';
		}		
		alert ("FAVICO Must be a .ICO file")
		document.getElementById('FavIcoSrc').select();
		document.getElementById('FavIcoSrc').focus();
		return false;
	}	
	document.getElementById('UpdProgressBar').style.display='';
	if (document.getElementById('UpdMessage')!=null) {
		document.getElementById('UpdMessage').style.display='none';
	}
	
	if (document.getElementById('SaveAsTemplate')!=null) {
		if (document.getElementById('SaveAsTemplate').checked) {
			if (document.getElementById('TemplateCategory').selectedIndex==0) {
				alert ("You must select a template category if you are to save as a template")
				document.getElementById('TemplateCategory').select();
				return false;
			}
		}
	}	

	ValidatefEmpApprov("DCWebWiz","UpdInd","divWeb","fUpdWebSiteBasicOptions();");	
	return false;		
}
function fUpdWebSiteBasicOptions() {

	for (i=0;i<document.getElementById('Style').options.length;i++) {
		if (document.getElementById('Style').options[i].value==document.getElementById('SelStyle').value) {
			document.getElementById('Style').selectedIndex=i;
		}
	}
	if (document.getElementById('EmailConfTemplate')!=null) {
		for (i=0;i<document.getElementById('EmailConfTemplate').options.length;i++) {
			if (document.getElementById('EmailConfTemplate').options[i].value==document.getElementById('EmailConfTemplateVal').value) {
				document.getElementById('EmailConfTemplate').selectedIndex=i;
			}
		}
	}	
	WBUpdProfileDiv();
}
function DoMessage(msg) {
	alert (msg);
}
function WebPageDelete(sid,mode,eA1id,eA2id) {
	
	var x=window.confirm('You are about to delete the page('+sid+')\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}	
	if (mode==null) {
		mode=0;
	}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebPageDelete.asp?sid='+sid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	if (mode==0) {
		new Effect.Puff('WPID_'+sid)
		document.getElementById('WrkArea_'+sid).innerHTML='';
	}
	if (mode==1) {
		document.getElementById(eA1id).className='StdNew';
		document.getElementById(eA2id).className='DisplayNone';
	}	
	
}
function WebSiteDelete (sid,gid,confcode) {
	
	var x=window.confirm('You are about to delete this site ('+sid+')\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}		
	
	var SubProcessJS='fRedisplayGroupInfo(\''+sid+'\',\''+gid+'\',\''+confcode+'\')';

	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebSoftDelete.asp?sid='+sid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true',SubProcessJS);
	
	new Effect.Puff('WSRow_'+sid)	
}
function fRedisplayGroupInfo(sid,gid,confcode) {
	dSimpleAjax('divAdminList','/dc_includes/cp6_AdminLists.asp?p=210&sp=2021&confcode='+confcode+'&ajaxmode=1&gid='+gid);
}
function GroupSoftDelete (gid) {
	
	var x=window.confirm('You are about to delete this Group('+gid+')\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}		

	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_GroupSoftDelete.asp?sid='+gid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	alert ("Group Deleted, Please reselect a new area to administer");	
}
function WebChangeStatus (sid,statusVal) {

	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebStatusChange.asp?statusVal='+statusVal+'&sid='+sid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function WebToggleDefaultSite (elem,sid) {
	
	var pars = document.getElementsByTagName('img');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('ActiveImage_')==0) {
			pars[i].src='../DC_Images/DC_CheckBoxOff.gif';
		}
	}		
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	

	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebToggleDefault.asp?sid='+sid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function SiteAccessEmailFlag (elemId) {
	var elem=document.getElementById(elemId);
	if (elem.disabled!=true) {
		elem.checked=true;
		elem.value=1;
	}
	
}
function SiteAccessBuildEmailNotifications(mode) {
	var emailList='';
	var sComma='';
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if ((sCN.indexOf('EmailSent_')==0)) {
			if (pars[i].disabled!=true && pars[i].checked==true) {
				var sIdA=sCN.split('_');
				var sId=sIdA[1];
				if (mode==1 && document.getElementById('Access1_'+sId).checked) {
					emailList=emailList+sComma+document.getElementById('Emails_'+sId).value;
					sComma=',';
				}
				if (mode==0 && document.getElementById('Access0_'+sId).checked) {
					emailList=emailList+sComma+document.getElementById('Emails_'+sId).value;
					sComma=',';
				}
				if (mode==2) {
					emailList=emailList+sComma+document.getElementById('Emails_'+sId).value;
					sComma=',';
				}
			}
		}
	}		
	 
	document.getElementById('Emails').value=emailList;
	
	if (document.getElementById('Emails').value.length==0) {
		alert ("You must select at least one person to notify")
		return;
	}
	
	if (mode==1) {
		document.getElementById('DCEmailForms').action='?p=210&sp=5027&confcode='+lPD_ConfCode+'&se=1';
	}
	if (mode==0) {
		document.getElementById('DCEmailForms').action='?p=210&sp=5028&confcode='+lPD_ConfCode+'&se=1';
	}
	if (mode==2) {
		document.getElementById('DCEmailForms').action='?p=210&sp=5029&confcode='+lPD_ConfCode+'&se=1';
	}	
	document.getElementById('DCEmailForms').submit();
}	
function SiteAccessToggle(elem,sid,mifl,UseAltEgo,bsid,accessLevel) {
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_SiteAccessToggle.asp?bsid='+bsid+'&sid='+sid+'&mifl='+mifl+'&UseAltEgo='+UseAltEgo+'&al='+accessLevel+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'AE_'+mifl,1,'true');
	
}
function SiteAccessDelete(seq,elemid) {
var x=window.confirm("You are about to delete an access\n\n if correct, press OK, else CANCEL")
if (!x) {
	return;
}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_SiteAccessDelete.asp?seq='+seq+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff(elemid)
	
}
function fAddSiteAccessMass() {
	
	var sDest=$('divEvtRegs').parentNode.id;
	ValidatefEmpApprov("formNewEmails","UpdInd",sDest);	
	return false;		
}
function WebHomePageToggle(elem,pageid,sid) {
	
	var pars = document.getElementsByTagName('img');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('HomeImage_')==0) {
			pars[i].src='/dc_Images/silk_icons/application_homedim.png';
		}
	}		
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_Images/silk_icons/application_homedim.png';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebToggleHomePage.asp?sid='+sid+'&pageid='+pageid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function DefaultQuestionDisplayToggle(elem,qid) {
	
//	var pars = document.getElementsByTagName('img');
//	for (var i=0;i<pars.length;i++) {
//		sCN=pars[i].id
//		if (sCN.indexOf('DefQuestImage_')==0) {
//			pars[i].src='/dc_Images/DC_CheckBoxOff.gif';
//		}
//	}		
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_Images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebToggleDefaultQuestion.asp?qid='+qid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function WebPageListToggleActive(elem,sid) {
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebToggleActive.asp?sid='+sid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function ShowUnassignedLinks(sid) {
	//SetUpSorts();
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebLinkShowUnassign.asp?sid='+sid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divUnassigned',1,'true','SetUpSorts()');	
}
function SetUpSorts() {
	Sortable.create('ul_0',{tree:true,scroll:window,dropOnEmpty: true})
//	Sortable.create('UALinks',{tree:true,dropOnEmpty: true})	
	
	fWebLinkDragDrop()
}
function WebLinkUnassign(lid,mode,parentid) {
	
	if (mode==null) {
		mode=0;
	}

// DC will check and alert for children
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebLinkUnassign.asp?lid='+lid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	if (mode==0) {
		new Effect.Puff('liWl_'+lid);
		document.getElementById('liWl_'+lid).innerHTML='';
		$('liWl_'+lid).parentNode.removeChild($('liWl_'+lid));
	}
	else	{
		document.getElementById('TA').innerHTML='Unassigned';
	}
}
function WebLinkListToggleActive(elem,lid) {
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebLinkToggleActive.asp?lid='+lid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function PricingToggle(elem,pid,mode) {
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_TogglePricing.asp?mode='+mode+'&pid='+pid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function fDBOptionsToggle(elem,sid,mode) {
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_ToggleDBOptions.asp?Mode='+mode+'&sid='+sid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function WebEditPage(sid) {
	var WA='WrkArea_'+sid;
	var WPAeditor=document.getElementById('WPEditor');
	
  WPAeditor.appendChild(WA);	
	
}			
function WebProjWiz2Validate(f) {
	
	if (document.getElementById('DCProjectTitle').value.length < 1) {
		alert ("You Must Specify Project Title");
		document.getElementById('DCProjectTitle').select();
		document.getElementById('DCProjectTitle').focus();		
		return false;
	}
	
	if (document.getElementById('DCProjectTitle').value.length>500) {
		alert ("Project Title cannot exceed 500 characters");
		document.getElementById('DCProjectTitle').select();
		document.getElementById('DCProjectTitle').focus();		
		return false;
	}
	
	document.getElementById('UpdInd').value='1';
	
	f.submit();
}
function WebPageEditSave () {
	
	if (document.getElementById('Title').value.length < 1) {
		alert ("You Must Specify Title for this page");
		document.getElementById('Title').select();
		document.getElementById('Title').focus();		
		return false;
	}	

	if (document.getElementById('Title').value.length > 250) {
		alert ("Title may not exceed 250 characters");
		document.getElementById('Title').select();
		document.getElementById('Title').focus();				
		return false;
	}
	if (document.getElementById('PageHTML').value.length < 1) {
		alert ("You have not entered data for a web page");
		return false;
	}	
	
	if (document.getElementById('Category').value.length>50) {		
		alert ("Category may not exceed 50 characters");
		document.getElementById('Category').select();
		document.getElementById('Category').focus();				
		return false;
	}	
	if (document.getElementById('Title').value!=document.getElementById('OrigTitle').value && document.getElementById('Seq').value!='0') {
		var x=window.confirm("You have changed the title of this page, do you want to save this as a new page?\n\n if correct, press OK, else CANCEL")
		if (x) {
			document.getElementById('Seq').value='0';
		}	
	}
	document.getElementById('UpdProgressBar').style.display='';
	document.getElementById('UpdInd').value='1';
}
function fUpdateProjTrackAlertsInd(fid) {
	fUpdateProjTrackAlerts(fid);
}	
function fUpdateProjTrackAlerts(fid) { 
	document.getElementById('UpdProgressBar').style.display='';
	ValidatefEmpApprov(fid,'UpdInd','divProjectMasters');
	return false;
}
function fProjAssignmentInd(fid) {
	fProjAssignment (fid);
}
function fProjAssignment (fid) {
	document.getElementById('UpdProgressBarRA').style.display='';
	ValidatefEmpApprov('formResourceAssignment','UpdIndRA','ContainerProjProj');
	return false;
}
function fProjSingleAssignment () {
	var sIdAssign='inpAss_'+document.getElementById('Dest').value;
	if ($(sIdAssign).value.length==0) {
		alert ('You must specify an email address to complete the assignment');
		$(sIdAssign).select();
		$(sIdAssign).focus();				
		return false;		
	}
	
	var dest='UpdProgressBarRA_'+document.getElementById('Dest').value;
	var UpdInd='UpdIndRA_'+document.getElementById('Dest').value;
	var formId='formResourceAssignment_'+document.getElementById('Dest').value;
	
	document.getElementById(dest).style.display='';
	ValidatefEmpApprov(formId,UpdInd,dest);
	return false;	
}	
function WLinkOn(lid,event) {
	if (document.getElementById(lid)!=null) {
		document.getElementById(lid).style.display='';	
	}
	if (event!=null) {
		event.cancelBubble=true;
	}
}
function WLinkOff(lid,event) {
	if (document.getElementById(lid)!=null) {
		document.getElementById(lid).style.display='none';	
	}
	if (event!=null) {
		event.cancelBubble=true;
	}
}
function WebLinkDelFunc(lid,rid) {

var x=window.confirm("You are about to delete Link: " + lid + "\n\n if correct, press OK, else CANCEL")
if (!x) {
	return;
}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebLinkDelete.asp?lid='+lid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	if (rid!=null) {
		new Effect.Puff(rid);
		$(rid).parentNode.removeChild($(rid));
	}
	else	{
		new Effect.Puff('WLID_'+lid);
		
	}
	
	CloseByIdPattern('div','LE',0,1);
	ChangeClass ('EditTabSelected','Tab','div',0);
}
function fChangeClassByClass(elemId,targetClass,replaceClass) {
	pars=$(elemId).childNodes;
	for (i=0;i<pars.length;i++) {
		if (pars[i].className==targetClass) {
			pars[i].className=pars[i].className.replace(targetClass,replaceClass);
		}
	}
}
function fDelPricing(pid) {

var x=window.confirm("You are about to delete a pricing definition\n\n if correct, press OK, else CANCEL")
if (!x) {
	return;
}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_PricingDefinitionDelete.asp?pid='+pid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('PD_'+pid)
}
function fDuplicateLinksInd() {
	fDuplicateLinks();
}
function fDuplicateLinks() {
	var dest=document.getElementById('UpdRowDest').value;
	
	document.getElementById('DupLinksUpd').value=1;
	document.getElementById('UpdProgressBarLink').style.display='';	
	
	//document.getElementById('UpdProgressBar_'+document.getElementById('AssignmentId').value).style.display='';
	
	ValidatefEmpApprov('formDupLinks','UpdInd',dest);
	return false;		
}
function WebLinkDupFunction (mode) {
	if (mode==1) {
		document.getElementById('Search').value='';
	}
	var UpdRowDest=document.getElementById('UpdRowDest').value;
	ValidatefEmpApprov('formWebLinkSearch','WlUpd',UpdRowDest);
	return false;	
}
function WebLinkSearch(mode) {
	if (mode==1) {
		document.getElementById('Search').value='';
	}
	ValidatefEmpApprov('formWebLinkSearch','WlUpd','divWeb');
	return false;
}
function PricingSearch(mode) {
	if (mode==1) {
		document.getElementById('Search').value='';
	}
	ValidatefEmpApprov('formPricingSearch','WlUpd','divWeb');
	return false;
}
function SurveySearch(mode) {
	if (mode==1) {
		document.getElementById('Search').value='';
	}
	ValidatefEmpApprov('formSurveySearch','WlUpd','divWeb');
	return false;
}

function UpdateAuthBox(Col, Type) {
	
	if (Type==0) {
		id = Col + "_D";
		}
	else	{
		id = Col + "_R";
	}
	
	if (document.getElementById(id).checked == true) {
		document.getElementById(id).value = Col;
		}
	else	{
		document.getElementById(id).value = "";
	}

}
function AjaxSelUpd(updElemInput,updElemText,elem) {
	
	document.getElementById(updElemInput).value=elem.value;
	if (document.getElementById(updElemText)!=null) {
		document.getElementById(updElemText).innerHTML=elem[elem.selectedIndex].text;
	}
}
function WPMContentType(ctype) {
	document.getElementById('WebPageLinkRow').style.display='none';
	if (document.getElementById('divEditPage')!=null) {
		document.getElementById('divEditPage').style.display='none';
	}
	
	document.getElementById('LinkTypeRow').style.display='none';
	document.getElementById('StdLinkURLRow').style.display='none';
	if (document.getElementById('TemplateRow')!=null) {
		document.getElementById('TemplateRow').style.display='none';
	}
	if (ctype==0) {
		document.getElementById('WebPageLinkRow').style.display=''
		if (document.getElementById('divEditPage')!=null) {
			document.getElementById('divEditPage').style.display='';
		}		
		document.getElementById('Type').value=1;
		if (document.getElementById('TemplateRow')!=null) {
			document.getElementById('TemplateRow').style.display='';
		}
	}
	if (ctype==0) {
		document.getElementById('LinkTypeRow').style.display='none';
		document.getElementById('Type').value=1;
		document.getElementById('LinkType').value=0;
	}	
	if (ctype==1) {
		document.getElementById('LinkTypeRow').style.display='';
		document.getElementById('Type').value=1;
	}
	if (ctype==2) {
		document.getElementById('StdLinkURLRow').style.display='';
		document.getElementById('Type').value=4;
	}		
	document.getElementById('Operation').value=ctype;
}
function SaveLinkUpdate() {
	WebLinkValidateBasic();
}
function ClearTabEditArea() {
	if (document.getElementById('wLC_0')!=null) {
		document.getElementById('wLC_0').style.display='none';
		document.getElementById('wLC_0').innerHTML='';
	}
	if (document.getElementById('LE_0')!=null) {
		document.getElementById('LE_0').style.display='none';
		document.getElementById('LE_0').innerHTML='';
	}	
}
function SetTabEdit(lid) {
	//ClearTabEditArea();
	ChangeClass ('EditTabSelected','Tab','div',0);
	$('divTabLayOut_'+lid).className="Tab EditTabSelected";
	if ($('Name')!=null) {
		$('Name').value=$('divTab_'+lid).value;
	}
}
function WebLinkValidateBasic() {
	
	if (document.getElementById('Type').value == 0) {		
		if (document.getElementById('Name').value.length < 1) {
			alert ("You must specify a link name");		
			document.getElementById('Name').focus();
			document.getElementById('Name').select();
			return false;
		}
	}

	if (document.getElementById('Type').value == 0) {
		if (document.getElementById('Name').value.length > 255) {
			alert ("The Link name may not exceed 255 characters");
			document.getElementById('Name').focus();
			document.getElementById('Name').select();
			return false;
		}
	}

	if (document.getElementById('LinkDesc').value.length >2000) {
		alert ("Your description may not exceed 2000 characters");
		document.getElementById('LinkDesc').focus();
		document.getElementById('LinkDesc').select();
		return false;
	}	
	
	if (document.getElementById('ShortDesc').value.length >2000) {
		alert ("Your short description may not exceed 2000 characters");
		document.getElementById('ShortDesc').focus();
		document.getElementById('ShortDesc').select();
		return false;
	}	
	
	if (!isNum(document.getElementById('AbrTitle').value)) {
		alert ("Abreviate Title Integers must be numeric");
		document.getElementById('AbrTitle').select();
		document.getElementById('AbrTitle').focus();
		return;
	}			
	
	if (document.getElementById('Type').value==1 && document.getElementById('LinkType').value==0) {
		if (document.getElementById('WebPageLinkDD').options.selectedIndex == 0) {
			alert ("You must specify a Web Page");
			document.getElementById('WebPageLinkDD').select();
			return false;
		}
	}

	if (document.getElementById('AccessName').value.length >255) {
		alert ("Your Access Name may not exceed 255 characters");
		document.getElementById('AccessName').focus();
		document.getElementById('AccessName').select();
		return false;
	}
	
	var sDriverProfileTypeValue='';
	var sComma='';
	if (document.getElementById('DriverProfileTypeSel')!=null) {
		for (i=0;i<document.getElementById('DriverProfileTypeSel').options.length;i++) {
			if (document.getElementById('DriverProfileTypeSel').options[i].selected==true) {
				sDriverProfileTypeValue = sDriverProfileTypeValue+sComma+document.getElementById('DriverProfileTypeSel').options[i].value;
				sComma=',';
			}
		}
		document.getElementById('DPT').value=sDriverProfileTypeValue;
	}
	
	var sDriverMarketValue='';
	var sComma='';
	if (document.getElementById('DriverMarketSel')!=null) {
		for (i=0;i<document.getElementById('DriverMarketSel').options.length;i++) {
			if (document.getElementById('DriverMarketSel').options[i].selected) {
				sDriverMarketValue=sDriverMarketValue+sComma+document.getElementById('DriverMarketSel').options[i].value;
				sComma=',';
			}
		}
		document.getElementById('DMV').value=sDriverMarketValue;	
	}
	//if ((document.getElementById('Type').value == 1) || (document.getElementById('Type').value == 5)){
	//	document.getElementById('UD_URL').value = document.getElementById('WebPageLinkDD').options[document.getElementById('WebPageLinkDD').options.selectedIndex].value; 
	//	if (document.getElementById('Name').value.length == 0 && document.getElementById('SpecialMnuImage').value.length==0) {
	//		document.getElementById('Name').value = document.getElementById('WebPageLinkDD').options[document.getElementById('WebPageLinkDD').options.selectedIndex].text; 
	//	}
	//}
	if ($('Lcid')!=null) {
		var sId=$('Lcid').value
		var sTitleId='divTab_'+sId
		if ($(sTitleId)!=null) {
			$(sTitleId).value=$('Name').value;
		}
	}
	var sDest=document.getElementById('Dest').value;
	document.getElementById('UpdProgressBarLink').style.display='';	
	document.getElementById('WlinkUpd').value="1";
	ValidatefEmpApprov('formLinkMaint','WlinkUpd',sDest,'fLinkInit()');
	return false;	
}
function WebLinkSchedule() {

	if (document.getElementById('SchedContent').selectedIndex==0) {
		alert ("You must select an existing content item")
		document.getElementById('SchedContent').focus();
		return false;
	}
	
	if (document.getElementById('StartDate').value.length<1) {
		alert ("You must enter a Start Date")
		document.getElementById('StartDate').focus();	
		return false	
	}
	
	if (!isDate(document.getElementById('StartDate').value)) {
		document.getElementById('StartDate').focus();
		return false;
	}	
	if (!isDate(document.getElementById('EndDate').value)) {
		document.getElementById('EndDate').focus();
		return false;
	}	
	
	splitDate = document.getElementById('StartDate').value.split("/");
	l_StartDate_x= new Date(splitDate[2],splitDate[0],splitDate[1]);
	
	splitDate = document.getElementById('EndDate').value.split("/");
	l_EndDate_x= new Date(splitDate[2],splitDate[0],splitDate[1])	;

	if (l_StartDate_x > l_EndDate_x) {
		alert ("Start Date cannot be greater then End Date");
		document.getElementById('StartDate').focus();
		return false;
	}	
	
	var dest=document.getElementById('dest').value;	
	if (dest!=null) {
		var sDest=dest;
	}
	else	{
		var sDest='divWLSchedContainer';
	}
		
	document.getElementById('UpdProgressBarSched').style.display='';	
	document.getElementById('WlUpd').value=1;
	ValidatefEmpApprov('formWLSched','WlUpd',sDest);
	return false;	
}
function WebLinkScheduleDelete(lid) {

	var x=window.confirm("You are about to delete a Link Schedule: " + lid + "\n\n if correct, press OK, else CANCEL")
	if (!x) {
		return;
	}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebLinkSchedDel.asp?lid='+lid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('WLSRow_'+lid)
}	
function WebLinkListSchedToggleActive(elem,lid) {
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebSchedToggleActive.asp?lid='+lid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');	
}
function WebToggleSitePublic (elem,sid) {
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebSchedTogglePubPriv.asp?sid='+sid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');	
}
function WebLinkListSchedUpd(Seq, ChildContentId, StartDate,StartHH,StartMM,StartAMPM,EndDate,EndHH,EndMM,EndAMPM, Active) {

	document.getElementById('SchId').value=Seq;
	document.getElementById('StartDate').value=StartDate;
	document.getElementById('EndDate').value=EndDate;
	document.getElementById('SchedContent').value=ChildContentId;
	
	if (Active=="True") {
		document.getElementById('Active').value=1;
		document.getElementById('Active').checked=true;
		}
	else	{
		document.getElementById('Active').value=0;
		document.getElementById('Active').checked=false;
	}	
	
	for (i=0;i<document.getElementById("StartTimeHH").options.length;i++) {
		if (document.getElementById("StartTimeHH").options[i].value==StartHH) {
			document.getElementById("StartTimeHH").selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById("StartTimeMM").options.length;i++) {
		if (document.getElementById("StartTimeMM").options[i].value==StartMM) {
			document.getElementById("StartTimeMM").selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById("StartTimeAMPM").options.length;i++) {
		if (document.getElementById("StartTimeAMPM").options[i].value==StartAMPM) {
			document.getElementById("StartTimeAMPM").selectedIndex=i;
		}
	}	
	
	for (i=0;i<document.getElementById("EndTimeHH").options.length;i++) {
		if (document.getElementById("EndTimeHH").options[i].value==EndHH) {
			document.getElementById("EndTimeHH").selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById("EndTimeMM").options.length;i++) {
		if (document.getElementById("EndTimeMM").options[i].value==EndMM) {
			document.getElementById("EndTimeMM").selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById("EndTimeAMPM").options.length;i++) {
		if (document.getElementById("EndTimeAMPM").options[i].value==EndAMPM) {
			document.getElementById("EndTimeAMPM").selectedIndex=i;
		}
	}				

}
function WebLinkListSchedClearContent() {
	document.getElementById('SchedContent').value='';
	document.getElementById('StartDate').value='';
	document.getElementById('EndDate').value='';
	document.getElementById('Active').checked=true;
	document.getElementById('Active').value=1;
	document.getElementById('SchId').value='';
}
function SurveyValidateForm() {
	
	if (document.getElementById('Title').value.length==0) {
		alert ("You must enter a value for this field")
		document.getElementById('Title').select();
		document.getElementById('Title').focus();
		return false;
	}
	if (document.getElementById('Title').value.length>500) {
		alert ("Title cannot be greater than 500 characters");
		document.getElementById('Title').select();
		document.getElementById('Title').focus();
		return false;
	}	
	if (document.getElementById('StartDate').value.length==0) {
		alert ("You must enter a date here");
		document.getElementById('StartDate').select();
		document.getElementById('StartDate').focus();
		return false;
	}	
	if (isDate(document.getElementById('StartDate').value)==false){
		document.getElementById('StartDate').focus()
		document.getElementById('StartDate').select()		
		return false;
	}
		
	if (document.getElementById('EndDate').value.length==0) {
		alert ("You must enter a date here");
		document.getElementById('EndDate').select();
		document.getElementById('EndDate').focus();
		return false;
	}	
	
	if (isDate(document.getElementById('EndDate').value)==false){
		document.getElementById('EndDate').focus()
		document.getElementById('EndDate').select()		
		return false;
	}		
	
	splitDate = document.getElementById('StartDate').value.split("/");
	l_RegStart_x= new Date(splitDate[2],splitDate[0],splitDate[1]);
	
	splitDate = document.getElementById('EndDate').value.split("/");
	l_RegEnd_x= new Date(splitDate[2],splitDate[0],splitDate[1])	;

	if (l_RegStart_x > l_RegEnd_x) {
		alert ("Start Date cannot be greater then End Date");
		document.getElementById('StartDate').focus();
		document.getElementById('StartDate').select();	
		return false;
	}
	
	document.getElementById('survUpd').value='1';		
}
function WebSiteAddlOpts(elem) {
	
	if (document.getElementById('divEventOptions')==null) {
		return;
	}
	
	$('divDuplicateOptions').style.display='none';
	if (elem.selectedIndex!=0) {
		$('divDuplicateOptions').style.display='';
	}
	
	document.getElementById('divEventOptions').style.display='none'
	var aCC=elem.value.split('~');
	if (aCC[0]==0) {
		document.getElementById('divEventOptions').style.display='';
		document.getElementById('divEventOptionsMore').style.display='';
	}
	if (aCC[0]==1) {
		document.getElementById('divEventOptions').style.display='';
	}	
}
function SurvQuestUpdateStyleList(mode) {
	
	if (mode!=null) {
		if ($('divWizQuest1')!=null) {
			if ($('divWizQuest1').innerHTML.indexOf('{DBADD}')!=-1 && $('RefreshEval')!=null && mode==0) {
				$('divWizQuest1').innerHTML='<h3>Question Added - Refreshing</h3>';
				eval($('RefreshEval').value);
			}
		else {
			$('divWizQuest1').innerHTML=$('divWizQuest1').innerHTML.replace('{DBADD}',' - Please Continue Adding');
			}
		}
	}

	document.getElementById('EssayStyleOption').style.display='none';
	if (document.getElementById('DateStyleOption')!=null) {
		document.getElementById('DateStyleOption').style.display='none';
	}
	document.getElementById('StyleOption').style.display='none';
	document.getElementById('ListOption').style.display='none';
	document.getElementById('YearsOption').style.display='none';
	document.getElementById('divRequiredRow').style.display='none';
	document.getElementById('SizeXOption').style.display='none';
	document.getElementById('SizeYOption').style.display='none';
	document.getElementById('divDefault').style.display='';
	document.getElementById('LabelsAndRows').style.display='none';
	document.getElementById('QualTableDirection').style.display='none';
	document.getElementById('EditClassRow').style.display='none';
	document.getElementById('divAskHTML').style.display='none';
	
	if (document.getElementById('MDCols')!=null) {
		document.getElementById('MDCols').style.display='none';
	}	
	if (document.getElementById('divDisplayMode')!=null) {
		document.getElementById('divDisplayMode').style.display='none';
	}
	document.getElementById('QualTable').style.display='none';
	
	if (document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value == 2) {
		document.getElementById('QualTable').style.display = '';
		document.getElementById('LabelsAndRows').style.display='';
		document.getElementById('QualTableDirection').style.display='';
	}
	
	if (document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value == 22) {
		document.getElementById('QualTable').style.display = '';
		document.getElementById('MDCols').style.display = '';
		//document.getElementById('QualTableDirection').style.display='';
	}			
	
	if (document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value=='3') {
		document.getElementById('StyleOption').style.display='';
	}
	
	if (document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value=='8') {
		if (document.getElementById('DateStyleOption')!=null) {
			document.getElementById('DateStyleOption').style.display='';
		}
	}
		
	if (document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value=='4') {
		document.getElementById('EssayStyleOption').style.display='';
		document.getElementById('SizeXOption').style.display='';
		document.getElementById('SizeYOption').style.display='';
	}
	
	if (document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value=='7') {
		document.getElementById('EssayStyleOption').style.display='';
		document.getElementById('SizeXOption').style.display='';
		document.getElementById('divDefault').style.display='';
		document.getElementById('EditClassRow').style.display='';
	}	
		
	if (document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value=='3') {
		document.getElementById('ListOption').style.display='';
		if (document.getElementById('Style').options[document.getElementById('Style').selectedIndex].value==0 || document.getElementById('Style').options[document.getElementById('Style').selectedIndex].value==1) {
			document.getElementById('divDisplayMode').style.display='';
		}
	}
	
	if (document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value=='8' 
		&& document.getElementById('DateStyle').options[document.getElementById('DateStyle').selectedIndex].value=='3') {	
		document.getElementById('YearsOption').style.display='';
	}
	
	if (document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value!='9' 
		&& document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value!='10'
		&& document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value!='11'
		&& document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value!='12'
		&& document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value!='') {	
		document.getElementById('divRequiredRow').style.display='';
	}	
	
	if (document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value=='10' 
		|| document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value=='11') {	
		document.getElementById('LineTypeOption').style.display='';
	}	
	
	if (document.getElementById('Type').value=='15') {
		document.getElementById('divAskHTML').style.display='';
	}					

}
function SurvQuestValidateFormInd(mode) {
	SurvQuestValidateForm(mode);
}
function SurvQuestValidateForm(mode) {
	
	if (mode==null) {
		mode=0;
	}

//	if (mode==0
//		&& document.getElementById('WizQuestionText').value.length==0
//		&& document.getElementById('Type').selectedIndex==0) {
//		document.getElementById('WSUpd').value="3";
//		return true
//	}

	if (document.getElementById('WizQuestionText').value.length==0) {
		alert ("You must enter a value for this field")
		document.getElementById('WizQuestionText').select();
		document.getElementById('WizQuestionText').focus();
		return false
	}
	if (document.getElementById('WizQuestionText').value.length>500) {
		alert ("Your question cannot be greater than 500 characters");
		document.getElementById('WizQuestionText').select();
		document.getElementById('WizQuestionText').focus();
		return false
	}

	if (document.getElementById('Type').selectedIndex==0) {
		alert ("You must tell us how to render this question");
		document.getElementById('Type').focus();
		return false
	}	
	
	if (document.getElementById('Type').options[document.getElementById('Type').selectedIndex].value==3 && document.getElementById('List').value.length==0) {
		alert ("You must enter a list of options for a Multiple Choice survey question");
		document.getElementById('List').select();
		document.getElementById('List').focus();
		return false
	}	
	
	if (document.getElementById('YearsOption').style.display!='none') {
		if (!isNum (document.getElementById('BegYear').value)) {
			alert ("Beginning Year must be numeric")
			document.getElementById('BegYear').select();
			document.getElementById('BegYear').focus();
			return false
		}
		if (!isNum (document.getElementById('EndYear').value)) {
			alert ("End Year must be numeric")
			document.getElementById('EndYear').select();
			document.getElementById('EndYear').focus();
			return false
		}
	}
	
	if (document.getElementById('Adv')!=null) {
		if (document.getElementById('Adv').style.display=='') {
			if ((document.getElementById('SubCategory').value.length > 0) && (document.getElementById('Category').value.length < 1)) {
				alert ("Sub Categories must be associated with a Category, Please Enter a Category");
				document.getElementById('Category').focus();
				document.getElementById('Category').select();			
				return false;
			}	
		
			if ((document.getElementById('Category').value.length > 0) && (document.getElementById('SubCategory').value.length < 1)) {
				alert ("Sub Categories must be associated with a Category, Please Enter a SubCategory");
				document.getElementById('SubCategory').focus();
				document.getElementById('SubCategory').select();			
				return false;
			}	
		
			if (document.getElementById('Category').value.length > 200)  {
				alert ("Category Names may not exceed 200 characters");
				document.getElementById('Category').focus();
				document.getElementById('Category').select();			
				return false;
			}	
		
			if (document.getElementById('SubCategory').value.length > 200)  {
				alert ("Sub Category Names may not exceed 200 characters");
				document.getElementById('SubCategory').focus();
				document.getElementById('SubCategory').select();			
				return false;
			}	
		
			if (document.getElementById('Category').value.length>0) {
				if (document.getElementById('Category').value==document.getElementById('SubCategory').value) {
					alert ("Category and Sub Category Names may not match");
					document.getElementById('SubCategory').focus();
					document.getElementById('SubCategory').select();			
					return false;	
				}	
			}
		}
	}
	
	var pars = $('formSurveyQuest').getElementsByTagName('textarea');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].name.indexOf('ColList')==0) {
			pars[i].value=pars[i].value.replace(',','!!@@!!')
		}
	}		
	
	document.getElementById('UpdProgressBar').style.display='';	
	ValidatefEmpApprov('formSurveyQuest','WSUpd','divWizQuest1','SurvQuestUpdateStyleList('+mode+')');
	return false;			
}


function SurvQuestDelete(qid) {

	var x=window.confirm("You are about to delete a question: " + qid + "\n\n if correct, press OK, else CANCEL")
	if (!x) {
		return;
	}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_SurvQuestDel.asp?qid='+qid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('Q_'+qid)
}	
function SurvQuestDisableClass() {
	document.getElementById('EditClassAttr').style.display = "none";
	document.getElementById('divDefault').style.display = "";
	

	if (document.getElementById('EditType2').checked == true) {
		document.getElementById('EditClassAttr').style.display = "";
	}
	if (document.getElementById('EditType3').checked == true) {
		document.getElementById('divDefault').style.display = "none";
	}	
}
function SurvQuestToggle(elem,qid,mode) {
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_SurvQuestToggle.asp?mode='+mode+'&qid='+qid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');	
}

function WikiContributorAccessToggle (elem,cid,mode) {
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WikiContributorAccessToggle.asp?mode='+mode+'&cid='+cid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true')	
	
}
function WebSecurityTogglePrimary (elem,pid,sid) {
	
	var pars = document.getElementsByTagName('img');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('ActiveImage_')==0) {
			pars[i].src='../DC_Images/DC_CheckBoxOff.gif';
		}
	}		
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	

	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebSecurityTogglePrimary.asp?sid='+sid+'&pid='+pid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function CloseByIdPattern(tag,pat,OC,destroy) {
	var pars = document.getElementsByTagName(tag);
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf(pat)==0) {
			if (OC==0) {
				pars[i].style.display='none';
				}
			else	{
				pars[i].style.display='';
			}
			if (destroy==1) {
				pars[i].innerHTML='';
			}
		}	
	}
}
function OpenByIdPattern(tag,pat) {
	var pars = document.getElementsByTagName(tag);
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf(pat)==0) {
				pars[i].style.display='';
		}	
	}	
}
function DCMasterValidateForm(mode) {
	
	if (document.getElementById('Title').value.length==0) {
		alert ("You must provide a title");
		document.getElementById('Title').select();
		document.getElementById('Title').focus();
		return false
	}
	
	if (document.getElementById('Title').value.length>500) {
		alert ("Title cannot exceed 500 characters");
		document.getElementById('Title').select();
		document.getElementById('Title').focus();
		return false
	}			
	
	if (document.getElementById('Description').value.length>2000) {
		alert ("Description cannot exceed 2000 characters");
		document.getElementById('Description').select();
		document.getElementById('Description').focus();
		return false
	}					
	
	document.getElementById('UpdProgressBar').style.display='';	
	ValidatefEmpApprov('formDBMaster','DBUpd','divDBMaster');
	return false;				
}
function DBMasterDelete(dbid) {

	var x=window.confirm("You are about to delete a database: " + dbid + "\n\n if correct, press OK, else CANCEL")
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_DBMasterDelete.asp?dbid='+dbid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('DB_'+dbid)
}
function DBToggleActive (elem,dbid) {
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_DBMasterToggleActive.asp?dbid='+dbid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true')	
	
}
function fSortAttributeRows(sid) {
	
	sId='divWikiPageList' 
	var sObject=document.getElementById(sId)
	
	var url='/dc_includes/cp5_wikisortupdate.asp?wid='+wid
	
	Sortable.create('ulSortWikiPageList',{tag:'li',
   onUpdate: function() {
   	new Ajax.Request(url, {
	   	method: "get",
     	parameters: {data:Sortable.serialize('ulSortWikiPageList','Tab_')}
     });
   }
	});
}
function DBFormValidateInd() {
	DBFormValidate();
}
function fCheckForFormConfirmations() {
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf('CONF_')==0) {
			var field1=pars[i].id.replace('CONF_','DCSurv_')
			if (pars[i].value!=$(field1).value) {
				alert ('Confirmation does not match');
				pars[i].select();
				pars[i].focus();
				return false;
			}
		}
	}	
	return true;
}
function fCustomFormDate() {
	var pars = document.getElementsByTagName('select');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf('DCS_MM_')==0) {
			var InternalDatefield=pars[i].id.replace('DCS_MM_','DCSurv_')
			$(InternalDatefield).value='';
			var IDF_DD=pars[i].id.replace('DCS_MM_','DCS_DD_')
			var IDF_YYYY=pars[i].id.replace('DCS_MM_','DCS_YYYY_')
			if ($(IDF_DD).value.length>0 && $(IDF_YYYY).value.length>0) {
				$(InternalDatefield).value=pars[i].value+'/'+$(IDF_DD).value+'/'+$(IDF_YYYY).value
			}
		}
	}	
}
function DBFormValidate() {
	var sid=$('iSid').value;
	var gid=$('iGid').value;
	var rid=$('CurRid').value;
	
// Quick fix to correct bug in editor when saving with HTML mode displayed - must change to a fix all regardless of div
	try {fSimpleEditorFix();}catch(E){};
	
	try {I_FinishEditing()}catch(E){;}
	if (document.getElementById('__divEditing')!=null) {
		document.getElementById('__divEditing').style.display='none';
		try{oEditorUtil.boxopen=false}catch(e){;}	
		try{oEditorUtil.onBoxClosed()}catch(e){;}	
	}		
	
	fCustomFormDate();
	
	if (!fCheckForFormConfirmations()) {
		return false
	}

// Checking to see where the update is coming from... if w/in list, then assume ajax update, else process as normal
	var ridId='rTr_'+sid+'_'+rid
	if ($(ridId)!=null) {
		$('DBFormRenderStyle').value=0;
	}
	
	if ($('AjaxMode')!=null) {
		if ($('AjaxMode').value==1) {
			$('DBFormRenderStyle').value=0;
		}
	}

	if ($('DBFormRenderStyle')!=null) {
		if ($('DBFormRenderStyle').value=='1') {
			$('formDB').action='';
			$('DBUpd').value='1';
			$('formDB').submit();
			return true;
		}
		else	{
			document.getElementById('UpdSVProgressBar').style.display='';				
			ValidatefEmpApprov('formDB','DBUpd','divFormDisplay','DBRedisplayRows(\''+sid+'\',\''+gid+'\')');
		}
	}
	else	{
		document.getElementById('UpdSVProgressBar').style.display='';
		ValidatefEmpApprov('formDB','DBUpd','divFormDisplay','DBRedisplayRows(\''+sid+'\',\''+gid+'\')');
	}
	
	return false;				
}
function fRedisplayBlankForm() {

	if ($('iSid')==null || $('iGid')==null) {
		return false;
	}
	var iSid=$('iSid').value;
	var iGid=$('iGid').value;
	$('divFormDisplay').innerHTML=$('divFormDisplay').innerHTML.replace('{LOGGEDOFF}');
	
	if (fSurveyEndProcess()) {
		if ($('PostDestinationURL')!=null) {
			if ($('PostDestinationURL').value.length>0) {
				if ($('PostDestinationURL').value.indexOf('{')==-1) {
					self.location=$('PostDestinationURL').value;
				}
			}
			else	{
				DisplayAjaxPage(0,'divFormDisplay','DBFORMDISPLAY','','','&DCMessag=Your information has been recieved&sid='+iSid+'&gid='+iGid+'&rid=0');
			}
		}
		else {
			DisplayAjaxPage(0,'divFormDisplay','DBFORMDISPLAY','','','&DCMessag=Your information has been recieved&sid='+iSid+'&gid='+iGid+'&rid=0');
		}
	}
}
function DBRedisplayRows(sid,gid) {
	
	if ($('divFormDisplay').innerHTML.indexOf('{DBADD}')!=-1) {
		//DisplayAjaxPage(0,'divDBQueryContainer_'+sid,'CP6PROJECTISSUEREAD','','','&type=10&sid='+sid+'&gid='+gid+'&rid=0');
	}
	fSurveyEndProcess();
}
function fSurveyValidateInd() {
	fSurveyValidate();
}
function fSurveyValidate() {
	
	if ($('UpdSVProgressBar')!=null) {
		document.getElementById('UpdSVProgressBar').style.display='';	
	}
	if ($('UpdSVProgressBar2')!=null) {
		document.getElementById('UpdSVProgressBar2').style.display='';	
	}
	
	ValidatefEmpApprov('formDB','DBUpd','divFormDisplay','fSurveyEndProcess()');
	return false;				
}
function fProcessSignOffCase(dest) {
	
}
function fSurveyEndProcess() {
	
	if ($('divFormDisplay').innerHTML.indexOf('{LOGGEDOFF}')!=-1 && lPD_LoggedInIdForLife.length<1) {
		$('divFormDisplay').innerHTML='<h1>You are currently signed-off, you will be required to sign-in</h1>';
		alert ('You are currently signed-off, you will need to sign-in for this option');
		self.location='?' + urlRequestQueryString;
		return false;
	}
	
	if ($('divFormDisplay').innerHTML.indexOf('{DBADD}')!=-1 && $('RefreshEval')!=null) {
		$('divFormDisplay').innerHTML='<h3>Row Added - Refreshing</h3>';
		eval($('RefreshEval').value);
	}
	
	fEvalDBEditor();
		
	self.location='#DCSurveyTop';
	if (document.getElementById('sSurveyErrors')!=null) {
		eval(document.getElementById('sSurveyErrors').value);
	}
	else {
		return true;
	}
	for (i=0;i<oSurveyErrors.length;i++) {
		//Append child records to div
		if (oSurveyErrors!=null) {
			if (oSurveyErrors[i].MXMDParent!=null) {
				if (oSurveyErrors[i].MXMDParent.length>0) {
					var iQid=oSurveyErrors[i].MXMDParent;
				}
				else	{
					var iQid=oSurveyErrors[i].Qid;
				}
			}
			else {
				var iQid=oSurveyErrors[i].Qid;
			}
			var elemId='SE_'+iQid;
			if ($(elemId)!=null) {
				var sErr='<div class="FormErrMsg">'+oSurveyErrors[i].Err+'</div>';
				$(elemId).insert(sErr);
			}
			var elemId=oSurveyErrors[i].Elem;
			if ($(elemId)!=null) {
				if (oSurveyErrors[i].DateStyle==3) {
					var sMM=$(elemId).id.replace('DCSurv_','DCS_MM_');
					var sDD=$(elemId).id.replace('DCSurv_','DCS_DD_');
					var sYYYY=$(elemId).id.replace('DCSurv_','DCS_YYYY_');
					
					if ($(sMM)!=null) {
						$(sMM).className=$(sMM).className.replace('ErrField','');
						$(sMM).className=$(sMM).className+' ErrField';	
					
						$(sDD).className=$(sDD).className.replace('ErrField','');
						$(sDD).className=$(sDD).className+' ErrField';		
						
						$(sYYYY).className=$(sYYYY).className.replace('ErrField','');
						$(sYYYY).className=$(sYYYY).className+' ErrField';																
					}
				}
				else	{
					$(elemId).className=$(elemId).className.replace('ErrField','');
					$(elemId).className=$(elemId).className+' ErrField';
				}
			}
			var elemId='SEQ_'+iQid;
			if ($(elemId)!=null) {
				$(elemId).className=$(elemId).className+' ErrText';
			}			
			delete oSurveyErrors[i];
			
		}
	}
	document.getElementById('sSurveyErrors').value='';
	
	return false;
	//fClearButtonVal('SaveButton')

}
function fClearButtonVal(cls) {
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className.indexOf(cls)==0) {
			pars[i].value='';
		}
	}	
}
function DCRowDelete(rid) {

	var x=window.confirm("You are about to delete a row: " + rid + "\n\n if correct, press OK, else CANCEL")
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_DBRowDelete.asp?rid='+rid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	if ($('Rid2_'+rid)!=null) {
		$('Rid2_'+rid).style.display='none';
	}
	new Effect.Puff('Rid_'+rid)
}
function fSortSurvQuestions(siteid,survId,spanText,event) {
	// Temporary
	
	if (document.getElementById(idLastSort)!=null) {
		Sortable.destroy(idLastSort);
		document.getElementById(spanText).innerHTML='Start Sorting';
		document.getElementById(spanText).className='Start';
		if (idLastSort==survId) {
			idLastSort=null;
			SortingMode=2;
			if (event!=null) {
				event.cancelBubble=true;
			}				
			return;
		}
	}
	
	if (document.getElementById(idLastSortText)!=null) {
		document.getElementById(idLastSortText).innerHTML='Start Sorting';
		document.getElementById(idLastSortText).className='Start';
	}
	
	document.getElementById(spanText).innerHTML='Stop Sorting';
	document.getElementById(spanText).className='Stop';
	SortingMode=1;
	
	idLastSort=survId
	
	var sObject=document.getElementById(survId)
	var url='/dc_includes/cp5_SurvQuestSortUpdate.asp?sid='+siteid+'&ulid='+survId
	
	Sortable.create(survId,{tag:'li',
   onUpdate: function(survId) {
   	new Ajax.Request(url, {
	   	method: "get",
     	parameters: {data:Sortable.serialize(survId,'Tab_')}
     });
   }
	});
	
	if (event!=null) {
		event.cancelBubble=true;
	}	
}

var gNum=1;
var Id1='';


	
function delListElement(aid,delRow,pid) {
	
	var iAid=aid.split('_');
	var sLeft=iAid[0];
	if (pid==null) {
		pid='';
	}
	
	
	if (document.getElementById(aid)==null) {
		alert ("You have not selected a folder to delete, please select one by clicking on the folder image in the file tree");
		return;
	}
	
	if (document.getElementById(aid).value==sLeft+'-1') {
		alert ("You have not selected a folder to delete, please select one by clicking on the folder image in the file tree");
		return;
	}	
		
	var x=window.confirm("You are about to delete a folder\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}

	var dElem = document.getElementById(aid).parentNode;
	var pElem = document.getElementById(aid).parentNode.parentNode;
	if (delRow!=null) {
 		//pElem.removeChild(document.getElementById(delRow));
 		new Effect.Puff(document.getElementById(delRow))
 	}
 	else	{
 		pElem.removeChild(dElem);
 	}
 		
	var ajaxscript = '/dc_includes/CP5_FileTreeFolderDelete.asp?aid='+iAid[1]+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,true,'fSimpleDisplayFileTree(\''+pid+'\')');	   
		

 	
//	var pars = document.getElementsByTagName('li');
//	for (var i=0;i<pars.length;i++) {
//		sCN=pars[i].id;
//		if (sCN.indexOf('li_'+iAid[1])==0) {
//			pElem.removeChild(document.getElementById(pars[i].id));
//		}
//	}			
}	
function addListElement(aid,mode) {
	
	if (document.getElementById(aid)==null) {
		alert ("You must select a folder");
		return;
	}
	if (document.getElementById(aid).value=='ul_-1') {
		alert ("You must select a folder");
		return;
	}	

	var splId=aid.split('_');
	
	if (mode==0) {
		
		var currElem=document.getElementById('ul_'+splId[1]);
	}
	else	{
		
		var currElem=document.getElementById('ul_'+(splId[1])).parentNode.parentNode;
	}		

	gNum=gNum+1
	var idName = gNum;
	var PidName = (gNum-1);
	
  var newLi = document.createElement('li');
  newLi.setAttribute('id','li_'+idName);
  lTools='<div id="sf_'+idName+'" class="StdFolder"><img src="/dc_images/dc_spacer.gif" /></div>';
	lTools=lTools+'<span id="Link_'+idName+'" onclick="javascript:FileManagerProcessFolder(\''+idName+'\');">'
	lTools=lTools+'<span id="FolderNameText_'+idName+'">New Item '+idName+'</span></span><input onblur="javascript:SaveFolderName(this,\''+idName+'\');" style="display:none;" type="text" value="New Item '+idName+'" name="FolderName" id="FolderName_'+idName+'" />'; 
	
	lTools=lTools+'<div class="FolderEditArea" id="divEditArea_'+idName+'" style="display:none;">'
	lTools=lTools+'<a title="Add New Folder" href="javascript:#" class="StdNew"><img src="/DC_Images/DC_Spacer.gif"/></a>'
	lTools=lTools+'<a title="Edit Folder" href="javascript:#" class="StdEdit"><img src="/DC_Images/DC_Spacer.gif"/></a>'
	lTools=lTools+'<a title="Delete Folder" href="javascript:delListElement(\'ul_'+idName+'\',\'0\');" class="StdClose"><img src="/DC_Images/DC_Spacer.gif"/></a>'
	lTools=lTools+'<br class="ClearFix"/></div>'	
	newLi.innerHTML=lTools;  
	newLi.className="Item";

  currElem.appendChild(newLi);
  
  var newDivEdit = document.createElement('div');
  newDivEdit.setAttribute('id','divEdit_'+idName);
  newDivEdit.setAttribute('style','display:none;');
 	lTools='<div id="EditArea2" class="EditArea2">'; 
	lTools=lTools+'</div>'
	newDivEdit.innerHTML=lTools;      
  newDivEdit.className="ItemEditContainer";
  newLi.appendChild(newDivEdit);  

  var newUl = document.createElement('ul');
  newUl.setAttribute('id','ul_'+idName);
  newLi.appendChild(newUl);
  
	if (SortingMode==1) {
		sortList('ul_0'); 
	}
}
function sortList(tid) {
	
	Sortable.create(tid,{tree:true,scroll:window,only:'Item'})
	if ($('FileDrop')!=null) {
		Sortable.create('FileDrop',{dropOnEmpty: true})
	}
	if ($('divWikiFiles')!=null) {
		Sortable.create('divWikiFiles',{dropOnEmpty: true})
	}
}
function UpdateAllFolderNames() {
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].className;
		var sids='';
		if (sCN.indexOf('FolderName_')==0) {
			var nIdA=pars[i].id.split('_');
			nId=nIdA[0]+'Text_'+nIdA[1];
			document.getElememtById(nId).innerHTML=pars[i].value;
		}
	}			
}
function SaveFolderName (elem,idName) {
	//temp - testing
	return;
	ToggleElement(elem.id);
	if (elem.value.length>0) {
		document.getElementById('FolderNameText_'+idName).innerHTML=elem.value;
	}
	document.getElementById('FolderNameText_'+idName).style.display='';
	document.getElementById('FolderName_'+idName).style.display='none';
	
}
function FileManagerEditFolderName(idName) {	

	//if (idName!=gFMXid) {
		var elem=document.getElementById('FolderName_'+gFMXid)
		var elem2=document.getElementById('FolderNameText_'+gFMXid)
		if (elem) {
			if (elem.value.length>0) {
				elem2.innerHTML=elem.value;
			}
			document.getElementById('FolderName_'+gFMXid).style.display='';		
			document.getElementById('FolderNameText_'+gFMXid).style.display='none';
			return;
			}
	//}
	
	//sortList('ul_0');
	
	//FMResetFolderClose();
	
	//ToggleElement('FolderName_'+idName);
	//ToggleElement('FolderNameText_'+idName);
	if (document.getElementById('FolderName_'+idName).style.display!='none') {
		document.getElementById('FolderName_'+idName).select();
		document.getElementById('FolderName_'+idName).focus();
	}
}
function SaveFolderDefinitions() {
	alert(Sortable.serialize('ul_0','li_'));
}
function ToggleFileManageEdits() {
	
	//sortList('ul_0');
	
	if (bFileManagerFolderEdit==1) {
		sDisplay='none';
		sDisabled='false'
		bFileManagerFolderEdit=0;
	}
	else	{
		sDisplay='';
		sDisabled='true'
		bFileManagerFolderEdit=1;		
	}
	
	var pars = document.getElementsByTagName('span');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('EditArea_')==0) {
			pars[i].style.display=sDisplay;
		}
	}
	var pars = document.getElementsByTagName('span');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('Link_')==0) {
			pars[i].disabled=sDisabled;
		}
	}
}	
function FMUpdateListAndSort() {
	sortList('ul_0');
}
function SaveFMLevels() {

	try {
		Sortable.create('ul_0',{tree:true,scroll:window})
		$('ul_0').highlight();
		$('FMLArray').value=Sortable.serialize('ul_0');
		ValidatefEmpApprov('formFM','FMLinkUpd','TreeList');
		return false;		
	}
	catch(E) {alert("We could not find anything to save");}
}
function FileManagerDragDrop() {

  $A($('divWikiFiles').getElementsByTagName('li')).each(
	  function(item) {
  	  new Draggable(
    	  item,
      		{
          	revert: true,
            ghosting: true,
            scroll: window
      		}
    	);
		}
   );

  Droppables.add(
   'FileDrop',
  	{
    	hoverclass: 'DropZoneActive',
      onDrop: moveItem
    }
  );
   // Set drop area by default  non cleared.
   
   $('divWikiFiles').cleared = false;
}
function moveItem( draggable,droparea){	
  if (!droparea.cleared) {
	 // droparea.innerHTML = '';
   // droparea.cleared = true;
  }
  draggable.parentNode.removeChild(draggable);
  droparea.appendChild(draggable);
  $('FileDrop').highlight();
   
  var xid=$('FileDropId').value
  var afid=draggable.id.split('_');
  var fid=afid[1];
   
	var ajaxscript = '/dc_includes/CP5_FileTreeFolderAsset.asp?xid='+xid+'&fid='+fid+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,true,'fSimpleDisplayFileTree()');	   
}
function fSimpleDisplayFileTree(pid) {
	if (pid==null) {
		pid='';
	}
	
	var wid=$('iWid').value;
	DisplayAjaxPage(0,'divWebCloud','DCFileTree',1,'','&wid='+wid+'&pid='+pid,1,'SetUpDragDropOrganizer()');
}
function FileManagerProcessFolder(xid,nf,ob,ad) {
	
	if (nf==null) {
		nf='';
	}
	
	ChangeClassOnByIdPat('sf_','StdFolder','div')
	
	gFMXid=xid;
	
	UpdateAllFolderNames();
	FileManagerSetFolderDrop(xid,nf,ob,ad);
	bFileManagerFolderEdit=0;
}
function sortListDestroy() {
		Sortable.destroy('ul_0');
		//Sortable.create('FileDrop',{dropOnEmpty: true})
		//Sortable.create('divWikiFiles',{dropOnEmpty: true})		
	}
function FileManagerToggleEdit(elemId) {
	elem=document.getElementById(elemId);
	if (bFileManagerFolderEdit==1) {
		bNotReadyToEdit=1;
		elem.className="StdEdit"
		bFileManagerFolderEdit=0;
	}
	else	{
		bNotReadyToEdit=0;
		bFileManagerFolderEdit=1;
		elem.className="StdEditDisabled";
	}
}
function FileManagerSetFolderDrop (xid,nf,ob,ad) {

	if (nf==null) {
		nf='';
	}
	
	if (ob==null) {
		ob='';
	}	
	
	if (ad==null) {
		ad='';
	}		
	
	if (bNotReadyToEdit==1) {
		if ($('sf_'+xid) || $('sfH_'+xid)) {
			bFileManagerFolderEdit=0;
			if ($('sf_'+xid)) {
				$('sf_'+xid).className='StdFolderOpen';
			}
			$('divFMContainer').innerHTML='<div id="progressind" class="Progress">Retrieving...</div>';	
			DisplayAjaxPage(0,'divFMContainer','DCFileManagerDrop','','','&nf='+nf+'&wcid='+lPD_WCID+'&wid='+lPD_WID+'&pid='+lPD_PID+'&xid='+xid+'&ob='+ob+'&ad='+ad,'','SetUpDragDropOrganizer()');
			return;
		}		
			$('divFMContainer').innerHTML='<div id="progressind" class="Progress">Retrieving...</div>';	
			DisplayAjaxPage(0,'divFMContainer','DCFileManagerDrop','','','&nf='+nf+'&wcid='+lPD_WCID+'&wid='+lPD_WID+'&pid='+lPD_PID+'&xid='+xid+'&ob='+ob+'&ad='+ad,'','SetUpDragDropOrganizer()');
		
		return;
	}
	
	if (xid!=gFMXid) {
		var elem=document.getElementById('FolderName_'+gFMXid)
		if (elem) {
			if (elem.value.length>0) {
				document.getElementById('FolderNameText_'+gFMXid).innerHTML=elem.value;
			}		
		}
	}	
	
	if (gFMXid==xid) {
		gFMXCnt++;
	}
	else {
		gFMXCnt=1;
		ToggleFileManageEdits(1);
		bFileManagerFolderEdit=0;
	}
	gFMXid=xid;
	
	if (gFMXCnt>1) {
//		bFileManagerFolderEdit=1;
//		FileManagerEditFolderName(xid);
//		gFMXCnt=0;
//		return;
	}
	
	ChangeClassOnByIdPat('sf_','StdFolder','div')
	UpdateFoldersWithChildren('sf_','StdFolderDim','div');	
	
	if ($('sf_'+xid)) {
		bFileManagerFolderEdit=0;
		$('sf_'+xid).className='StdFolderOpen';
		DisplayAjaxPage(0,'divFMContainer','DCFileManagerDrop','','','&xid='+xid+'&ob='+ob+'&ad='+ad,'','SetUpDragDropOrganizer()');
	}
}
function FMResetFolderClose() {
	
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('FolderName_')==0) {
			pars[i].style.display='none';
		}
	}	
	var pars = document.getElementsByTagName('span');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('FolderNameText_')==0) {
			pars[i].style.display='';
		}
	}		
}

function ChangeClassOnByIdPat(pat,newClass,tType,ConstrainPat) {

	var pars = document.getElementsByTagName(tType);
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if ((ConstrainPat!=null && ConstrainPat.length>0 && sCN.indexOf(pat)!=-1) || ConstrainPat==null) {
			if (sCN.indexOf(pat)==0 && pars[i].className!='StdFolderFile') {
				pars[i].className=newClass;
			}
		}
	}
}
function UpdateFoldersWithChildren(pat,newClass,tType) {

	var pars = document.getElementsByTagName(tType);
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf(pat)==0) {
			if (!pars[i].parentNode.lastChild.hasChildNodes()) {
			//	if (pars[i].parentNode.lastChild.firstChild.nodeName=='#text') {
					var aId=pars[i].id.split('_');
					//$('sf_'+aId[1]).className=newClass;
			//	}
			}
		}
	}
}
function WBUpdProfileDiv (elem) {
	if (elem==null) {
		elem=$('Style');
	}
	
	if ($('divAddressInfo')!=null) {
		if (elem.value==0) {
			$('divAddressInfo').style.display='';
		}
		else	{
			$('divAddressInfo').style.display='none';
		}
	}
	if ($('divMobileSiteOptions')!=null) {
		if (elem.value==9) {
			$('divMobileSiteOptions').style.display='';
		}
		else	{
			$('divMobileSiteOptions').style.display='none';
		}		
	}
}
function WBCCCheckValue () {
	
	UpdateCheckValueID('AcceptCC');
	
	document.getElementById('ShowCCKey').style.display = "none";

	if (document.getElementById('AcceptCC').value == 1) {
		document.getElementById('ShowCCKey').style.display = "block";	
	}
}
function fSetLastTenant (mifl,kType,tid,kn) {

	if (kn==null) {
		var kn=''
	}	

	var ajaxscript = '/dc_includes/CP5_SetLastTenant.asp?mifl='+mifl+'&kn='+kn+'&ktype='+kType+'&tid='+tid+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,true,'resetAdminLastVisits()');	   
	
}
function resetAdminLastVisits() {
	var ajaxscript = '/dc_includes/CP5_AdminLastVisits.asp?xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divLastAdmins',1);	 
}
function fAddEntry(elem) {
	
	elemArray=elem.id.split('_');
	
//  var newLi = document.createElement('div');
//  newLi.setAttribute('id','ee_'+elemArray[1]+'_'+elemArray[2]);
//  lTools='<div class="Item">test</div>'; 
//	newLi.innerHTML=lTools;  
//	newLi.className="StdEntry";

//	elem.appendChild(newLi);
	
// Count Children	
//	iChildCnt=0;
//	
//	var pars = document.getElementsByTagName('div');
//	for (var i=0;i<pars.length;i++) {
//		sCN=pars[i].id
//		if (sCN.indexOf('ee_'+elemArray[1])==0) {
//			iChildCnt++
//		}
//	}			

//	newLi.style.height=(elem.parentNode.offsetHeight)-1;
//	
//		
//	if (iChildCnt>0) {
//		var pars = document.getElementsByTagName('div');
//		for (var i=0;i<pars.length;i++) {
//			sCN=pars[i].id
//			if (sCN.indexOf('ee_'+elemArray[1])==0) {
//				pars[i].style.width=elem.parentNode.offsetWidth/iChildCnt;
//			}
//		}	
//	}
//	else {
//		newLi.style.width=elem.parentNode.offsetWidth;
//	}
	
//	newLi.style.width=150;
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_CalendarDayEdit.asp?xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divEditDayItem',1,'true')	
		
	document.getElementById('divEditDayItem').style.top=elem.parentNode.offsetTop+elem.parentNode.parentNode.parentNode.offsetTop+20;
	
  new Draggable('divEditDayItem', {scroll: window});
}
function fMoveDayCal(event,elem,seq) {
	
  new Draggable(elem.parentNode.parentNode, 
                {scroll: window, onEnd : function(event){
			    event.cancelBubble=true;}

                });	
	event.cancelBubble=true;
}
function fDispDayCal(event,elem,seq) {
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_CalendarDayEdit.asp?seq='+seq+'xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divEditDayItem',1,'true')	

	document.getElementById('divEditDayItem').style.top=elem.parentNode.parentNode.parentNode.parentNode.offsetTop+20;
	
	new Draggable('divEditDayItem', { scroll: window });
	event.cancelBubble=true;
}	
function fSetUpDayCal() {
	
	fUpdateTimes()
	
	fSimpleEditInit();	
	
	fCheckForEdit('divAddCalendarItemV6')

	if (!document.getElementById('Content') || !document.getElementById('Hours')) {
		return;
	}
	
	document.getElementById('Content').style.height=document.getElementById('Hours').offsetHeight-2;
	
	var pars = document.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('cc_')==0) {
			var hId=pars[i].id.split('_');
			var hElem=document.getElementById('hh_'+hId[1])
			pars[i].style.height=hElem.offsetHeight;
		}
	}	
	
	var pars = document.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('ee_')==0) {
			var hId=pars[i].id.split('_');
			var hElem=document.getElementById('MM_'+hId[1]+'_'+hId[2])
			var eTElem=document.getElementById('et_'+hId[1]+'_'+hId[2])
			var eeElem=document.getElementById('ee_'+hId[1]+'_'+hId[2]+'_'+hId[3])
			
			hElem.appendChild(pars[i]);
			
			nHours=eTElem.value-hId[1]
			if (nHours>0) {
				eeElem.style.height=(hElem.parentNode.offsetHeight*nHours)-6;
			}
			else	{
				eeElem.style.height=hElem.parentNode.offsetHeight-6
			}
			eeElem.style.width=75;
		}
	}	
	document.getElementById('divDayCalendar').style.width=720;
	document.getElementById('Content').style.width=document.getElementById('divDayCalendar').offsetWidth-document.getElementById('Hours').offsetWidth;
}
function FMDeleteFileFromTree(elem,whatid,fileid,remove) {

	var x=window.confirm("You are about to delete a file from the tree\n\n if correct, press OK, else CANCEL")
	if (!x) {
		return;
	}
	if (remove==null) {
		remove=0;
	}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_FileTreeLeafAssetDelete.asp?df='+remove+'&whatid='+whatid+'&fileid='+fileid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true','fSimpleDisplayFileTree()');
	
	new Effect.Puff(elem)
}
function fSurvTreeSubCats(sc,cat,dest) {

	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_SurveySubCatQuery.asp?sc='+sc+'&cat='+cat+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest,1,'true');
}		
function fSurveySortToggleSorting(qId,cat,event) {
	
	//spanClickSortSubCat_
	//nWSubCatUL_
	//ToggleElement('spanClickSortSubCat_" & oRS("QuestId") & "','','');ToggleElement(this.lastChild.id,'','',event);
	
}
function fCloseElems(parId, elemClass, elemType,exclId) {
	if (exclId==null) {
		exclId='';
	}
	
	pars=$(parId).getElementsByTagName(elemType);
	for (i=0;i<pars.length;i++) {
		if (pars[i].className==elemClass) {
			if (exclId!=pars[i].id) {
				pars[i].style.display='none';
			}
		}
	}	
}
function ToggleFM(mode) {
	if (mode==0) {
		document.getElementById('divTreeFiles').style.display='';
		document.getElementById('AvailableFiles').style.display='none';
		}
	else	{
		document.getElementById('divTreeFiles').style.display='none';
		document.getElementById('AvailableFiles').style.display='';			
	}
}
function PostBackWallMsg(wmid,oMifl,gMifl,fType,destDispId,WhoFrom) {
	
	var dest='divUpdArea_'+wmid;
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_WallMsgMaint.asp?cbid='+wmid+'&bNd=1&Mifl='+gMifl+'&g='+oMifl+'&t='+fType+'&did='+destDispId+'&whofrom='+WhoFrom+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest,1,'true');
}
function fEvtSearch () {
	ValidatefEmpApprov('formEvtRegs','UpdIndSearch','AdminArea');
}
function ValidateFileAlert() {
	var timeofday;
	timeOfDay='01/01/1900 '+document.getElementById('TimeHH').value;
	timeOfDay=timeOfDay+':'+document.getElementById('TimeMM').value;
	timeOfDay=timeOfDay+' '+document.getElementById('TimeAMPM').value;

	document.getElementById('FTUpd').value="1"
	document.getElementById('TimeOfDay').value=timeOfDay;
	document.getElementById('FAUpdProgressBar').style.display='';

	ValidatefEmpApprov('formAutoVersion','UpdInd','FEAdvanced');
	return false;		
}
function fRedisplayFileAlerts() {
	var fid=document.getElementById('ftFid').value;
	var wid=document.getElementById('ftWid').value;	
	DisplayAjaxPage(0,'FEAdvanced','CP6FILEALERTROWS',1,'','&wid='+wid+'&fid='+fid)
}
function ValidateAutoVersion() {
	
	var timeofday;
	timeOfDay='01/01/1900 '+document.getElementById('TimeHH').value;
	timeOfDay=timeOfDay+':'+document.getElementById('TimeMM').value;
	timeOfDay=timeOfDay+' '+document.getElementById('TimeAMPM').value;
	document.getElementById('TimeOfDay').value=timeOfDay;
	
	if (document.getElementById('WikiContentVersionId').selectedIndex==0) {
			alert ("You must select an article to version - Article must be a \'status\' type");
			document.getElementById('WikiContentVersionId').focus();
			return false;
	}
	
	document.getElementById('UpdProgressBar').style.display='';
	ValidatefEmpApprov('formAutoVersion','UpdInd','divAutoVersion','fRedisplayStatusAlerts()');
	return false;	
}
function fRedisplayStatusAlerts() {
	var pid=document.getElementById('pid').value;
	DisplayAjaxPage(0,'divWeb','DCWIKIAUTOVERSIONRows',1,'','&pid='+pid)
}
function ValidateEmbeddableFormInd() {
	ValidateEmbeddableForm();
}
function ValidateEmbeddableForm() {
	
	if (document.getElementById('Title').value.length==0) {
		alert ("You must enter a Title");
		document.getElementById('Title').focus();
		document.getElementById('Title').select();
		return false;
	}		
		
	if (document.getElementById('Title').value.length >100) {
		alert ("Your title may not exceed 100 characters");
		document.getElementById('Title').focus();
		document.getElementById('Title').select();
		return false;
	}	
	
	if (document.getElementById('Description').value.length >1000) {
		alert ("Description may not exceed 1000 characters");
		document.getElementById('Description').focus();
		document.getElementById('Description').select();
		return false;
	}
	if (document.getElementById('EmbeddableScript').value.length==0) {
		alert ("Embeddable Script is required");
		document.getElementById('EmbeddableScript').focus();
		document.getElementById('EmbeddableScript').select();
		return false;
	}					
	if (document.getElementById('EmbeddableScript').value.length >5000) {
		alert ("The Embeddable Script may not exceed 5000 characters");
		document.getElementById('EmbeddableScript').focus();
		document.getElementById('EmbeddableScript').select();
		return false;
	}		

	document.getElementById('UpdProgressBar').style.display='';	
	document.getElementById('EOUpd').value="1";
	ValidatefEmpApprov('formEmbeddableEdit','EOUpd','divEmbeddableEdit');
	return false;		
}
function ObjectEmbeddableListToggle(elem,seq,mode) {
	
	if (mode==null) {
		mode=0;
	}
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_ObjectEmbeddableToggle.asp?mode='+mode+'&seq='+seq+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}	
function ObjectEmbeddableDelFunc(seq) {

var x=window.confirm("You are about to delete an embeddable: " + seq + "\n\n if correct, press OK, else CANCEL")
if (!x) {
	return;
}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_ObjectEmbeddableDelete.asp?seq='+seq+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divOE_'+seq)
}
function DisplayPlayer(elem,dest) {
	if (dest==null) {
		var dest='DCEmbeddableView';
	}
	
	DisplayAjaxPage(0,dest,'JAWSMyMusic','','','&eoid='+elem.value);
}	
function UpdateMusicPlayer() {
	document.getElementById('UpdProgressBar').style.display='';	
	ValidatefEmpApprov('formMusicSelector','UpdInd','divMusicSelector');
	return false;			
}
function UpdateAjaxOpener() {
	try {
		if (document.getElementById('AjxFunction')!=null) {
			//alert(document.getElementById('AjxFunction').value);
			eval(document.getElementById('AjxFunction').value);
		}
	}	catch(E) {
		alert ("Could Not Update the list");
	}
}
function fSecurityAdminsByGrp (gid) {
	
	var dest='GrpAdmins_'+gid;
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_tenantMassSecurityGrpDetails.asp?gid='+gid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest,1,'true');

}
function fSecurityMassMaint() {
	
	var upg='UpdProgressBar';
	var f='formMassSecurityMaint';
	var d='divMassSecurity';
	var uid='UpdInd';
	
	document.getElementById(upg).style.display='';	

	ValidatefEmpApprov(f,uid,d);
	return false;			
}
function delQuery(qid) {
var x=window.confirm("You are about to delete a query: " + qid + "\n\n if correct, press OK, else CANCEL")
if (!x) {
	return;
}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_PowerQuery_DelQuery.asp?qid='+qid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('d_'+qid);
}	
function copyQuery(qid,sid,gid,pid,st) {
	
	var AddlFunc="DisplayAjaxPage(0,'divWeb','DCPowerQuery','','','&st="+st+"&sid="+sid+"&gid=" +gid+"&DCMessage=Query duplicated')"
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_PowerQuery_DupQuery.asp?pid='+pid+'&st='+st+'&qid='+qid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true',AddlFunc);	
		
}
function SubmitRemDups() {
	document.getElementById('Upd').value="3";
	document.DCQForm.submit();
}
function PQfAddCol() {

	document.getElementById('Upd').value="1";
	document.getElementById('UpdProgressBar').style.display='';

	ValidatefEmpApprov('DCQForm','Upd','divWeb');
	return false;				
}
function ShowCols() {
	document.getElementById('AddCol').style.display="none";
	document.getElementById('QAddField').style.display="";
}
function RemCols(col) {

	lComma="";

// rebuild Fields	

	for (i=0;i<lSelFieldsArray.length;i++) {
		if (lSelFieldsArray[i] != lSelFieldsArray[col]) {
			document.getElementById('NewFields').value=document.getElementById('NewFields').value + lComma + lSelFieldsArray[i];
			lComma=",";
		}
	}

	document.getElementById('Upd').value="2";
	document.DCQForm.submit();	
}
function PQNewPage(Form, Elem, ExcElem,sHref) {
	sHref=sHref.replace('|','\'');
	Form.action=sHref + Elem.options[Elem.selectedIndex].value + "&ExcOpt=" + document.getElementById(ExcElem).value;
	Form.submit();
}	
function PQNextPage (Form, Elem, ExcElem,sHref) {

	lSI = document.getElementById(Elem).selectedIndex + 1
	
	if (lSI == document.getElementById(Elem).options.length) {
		document.getElementById(Elem).selectedIndex = 0;
	}
	else {
		document.getElementById(Elem).selectedIndex = lSI;
	}
	if (document.getElementById(Elem).selectedIndex < 0) {

		document.getElementById(Elem).selectedIndex = 0;
	}
	sHref=sHref.replace('|','\'');
	document.getElementById(Form).action=sHref+"&NextPage=" + document.getElementById(Elem).options[document.getElementById(Elem).selectedIndex].value + "&ExcOpt=" + document.getElementById(ExcElem).value;
	document.getElementById(Form).submit();
}
var HighOrder = 0;
var lQComma ="";
var lQFieldComma ="";
var lTotFieldsSel=0;

function UpdCols(idx, id, val) {

	idx=idx-1

	var QueriesUniqueFieldID='QueriesUniqueField'+id;
	oSelect=document.getElementById(QueriesUniqueFieldID)
	
	for (i=oSelect.options.length-1; i>=0;i--) {
		oSelect.remove(i)
	}	
	
	oSelect.options[0] = new Option(' ', ' ');
	lidx=1
	for (i=1;i<jsQuerColsTable.length;i++) {
		if (jsQuerColsTable[i]==jsQTable[idx]) {
			oSelect.options[lidx] = new Option(jsQuerCols[i], jsQuerCols[i]);
			lidx=lidx+1
		}
	}
	for (i=0;i<oSelect.options.length;i++) {
		if (oSelect.options[i].value==val) {
			oSelect.selectedIndex=i;
		}		
	}
}

function UpdOrder() {

	document.getElementById('Upd').value="4";
	document.DCQForm.submit();
}	
function ShowListSel(mode, id) {
	var qlistuselistboxid='QListUseListBox'+id
	var FieldEQValue1id='FieldEQValue1'+id
	
	document.getElementById(qlistuselistboxid).style.display="none";
	document.getElementById(FieldEQValue1id).style.visibility="visible";	
	
	if (mode==1) {
		document.getElementById(qlistuselistboxid).style.display="";
		document.getElementById(FieldEQValue1id).style.visibility="hidden";
	}
}
function UpdateOrder(ID) {
	var OrderID='QFilterOrder'+ID;
	var qfidImg='fOrderImg'+ID;
	
	document.getElementById(OrderID).value=HighOrder
	document.getElementById('fOrder').value=document.getElementById('fOrder').value + lQComma + ID
	document.getElementById(qfidImg).style.display="none";
	lQComma =","
	HighOrder=HighOrder+1
}


function ClearFieldsOrder () {

	for (i=0;i<lTotRows;i++) {
		var fid='FieldOrderLink'+i
		document.getElementById(fid).disabled=false;
		document.getElementById(fid).className="OrderableField";
	}
	
	document.getElementById('FieldOrder').value="";
	lQFieldComma="";
}
function UpdFieldOrder(Field, ID) {

	var sFieldLink='FieldOrderLink' + ID
	
	if (document.getElementById(sFieldLink).disabled!=true) {
		document.getElementById('FieldOrder').value=document.getElementById('FieldOrder').value + lQFieldComma + Field;
	}

	document.getElementById(sFieldLink).disabled=true;
	document.getElementById(sFieldLink).className="OrderedField";
	lQFieldComma = ","

}

function ClearFilterOrder() {
	for (i=0;i<afFields.length;i++) {
		var qfid='QFilterOrder'+afFields[i]
		var qfidImg='fOrderImg'+afFields[i]
		document.getElementById(qfid).value="";
		document.getElementById(qfidImg).style.display="inline";
	}
	document.getElementById('fOrder').value="";
	document.getElementById('UpdOrder').style.display="";
	HighOrder =0
}
function PQDelFunc(fid) {
	var x=window.confirm('You are about to delete the selected filter\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_PowerQueryDelFilter.asp?fid=' + fid + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('fid_'+fid)
}
function CheckValFields(ID) {
	var FieldEQValue2ID='FieldEQValue2'+ID;
	var FieldEQID='FieldEQ_'+ID;	
	var QListID='QList'+ID;	

	if (document.getElementById(FieldEQValue2ID) != null) {
		document.getElementById(FieldEQValue2ID).style.visibility="hidden";
		if (document.getElementById(FieldEQID).options[document.getElementById(FieldEQID).selectedIndex].value=='between') {
			document.getElementById(FieldEQValue2ID).style.visibility="visible";
		}
	}
	if (document.getElementById(QListID)!=null) {
		document.getElementById(QListID).style.display="none";
		if (document.getElementById(FieldEQID).options[document.getElementById(FieldEQID).selectedIndex].value=="in" || document.getElementById(FieldEQID).options[document.getElementById(FieldEQID).selectedIndex].value=="not in") {
			document.getElementById(QListID).style.display="";
		}
	}
}
function GenOB() {

}
function UpdateTD(id) {
	
	var aId=id.split('_');
	var lid='divSel_'+aId[1];
	
	if (document.getElementById(id).checked) {
		document.getElementById(lid).className='selColumns SelectedField'
		}
	else	{
		document.getElementById(lid).className='selColumns NonSelectedField';
	}	

}
function PQGetTableQuery(sid,gid,qmidTable,st,pid) {
	var qa=qmidTable.split(':');
	var qmid=qa[0];
	var qtable=qa[1];
	var dest=$('dest').value;
	if (pid==null) {
		pid='';
	}
	
	DisplayAjaxPage(0,dest,'DCPowerQueryTS','','','&pid='+pid+'&st='+st+'&sid='+sid+'&gid='+gid+'&qmid='+qmid+'&qtable='+qtable+'&dest='+dest,'1','PWUpdatePage()')
}

function PQSaveTSInd() {
	PQSaveTS();
}
function PQSaveTS() {
	
	var Mode=document.getElementById('Mode').value;
	
	if (document.getElementById('QName').value.length<1) {
		alert ("Query Name is required")
		document.getElementById('QName').select();
		document.getElementById('QName').focus();		
		return false;
	}
	if (document.getElementById('QName').value.length>50) {
		alert ("Query Name may not exceed 50 characters")
		document.getElementById('QName').select();
		document.getElementById('QName').focus();		
		return false;
	}	
	if (document.getElementById('QDesc').value.length>500) {
		alert ("Query Description may not exceed 500 characters")
		document.getElementById('QDesc').select();
		document.getElementById('QDesc').focus();		
		return false;
	}		
	
	if (lTotFieldsSel<1) {
		//alert ("You must select at least one field to display on query")
		//return false;	
	}

	document.getElementById('Mode').value=Mode;
	document.getElementById('Upd').value="1";
	document.getElementById('UpdProgressBar').style.display='';
	
	var sComma='';
	document.getElementById('qResidenceVal').value='';
	document.getElementById('qResidenceVal').value;
	for (i=0;i<document.getElementById('qResidence').options.length;i++) {
		if (document.getElementById('qResidence').options[i].selected==true && document.getElementById('qResidence')[i].value.length>0) {
			document.getElementById('qResidenceVal').value=document.getElementById('qResidenceVal').value+sComma+document.getElementById('qResidence')[i].value;
			sComma=',';
		}
	}
	if (sComma.length==0) {
		document.getElementById('qResidence')[0].selected==true;
	}
	var dest=$('dest').value;
		
	ValidatefEmpApprov('DCQForm','Upd',dest,'PWUpdatePage()');
	return false;				
}
function PWUpdatePage(qid) {
	
	var pars = document.getElementsByTagName('select');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		var sids='';
		if (sCN.indexOf('FieldEQ_')==0 && sCN.indexOf('FieldEQ_0')!=0) {
			sids=sCN.split('_');
			for (i2=0;i2<pars[i].options.length;i2++) {
				if (pars[i].options[i2]!=null) {
					if (pars[i].options[i2].value==document.getElementById('FieldEQVal_'+sids[1]).value) {
						pars[i].options[i2].selected=true;
						pars[i].selectedIndex=i2;
					}
				}
			}			
		}
	}	
	
	var pars = document.getElementsByTagName('select');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		var sids='';
		if (sCN.indexOf('QValType_')==0 && sCN.indexOf('QValType_0')!=0) {
			sids=sCN.split('_');
			for (i2=0;i2<pars[i].options.length;i2++) {
				if (pars[i].options[i2]!=null) {
					if (pars[i].options[i2].value==document.getElementById('QValTypeVal_'+sids[1]).value) {
						pars[i].selectedIndex=i2;
					}
				}
			}			
		}
	}		
	
	
	for (i=0;i<document.getElementById('QueryType').options.length;i++) {
		if (document.getElementById('QueryType').options[i].value==document.getElementById('QueryTypeVal').value) {
			document.getElementById('QueryType').selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById('QRingLevel').options.length;i++) {
		if (document.getElementById('QRingLevel').options[i].value==document.getElementById('QRingLevelVal').value) {
			document.getElementById('QRingLevel').selectedIndex=i;
		}
	}
	if (document.getElementById('qResidenceVal').value.indexOf(",")>0) {
		var sResidesValArray=document.getElementById('qResidenceVal').value.split(",");
		for (i=0;i<sResidesValArray.length;i++) {
			for (i2=0;i2<document.getElementById('qResidence').options.length;i2++) {
				if (sResidesValArray[i]==document.getElementById('qResidence')[i2].value) {
					document.getElementById('qResidence')[i2].selected=true;
				}
			}
		}
	}
	else	{
		for (i=0;i<document.getElementById('qResidence').options.length;i++) {
			if (document.getElementById('qResidence')[i].value==document.getElementById('qResidenceVal').value) {
				document.getElementById('qResidence')[i].selected=true;
			}
		}			
	}

	if (qid!=null) {
		CheckValFields(qid);
	}
}
function ToggleAscDesc(theIdOfSelect) {
	var aUpdateOptions = new Array();

	oSelect = document.getElementById(theIdOfSelect)

	if (oSelect.selectedIndex == -1) {
		alert ("You must choose an element to toggle");
		return;
	}
	
	lVA=oSelect.options[oSelect.selectedIndex].value.split(" ")
	if (lVA[1] == 'ASC') {
		lVA[1]="DESC";
		}
	else	{
		lVA[1]="ASC";
	}
	
	lVAText=oSelect.options[oSelect.selectedIndex].text.replace(' ASC','');
	lVAText=lVAText.replace(' DESC','');
	lVAText=lVAText+" " + lVA[1];	


	lNV=lVA[0] + " " + lVA[1];	
	oSelect.options[oSelect.selectedIndex].value=lNV;
	oSelect.options[oSelect.selectedIndex].text=lVAText;		
}
function PQContinueOB(Mode) {
	document.getElementById('OrderedFields').value="";
	var lComma="";
	for (i=0;i<document.getElementById('OrderBy').options.length;i++) {
		document.getElementById('OrderedFields').value=document.getElementById('OrderedFields').value + lComma + document.getElementById('OrderBy').options[i].value;
		lComma=",";
	}
	document.getElementById('Mode').value=Mode;
	document.getElementById('Upd').value="1";
	document.getElementById('UpdProgressBar').style.display='';
	var dest=$('dest').value;

	ValidatefEmpApprov('DCQForm','Upd',dest);
	return false;			
}
function PQContinueQFInd(mode) {
	PQContinueQF(mode);
}
function PQContinueQF(Mode) {
	document.getElementById('OrderedFields').value="";
	var lComma="";
	for (i=0;i<document.getElementById('OrderCols').options.length;i++) {
		document.getElementById('OrderedFields').value=document.getElementById('OrderedFields').value + lComma + document.getElementById('OrderCols').options[i].value;
		lComma=",";
	}
	document.getElementById('Mode').value=Mode;
	document.getElementById('Upd').value="1";
	document.getElementById('UpdProgressBar').style.display='';
	
	var dest=$('dest').value;
	
	ValidatefEmpApprov('DCQForm','Upd',dest);
	return false;			
}
function SiteCCCheckValue() {
	document.getElementById('CCInfo').style.display='none';
	UpdateCheckValueID('AcceptCC');
	if (document.getElementById('AcceptCC').value=='1') {
		document.getElementById('CCInfo').style.display='';	
	}	
}
function fSiteCC() {
	if (document.getElementById('AcceptCC').value=='1') {
		if (document.getElementById('PayPalID').value.length==0 && document.getElementById('MerchantID').value.length==0) {	
			alert ("You Must Choose a CC Id, either PayPal or DC")
			document.getElementById('PayPalID').select();
			document.getElementById('PayPalID').focus();		
			return false;			
		}

		if (document.getElementById('PayPalID').value.length>0 && document.getElementById('MerchantID').value.length>0) {	
			alert ("You Must Choose either PayPal or DC")
			document.getElementById('PayPalID').select();
			document.getElementById('PayPalID').focus();		
			return false;			
		}
		if (document.getElementById('MerchantID').value.length>0) {	
			if (document.getElementById('MerchantPWD').value.length==0) {	
				alert ("You Must enter a DC Credit Processing Password")
				document.getElementById('MerchantPWD').select();
				document.getElementById('MerchantPWD').focus();		
				return false;			
			}
		}
	}	
	if (document.getElementById('PayPalID').value.length>255) {
		alert ("PayPal ID cannot exceed 255 characters")
		document.getElementById('PayPalID').select();
		document.getElementById('PayPalID').focus();		
		return false;			
	}
	if (document.getElementById('MerchantID').value.length>50) {
		alert ("Merchant ID cannot exceed 50 characters")
		document.getElementById('MerchantID').select();
		document.getElementById('MerchantID').focus();		
		return false;			
	}
	if (document.getElementById('MerchantPWD').value.length>50) {
		alert ("Merchant PassWord cannot exceed 50 characters")
		document.getElementById('MerchantPWD').select();
		document.getElementById('MerchantPWD').focus();		
		return false;			
	}			
	
	var sComma='';
	var sNewVal='';
	for (i=0;i<$('CreditCardOptions').options.length;i++) {
		if ($('CreditCardOptions').options[i].selected) {
			sNewVal=sNewVal+sComma+$('CreditCardOptions').options[i].value;
			sComma=',';
		}
	}
	
	$('CreditCardOptionsVal').value=sNewVal
			
	ValidatefEmpApprov('formCC','UpdInd','divWeb','fSetCCOptions()');
	return false;			
}
function fSetCCOptions() {
	aCurr=$('CreditCardOptionsVal').value.split(',');
	for (i=0;i<aCurr.length;i++) {
		for (i2=0;i2<$('CreditCardOptions').options.length;i2++) {
			if ($('CreditCardOptions').options[i2].value==aCurr[i]) {
				$('CreditCardOptions').options[i2].selected=true;
			}
		}	
	}
}
function CheckActivePreEventFlag () {
	if (document.getElementById('WillBeUsingScheduling').value=="1") {
		document.getElementById('PreEventSurvey').value="1";
		document.getElementById('ActivePreEventDiv').style.display="inline";
		}
	else	{
		document.getElementById('PreEventSurvey').value="0";
		document.getElementById('ActivePreEventDiv').style.display="none";	
	}
}
function CheckSurveyCatFlag () {
	if (document.getElementById('Survey').value=="1") {
		document.getElementById('SurveyCatDiv').style.display="inline";
		document.getElementById('ShowSuppSurvOnReturn').value="1"
		document.getElementById('ShowSuppSurvOnReturn').checked=true;
		document.getElementById('divShowSuppSurvOnReturn').style.display="";
		}
	else	{
		document.getElementById('SurveyCats').value="0";
		document.getElementById('SurveyCatDiv').style.display="none";	
		document.getElementById('ShowSuppSurvOnReturn').value="0"
		document.getElementById('divShowSuppSurvOnReturn').style.display="none";
	}
}
function fUpdatePayDefSites(ProductId,SiteId) {
	DisplayAjaxPage(0,'divSites','DCECOMMSITES','','','&siteid='+SiteId+'&productid='+ProductId);
}
function fUpdatePricingAlt(pid) {
	fUpdatePricing(pid);
}
function fUpdatePricing(pid) {

	document.getElementById('PayCode').value = document.getElementById('PayCode').value.replace(" ", "_");
	l_ErrorFound = 0;
	if (document.getElementById('PayCode').value.length < 1) {
		alert ("You must enter a Pay Code Name");
		document.getElementById('PayCode').select();
		document.getElementById('PayCode').focus();
		return false;
	}
	if (document.getElementById('PayDesc').value.length < 1) {
		alert ("You must enter a Payment Title");
		document.getElementById('PayDesc').select();
		document.getElementById('PayDesc').focus();
		return false;
	}
	if (document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "1") {
		if (document.getElementById('PromoCode').value.length < 1) {
			alert ("Promotional Code is required for this paytype");
			document.getElementById('PromoCode').select();
			document.getElementById('PromoCode').focus();
			return false;
		}
	}	
	if (document.getElementById('StartDate').value.length < 1) {
		alert ("Start Date must not be blank");
		document.getElementById('StartDate').focus();
		document.getElementById('StartDate').select();	
		return false;
	}
	if (isDate(document.getElementById('StartDate').value)==false){
		document.getElementById('StartDate').focus()
		document.getElementById('StartDate').select()		
		return false
	}
	if (document.getElementById('ExpireDate').value.length < 1) {
		alert ("Expire Date must not be blank");
		document.getElementById('ExpireDate').focus();
		document.getElementById('ExpireDate').select();	
		return false;
	}
	if (isDate(document.getElementById('ExpireDate').value)==false){
		document.getElementById('ExpireDate').focus();
		document.getElementById('ExpireDate').select();		
		return false;
	}
	splitDate = document.getElementById('StartDate').value.split("/");
	l_StartDate_x= new Date(splitDate[2],splitDate[0],splitDate[1])	;	
	splitDate = document.getElementById('ExpireDate').value.split("/");
	l_ExpireDate_x= new Date(splitDate[2],splitDate[0],splitDate[1])	;
	if (l_StartDate_x > l_ExpireDate_x) {
		alert ("Start Date cannot be greater then Expiration Date");
		document.getElementById('StartDate').focus();
		document.getElementById('StartDate').select();	
		return false;
	}	
	if (document.getElementById('PromoCode').value.length > 10) {
		alert ("Promotional Code can only be 10 characters long");
		document.getElementById('PromoCode').select();
		document.getElementById('PromoCode').focus();
		return false;
	}
	if (document.getElementById('Amount').value.length < 1) {
		alert ("Paycode Amount is required");
		document.getElementById('Amount').select();
		document.getElementById('Amount').focus();
		return false;
	}
	var lTmpAmt = document.getElementById('Amount').value.replace(".", "")
	if (!isNum(lTmpAmt)) {
		alert ("Paycode Amount must be numeric");
		document.getElementById('Amount').select();
		document.getElementById('Amount').focus();
		return false;
	}	
	if (document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value  == 5 || document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value  == 6) {
		if (document.getElementById('FactorType').options[document.getElementById('FactorType').selectedIndex].value!=0) {
			alert ("Factor Type must be be set to none for this pay type");
			document.getElementById('FactorType').select();
			document.getElementById('FactorType').focus();
			return false;
		}
		if (document.getElementById('RegEligCount').value.length < 1) {
			alert ("Eligible count is required when you choose this pay type");
			document.getElementById('RegEligCount').select();
			document.getElementById('RegEligCount').focus();
			return false;
		}
		if (!isNum(document.getElementById('RegEligCount').value)) {
			alert ("Eligible count must be numeric");
			document.getElementById('RegEligCount').select();
			document.getElementById('RegEligCount').focus();
			return false;
		}		
	}
	// optional items w/ counts
	if (document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value  == 8 || document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value  == 9) {
		if (document.getElementById('RegEligCount').value.length < 1) {
			alert ("Eligible count is required when you choose this pay type");
			document.getElementById('RegEligCount').select();
			document.getElementById('RegEligCount').focus();
			return false;
		}
		if (!isNum(document.getElementById('RegEligCount').value)) {
			alert ("Eligible count must be numeric");
			document.getElementById('RegEligCount').select();
			document.getElementById('RegEligCount').focus();
			return false;
		}		
	}	
	if (document.getElementById('FactorType').selectedIndex !=0) {
		if (document.getElementById('Factor').value.length < 1) {
			alert ("A Factor is required when you choose a Factor Type");
			document.getElementById('Factor').select();
			document.getElementById('Factor').focus();
			return false;
		}
		var lTmpAmt = document.getElementById('Factor').value.replace(".", "")
		if (!isNum(lTmpAmt)) {
			alert ("Factor must be numeric");
			document.getElementById('Factor').select();
			document.getElementById('Factor').focus();
			return false;
		}		
	}
	if (!isNum(document.getElementById('RegEligCount').value)) {
		alert ("Eligible count must be numeric");
		document.getElementById('RegEligCount').select();
		document.getElementById('RegEligCount').focus();
		return false;
	}

	if (document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value  == 10) {
		if (!isNum(document.getElementById('Period').value.length==0)) {
			alert ("Period is required");
			document.getElementById('Period').select();
			document.getElementById('Period').focus();
			return false;
		}				
		if (!isNum(document.getElementById('Period').value)) {
			alert ("Period amount must be numeric");
			document.getElementById('Period').select();
			document.getElementById('Period').focus();
			return false;
		}			
	}
	
	if (document.getElementById('Comment').value.length>2000) {
		alert ("Comment may not exceed 2000 characters");
		document.getElementById('Comment').select();
		document.getElementById('Comment').focus();
		return false;	
	}
	
	lComma=""	
	if (document.getElementById('DriverValue')!=null) {	
		document.getElementById('DriverValue').value='';
		for (i=0; i < document.getElementById('DriverValueSel').options.length;i++) {
			if (document.getElementById('DriverValueSel').options[i].selected) {
				document.getElementById('DriverValue').value = document.getElementById('DriverValue').value + lComma + document.getElementById('DriverValueSel').options[i].value;
				lComma=",";
			}
		}
	} 		
	
	var dest='PDE_'+pid;
	document.getElementById('UpdProgressBar').style.display='';

	if (pid==0) {
		var Output=document.getElementById('aPricingTab').href
		Output=Output.replace('&sid','&DCMessage=Pricing Definition Added&sid');
		ValidatefEmpApprov('formPayMaint','UpdInd',dest,Output);
	}
	else	{
		ValidatefEmpApprov('formPayMaint','UpdInd',dest,'fPaymentLoadForm()');
	}
	return false;			
}	
function SetDenoteMemberBox() {
	if (document.getElementById('MembersOnly').checked==true) {
		document.getElementById('Member').checked=true;
		document.getElementById('Member').value=1;
		}
	else	{
		document.getElementById('Member').checked=false;
		document.getElementById('Member').value=0;	
	}	
}

function UpdateCost(){
	var cstCode= document.EAPayMaint.DueCode.options[document.EAPayMaint.DueCode.selectedIndex].value;
	var cst = document.getElementById('DueCost_' + cstCode).value;
	document.getElementById("Amount").value = cst;
}
	
function ActivatePromoCode() {
	
	document.getElementById('PayCodeID').style.display = "";
	document.getElementById('DueCodeID').style.display = "none";
	document.getElementById('ShowPromoCode').style.display = "none";
	document.getElementById('FactorRowId').style.display = "none";
	document.getElementById('FactorTypeRowId').style.display = "none";
	document.getElementById('EligibleRowId').style.display = "none";
	document.getElementById('divSubscription').style.display = "none";
	
	if (document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "1") {
		document.getElementById('ShowPromoCode').style.display = "";
	}	
	if (document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "1" ||
		document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "2" ||
		document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "3" ||
		document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "4") {
		document.getElementById('FactorRowId').style.display = "";
		document.getElementById('FactorTypeRowId').style.display = "";
	}
	if (document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "5" || document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "6"
		|| document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "8" || document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "9") {
		document.getElementById('EligibleRowId').style.display = "";
	}
	if (document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "7") {
		document.getElementById('DueCodeID').style.display = "";
	}else{
		document.getElementById('DueCodeID').style.display = "none";
	}
	if (document.getElementById('PayType').options[document.getElementById('PayType').selectedIndex].value == "10") {
		document.getElementById('divSubscription').style.display = "";
	}	
}	
function fPaymentLoadForm() {

	for (i=0;i<document.getElementById('PayType').length;i++) {
		if (document.getElementById('PayType').options[i].value == document.getElementById('PayTypeVal').value) {
			document.getElementById('PayType').selectedIndex=i
		}
	}

	for (i=0;i<document.getElementById('FactorType').options.length;i++) {
		if (document.getElementById('FactorType').options[i].value == document.getElementById('FactorTypeVal').value) {
			document.getElementById('FactorType').selectedIndex=i
		}
	}
	for (i=0;i<document.getElementById('UOM').options.length;i++) {
		if (document.getElementById('UOM').options[i].value == document.getElementById('UOMSel').value) {
			document.getElementById('UOM').selectedIndex=i
		}
	}	
	
     
	ActivatePromoCode();

}
function SaveLinkTabMenusInd(dest) {
	SaveLinkTabMenus(dest);
}		
function SaveLinkTabMenus(dest) {
	
	if (dest==null) {
		dest='divWeb';
	}
	
	if (document.getElementById('TabLayout').innerHTML.length==0) {
		alert ("You have not added any tabs... How can you eat your meat if you haven't finished your tabs? :-)");
		return false;
	}

	serializeLinkTabs('TabLayout', 'divTab')
	
	document.getElementById('UpdInd').value='1';
	document.getElementById('UpdProgressBar').style.display='';
	ValidatefEmpApprov('formLinkTabBuild','UpdInd','divWeb','ManageTabsOrder()');	
	return false;
}
function serializeLinkTabs (container, name){
	var lCarrot='';
	$('TabMenuOrder').value=''
	
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('divTab_')==0) {
			document.getElementById('TabMenuOrder').value=document.getElementById('TabMenuOrder').value+lCarrot+sCN
			lCarrot='^';
			iCnt++;
		}
	}		
}
function fWebLinkChildrenSort() {
	Sortable.create('ul_0',{tree:true,scroll:window,dropOnEmpty: true})
	
	//Sortable.create('TabLayout',{dropOnEmpty: true})
}
function OpenCloseAuthOptions() {

	if (document.getElementById('SimpleAuth').value == "1") {
		document.getElementById('SAPContainer').style.display = "";
		}
	else	{
		document.getElementById('SAPContainer').style.display = "none";
	}
}
function fLinkInit() {
	
	if ($('divTab_'+$('Lcid'))!=null && $('Name')!=null) {
		$('divTab_'+$('Lcid').value).value=$('Name').value;
	}
	
	return;
	
	UpdateSpecialLinkType();

	for (i=0;i<document.getElementById('AreaType').length;i++) {
		if (document.getElementById('AreaType').options[i].value==document.getElementById('AreaTypeVal').value) {
			document.getElementById('AreaType').selectedIndex=i
		}
	}
	for (i=0;i<document.getElementById('UserRingLevel').length;i++) {
		if (document.getElementById('UserRingLevel').options[i].value==document.getElementById('UserRingLevelVal').value) {
			document.getElementById('UserRingLevel').selectedIndex=i
		}
	}
	for (i=0;i<document.getElementById('LinkType').length;i++) {
		if (document.getElementById('LinkType').options[i].value==document.getElementById('LinkTypeVal').value) {
			document.getElementById('LinkType').selectedIndex=i
		}
	}
	for (i=0;i<document.getElementById('Location').length;i++) {
		if (document.getElementById('Location').options[i].value==document.getElementById('LocationVal').value) {
			document.getElementById('Location').selectedIndex=i
		}
	}								
}
function UpdateSpecialLinkType() {

	var lType = document.getElementById('LinkType').options[document.getElementById('LinkType').selectedIndex].value;
	switch (lType) {
			
		case "999": 
			document.getElementById('UD_URL').value="";
			document.getElementById('StdLinkURLRow').style.display="";
			document.getElementById('UD_URL').style.display="";
			document.getElementById('UD_URLIDAssets').style.display="";
			document.getElementById('UD_URLIDText').style.display="none";

		break;
		

		case "5":  //Hotels
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";			
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="Hotel";
			}
		
						
		break;				

		case "6": //Agenda Table Style
			document.getElementById('WebPageLinkId').style.display="none";
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";			
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="Agenda";
			}		
				
			
		break;	
			
		case "7": //Pricing
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";			
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="Pricing";
			}	
					
						
		break;		

		case "8": //Agenda List Style
			document.getElementById('WebPageLinkId').style.display="none";	
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";	
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="Agenda";
			}						
			
			
		break;				

		case "9": // Main Page
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="General Information";
			}				
				
			
		break;	
		
		case "10": // Other DC Web Site
			//document.getElementById('UD_URL').value="";
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').style.display="";
			document.getElementById('UD_URLIDAssets').style.display="";
			document.getElementById('UD_URLIDText').style.display="none";
				
			
		break;	
		
		case "11": //Log Off
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";	
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="Log Off";
			}	
		
		case "12": //Account Services
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";	
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="Account Services";
			}									
			
			
			
		case "15": //Change Password
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";	
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="Change Password";
			}									
			
			
			
		case "16": //Opt-In Query
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";	
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="Find Someone (Opt-In Query)";
			}									
			
				
			
		case "161": //Opt-In Query
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";	
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="Find Someone Using Company Attributes";
			}									
			
													
			
		case "13": //Unscheduled Agenda List
			document.getElementById('WebPageLinkId').style.display="none";		
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";	
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="Agenda";
			}						
			
			
					
		break;	
		
			
		case "100": //Spacer
			document.getElementById('StdLinkURLRow').style.display="none";
			document.getElementById('UD_URL').value="";			
			if (document.getElementById('Name').value.length < 1) {
				document.getElementById('Name').value="Pricing";
			}	
					
						
		break;				
	}
}
function fWebLinkDragDrop() {
	
	if (document.getElementById('ul_0')==null || document.getElementById('UALinks')==null ) {
		//return;
	}

  if ($('UALinks')!=null) {
  	$A($('UALinks').getElementsByTagName('li')).each(
		  function(item) {
  	  	new Draggable(
	    	  item,
      			{
	          	revert: true,
            	ghosting: true,
            	scroll: window
      			}
    		);
			}
   	);
	}   
  $A($('ul_0').getElementsByTagName('li')).each(
	  function(item) {   
			  Droppables.add(
  				item,
					{
  					hoverclass: 'DropZoneActive',
   					onDrop: moveLinkItem
				}
    			);
    		}
  	);
  	
//  Droppables.add(
//   'ul_0',
//  	{
//    	hoverclass: 'DropZoneActive',
//      onDrop: moveLinkItem
//    }
//  );  	
   // Set drop area by default  non cleared.
   
  if ($('UALinks')!=null) {
   	$('UALinks').cleared = false;
  }
   
//  var pars = document.getElementsByTagName('li');
//  d=document.getElementById('ul_0')
//	for (var i=0;i<pars.length;i++) {
//		sCN=pars[i].id;
//		if (sCN.indexOf('temp_')==0) {
//			//d.remove(document.getElementById(sCN));
//		}
//	}
}
function moveLinkItem( draggable,droparea){	

  draggable.parentNode.removeChild(draggable);
  insertAfter (draggable,droparea)
 // droparea.appendChild(draggable);
  $('ul_0').highlight();
 // ToggleElement('divUnassigned');
 
  
  Sortable.serialize('ul_0');
 
 SetUpSorts(); 
  //fWebLinkOrderFormInd();
  //fWebLinkChildrenSort();

}
//create function, it expects 2 values.
function insertAfter(newElement,targetElement) {
//target is what you want it to go after. Look for this elements parent.
var parent = targetElement.parentNode;

//if the parents lastchild is the targetElement...
	if(parent.lastchild == targetElement) {
		//add the newElement after the target element.
		parent.appendChild(newElement);
		} 
	else {
		// else the target has siblings, insert the new element between the target and it's next sibling.
		parent.insertBefore(newElement, targetElement.nextSibling);
	}
	
	if (targetElement.id=='liWL_0') {
		var parent = document.getElementById('ul_0');
		parent.removeChild(targetElement);	
	}
}
function AddLinkChildNode(aid) {

	var splId=aid.split('_');
	var currElem=document.getElementById(aid);

	gNum=gNum+1;
	var idName = gNum;
	
		
  var newUl = document.createElement('ul');
  newUl.setAttribute('id','fut_'+idName);
  currElem.appendChild(newUl);
	
  var newLi = document.createElement('li');
  newLi.setAttribute('id','liWl_'+idName);
  newUl.appendChild(newLi);
  
  lTools='<input type="hidden" name="FolderName" id="FolderName_'+idName+'" value="New Drop Area"/>New Drop Area'; 
	newLi.innerHTML=lTools;    
  
	fWebLinkChildrenSort();
	fWebLinkDragDrop();
}
function fWebLinkOrderFormInd() {
	
	fWebLinkOrderForm();
}
function fWebLinkOrderForm() {
	
	Sortable.destroy('ul_0');
	Sortable.create('ul_0',{tree:true,scroll:window});
	
	document.getElementById('Serial').value=Sortable.serialize('ul_0');
	document.getElementById('WLUpdInd').value="1";
	document.getElementById('WLUpdProgressBarLink').style.display='';
	sComma='';
  var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('FolderName_')==0 && pars[i].value!='') {
			document.getElementById('FolderName').value=document.getElementById('FolderName').value+sComma+pars[i].value;
			sComma=',';
		}
	}
  
  ValidatefEmpApprov('formWebLinkOrder','WLUpdInd','LE_0','fWebLinkChildrenSort()');
  return false;
	
}
function StartSort() {
	
	if ($('ul_0')!=null) {
		fWebLinkChildrenSort();
	}
}
function fCreateReportSizer() {
	
	new Control.Slider('divSizerHandle', 'divSizer', {
		range: $R(.5, 2),
			//values: [.5, .6, .7, .8, .9, 1, 1.2, 1.4, 1.5, 2],
			sliderValue: 1, // won't work if set to 0 due to a bug(?) in script.aculo.us
			//onSlide: function(v){ $('debug3').innerHTML = 'slide: ' + v },
			onSlide: function(v){
				var sSize = v+'em'; 
				$('tableReportTable').style.fontSize=sSize;
			}
		});
		
	fClonePaging('divPageFooter','divPageHeader');

}
function SavePaymentDesigneeRecordInd(mode) {
	SavePaymentDesigneeRecord(mode);
}
function SavePaymentDesigneeRecord(mode) {
	
	if (mode!='2') {
		if (document.getElementById('AttnName').value.length < 1) {
			alert ("Attention is a required field for this function");
			document.getElementById('AttnName').focus();
			document.getElementById('AttnName').select();
			return false;
		}
		if (document.getElementById('AttnName').value.length > 100) {
			alert ("Attention cannot exceed 100 characters");
			document.getElementById('AttnName').focus();
			document.getElementById('AttnName').select();
			return false;
		}	
		if (document.getElementById('FirstName').value.length < 1) {
			alert ("First Name is a required field for this function");
			document.getElementById('FirstName').focus();
			document.getElementById('FirstName').select();
			return false;
		}
		if (document.getElementById('FirstName').value.length > 100) {
			alert ("First Name cannot exceed 100 characters");
			document.getElementById('FirstName').focus();
			document.getElementById('FirstName').select();
			return false;
		}	
		
		if (document.getElementById('LastName').value.length > 100) {
			alert ("Last Name cannot exceed 100 characters");
			document.getElementById('LastName').focus();
			document.getElementById('LastName').select();
			return false;
		}
		if	(document.getElementById('Addr1').value.length < 1) {
			alert ("Address 1 is a required field for this function");
			document.getElementById('Addr1').focus();
			document.getElementById('Addr1').select();
			return false;
		}
		if (document.getElementById('Addr1').value.length > 100) {
			alert ("Address 1 cannot exceed 100 characters");
			document.getElementById('Addr1').focus();
			document.getElementById('Addr1').select();
			return false;
		}		
		if (document.getElementById('Addr2').value.length > 100) {
			alert ("Address 2 cannot exceed 100 characters");
			document.getElementById('Addr2').focus();
			document.getElementById('Addr2').select();
			return false;
		}
		if (document.getElementById('Addr3').value.length > 100) {
			alert ("Address 3 cannot exceed 100 characters");
			document.getElementById('Addr2').focus();
			document.getElementById('Addr2').select();
			return false;
		}
		if (document.getElementById('City').value.length > 100) {
			alert ("City cannot exceed 100 characters");
			document.getElementById('City').focus();
			document.getElementById('City').select();
		return false;	
		}	
		if (document.getElementById('State').value.length > 4) {
			alert ("State cannot exceed 4 characters");
			document.getElementById('State').focus();
			document.getElementById('State').select();
			return false;
		}			
		if (document.getElementById('Zip').value.length > 50) {
			alert ("Postal Code cannot exceed 50  characters");
			document.getElementById('Zip').focus();
			document.getElementById('Zip').select();	
			return false;	
		}
		if (document.getElementById('CheckPayable').value.length > 200) {
			alert ("City cannot exceed 200 characters");
			document.getElementById('CheckPayable').focus();
			document.getElementById('CheckPayable').select();
			return false;
		}	
	}
		
	document.getElementById('PDUpdInd').value=mode;
	document.getElementById('UpdProgressBarLink').style.display='';
	  
	ValidatefEmpApprov('formPaymentDesignee','UpdInd','divWeb');
	return false;
}	
function fCountCharacters(inId,outId,total) {
	if (total==null) {
		total=1000;
	}
	var sCnt=document.getElementById(inId).value.length;
	var sCntAvail=total-(sCnt);
	if (sCntAvail<0) {
		document.getElementById(outId).style.color='#ff0000';
	}
	else {
		document.getElementById(outId).style.color='#666666';
	}
	document.getElementById(outId).innerHTML=sCntAvail+' Characters Available';
}
function fSubscribeRSS(fid) {
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_RSSEasySubscribe.asp?fid=' + fid + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'aRSSLink_'+fid,1,'true','alert(\'You have been successfully subscribed to the feed\')');

}
function fSubscriptionRSSEdit(fid) {
	
}
function fSaveMemberPWD() {
	
	if (document.getElementById('txtPassword').value.length==0) {
		alert ("You must enter a new password");
		document.getElementById('txtPassword').focus();
		document.getElementById('txtPassword').select();
		return false;
	}
	if (document.getElementById('txtPassword').value.length>50) {
		alert ("Password cannot exceed 50 characters");
		document.getElementById('txtPassword').focus();
		document.getElementById('txtPassword').select();
		return false;
	}
	if (document.getElementById('txtConfirm').value.length==0) {
		alert ("You must enter a confirmation password");
		document.getElementById('txtConfirm').focus();
		document.getElementById('txtConfirm').select();
		return false;
	}
	if (document.getElementById('txtConfirm').value!=document.getElementById('txtPassword').value) {
		alert ("Password and confirmation password do not match");
		document.getElementById('txtConfirm').focus();
		document.getElementById('txtConfirm').select();
		return false;
	}			
	if (document.getElementById('txtPWDAnswer').value.length==0) {
		alert ("You must enter a new Hint Question");
		document.getElementById('txtPWDAnswer').focus();
		document.getElementById('txtPWDAnswer').select();
		return false;
	}
	if (document.getElementById('txtPWDAnswer').value.length>50) {
		alert ("Hint Question cannot exceed 50 characters");
		document.getElementById('txtPWDAnswer').focus();
		document.getElementById('txtPWDAnswer').select();
		return false;
	}	
	document.getElementById('PWDUpd').value='1';
	document.getElementById('UpdProgressBar').style.display='';	
	ValidatefEmpApprov('formMemberPwd','PWDUpd','divIFrame');	
	return false;
}
function FMLinkOn(xrefid,event) {
	if (bFileManagerFolderEdit==1) {
		document.getElementById('divEditArea_'+xrefid).style.display='';	
		if (event!=null) {
			event.cancelBubble=true;
		}
	}
}
function FMLinkOff(xrefid,event) {
	if (bFileManagerFolderEdit==1) {
		if ($('FolderNameText_'+xrefid).style.display=='none') {
			$('FolderNameText_'+xrefid).innerHTML=$('FolderName_'+xrefid).value;
		}
		document.getElementById('divEditArea_'+xrefid).style.display='none';
		if (event!=null) {
			event.cancelBubble=true;
		}
	}
}
function fCloudEditFolderName(fid) {
	
	CloseByIdPattern('span','cFolderNameContainer_',0,0);
	OpenByIdPattern('span','cFolderNameText_');
	
	$('cFolderNameText_'+fid).style.display='none';
	$('cFolderNameContainer_'+fid).style.display='';
	$('cFolderNameText_'+fid).innerHTML=$('cFolderName_'+fid).value;
}
function fSaveFolderNameInd(elem,fid) {
	fSaveFolderName(elem,fid);
}
function fSaveFolderName(elemId,fid) {
	
	var elem=$(elemId);
	var elemSplit=elemId.split('_')
	var elem2=$('cFolderDesc_'+elemSplit[1]);
	var elem3=$('CloudTag_'+elemSplit[1]);
	
	var elem4=$('libr_'+elemSplit[1]);
	var elem5=$('librCascFunc_'+elemSplit[1]);
	var elem6=$('librOffLineFunc_'+elemSplit[1]);
	var elem7=$('Broadcast_'+elemSplit[1]);
	
	
	$('fn').value=elem.value;
	$('fd').value=elem2.value;
	$('ct').value=elem3.value;
	$('lf').value=elem4.value;
	$('lfc').value=elem5.value;
	$('lfol').value=elem6.value;
	$('bc').value=elem7.value;
	$('fid').value=fid;
	$('UFNUpd').value='1';
	//fCloudEditFolderName('+fid+');
	ValidatefEmpApprov('formUpdFoldName','UFNUpd','fid_'+fid);	
	$('cFolderNameText_'+fid).style.display='';
	$('cFolderNameContainer_'+fid).style.display='none';	
	return false;	
}

function fCancelFolderName(elem,fid) {
	$('fn').value='';
	$('fid').value='';
	$('UFNUpd').value='';	
	
	$('cFolderNameText_'+fid).style.display='';
	$('cFolderNameContainer_'+fid).style.display='none';
}
function EditFolderName(fid) {
	ToggleElement('FolderNameText_'+fid);
	ToggleElement('FolderName_'+fid);
	$('FolderNameText_'+fid).innerHTML=$('FolderName_'+fid).value;
}
function SetUpDragDropOrganizer() {
	//Sortable.create('ul_0',{tree:true,scroll:window,dropOnEmpty: true,only:'Item'})
	//Sortable.create('FileDrop',{tree:true,dropOnEmpty: true})	
	
	fDragDropTrees('ul_0','FileDrop');
}
function fDragDropTrees(List1,List2) {
	//alert ('Processing Drag and Drop');
	
	if (document.getElementById(List1)==null || document.getElementById(List2)==null ) {
		//alert ('Cannot Process Drag and Drop - Error')
		return;
	}

  $A($(List2).getElementsByTagName('li')).each(
	  function(item) {
  	  new Draggable(
    	  item,	{
          	revert: true,
            ghosting: true,
            scroll: window
      		}
    	);
		}
   );
   
  $A($(List1).getElementsByTagName('li')).each(
	  function(item) {   
			  Droppables.add(
   				item,
  					{
    					hoverclass: 'DropZoneActive',
      				onDrop: moveFileItem
    				}
    			);
    		}
  	);

   // Set drop area by default  non cleared.
   
   $(List2).cleared = false;
   
  var pars = document.getElementsByTagName('li');
  d=document.getElementById(List1)
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('temp_')==0) {
			//d.remove(document.getElementById(sCN));
		}
	}
}
function moveFileItem(draggable,droparea){	

  draggable.parentNode.removeChild(draggable);

	var iA=draggable.id.split('_');
	var iDragId=iA[1];
	var iRt=iA[2];
		
	var iA=droparea.id.split('_');
	var iDropId=iA[1];
	
	var AssetTotId='TotAssets_'+iDropId;

	var ajaxscript = '/dc_includes/CP5_FileTreeFolderAsset.asp?rt='+iRt+'&xid='+iDropId+'&fid='+iDragId+'&dm=1&xc=' + ajaxTimeStamp;
	//AjaxSimpleCheck(ajaxscript, '','divGnrlAjax',1,true,'fSimpleDisplayFileTree()');	   	
	AjaxSimpleCheck(ajaxscript, '','divGnrlAjax',1,true,'');	   	
	$(droparea).highlight();	
	
	//var iTimer = window.setInterval('ReCalcAssets(\''+draggable.id+'\','+iDragId+')', 10000);
	//var iTimer = window.setInterval('ReCalcAssets(\''+droparea.id+'\','+iDropId+')', 10000);
}
function ReCalcAssets(elemId,xid) {
	var ajaxscript = '/dc_includes/CP5_FileTreeAssetCnt.asp?xid='+xid+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '',elemId,1);	   	
}
function ReshowFolderContents (xid) {
	
		//$('sf_'+xid).className='StdFolderOpen';
		//$('divFMContainer').innerHTML='<div id="progressind" class="Progress">Retrieving...</div>';	
		DisplayAjaxPage(0,'divFMContainer','DCFileManagerDrop','','','&xid='+xid,'1','SetUpDragDropOrganizer()');
}
function SimplePeopleSearch() {
	document.getElementById('UpdProgressBar').style.display='';	
	document.getElementById('PSUpd').value="1";
	ValidatefEmpApprov('formSearchPerson','PSUpd','divWeb');	
	return false;
}
function elementStartMove(elemId) {
	dragElem=document.getElementById(elemId)
	dragHandle=new Draggable(dragElem,{scroll:window});
}
function elementStopMove(elemId) {
	//dragHandle.destroy();	
}
function fDispProjAlert (pid,wid,aid,tid,ttid,dest) {
	if (tid==null) {
		tid=0;
	}
	if (ttid==null) {
		ttid=0;
	}	
	
	if (dest==null) {
		dest='divEditNote_'+tid
	}
	CloseByIdPattern('div','divEditNote_',0,1);
	DisplayAjaxPage	(0,dest,'ProjTaskAlertDetails','','&ttid='+ttid+'&wid='+wid+'&pid='+pid+'&aid='+aid+'&tid='+tid+'&dest='+dest);
}
function saveProjTaskAlertsInd() {
	saveProjTaskAlerts();
}
function saveProjTaskAlerts() {
	var dest='divEditNote_'+document.getElementById('tid').value;
	var pid=document.getElementById('pid').value;
	var aid=document.getElementById('aid').value;
	
	var bAdminSelected=-1;
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('WhoAdmins_')==0) {
			if (pars[i].value.length>0) {
				bAdminSelected=1;
			}
		}
	}
	
	if (!isNum(document.getElementById('PctComplete').value)) {
		alert ("Percent Complete must be numeric and represent a percentage");
		document.getElementById('PctComplete').select();
		document.getElementById('PctComplete').focus();
		return false;
	}
	if (!isNum(document.getElementById('PctComplete').value>100)) {
		alert ("Percent Complete cannot exceed 100%");
		document.getElementById('PctComplete').select();
		document.getElementById('PctComplete').focus();
		return false;
	}
		
	if (bAdminSelected==1 || document.getElementById('Who').value>0) {
		document.getElementById('PTUpd').value='1';
		var sDest=document.getElementById('PTDest').value;
		//document.getElementById('TaskUpdProgressBar').style.display='';
		ValidatefEmpApprov('formProjTaskAlert','DCUpdInd',sDest,'fRedisplayAlerts()');	
		return false;	
	}
	else {
		alert ('You must either select or add someone to alert');
		return false;	
	}
}
function fRedisplayAlerts() {
	var pid=document.getElementById('pid').value;
	var aid=document.getElementById('aid').value;
	DisplayAjaxPage(0,'tdTaskAlert_'+aid,'ProjTaskAlerts',1,'','&pid='+pid+'&uid='+aid);
}
function deleteNotificationWho(seq) {
	var x=window.confirm("You are about to delete this specific notification\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ProjTaskAlertDelete.asp?sid=' + seq + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divNotification_'+seq)
}	
function ToggleTaskKPI(wid,pid,tid,ttype) {
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ProjTaskToggleKPI.asp?aid=' + wid + '&pid=' + pid + '&tid=' + tid + '&type=' + ttype + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');	
}
function fUpdCalByPid(dest,sRDate,iid,selPid,mode) {
	
	if (mode==null) {
		mode=0;
	}
	
	var sSelPids='';
	var sComma='';
	var pars = document.getElementsByTagName('input');

	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('SelProjCal_')==0) {
			if (pars[i].value.length>0) {
				sSelPids=sSelPids+sComma+pars[i].value;
				sComma=',';
			}
		}
	}
	if (sComma.length==0) {
		alert('You must have at least one project selected');
		document.getElementById(iid).checked=true;
		document.getElementById(iid).value=selPid;
	}
	else	{
		if (mode==0) {
			DisplayAjaxPage(0,dest,'DCAtomProjWeekCalendar',1,'&dest='+dest+'&d='+sRDate+'&pid='+sSelPids,'',1);
		}
		else	{
			DisplayAjaxPage(0,dest,'DCProjCalendarByDay',1,'&dest='+dest+'&d='+sRDate+'&pid='+sSelPids,'',1);
		}
	}
}
function SetSelectedDay(tid,mmDdYy) {
	var pars = document.getElementsByTagName('td');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('MM_')==0) {
			if (pars[i].className.indexOf('DaySelHighlight')>0) {
				pars[i].className=pars[i].className.replace('DaySelHighlight','');
			}
			pars[i].className=pars[i].className.replace('MMHighLight','');
		}
	}
	if (document.getElementById(tid)!=null) {
		document.getElementById(tid).className=document.getElementById(tid).className+' DaySelHighlight';
	}
	else	{
		if (mmDdYy!=null) {
			var sD=mmDdYy.split('/');
			yyyy=sD[2];
			DisplayAjaxPage(0,'divCalContainer','DCVISCALONLY',1,'&cc='+lPD_ConfCode+'&dd=01&mm=-1&yyyy='+yyyy,'','','SetSelectedDay('+tid+')');
		}
		else {
			DisplayAjaxPage(0,'divCalContainer','DCVISCALONLY',1,'&cc='+lPD_ConfCode+'&dd=01&mm=-1','','','SetSelectedDay('+tid+')');
		}
	}
}
function fDelResourceAssignment(pid,rid) {

	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_ProjResourceAssignmentDelete.asp?pid='+pid+'&rid='+rid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	document.getElementById('inpAssId_'+rid).value='';
	document.getElementById('inpAss_'+rid).value='';
	document.getElementById('UpdProgressBarRA_'+rid).innerHTML='Unassigned';

}
function fDispWebPageShadow (pageId,gid) {
	DisplayShadowBox(1,'DCWEBPAGEEDITAtom','&sid='+pageId+'&gid='+gid)
}
function WebToggleSpecPages (elem,sid,sType) {
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}

	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_ToggleSpecPages.asp?sid='+sid+'&type='+sType+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function WebToggleSpecCommentPage (elem,cmtId) {
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}

	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_ToggleSpecCommentPage.asp?cmtId='+cmtId+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function fTogglePersistValue (elem,kt,kn) {
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_TogglePersistValue.asp?kt='+kt+'&kn='+kn+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function fSaveSiteOptionsInd() {
	fSaveSiteOptions();
}
function fSaveSiteOptions() {


	if (document.getElementById('dSpecificBannerAd')!=null) {
		if (document.getElementById('dSpecificBannerAd').value.length > 128) {
			alert ("Specific Banner Ad cannot be greater than 128 characters");
			document.getElementById('dSpecificBannerAd').focus();
			document.getElementById('dSpecificBannerAd').select();
			return false;
		}
	}
	
	if (document.getElementById('dSpecificReplyTo').value.length > 50) {
		alert ("Specific Replyto cannot be greater than 50 characters");
		document.getElementById('dSpecificReplyTo').focus();
		document.getElementById('dSpecificReplyTo').select();
		return false;
	}	

	if (document.getElementById('dRegPart1Title').value.length > 100) {
		alert ("Registration Part 1 Title may not exceed 100 characters");
		document.getElementById('dRegPart1Title').focus();
		document.getElementById('dRegPart1Title').select();
		return false;
	}		
	
	if (document.getElementById('dRegPart2Title').value.length > 100) {
		alert ("Registration Part 1 Title may not exceed 100 characters");
		document.getElementById('dRegPart2Title').focus();
		document.getElementById('dRegPart2Title').select();
		return false;
	}		
		
	if (document.getElementById('dEventServiceTitle').value.length > 100) {
		alert ("Event Services Title may not exceed 100 characters");
		document.getElementById('dEventServiceTitle').focus();
		document.getElementById('dEventServiceTitle').select();
		return false;
	}		
	
	if (document.getElementById('dConfirmationTitle').value.length > 100) {
		alert ("Confirmation Title may not exceed 100 characters");
		document.getElementById('dConfirmationTitle').focus();
		document.getElementById('dConfirmationTitle').select();
		return false;
	}	
	
	if (document.getElementById('NotApprovedRegMessage').value.length>2000) {
		alert ("Not approved for registration message may not exceed 2000 characters");
		document.getElementById('NotApprovedRegMessage').focus();
		document.getElementById('NotApprovedRegMessage').select();
		return false;	
	}	
	
	if (document.getElementById('GoogleMarker').value.length > 255) {
		alert ("Google/Map Marker  may not exceed 255 characters");
		document.getElementById('GoogleMarker').focus();
		document.getElementById('GoogleMarker').select();
		return false;
	}		
	
	if (document.getElementById('DPListArray')!=null) {
		document.getElementById('DPListArray').value = "";
	}
	if (document.getElementById('dAttributeFilterArray')!=null) {
		document.getElementById('dAttributeFilterArray').value = "";
	}	
	if (document.getElementById('SAListArray')!=null) {
		document.getElementById('SAListArray').value = "";
	}		
	if (document.getElementById('dSurvListArray')!=null) {
		document.getElementById('dSurvListArray').value = "";	
	}	
	if (document.getElementById('dRegListArray')!=null) {
		document.getElementById('dRegListArray').value = "";
	}			
	if (document.getElementById('dsessionfilter')!=null) {
		document.getElementById('dsessionfilter').value = "";	
	}		

	lComma="";	
	
	if (document.getElementById('DPList')!=null) {
		for (i=0; i < document.getElementById('DPList').options.length;i++) {
		
			if (document.getElementById('DPList').options[i].selected) {
				document.getElementById('DPListArray').value = document.getElementById('DPListArray').value + lComma + document.getElementById('DPList').options[i].text;
				lComma=",";
			}
		} 
	}
	
	if (document.getElementById('dAttributeFilter')!=null) {
		for (i=0; i < document.getElementById('dAttributeFilter').options.length;i++) {
		
			if (document.getElementById('dAttributeFilter').options[i].selected) {
				document.getElementById('dAttributeFilterArray').value = document.getElementById('dAttributeFilterArray').value + lComma + document.getElementById('dAttributeFilter').options[i].text;
				lComma=",";
			}
		} 
	}
		
	
	lComma=""
	if (document.getElementById('SAList')!=null) {		
		for (i=0; i < document.getElementById('SAList').options.length;i++) {
			if (document.getElementById('SAList').options[i].selected) {
				document.getElementById('SAListArray').value = document.getElementById('SAListArray').value + lComma + document.getElementById('SAList').options[i].text;
				lComma=",";
			}
		} 	
	}
	
	lComma=""	
	if (document.getElementById('SLList')!=null) {	
		for (i=0; i < document.getElementById('SLList').options.length;i++) {
			if (document.getElementById('SLList').options[i].selected) {
				document.getElementById('dSurvListArray').value = document.getElementById('dSurvListArray').value + lComma + document.getElementById('SLList').options[i].text;
				lComma=",";
			}
		}
	} 	
	lComma=""	
	if (document.getElementById('RegList')!=null) {	
		for (i=0; i < document.getElementById('RegList').options.length;i++) {
			if (document.getElementById('RegList').options[i].selected) {
				document.getElementById('dRegListArray').value = document.getElementById('dRegListArray').value + lComma + document.getElementById('RegList').options[i].text;
				lComma=",";
			}
		}
	}
	document.getElementById('dRegListArray').value = document.getElementById('dRegListArray').value + lComma + "RegistrationClosed"		
	lComma=""	
	if (document.getElementById('dsessionfilterArray')!=null) {	
		for (i=0; i < document.getElementById('dsessionfilterArray').options.length;i++) {
			if (document.getElementById('dsessionfilterArray').options[i].selected) {
				document.getElementById('dsessionfilter').value = document.getElementById('dsessionfilter').value + lComma + document.getElementById('dsessionfilterArray').options[i].text;
				lComma=",";
			}
		}
	} 		
	lComma=""	
	if (document.getElementById('dSurveyFilter')!=null) {	
		document.getElementById('dSurveyFilter').value = "";
		for (i=0; i < document.getElementById('dSurveyFilterArray').options.length;i++) {
			if (document.getElementById('dSurveyFilterArray').options[i].selected) {
				document.getElementById('dSurveyFilter').value = document.getElementById('dSurveyFilter').value + lComma + document.getElementById('dSurveyFilterArray').options[i].text;
				lComma=",";
			}
		}
	} 	
	
	$('UpdProgressBarLink').style.display='';
	ValidatefEmpApprov("formSiteOptions","SiteUpdInd","divWeb","fUpdateSiteOptionFields();");	
	return false;		
}
function fUpdateSiteOptionFields() {
	
	for (i=0;i<document.getElementById('NavigationStyle').length;i++) {
		if (document.getElementById('NavigationStyle').options[i].value==document.getElementById('NavigationStyleVal').value) {
			document.getElementById('NavigationStyle').selectedIndex = i;
		}
	}

	if (document.getElementById('DPListArray') !=null) {

		var lArray=document.getElementById('DPListArray').value.split(",")

		for (i=0; i < document.getElementById('DPList').options.length;i++) {
			for (i2=0; i2 < lArray.length;i2++) {
	
				if (document.getElementById('DPList').options[i].value == lArray[i2]) {
					document.getElementById('DPList').options[i].selected=true;
				}
			}
		} 
	}
	if (document.getElementById('dAttributeFilterArray') !=null) {

		var lArray=document.getElementById('dAttributeFilterArray').value.split(",")

		for (i=0; i < document.getElementById('dAttributeFilter').options.length;i++) {
			for (i2=0; i2 < lArray.length;i2++) {
	
				if (document.getElementById('dAttributeFilter').options[i].value == lArray[i2]) {
					document.getElementById('dAttributeFilter').options[i].selected=true;
				}
			}
		} 
	}	
	
	if (document.getElementById('SAListArray') !=null) {	
		var lArray=document.getElementById('SAListArray').value.split(",")
		for (i=0; i < document.getElementById('SAList').options.length;i++) {
			for (i2=0; i2 < lArray.length;i2++) {
				if (document.getElementById('SAList').options[i].value == lArray[i2]) {
					document.getElementById('SAList').options[i].selected=true;
				}
			}
		}
	} 	

	if (document.getElementById('dSurvListArray') !=null) {	
		var lArray=document.getElementById('dSurvListArray').value.split(",")

		for (i=0; i < document.getElementById('SLList').options.length;i++) {
			for (i2=0; i2 < lArray.length;i2++) {
				if (document.getElementById('SLList').options[i].value == lArray[i2]) {
					document.getElementById('SLList').options[i].selected=true;
				}
			}
		} 	
	}
	
	if (document.getElementById('dRegListArray') !=null) {	
		
		var lArray=document.getElementById('dRegListArray').value.split(",")

		for (i=0; i < document.getElementById('RegList').options.length;i++) {
			for (i2=0; i2 < lArray.length;i2++) {
				if (document.getElementById('RegList').options[i].value == lArray[i2]) {
					document.getElementById('RegList').options[i].selected=true;
				}
			}
		} 	
	}	

	if (document.getElementById('dsessionfilter') !=null) {	
		var lArray=document.getElementById('dsessionfilter').value.split(",")

		for (i=0; i < document.getElementById('dsessionfilterArray').options.length;i++) {
			for (i2=0; i2 < lArray.length;i2++) {
				if (document.getElementById('dsessionfilterArray').options[i].value == trim(lArray[i2])) {
					document.getElementById('dsessionfilterArray').options[i].selected=true;
				}
			}
		} 
	}

	if (document.getElementById('dSurveyFilter')!=null) {

		var lArray=document.getElementById('dSurveyFilter').value.split(",")

		for (i=0; i < document.getElementById('dSurveyFilterArray').options.length;i++) {
			for (i2=0; i2 < lArray.length;i2++) {
				if (document.getElementById('dSurveyFilterArray').options[i].value == trim(lArray[i2])) {
					document.getElementById('dSurveyFilterArray').options[i].selected=true;
				}
			}
		}
	}
}

function fSaveSpecComments() {
	document.getElementById('EAComMaint').onsubmit();

	if (document.getElementById('Comment').value.length < 1) {
		alert ("You must enter a comment value");
		return false;
	}
	document.getElementById('Upd').value="1";
}	
function fValOrgMaintInd() {
	fValOrgMaint();
}
function fValOrgMaint() {
	if (document.getElementById('Name').value.length==0) {
		alert ("Name is a Required Field");
		document.getElementById('Name').select();
		document.getElementById('Name').focus();
		return false;
	}
	if (document.getElementById('Name').value.length>100) {
		alert ("Name may not exceed 200 characters");
		document.getElementById('Name').select();
		document.getElementById('Name').focus();
		return false;
	}

	if (document.getElementById('Description').value.length>1000) {
		alert ("Name may not exceed 1000 characters");
		document.getElementById('Description').select();
		document.getElementById('Description').focus();
		return false;
	}
		
	document.getElementById('PosUpd').value='1';
	var dest=document.getElementById('dest').value;
	
	$('UpdProgressBar').style.display='';
	ValidatefEmpApprov("DCOrgWizard","UpdInd",dest,"fReDisplayOrgMasters();");	
	return false;			
}
function fReDisplayOrgMasters() {
	var dest=document.getElementById('dest').value;
	if (dest=='divRole_0') {
		var gid=document.getElementById('gid').value;
		DisplayAjaxPage(0,'divWeb','DCORGANIZATIONROLESLIST','','','&gid='+gid+'&DCMessage=Role Added');
	}
}
function fDeletePos(Pos,gid) {
	var x=window.confirm("You are about to delete the selected Position\n\n if correct, press OK, else CANCEL")
	if (!x) {
		return;
	}
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_OrganizationPositionDelete.asp?posid='+Pos+'&gid='+gid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divPosContainer_'+Pos)
}
function fValOrgClassMaintInd() {
	fValOrgClassMaint();
}
function fValOrgClassMaint() {
	if (document.getElementById('Name').value.length==0) {
		alert ("Name is a Required Field");
		document.getElementById('Name').select();
		document.getElementById('Name').focus();
		return false;
	}
	if (document.getElementById('Name').value.length>100) {
		alert ("Name may not exceed 200 characters");
		document.getElementById('Name').select();
		document.getElementById('Name').focus();
		return false;
	}

	if (document.getElementById('Description').value.length>1000) {
		alert ("Name may not exceed 1000 characters");
		document.getElementById('Description').select();
		document.getElementById('Description').focus();
		return false;
	}	
	document.getElementById('ClassUpdInd').value='1';
	document.getElementById('UpdProgressBar').style.display='';
	var dest=document.getElementById('OrgClassDest').value;
	
	ValidatefEmpApprov("DCOrgWizard","UpdInd",dest,"fReDisplayOrgClassMasters();");	
	return false;			
}	
function fReDisplayOrgClassMasters() {
	var dest=document.getElementById('OrgClassDest').value;
	if (dest=='divEditOrgClass_0') {
		var gid=document.getElementById('gid').value;
		DisplayAjaxPage(0,'divWeb','DCORGANIZATIONCLASSESLIST','','','&gid='+gid+'&DCMessage=Class Added');
	}
}
function fDeleteOrgClass(cid,gid) {
	var x=window.confirm("You are about to delete the selected Organizational Class\n\n if correct, press OK, else CANCEL")
	if (!x) {
		return;
	}
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_OrganizationClassDelete.asp?classid='+cid+'&gid='+gid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divOrgClassContainer_'+cid)
}


function editorReturnSelected() {
  var idx  = document.getElementById('textPulldown').selectedIndex;
  var urlValue = document.getElementById('textPulldown')[idx].value;
  var text = document.getElementById('textPulldown')[idx].text;  
  
  oEdit1.insertLink(urlValue , text );

}
function linkReturnSelectedAsset() {
  var idx  = document.getElementById('AssetPulldown').selectedIndex;
  var urlValue = document.getElementById('AssetPulldown')[idx].value;
  var text = document.getElementById('AssetPulldown')[idx].text;
  
  document.getElementById('Target1').checked=true;
  document.getElementById('Target').value='1';
  document.getElementById('LinkType').selectedIndex=0;
  document.getElementById('UD_URL').value=urlValue;
}
function editorReturnSelectedAsset() {
  var idx  = document.getElementById('AssetPulldown').selectedIndex;
  var urlValue = document.getElementById('AssetPulldown')[idx].value;
  var text = document.getElementById('AssetPulldown')[idx].text;

	oEdit1.insertLink(urlValue ,text  )

}
function fWPSUpdateContentActive(Seq) {

	var lTarget='Active' + Seq;
	
	document.getElementById('SID').value=Seq;
	document.getElementById('Upd').value="3";
	document.getElementById('Active').value=document.getElementById(lTarget).value;
	document.getElementById('SaveButton').disabled=true;
	
	document.DCForm.submit();	
}
function fWPSClearUpdContent() {
	document.getElementById('SchedContent').selectedIndex=0;
	document.getElementById('StartDate').selectedIndex=0;
	document.getElementById('EndDate').selectedIndex=0;
	document.getElementById('Active').checked=true;
	document.getElementById('Active').value=1;
}
function fWPSUpdContentSched(Seq, ChildContentId, StartDate, StartHH,StartMM,StartAMPM, EndDate, EndHH,EndMM,EndAMPM, Active) {

	document.getElementById('SID').value=Seq;
	document.getElementById('StartDate').value=StartDate;
	document.getElementById('EndDate').value=EndDate;
	
	for (i=0;i<document.getElementById('SchedContent').length;i++) {
		if (document.getElementById('SchedContent').options[i].value==ChildContentId) {
			document.getElementById('SchedContent').selectedIndex=i;
		}
	}
	
	for (i=0;i<document.getElementById("StartTimeHH").options.length;i++) {
		if (document.getElementById("StartTimeHH").options[i].value==StartHH) {
			document.getElementById("StartTimeHH").selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById("StartTimeMM").options.length;i++) {
		if (document.getElementById("StartTimeMM").options[i].value==StartMM) {
			document.getElementById("StartTimeMM").selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById("StartTimeAMPM").options.length;i++) {
		if (document.getElementById("StartTimeAMPM").options[i].value==StartAMPM) {
			document.getElementById("StartTimeAMPM").selectedIndex=i;
		}
	}	
	
	for (i=0;i<document.getElementById("EndTimeHH").options.length;i++) {
		if (document.getElementById("EndTimeHH").options[i].value==EndHH) {
			document.getElementById("EndTimeHH").selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById("EndTimeMM").options.length;i++) {
		if (document.getElementById("EndTimeMM").options[i].value==EndMM) {
			document.getElementById("EndTimeMM").selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById("EndTimeAMPM").options.length;i++) {
		if (document.getElementById("EndTimeAMPM").options[i].value==EndAMPM) {
			document.getElementById("EndTimeAMPM").selectedIndex=i;
		}
	}	
	
	if (Active=="True") {
		document.getElementById('Active').value=1;
		document.getElementById('Active').checked=true;
		}
	else	{
		document.getElementById('Active').value=0;
		document.getElementById('Active').checked=false;
	}	

}
function fWPSSaveContent() {

	if (document.getElementById('SchedContent').selectedIndex==0) {
		alert ("You must select an existing content item")
		document.getElementById('SchedContent').focus();
		return false;
	}
	
	if (document.getElementById('StartDate').value.length==0) {
		alert ("Please enter an Start Date")
		document.getElementById('StartDate').focus();
		return false;
	}
	
	if (document.getElementById('EndDate').value.length==0) {
		alert ("Please enter an End Date")
		document.getElementById('EndDate').focus();
		return false;
	}	
	
	if (!isDate(document.getElementById('StartDate').value)) {
		document.getElementById('StartDate').focus();
		return false;
	}	
	if (!isDate(document.getElementById('EndDate').value)) {
		document.getElementById('EndDate').focus();
		return false;
	}	
	
	splitDate = document.getElementById('StartDate').value.split("/");
	l_StartDate_x= new Date(splitDate[2],splitDate[0],splitDate[1]);
	
	splitDate = document.getElementById('EndDate').value.split("/");
	l_EndDate_x= new Date(splitDate[2],splitDate[0],splitDate[1])	;

	if (l_StartDate_x > l_EndDate_x) {
		alert ("Start Date cannot be greater then End Date");
		document.getElementById('StartDate').focus();
		return false;
	}	
		
	document.getElementById('WPSUpdSched').value='1';
	var dest=document.getElementById('WPSdest').value;
	document.getElementById('UpdProgressBarSched').style.display='';
	
	ValidatefEmpApprov("formWebPageSched","WPSUpdInd",dest);	
	return false;		
}
function fWPSDelContentSched(schedid) {
	var x=window.confirm("You are about to delete a Content Schedule: " + schedid + "\n\n if correct, press OK, else CANCEL")
	if (!x) {
		return;
	}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebContentSchedDel.asp?schedid='+schedid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divDetail_'+schedid);
	
}
function fWPSWebPageSchedToggleActive(elem,schedid) {
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_WebPageSchedToggleActive.asp?schedid='+schedid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');	
}
function fWPOODelContentSched(Seq) {

}

function fWPOOClearUpdContent() {
	document.getElementById('DriverContent').selectedIndex=0;
	document.getElementById('DriverProfileTypeValue').selectedIndex=0;
	document.getElementById('DriverMarketValue').selectedIndex=0;
	document.getElementById('Active').checked=true;
	document.getElementById('Active').value=1;
}
function fWPOOUpdContent(Seq, ChildContentId, DriverProfileTypeValue, DriverMarketValue, Active) {

	document.getElementById('SchedId').value=Seq;
	
	for (i=0;i<document.getElementById('DriverProfileTypeValue').options.length;i++) {
		if (document.getElementById('DriverProfileTypeValue').options[i].value==DriverProfileTypeValue) {
			document.getElementById('DriverProfileTypeValue').selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById('DriverMarketValue').options.length;i++) {
		if (document.getElementById('DriverMarketValue').options[i].value==DriverMarketValue) {
			document.getElementById('DriverMarketValue').selectedIndex=i;
		}
	}			
	
	for (i=0;i<document.getElementById('DriverContent').options.length;i++) {
		if (document.getElementById('DriverContent').options[i].value==ChildContentId) {
			document.getElementById('DriverContent').selectedIndex=i;
		}
	}
	
	if (Active=="True") {
		document.getElementById('Active').value=1;
		document.getElementById('Active').checked=true;
		}
	else	{
		document.getElementById('Active').value=0;
		document.getElementById('Active').checked=false;
	}	

}
function fWPOOSaveContent() {

	if (document.getElementById('DriverContent').selectedIndex==0) {
		alert ("You must select an existing content item")
		document.getElementById('DriverContent').focus();
		return false;
	}
	
//	if (document.getElementById('DriverProfileTypeValue').selectedIndex==0 && document.getElementById('DriverMarketValue').selectedIndex==0) {
//		alert ("You must select at least one type of one-to-one driver value")
//		document.getElementById('DriverProfileTypeValue').focus();
//		return false;	
//	}
	
	if (document.getElementById('DriverProfileTypeValue').selectedIndex==1 && document.getElementById('DriverMarketValue').selectedIndex==1) {
		alert ("You may not have all driver values default to 'No Consideration', this would be a moot situation")
		document.getElementById('DriverProfileTypeValue').focus();
		return false;	
	}	
	
	document.getElementById('WPOOUpd').value="1";
	var dest=document.getElementById('WPOOdest').value;
	document.getElementById('UpdProgressBarWPOO').style.display='';
	
	ValidatefEmpApprov("formWPOO","WPOOUpdInd",dest);	
	return false;		
}
		
			function FSOOCSourceName(mode) {
					if (mode==1) {
							document.getElementById('divSourceRow').style.display='';
							document.getElementById('divQType').style.display='none';
							document.getElementById('frmQType0').checked=true;
						}
					else	{
							document.getElementById('divSourceRow').style.display='none';
							document.getElementById('divQType').style.display='';
					}
							
			}

			function FSODisplayRegion() {
				var elms, elm, FSODisplayRegion, region;
				
				FSODisplayRegion = false;
				
				elm = document.getElementById("CA_Region");
				elm.style.display = "none";
				
				elm = document.getElementById("US_Region");
				elm.style.display = "none";
				
				elm = document.getElementById("Clear_Region");
				elm.style.display = "none";
				
				elms = document.getElementsByName("frmCountry");
				for(var i = 0; i < elms.length; i++) {
					elm = elms[i];
					
					if(elm.checked) {
						switch(elm.value) {
							case "US":
								FSODisplayRegion = !FSODisplayRegion;
								region = "US_Region";
								break;
								
							case "CA":
								FSODisplayRegion = !FSODisplayRegion;
								region = "CA_Region";
								break;
								
							default:
								FSODisplayRegion = false;
								region = "";
								break;
						}
					}
				}
		
				if(FSODisplayRegion) {
					elm = document.getElementById(region);
					elm.style.display = "block";
					
					elm = document.getElementById("Clear_Region");
					elm.style.display = "block";
				}

			}
			
			function FSOClearSelection(elmName) {
				var elms, elm;
				
				elms = document.getElementsByName(elmName);
				for(var i = 0; i < elms.length; i++) {
					elm = elms[i];
					if(elm.type == "checkbox" && elm.checked == true) elm.checked = false;
				}
				
				if(elmName == "frmCountry") FSODisplayRegion();
			}
			
			function FSOInsertQuery()
			{
				var myQuery = $('MyAttr').value;
				var frmElms, frmElm
				
				//Remove any current selections
				FSOFSOClearSelections();
				
				frmElms = $('divOptInReq').getElementsByTagName("input");
				for(var i = 0; i < frmElms.length; i++){
					frmElm = frmElms[i];
					if (frmElm.id.indexOf('iv_')!=-1) {
						if(myQuery.indexOf(frmElm.value) != -1){
							var sA=frmElm.id.split('_');
							var sElem='_'+sA[1];
							document.getElementById(sElem).checked = true;
							document.getElementById(sElem).value=RTrim(frmElm.value);
						}
					}
				}
			}

			function FSODCMenuNavBarOpen() {

				FSOCloseAll();
				
				FSOOpenInitialMenu('NavMenuNavigation')
				
				FSODisplayPage()
			}

			function FSODisplayPage() {
				document.getElementById('WaitMessage').style.display = "none";
				document.getElementById('WholePage').style.display = "";
			}
			function FSOFSOClearSelections(){
				var frmElms, frmElm
				
				frmElms = document.getElementsByTagName("input");
				for(var i = 0; i< frmElms.length; i++) {
					frmElm = frmElms[i];
					
					if(frmElm.name.substr(0,1) == "_") {
						if(frmElm.type == "checkbox" && frmElm.checked == true) frmElm.checked = false;
					}
				}
			}
			function FSOSubmitQuery() {
				
				var frmElm
				
				if (document.getElementById('frmOutput1')!=null) {
					if (document.getElementById('frmOutput1').checked) {
							if (document.getElementById('frmSource').value.length<1) {
									alert ("Source Name is required for this function");
									document.getElementById('frmSource').select();
									document.getElementById('frmSource').focus();
									return false;
							}
											
							if (document.getElementById('frmSource').value.length>200) {
									alert ("Source Name cannot exceed 200 characters");
									document.getElementById('frmSource').select();
									document.getElementById('frmSource').focus();
									return false;
							}
						}
				}
				
				document.getElementById('Upd').value="1"
				document.getElementById('UpdProgressBarOIQ').style.display='';
				document.getElementById('UpdProgressBarOIQ2').style.display='';
				var sDest=document.getElementById('Dest').value
				ValidatefEmpApprov('formOptInQuery','Upd',sDest);
				return false;	

			}	
function FSORDCMenuNavBarOpen()
{
	try {
		FSORCloseAll();
		FSOROpenInitialMenu('NavMenuNavigation');
	} catch(e) {}
	
	FSORDisplayPage();
}
function FSORSubmitRequestForm(ID)
	{
			var frmElm
			
			frmElm = document.getElementById("TargetIDForLife");
			frmElm.value = ID;
			
			frmElm = document.forms("DCRequestForm")
			frmElm.submit();
		}
		function FSORClonePaging()
		{
			var frmElm, frmClone
			
			frmElm = document.getElementById("pagingFooter");
			if (frmElm == null){
				return;
			}
			frmClone = frmElm.cloneNode(true);
			
			frmElm = document.getElementById("pagingHeader");
			frmElm.replaceNode(frmClone);
			
			document.getElementById('AnimLogo').style.display="none";
			document.getElementById('OneMoment').style.display="none";	
		}

// Modify these vars to suit your needs

var cssPath = "easyflashuploader.css"; // the page where the files will be posted
var formPostURL = "/dc_includes/CP6_UploadServer.asp"; // the page where the files will be posted
var afterCompletionPage = ""; // leave empty if you dont want to redirect
var onCancelPage = ""; // page where you want to take the user if they cancel upload
var flashMovieObjectEmbedID = "FileUploader"; // the html tag "id" for the flash <object> and <embed> tags
var flashFormID = "UploadForm"; // the form which has the flash uploader embeded
var maxUploadSize = 524288000; // maximum allowed upload size in bytes
var minUploadSize = 1; // minimum allowed upload size bin bytes
var maxFiles = 200; // allow a maximum of 5 files to be uploaded at a time
var allowedFileTypes = '*.css;*.psd;*.bmp;*.wrf;*.xlsx;*.docx;*.pptx;*.vsd;*.ppt;*.doc;*.xls;*.pdf;*.xml;*.swf;*.mp3;*.mp4;*.jpg;*.gif;*.png;*.avi;*.zip;*.xml;*.psd;*.mpp;*.txt;*.eps'; // allowed file types; add or delete extensions in the given format
var showFlashAlert = false; // will show javascript based alert by default; set true to show flash alert for validation
var showNoAlert = false; // will not show any alert if set to true - set to true when you want to surpress any error message

var svAllowedFileTypes = '*.css;*.psd;*.bmp;*.wrf;*.xlsx;*.docx;*.pptx;*.vsd;*.ppt;*.doc;*.xls;*.pdf;*.xml;*.mp3;*.mp4;*.swf;*.jpg;*.gif;*.png;*.avi;*.zip;*.psd;*.mpp;*.txt;*.eps' // allowed file types; add or delete extensions in the given format

// Called by flash; modify if you want to validate html form
function efuValidateForm()
{
	// put javascript form validation code here if you want
	// this function must return true for the flash to work
	// If there is a validation issue, show js alert box and return false.
	return true;	
}

// --- DO NOT MODIFY BEYOND THIS POINT; UNLESS YOU KNOW WHAT YOU ARE DOING ---
var formValues = ""; // leave it empty
// Called by flash
function efuGetAfterCompletionPage()
{
	return afterCompletionPage;
}

// Called by flash; no modification needed
function efuGetFormPostURL()
{
	return formPostURL;
}

// Called by flash; no modification needed
function efuGetFormValues()
{
	return formValues;
}

function efuGetCssPath()
{
	return cssPath;
}

function efuGetMaxUploadSize()
{
	return maxUploadSize;
}

function efuGetMinUploadSize()
{
	return minUploadSize;
}

function efuGetAllowedFileTypes()
{
	return allowedFileTypes;
}

function efuGetShowFlashAlert()
{
	return showFlashAlert;
}

function efuGetShowNoAlert()
{
	return showNoAlert;
}

function efuGetMaxFiles()
{
	return maxFiles;
}

// called by html form; no modification needed
function efuGetFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}
// called by html form; no modification needed
function efuDoSubmitInd() {
	efuDoSubmit();
}
function efuDoSubmit()
{
	if ($('CloudTag')!=null) {
		$('CloudTag').value=$('CloudTag').value.replace('Add a Tag?','');
		}
	
	if(efuValidateForm())
	{
		
		if (document.getElementById('UpdProgressBar')!=null) {
			//document.getElementById('UpdProgressBar').style.display='';
		}
		formValues = '';
		var flash = efuGetFlashMovieObject(flashMovieObjectEmbedID);
		var formObj = document.getElementById(flashFormID);		
		for (var i = 0; i < formObj.elements.length; i++) 
		{
			if (formObj.elements[i].name!=''>0) {
				formValues += escape(formObj.elements[i].name) + '=' + encodeURI(formObj.elements[i].value) + ((i != (formObj.elements.length - 1)) ? '&':'');
			}
		}
		try {
			flash.startUpload();
		}catch(E) {
			alert ('Having difficulty uploading your file... please try refreshing your page(F5).  If problem persists, please contact the administrator of this site.\n');
		}

		//alert (efuGetFormValues());
	}
	
	//allowedFileTypes=svAllowedFileTypes;
}

// cancel the upload
function efuCancelUpload()
{
	var flash = efuGetFlashMovieObject(flashMovieObjectEmbedID);
	flash.cancelUpload();
	if(onCancelPage!='')
	{
		location.href = onCancelPage;
	}
}
function fProjConSetup() {
	
	if (document.getElementById('Title').value.length==0) {
		alert ("Title is required");
		document.getElementById('Title').select();
		document.getElementById('Title').focus();
		return false;
	}	
	
	if (document.getElementById('Title').value.length>500) {
		alert ("Title may not exceed 500 characters");
		document.getElementById('Title').select();
		document.getElementById('Title').focus();
		return false;
	}

	if (document.getElementById('Purpose').value.length>2000) {
		alert ("Purpose may not exceed 2000 characters");
		document.getElementById('Purpose').select();
		document.getElementById('Purpose').focus();
		return false;
	}
	if (document.getElementById('ExistingTemplates').selectedIndex==0) {
		alert ("You must select a template");
		document.getElementById('ExistingTemplates').focus();
		return false;
	}	
	
	document.getElementById('WikiUpdInd').value='1';
}
function fOpenFileOptions(fid,event) {
	
	if ($('cFolderNameContainer_'+fid).style.display=='none') {
		$('fOptions_'+fid).style.display='';
		if (event!=null) {
			//event.cancelBubble=true;
		}	
	}
}
function fCloseFileOptions(fid) {
	CloseByIdPattern('span','fOptions_',0,0);
}
function fDelNote(seq,mifl) {

	if (CheckForLogin()==false) {
		DCBLogin();
		return;
	}
	
	var x=window.confirm("You are about to delete the selected note\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}	
	var rid="divNoteContainer_" + seq
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_NoteDelete.asp?seq='+seq+'&mifl='+mifl+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '','divGnrlAjax',1);	
	iPid=$(rid).parentNode.id;
	PuffId(rid);
	PuffId(iPid);
}
function ToggleCheckBoxesByIdPattern(pat,val) {
	
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf(pat)==0) {
			pars[i].value=val;
			if (val==1) {
				pars[i].checked=true;
			}
			else	{
				pars[i].checked=false;
			}
		}
	}
}
function OpenAllOrgShoutBoxes() {
	var val=$('CBO').value;
	if (val==1) {
		CloseByIdPattern('div','divOrgDetails_',0,1);	
		$('CBO').value=0;
		$('spanCBT').innerHTML='Open All';
		$('aCBT').className='StdFolderEdit';
	}
	else	{
		var pat='divOrgDetails_'
		var pars = document.getElementsByTagName('div');
		for (var i=0;i<pars.length;i++) {
			sCN=pars[i].id
			if (sCN.indexOf(pat)==0) {
				var patA=sCN.split('_');
				DisplayAjaxPage(0,'divOrgDetails_'+patA[1],'CP6ORGSHOUTDETAILS','','','&clid='+patA[1]);
			}
		}	
		$('CBO').value=1;
		$('spanCBT').innerHTML='Close All';
		$('aCBT').className='StdFolderClosed';		
	}
}
function ShoutNotificationsInd(mode) {
	ShoutNotifications(mode);
}
function ShoutNotifications(mode) {
	
	if (mode==null) {
		mode=0
	}
	
	var emailList='';
	var sComma='';
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if ((sCN.indexOf('cb_')==0)) {
			if (pars[i].checked==true) {
				var sIdA=sCN.split('_');
				emailList=emailList+sComma+sIdA[1]+'^'+sIdA[2];
				sComma=',';
			}
		}
	}
	 
	document.getElementById('Emails').value=emailList;
	
	if (document.getElementById('Emails').value.length==0) {
		alert ("You must select at least one person to notify")
		return false;
	}
	
	if (mode==1) {
		var dest=$('dest').value;
		if (dest.length==0) {
			dest='divWebSpecial'
		}
	}
	
	if (mode==1) {
		$('PSUpdProgressBar').style.display='';
		ValidatefEmpApprov('formShoutList','PSUpd',dest);	
		return false;			
	}
	else {
		document.getElementById('formShoutList').action='?p=210&sp=5030&confcode='+lPD_ConfCode+'&se=1';
		document.getElementById('formShoutList').submit();
	}
}
function fCP6SearchResult(SearchMode) {
	
	document.getElementById('SDate').value=document.getElementById('SDate').value.replace("/g", " " , "");
	document.getElementById('EDate').value=document.getElementById('EDate').value.replace("/g", " ", "");
	
	if (document.getElementById('SDate').value.length > 1) {
		if (isDate(document.getElementById('SDate').value)==false){
			document.getElementById('SDate').focus()
			document.getElementById('SDate').select()		
			return false
		}
		if (document.getElementById('EDate').value.length < 1) {
			alert ("End Date must not be blank");
			document.getElementById('SDate').focus();
			document.getElementById('SDate').select();	
			return
		}		
		if (isDate(document.getElementById('EDate').value)==false){
			document.getElementById('EDate').focus()
			document.getElementById('EDate').select()		
			return false
		}		
	}
	if (document.getElementById('EDate').value.length > 1) {
		if (document.getElementById('SDate').value.length < 1) {
			alert ("Start Date must not be blank if you entered an End Date\n You may clear them both or provide the query dates");
			document.getElementById('SDate').focus();
			document.getElementById('SDate').select();	
			return
		}	
		if (isDate(document.getElementById('SDate').value)==false){
			document.getElementById('SDate').focus()
			document.getElementById('SDate').select()		
			return false
		}
		if (isDate(document.getElementById('EDate').value)==false){
			document.getElementById('SDate').focus()
			document.getElementById('SDate').select()		
			return false
		}		
	}			
	if (SearchMode==1) {
		document.SearchForm.LastName.value = "";
	}	
	document.getElementById('divFindSomeone6Results').innerHTML='<img src="/dc_images/silk_icons/AjaxProcesBar.gif" />';
	ValidatefEmpApprov('formFindSomeone','FSUpd','divFindSomeone6Results');	
	return false;	
	
}
function fCP6DoSort(sField, sOrder){
	document.SearchForm.SortField.value = sField;
	document.SearchForm.SortOrder.value = sOrder;
	document.SearchForm.submit()
}

function fCP6CheckTypeOfSearch(cb) {
	if (cb==1 || cb==2) {
		document.getElementById('AreaToSearch5').disabled=true;
		document.getElementById('AreaToSearch6').disabled=true;
		if (document.SearchForm.AreaToSearch.value > "4" && document.SearchForm.AreaToSearch.value < "8") {
			document.getElementById('AreaToSearch2').checked=true;
			}
		}
	else	{	
		document.getElementById('AreaToSearch5').disabled=false;
		document.getElementById('AreaToSearch6').disabled=false;
	
	}	
	if (cb==4) {
		document.getElementById('LastName').value="";
	}	
}
function fCP6CheckAreaToSearch(cb) {
	if (cb==5 || cb==6 || cb==7) {
		document.getElementById('TypeOfSearch3').checked=true;	
		document.getElementById('TypeOfSearch').value=3;	
	}
	document.getElementById('AreaToSearch').value=cb;	
}

function fCP6DefaultDates(mode) {
	if (mode==0) {
		document.getElementById('SDate').value="<%=lCC_RegStart_MDY%>";
		document.getElementById('EDate').value="<%=lCC_EndDate_MDY%>";	
		}
	else	{
		document.getElementById('SDate').value="";
		document.getElementById('EDate').value="";		
	}
}
function fCP6CheckIn (idfl, sid,due,iMode) {
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP6_EventCheckIn.asp?due='+due+'&mode='+iMode+'&lifl='+idfl+'&sid='+sid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'CI_'+idfl,1,'true');
}
function fCP6CheckInWithPayment(idfl,mc,gc,cc) {
	var sURL='/DC_Administrator_Pages/registrant/CheckIn.asp?MarketCode='+mc+'&ConfCode='+cc+'&ConfMode=1&GrpCode='+gc+'&SurveyType=3&idfl='+idfl+'&DCAMode=2&Payment=1&CI=1';
	x=window.open(sURL,'DCAuxWin3','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=700,height=675,left=50,top=50');
}		
function fSpecialFunction(func,btn,tid,targetDiv) {
	
	if (btn==null || btn.length==0) {
		btn='btin100';
	}
	
	if (targetDiv==null) {
		targetDiv='divBaseOps';
	}
	if ($(targetDiv)==null || $('divSpecialOps')==null) {
		return;
	}
	$('divSpecialOps').style.display='';
	$(targetDiv).style.display='none';
	if ($(btn)!=null) {
		$(btn).innerHTML=func;
	}
	if ($(tid+'_Function')!=null && $('a_'+btn)!=null) {
		$('a_'+btn).href='javascript:'+$(tid+'_Function').value;
	}
}
function fSpecialFunctionBack(targetDiv) {
	
	if (targetDiv==null) {
		targetDiv='divBaseOps';
	}
	
	var elem=document.getElementById('divWebSpecial')
		
	document.getElementById(targetDiv).style.display='block';
	document.getElementById('divSpecialOps').style.display='none';
	
	if (elem!=null) {
		if (elem.hasChildNodes()) {
   	while (elem.childNodes.length >= 1 )	{
        elem.removeChild(elem.firstChild);       
    	} 
		}
	}
}
function fEditCloudFile() {

	if (document.getElementById('SimpleName').value.length > 100) {
		alert ("Simple Name cannot exceed 100 characters");
		document.getElementById('SimpleName').focus();
		document.getElementById('SimpleName').select();	
		return
	}	
	
	if (document.getElementById('ShortDesc').value.length > 500) {
		alert ("Short Desc cannot exceed 500 characters");
		document.getElementById('ShortDesc').focus();
		return
	}		

	$('FEUpdProgressBar').style.display='';
	$('FEUpd').value=1;
	var fid=$('sFid').value;
	ValidatefEmpApprov('formEditFile','FEUpdInd','fid_'+fid,'fFinishFileEdit(\''+fid+'\')');	
	return false;	
	
}
function fFinishFileEdit(fid) {
	$('Arch_'+fid).style.display='none';
	$('Arch_'+fid).innerHTML='';
}
function CP6ModuleCreate(xMode) {
	
	if (xMode==null) {
		var xMode=0;
	}
	
	if (document.getElementById('NewTitle').value.length>500) {
		alert ("Title cannot exceed 500 characters")
		document.getElementById('NewTitle').select();
		document.getElementById('NewTitle').focus();
		return false;
	}
	if (document.getElementById('NewTitle').value.length==0) {
		alert ("You must enter a Title")
		document.getElementById('NewTitle').select();
		document.getElementById('NewTitle').focus();
		return false;
	}	
					
	if (document.getElementById('GrpCode').value.length<1) {
		alert ("You must choose a valid group to add your site to")
		return false;
	}
	
	var dest=$('dest').value;
	if (dest.length==0) {
		var dest='divWeb';
	}
	
	$('MCUpdInd').value='1';
	$('MCUpdProgressBar').style.display='';
	ValidatefEmpApprov('formModuleCreate','MCUpdInd',dest,'CP6ModuleCreateStep1()');	
	return false;			
}
function CP6ModuleCreateStep1() {
	var iSid=$('sid').value;
	var iTos=$('typeofsite').value;
	var iGid=$('GrpId').value;
	var dest=$('dest').value;
	var sConfCode=$('ConfCode').value;
	if (dest.length==0) {
		var dest='divWeb';
	}	
	
	dSimpleAjax('divAdminList','/dc_includes/cp6_AdminLists.asp?p=210&sp=2021&confcode='+sConfCode+'&ajaxmode=1&gid='+iGid);
	
	// Databases & Survey's
	if (iTos==8 || iTos==1 ) {
		DisplayAjaxPage(0,dest,'DCWizSurvQuest1','','','&gid='+iGid+'&sid='+iSid+'&st='+iTos+'&wzp=1&dest='+dest)
	}
	// Web Sites & Events
	if (iTos==9 || iTos==0) {
		DisplayAjaxPage(1,'AdminArea','DCWEBSITEMAINTENANCE','','&sid='+iSid+'&st=8&sx=1&gid='+iGid+'&dest='+dest);
	}
}
function CP6TerrirtorySaveFormInd() {
	CP6TerritoryValidateForm();
}
function CP6TerritoryValidateForm() {

	var lComma='';
	for (i=0; i < document.getElementById('StatesSel').options.length;i++) {
		if (document.getElementById('StatesSel').options[i].selected) {
			document.getElementById('States').value = document.getElementById('States').value + lComma + document.getElementById('StatesSel').options[i].value;
			lComma=",";
		}
	}
	
	lComma='';
	for (i=0; i < document.getElementById('CountriesSel').options.length;i++) {
		if (document.getElementById('CountriesSel').options[i].selected) {
			document.getElementById('Countries').value = document.getElementById('Countries').value + lComma + document.getElementById('CountriesSel').options[i].value;
			lComma=",";
		}
	} 	 
	
	if (document.getElementById('PostalCodes').value.length > 2000) {
		alert ("Postal Codes cannot exceed 2000 characters")
		document.getElementById('PostalCodes').select();
		document.getElementById('PostalCodes').focus();
		return false;
	}
	if (document.getElementById('AreaCodes').value.length > 2000) {
		alert ("Area Codes cannot exceed 2000 characters")
		document.getElementById('AreaCodes').select();
		document.getElementById('AreaCodes').focus();
		return false;
	}
	if (document.getElementById('PhoneNumbers').value.length > 2000) {
		alert ("Phone Numbers cannot exceed 2000 characters")
		document.getElementById('PhoneNumbers').select();
		document.getElementById('PhoneNumbers').focus();
		return false;
	}
		
	if (document.getElementById('SpecificAccounts').value.length > 2000) {
		alert ("Specific Accounts cannot exceed 2000 characters")
		document.getElementById('SpecificAccounts').select();
		document.getElementById('SpecificAccounts').focus();
		return false;
	}
	document.getElementById('Upd').value="1"	
	
	var dest=$('dest').value;
	if (dest.length==0) {
		var dest='divGroup';
	}
	
	$('TUpdProgressBar').style.display='';
	ValidatefEmpApprov('formTerritory','TUpdInd',dest);	
	return false;				
}
function initialize() {
 var map = new google.maps.Map2(document.getElementById("map"));
 map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);

 var searchControl = new google.search.SearchControl();
 searchControl.addSearcher(new google.search.WebSearch());
 searchControl.addSearcher(new google.search.NewsSearch());
 searchControl.draw(document.getElementById("searchcontrol"));
}
function cp5EditOnetoOneForm() {
	if (document.getElementById('Type').selectedIndex==0) {
		alert ("You must select the type of list you are defining");
		document.getElementById('Type').focus();
		return false;
	}
	
	if (document.getElementById('ListName').value.length==0) {
		alert ("List Name is required");
		document.getElementById('ListName').select();
		document.getElementById('ListName').focus();
		return false;		
	}
	if (document.getElementById('ListName').value.length>200) {
		alert ("List Name cannot exceed 200 characters");
		document.getElementById('ListName').select();
		document.getElementById('ListName').focus();
		return false;		
	}	
	if (document.getElementById('Description').value.length>1000) {
		alert ("Description cannot exceed 1000 characters");
		document.getElementById('Description').select();
		document.getElementById('Description').focus();
		return false;
	}		
		
	if (document.getElementById('Items').value.length==0) {
		alert ("Items are required");
		document.getElementById('Items').select();
		document.getElementById('Items').focus();
		return false;		
	}	
	if (document.getElementById('Items').value.length>1000) {
		alert ("Items cannot exceed 1000 characters");
		document.getElementById('Items').select();
		document.getElementById('Items').focus();
		return false;		
	}		
	document.getElementById('O2OUpdProgressBarLink').style.display='';
	document.getElementById('Upd').value="1"
	var dest=document.getElementById('dest').value;
	if (dest.length==0) {
		dest='divWeb';
	}
	ValidatefEmpApprov('formOneToOne','O2OUpd',dest,'fUpdOneToOneListOnly()');	
	return false;		
}
function fUpdOneToOneListOnly() {
	var iGid=$('aGid').value;
	DisplayAjaxPage(0,'spanOneToOneList','CP6ONETOONELISTONLY','','','&gid='+iGid,'1')
}
function fDelList(lid,SecLev) {
	var x=window.confirm('You are about to delete this List('+lid+')\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	if (SecLev<5) {
		alert ("You must be at least a Group Level Security Administrator to delete a list");
		}
	else	{
		ajaxIncrement=ajaxIncrement+1;
		var ajaxscript = '/dc_includes/CP6_OneToOneDeleteList.asp?lid=' + lid + '&xc=' + ajaxTimeStamp+ajaxIncrement;
		AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true','fUpdOneToOneListOnly()');
	}
}
function fSaveCSS(elemId) {
	$('NewCSS').value=$(elemId).value;
	ValidatefEmpApprov('formSimmCSS','SimmUpd','divGnrlAjax','alert(\'Style Saved\')');	
	return false;
}
function fGetScrollHeight(elemId) {
	
	if (document.all) { 
		var sSc='document.all.'+elemId+'.scrollHeight';
		sBodyHeight=eval(sSc);
		}
	else {
		sBodyHeight=document.getElementById(elemId).scrollHeight;
	}
}
function fSetScrollHeight(elemId) {
	if (document.all) { 
		var sSc='parent.document.all.'+elemId+'.style.height=sBodyHeight';
		sBodyHeight=eval(sSc);
		}
	else {
		parent.document.getElementById(elemId).style.height=sBodyHeight;
	}	
}
function fInstantiateEditor(elemId) {
	
	if (elemId==null) {
		elemId='EditorArea';
	}

	elem=$('divWYSIWYGEditor')
	
	if (document.all) { 
		var nEditor=document.all.divWYSIWYGEditor.cloneNode(true); 
		}
	else {
		var nEditor=elem.cloneNode(true);
		
	}
	
	var nEditorObject=Object.clone(oEdit1);

	nEditor.style.display='';
	document.getElementById(elemId).appendChild(nEditor);
	nEditor.style.display='';	
	
	BaseEditorObj = Object.clone(oEdit1);
	
	document.getElementById(elemId).appendChild(elem);
	elem.style.display='';
	
	nEditor=elem.cloneNode(true);
	nEditor.style.display='none';
	document.getElementById('divWYSIWYGEditorContainer').appendChild(nEditor);	
	
	var sHTML='Test2';
	//nEditorObject.REPLACE("PageHTML");
	nEditorObject.loadHTML(sHTML) 
	
	//var oEdit1 = new InnovaEditor("PageHTML");
	//oEdit1.REPLACE("PageHTML");
	
	//document.getElementById(elemId).innerHTML=elem.innerHTML;
	//document.getElementById(elemId).innerHTML=document.getElementById(elemId).innerHTML.replace(/WYSIWYGContent/gi,'t_WYSIWYGContent');
}

function fSavePQFormInd(ID) {
	fSavePQForm(ID)
}
function fSavePQForm(ID) {

	var QFilterFieldID='QFilterField'+ID
	var FieldEQID='FieldEQ_'+ID
	var FieldEQValue1ID='FieldEQValue1'+ID
	var FieldEQValue2ID='FieldEQValue2'+ID
	var QValTypeID='QValType_'+ID	
	var LeftParensID='LeftParens'+ID
	var RightParensID='RightParens'+ID
	var UseListID0='UseList'+ID+0
	var UseListID1='UseList'+ID+1	
	var QueriesID='Queries'+ID


	document.getElementById('QFilterField').value=document.getElementById(QFilterFieldID).options[document.getElementById(QFilterFieldID).selectedIndex].value;
	document.getElementById('FieldEQ').value=document.getElementById(FieldEQID).options[document.getElementById(FieldEQID).selectedIndex].value;
	document.getElementById('FieldEQValue1').value=document.getElementById(FieldEQValue1ID).value;
	document.getElementById('FieldEQValue2').value=document.getElementById(FieldEQValue2ID).value;
	document.getElementById('QValType').value=document.getElementById(QValTypeID).options[document.getElementById(QValTypeID).selectedIndex].value;

	document.getElementById('LeftParens').value=document.getElementById(LeftParensID).value;
	document.getElementById('RightParens').value=document.getElementById(RightParensID).value;
	
	if (document.getElementById(UseListID1).checked) {
		document.getElementById('UseList').value=0;
		}
	else	{
		document.getElementById('UseList').value=1;
	}
	document.getElementById('Queries').value=document.getElementById(QueriesID).value;
	
	document.getElementById('QFilterID').value=ID;
	document.getElementById('QFUpdProgressBar').style.display='';
	
	document.getElementById('Upd').value="1"
	var dest=document.getElementById('dest').value;
	if (dest.length==0) {
		dest='divWeb';
	}
	ValidatefEmpApprov('formPQFilters','Upd',dest,'PWUpdatePage()');
	return false;			
}
function CP5DelComment(seq) {
	var x=window.confirm('You are about to delete the Comment ('+seq+')\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_DelConfComment.asp?seq=' + seq + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divSCR_'+seq)	
}
function CP6MailTemplateFormInd() {
	document.getElementById('formEditTemplate').onsubmit();
	document.getElementById('formEditTemplate').submit();
	
}
function CP6MailTemplateForm () {
	
	if (document.getElementById('Name').value!=document.getElementById('OrigName').value && document.getElementById('tid').value!='0' && document.getElementById('tid').value!='') {
		var x=window.confirm("You have changed the name of this template, do you want to save this as a new template?\n\n if correct, press OK, else CANCEL")
		if (x) {
			document.getElementById('tid').value='0';
		}	
	}	

	if (document.getElementById('Name').value.length > 100) {
		alert ("Template Name may not exceed 100 characters");
		document.getElementById('Name').focus();
		document.getElementById('Name').select();	
		return false;
	}	

	document.getElementById('EditUpd').value='1';
}
function CP6MailTemplateFormSaveAsNew() {
	document.getElementById('formEditTemplate').onsubmit();
	document.getElementById('tid').value='0';
	document.getElementById('EditUpd').value='1';
	document.getElementById('formEditTemplate').submit();
}	
function CP6SubmitTemplateOptions() {
	
	var iGid=document.getElementById('gid').value;
	var sDest=document.getElementById('dest').value;
	var sSortOrder=document.getElementById('SortOrder').value;
	var iActiveFilter=document.getElementById('ActiveFilter').value;
	var iSel=document.getElementById('Sel').value;

	DisplayAjaxPage(0,sDest,'DCMAILTEMPLATELIST','','&sel='+iSel+'&ActiveFilter='+iActiveFilter+'&sortorder='+sSortOrder+'&gid='+iGid+'&dest='+sDest,'','','CP6SetTemplateOptions()')
}
function fSetDayCalendar(dest) {

	if (dest==null) {
		dest='divWeb'
	}
	
	var pars = document.getElementById(dest).getElementsByTagName('div');
	var iLeftRelPos;
	var bLocatedItem;
	
	// Append Chips to Calendar
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('divChip_')==0) {
			sA=sCN.split('_');

			saWkStartRowtId='liTmI_'+sA[2]+'_'+sA[3];
			saWkEndRowId='liTmI_'+sA[4]+'_'+sA[5]
			
			if (document.getElementById(saWkEndRowId)==null) {
				saWkEndRowId='liTmI_'+(sA[2]+1)+'_45'
			}		
			
			if (document.getElementById(saWkStartRowtId)!=null && document.getElementById(saWkEndRowId)!=null) {
				pars[i].style.height=(document.getElementById(saWkEndRowId).offsetTop-document.getElementById(saWkStartRowtId).offsetTop)+'px';
			}
			
			if (document.getElementById(saWkStartRowtId)!=null) {
				document.getElementById(saWkStartRowtId).appendChild(pars[i]);
			}
		}
	}	
	// Adjust Left Positions
	var bOverlappingFound=false;
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id;
		if (sCN.indexOf('divChip_')==0) {
			iLeftRelPos=0;
			if (pars[i].previousSibling!=null) {
				iLeftRelPos=pars[i].previousSibling.offsetLeft+pars[i].previousSibling.offsetWidth;
			}
			
			// Calculate Height
			pars[i].style.left=iLeftRelPos+'px'
			pars[i].style.top=pars[i].parentNode.parentNode.offsetTop;
			
			// Check to see if any other chips fall w/in this position, if so... add to iLeftRelPos (don't want overlapping items
			bLocatedItem=false;
			for (var i2=0;i2<pars.length;i2++) {
				sCN2=pars[i2].id;
				if (sCN2.indexOf('divChip_')==0) {
					
					var iTop=pars[i].offsetTop;					
					var iBottom=pars[i].offsetTop+pars[i].offsetHeight;					
					
					var iTop2=pars[i2].offsetTop;
					var iBottom2=pars[i2].offsetTop+pars[i2].offsetHeight;
					
					if (pars[i2].offsetLeft==iLeftRelPos && pars[i2].offsetTop!=pars[i].offsetTop && bLocatedItem==false) {
						if ((iTop>iTop2 && iTop<iBottom2)) {
							iLeftRelPos2=iLeftRelPos+(pars[i2].offsetLeft+pars[i2].offsetWidth);
							pars[i2].style.left=iLeftRelPos2+'px'
							//bLocatedItem=true;
							bOverlappingFound=true;
						}
					}
				}
			}			
		}		
	}	
	
	// Temporary overlap for stretching logic... dealing with top and bottom issues due to border
	bOverlappingFound=false;
	// Finally, do final chip stretcing to balance look and feel
if (!bOverlappingFound) {
	iContainerWidth=document.getElementById('divDayCalScroller').offsetWidth;
	var pars = document.getElementById(dest).getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		sId=pars[i].id;
		if (sId.indexOf('liTmI_')==0) {
			iChildCnt=0;
			if (pars[i].hasChildNodes()) {
				var children = pars[i].childNodes;
				for (var i2 = 0; i2<children.length; i2++) {
					iChildCnt++;
				}
			}
			iLeftRelPos=0;
			if (iChildCnt>0) {
				// Update Width based on # of children in row - divide by 10
				var Chips=pars[i].getElementsByTagName('div');
				for (i2=0;i2<Chips.length;i2++) {
					sId=Chips[i2].id;
					if (sId.indexOf('divChip_')==0) {
						Chips[i2].style.width=((iContainerWidth/iChildCnt))+'px';
						Chips[i2].style.left=iLeftRelPos;
						iLeftRelPos=iLeftRelPos+((iContainerWidth/iChildCnt));
					}
				}
			}
		}
	}
}
	document.getElementById('divDayCalContainer').style.height=document.getElementById('divLeftCalKey').offsetHeight;
	document.getElementById('divDayCalScroller').style.height=document.getElementById('divLeftCalKey').offsetHeight+50;
}	
function CP6SubmitAgendaFormInd(adMode) {
	CP6SubmitAgendaForm(adMode);
}
function CP6SubmitAgendaForm(adMode) {
	
	document.getElementById('adMode').value=adMode;
	
	if (document.getElementById('SessionDate').options.selectedIndex == 0 && document.getElementById('SessionDate').options.length>1) {
		alert ("Session Date is a required field");
		document.getElementById('SessionDate').focus();
		return false;
	}

	if (document.getElementById('Title').value.length==0) {
		alert ("Title is a required field");
		document.getElementById('Title').focus();
		document.getElementById('Title').select();		
		return false;		
	}
	
	if (document.getElementById('OverSchedule').checked && document.getElementById('SimpleCapacity').value.length < 1) {
		alert ("You must enter a capacity for capacity planning");
		document.getElementById('SimpleCapacity').focus();
		document.getElementById('SimpleCapacity').select();		
		return false;		
	}	

	if (document.getElementById('OverSchedule').checked && !isNum (document.getElementById('SimpleCapacity').value)) {
		alert ("Capacity must be numeric");
		document.getElementById('SimpleCapacity').focus();
		document.getElementById('SimpleCapacity').select();		
		return false;		
	}	
	document.getElementById('ADUpdProgressBar').style.display='';
	document.getElementById('ADUpd').value="1"
	var sNavDest=document.getElementById('NavDest').value;
	if (sNavDest.length==0) {
		sNavDest='divWeb';
	}
	if ($('adMode').value==1) {
		ValidatefEmpApprov('formAgendaDetail','ADUpd',sNavDest,'fADUpdatePageAfterDel()');
	}
	else	{
		ValidatefEmpApprov('formAgendaDetail','ADUpd',sNavDest,'fADUpdatePage(1)');
	}
	return false;		
}	
function fADUpdatePageAfterDel () {
	eval(document.getElementById('refreshEval').value);
	if (document.getElementById('NavDest').value=='divWeb') {
	}
	else	{
		CloseEmailWindow();
	}
}
function fADUpdatePage(rfList) {
	
	if (rfList==1 && $('refreshEval')!=null) {
		eval(document.getElementById('refreshEval').value);
	}
	sDate=document.getElementById('StartTime').value;
	sDa=sDate.split(':');
	sDa2=sDa[1].split(' ');
	sHH=sDa[0];
	sMM=sDa2[0];
	sAMPM=sDa2[1];
	
	if (sHH<10) {
		sHH='0'+sHH;
	}
	
	for (i=0;i<document.getElementById('StHour').options.length;i++) {
		if (document.getElementById('StHour').options[i].value==sHH) {
			document.getElementById('StHour').selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById('StMin').options.length;i++) {
		if (document.getElementById('StMin').options[i].value==sMM) {
			document.getElementById('StMin').selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById('StDayNight').options.length;i++) {
		if (document.getElementById('StDayNight').options[i].value==sAMPM) {
			document.getElementById('StDayNight').selectedIndex=i;
		}
	}			
	
	sDate=document.getElementById('EndTime').value;
	sDa=sDate.split(':');
	sDa2=sDa[1].split(' ');
	sHH=sDa[0];
	sMM=sDa2[0];
	sAMPM=sDa2[1];
	
	if (sHH<10) {
		sHH='0'+sHH;
	}	
		
	for (i=0;i<document.getElementById('EdHour').options.length;i++) {
		if (document.getElementById('EdHour').options[i].value==sHH) {
			document.getElementById('EdHour').selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById('EdMin').options.length;i++) {
		if (document.getElementById('EdMin').options[i].value==sMM) {
			document.getElementById('EdMin').selectedIndex=i;
		}
	}
	for (i=0;i<document.getElementById('EdDayNight').options.length;i++) {
		if (document.getElementById('EdDayNight').options[i].value==sAMPM) {
			document.getElementById('EdDayNight').selectedIndex=i;
		}
	}		
}
function fDeleteAgendaItem(aid,mode) {
	var x=window.confirm('You are about to delete the selected agenda item ('+aid+')\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}	
	ajaxIncrement=ajaxIncrement+1;
	
	var ajaxscript = '/dc_includes/CP6_AgendaDel.asp?aid=' + aid + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	if (mode==1) {
		AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
		var dest='divRow_'+aid;
		new Effect.Puff(dest)
	}
	else	{
		AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true','fSetDayCalendar()');
	}
}
function fSubResAnalysisInd() {
	fSubResAnalysis();
}
function fSubResAnalysis() {
	
	var sDest=$('Dest').value;

	ValidatefEmpApprov('formResAnalysis','RAUpdInd',sDest);
	return false;
}
function fThisMonth(Base,Start,End) {
	var iLD=31;
	var iCM;
	var iCYYY;
	var sA=Base.value.split('/');
	Start.value=sA[0]+'/1/'+sA[2];
	iCM=sA[0];
	iCYYY=sA[2];

	switch (sA[0]) {
		case '1':
			iLD=31;
			break;
		case '2':
			iLD=28;
			break;		
		case '3':
			iLD=31;
			break;		
		case '4':
			iLD=30;
			break;		
		case '5':
			iLD=31;
			break;		
		case '6':
			iLD=30;
			break;		
		case '7':
			iLD=31;
			break;		
		case '8':
			iLD=31;
			break;		
		case '9':
			iLD=30;
			break;		
		case '10':
			iLD=31;
			break;		
		case '11':
			iLD=30;
			break;		
		case '12':
			iLD=31;
			break;
		}
		
		End.value=iCM+'/'+iLD+'/'+iCYYY;	
}
function fPricingReorder() {
	
	if ($('CurrOrder').options.length>0) {
		alert ("You must move all options from current order to new order")
		return false;
	}
	
	var sComma='';
	var sNewVal='';
	for (i=0;i<$('NewOrder').options.length;i++) {
		sNewVal=sNewVal+sComma+$('NewOrder').options[i].value;
		sComma=',';
	}
	
	$('UpdOrderVal').value=sNewVal
	
	document.getElementById('PRUpdProgressBar').style.display='';
	document.getElementById('PRUpd').value="1"
	var dest=document.getElementById('dest').value;
	if (dest.length==0) {
		dest='divWeb';
	}
		
	ValidatefEmpApprov('DCPForm','Upd',dest);	
	return false;
}
function fClonePaging(CloneIdFrom,CloneIdTo)	{
	
	///Fake Cloning
	var frmElm, frmClone, ToElm
			
	frmElm = document.getElementById(CloneIdFrom);
	ToElm = document.getElementById(CloneIdTo);
	ToElm.innerHTML=frmElm.innerHTML;
}
function fSaveGalleryInd() {
	fSaveGallery()
}
function fSaveGallery() {
	
	dest=$('divGallery').parentNode.id;
	
	if ($('FileSetName').value.length==0) {
		alert ("Name is required");
		document.getElementById('FileSetName').focus();
		document.getElementById('FileSetName').select();		
		return false;		
	}
	if ($('FileSetName').value.length>255) {
		alert ("Name may not exceed 255 characters");
		document.getElementById('FileSetName').focus();
		document.getElementById('FileSetName').select();		
		return false;		
	}	
	if ($('FileSetDesc').value.length>255) {
		alert ("Description may not exceed 2000 characters");
		document.getElementById('FileSetDesc').focus();
		document.getElementById('FileSetDesc').select();		
		return false;		
	}		

	$('GUpdInd').value=1;
	ValidatefEmpApprov('formGalleryEdit','GUpdInd',dest);	
	return false;	
	
}
function fBuildSurveyPage(pageIdPrefix,pageClass,parentId) {
	
	var iCnt=0;
	var pars = $(parentId).getElementsByTagName('div');
	for (i=0;i<pars.length;i++) {
		if (pars[i].className.indexOf('SurveyPage')==0) {
			iCnt++;
		}
	}
	
	iCnt++;
	var pageId='';

	pageId=pageClass+'_'+iCnt+'_0';
	dropPageId='Drop'+pageClass+'_'+iCnt;
	InputPageId='Input'+pageClass+'_'+iCnt;
	TrashPageId='a'+pageClass+'_'+iCnt;

	var element = Builder.node('div', { id: pageId, className: 'SurveyPage'}, [
	  	Builder.node('div', { id: dropPageId, className: 'pDropArea'  }, [
	  		Builder.node('div', { id: dropPageId, className: 'WizRow Options'  }, [
	  			'Page: ',
	  			Builder.node('input', { id: InputPageId, name: InputPageId, className: 'Name', value: 'Page '+iCnt  }, [	
	  			])
				])
			])
	]);

	$(parentId).insert(element)
	
	//fSurveyPagesMove();
	fSurveyPagesItemsMove();

}
function fSurveyPagesMove() {
	Sortable.create('divSurveyPages',{tag:'div'});

//  $A($('divSurveyPages').getElementsByTagName('div')).each(
//	  function(item) {
//	  	if (item.className=='SurveyPage') {
//		  	new Draggable(item, { handle: 'handle' });
//		  }
//    }
//  );
}
function fSurveyPagesMoveDestroy() {
	//Sortable.destroy ('divSurveyPages')
}
function fSurveyPagesMoveWithinPage() {
	
	//Make new sortables within page

	$A($('divAvailQuestions').getElementsByTagName('p')).each(
	  function(item) {
    	new Draggable(
	   	  item.id,
     			{
           	scroll: window,
           	zIndex:5000
     			}
   		);
		}
  );   
  
  $A($('divSurveyPages').getElementsByTagName('p')).each(
	  function(item) {
	  	if (item.className.indexOf('pDrag')) {   
			   new Draggable(item.id,{
			   	constraint:'vertical',
			   	snap:false,
			   	zIndex:5000
		   	});
    	}
    }
  );
    
  $A($('divSurveyPages').getElementsByTagName('div')).each(
	  function(item) {
	  	if (item.className.indexOf('pDropArea') && item.id.indexOf('o1_')==-1) {   
			   Droppables.add(item.id,{
			   		accept:'pDrag',
			   		onDrop: moveSurveyItem,
			   		hoverclass: 'DropZoneActive'});
    	}
    }
  );  
}
function fSurveyPagesItemsMove() {
	
	$A($('divAvailQuestions').getElementsByTagName('p')).each(
	  function(item) {
    	new Draggable(
	   	  item.id,
     			{
           	scroll: window,
           	zIndex:5000
     			}
   		);
		}
  );  

  $A($('divSurveyPages').getElementsByTagName('div')).each(
	  function(item) {
	  	if (item.className=='pDropArea' && item.id.indexOf('o1_')==-1) {   
			  Droppables.add(
  				item.id,
					{
  					hoverclass: 'DropZoneActive',
  					accept: 'pDrag',
  					onDrop: moveSurveyItem
						}
    		);
    	}
    }
  );
 
  $A($('divSurveyPages').getElementsByTagName('div')).each(
	  function(item) {
	  	if (item.className=='pDropArea') {   
			   Sortable.create(item.id,{
			   	tag:'p'
			   	});
    	}
    }
  ); 
}
function moveSurveyItem(draggable,droparea){	

	if (draggable.parentNode.id!=droparea.id) {
	  draggable.parentNode.removeChild(draggable);
  	droparea.appendChild(draggable);
  }
  draggable.parentNode.parentNode.zIndex=5000;
  draggable.style.top='0px';
  draggable.style.left='0px';

}
function fSerializeSurveyPagesInd() {
	fSerializeSurveyPages();
}
function fSerializeSurveyPages() {
	
	var sSerial='';
	var sComma='';
	var sSquiggle='';
	var sNames='';
	
	var pars=$('divSurveyPages').getElementsByTagName('div')
	
	for (i=0;i<pars.length;i++) {
		
		if (pars[i].className=='SurveyPage') {
			sSerial=sSerial+sSquiggle+pars[i].id;
			sSquiggle='~';
		
			var pars2=pars[i].getElementsByTagName('p');
			for (i2=0;i2<pars2.length;i2++) {
				if (pars2[i2].className=='WizRow ListItem pDrag') {
					sSerial=sSerial+','+pars2[i2].id;
				}
			}
		}	
	}
	sSquiggle='';
	var pars=$('divSurveyPages').getElementsByTagName('input')
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='Name') {
			sNames=sNames+sSquiggle+pars[i].value;
			sSquiggle='~';
		}
	}	
	
	var sDest=$('Dest').value;
	if (sDest.length==0) {
		sDest='divWeb';
	}
	
	$('UpdInd').value='1';
	$('SurveyInfo').value=sSerial;
	$('Names').value=sNames;
	$('UpdProgressBarSP').style.display='';
	
	ValidatefEmpApprov('formSurveyPages','UpdInd',sDest,'fRefreshDCSurvPages()');	
	return false;		
}
function fRefreshDCSurvPages() {
	//fSurveyPagesMove();
	fSurveyPagesItemsMove();
}
function fDeleteSurvPageItem(qid,sid,mode) {

	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_SurveyEditDelFromPage.asp?qid=' + qid + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true','fRedisplayAvailableSurvItems(\''+sid+'\',\''+qid+'\')');
	new Effect.Puff('q_'+qid);
	$('q_'+qid).innerHTML='';
	$('q_'+qid).parentNode.removeChild($('q_'+qid));
}
function fRedisplayAvailableSurvItems(sid,qid) {

	DisplayAjaxPage(0,'divAvailQuestions','DCSURVEYEDITPAGESAVAILONLY','','','&sid='+sid,'','fRefreshDCSurvPages()')
}
function fDeleteSurvPage(spid,sid,pageid) {

	var x=window.confirm('You are about to delete selected page ('+spid+')\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}		
			
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_SurveyEditDelPage.asp?spid=' + spid + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true','fRedisplayAvailableSurvItems(\''+sid+'\',\''+spid+'\')');		
	new Effect.Puff(pageid);
	$(pageid).innerHTML='';
}
function fSaveSurvNavInd() {
	fSaveSurvNav();
}
function fSaveSurvNav() {
	
	if (document.getElementById('PageName').value.length==0) {
		alert ("Page Name is required");
		document.getElementById('PageName').select();
		document.getElementById('PageName').focus();
		return false;
	}
	if (document.getElementById('PageName').value.length>200) {
		alert ("Page Name cannot exceed 200 characters");
		document.getElementById('PageName').select();
		document.getElementById('PageName').focus();
		return false;
	}					
	
	lComma=""	
	if (document.getElementById('Answers')!=null) {	
		document.getElementById('Answers').value='';
		for (i=0; i < document.getElementById('AnswersSel').options.length;i++) {
			if (document.getElementById('AnswersSel').options[i].selected) {
				document.getElementById('Answers').value = document.getElementById('Answers').value + lComma + document.getElementById('AnswersSel').options[i].value;
				lComma=',';
			}
		}
	} 
	var pars=$('JumpAnswers').getElementsByTagName('input');
	for (i=0;i<pars.length;i++) {
		if (pars[i].checked) {
			var sA=pars[i].id.split('_');
			if ($('JumpTo_'+sA[1]).selectedIndex==0) {
				alert ('You have Jump Answer checked, but you did not select a page to jump to. Please correct');
				pars[i].select();
				pars[i].focus();
				return false;
			}
		}
	}

	$('UpdInd').value='1';
	$('UpdProgressBarSPN').style.display='';
	var sDest=$('SPDest').value
	
	ValidatefEmpApprov('formSurveyNav','SPUpdInd',sDest,'fRefreshSurvPagesNav()');	
	return false;			
}
function fRefreshSurvPagesNav() {
	
}
function fDelPool(PoolId,Pid) {
	var x=window.confirm('You are about to delete the selected Pool\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ProjPoolDelete.asp?poolid=' + PoolId + '&pid='+Pid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('PP_'+PoolId)	
}
function fSavePoolNameInd() {
	fSavePoolName();
}
function fSavePoolName() {
	
	if ($('PoolName').value.length==0) {
		alert ("Pool Name is required");
		document.getElementById('PoolName').focus();
		document.getElementById('PoolName').select();		
		return false;		
	}
	if ($('PoolName').value.length>200) {
		alert ("Pool Name cannot exceed 200 characters");
		document.getElementById('PoolName').focus();
		document.getElementById('PoolName').select();		
		return false;		
	}
	
	var sDest=$('Dest').value;
	$('PoolUpdProgressBar').style.display='';
	$('UpdInd').value=1;
	
	ValidatefEmpApprov('formPoolMaint','UpdInd',sDest,'fRedisplayPoolList()');	
	return false;		
}
function fRedisplayPoolList() {
	DisplayAjaxPage(0,'divWeb','DCPROJRESOURCEPOOLLIST',1,'','&pid='+$('Pid').value+'&OrgId='+$('OrgId').value);
}
function fInsertProjPoolResource (pid,poolId,resourceName) {
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_ProjPoolResourceAdd.asp?pid='+pid+'&poolid='+poolId+'&resourcename='+resourceName+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function fDelProjPoolResource(pid,rid) {
	var x=window.confirm('You are about to delete the selected resource from your pool\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_ProjPoolResourceDelete.asp?pid='+pid+'&rid=' + rid + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('PP_'+rid)	
}
function DownloadPoolConflicts (sd,ed,rn,um,dest) {
	
	ajaxIncrement=ajaxIncrement+1;
	document.getElementById(dest).innerHTML='<img src=/DC_Images/silk_icons/AjaxProcesBar.gif />';
	document.getElementById(dest).style.display='';
	var ajaxscript = '/dc_includes/CP5_ProjPoolConflictCSV.asp?sd='+sd+'&ed='+ed+'&reqnames='+rn+'&UtilizationMode='+um+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', dest ,1);	
}
function fRefreshOnline() {
	
	var bFO=0;
	if ($('ActiveUsersMode')!=null) {
		bFO=$('ActiveUsersMode').value;
	}
	
	ajaxTimeStamp=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/cp6_ActiveUsers.asp?ConfCode='+lPD_ConfCode+'&sessid='+lPD_SessionId+'&mc='+lPD_MarketCode +'&fo='+bFO+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divActiveUsers6Container',1,'true','fHighlightElem(\'OLUpdater\')');

}
function fRefreshAlerts(sDest) {
	
	if ($(sDest)==null) {
		sDest='';
	}
	
	if (document.getElementById('MarketCodeAlerts')!=null) {
		var sMarketCode=document.getElementById('MarketCodeAlerts').value;
	}
	else {
		var sMarketCode=lPD_MarketCode;
	}
	var sTopRow=5;
	if ($('NFTopRow')!=null) {
		sTopRow=$('NFTopRow').value;
	}
	
	if (document.getElementById('TagDest')!=null) {
		sDest=document.getElementById('TagDest').value;
	}
	else	{
		sDest='divTagSearchResultsAlertsContainer';
	}
	
	sDest=$('divTagSearchResultsAlertsContainer').parentNode.id+'_Inner';
	
	ajaxTimeStamp=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP5_TagSearchResultsAlerts.asp?dest='+sDest+'&refresh=1&mc='+sMarketCode+'&tr='+sTopRow+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', sDest,1,'true','fHighlightElem(\'AlertUpdater\')');
}

function fHighlightElem(elem) {
	$(elem).highlight();
	if ($('NewAlertEval')!=null) {
		eval($('NewAlertEval').value);
	}
}
function fClearRow(RankType,Pat,currId,parentId) {
	if (RankType==0) {
		return;
	}
	var pars=null;
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		if ((pars[i].id.indexOf(Pat)==0 && pars[i].id!=currId)) {
			pars[i].checked=false;
		}
	}
	// Update all "holding" values
	sSa=Pat.split('_');
	var sCurrMXVal='DCSurv_2_'+sSa[2]
	sCurrVal=$(currId).value;

	var pars = $(parentId).getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		if ((pars[i].id.indexOf('DCSurv_2_')==0 && pars[i].id!=sCurrMXVal)) {
			if (pars[i].value==sCurrVal) {
				pars[i].value='-1';
			}
		}
	}

	$(currId).checked=true;
	
}
function fBuildNewMatrixMDQuestion () {
	
		var parentId='MDCols';
		var iCnt=0;
		var pars = $(parentId).getElementsByTagName('input');
		iCnt=pars.length+1;
		
		var ColNameId='ColName'+iCnt
		var ColId='Col'+iCnt
		var ColListId='ColList'+iCnt
		var sNColumName='Column Name/List '+iCnt

		var element = Builder.node('div', {id:ColId, className: 'WizRow'}, [
	  	Builder.node('span', {className: 'WizLabel'}, [sNColumName]),
	  	Builder.node('span', {className: 'WizInput'}, [
	  		Builder.node('input', {id:ColNameId, name:'ColName', className: 'WebBasicText'}),
	  		Builder.node('br'),
  			Builder.node('textarea', { id:ColListId, name: 'ColList', className: 'WebBasicText'})
	  	]),
	  	Builder.node('br', {className: 'ClearFix'})
		]);
		
		$(parentId).insert(element);
		$(ColId).highlight();
}
function fDestroyMatrixMDQuestion(rid) {
	$(rid).innerHTML='';
	$(rid).style.display='none';
}
function fOpenSubCloudFolder(wid,sid,parentid) {
	if ($('sf_'+parentid)!=null) {
		if ($('sf_'+parentid).className=='StdFolderOpen') {
			if ($('ul_'+parentid)!=null) {
				$('ul_'+parentid).style.display='none';
				$('sf_'+parentid).className='StdFolder';
			}
		}
		else {
			if ($('ul_'+parentid)!=null) {
				//$('ul_'+parentid).style.display='none';
			}
			var ajaxscript = '/dc_includes/CP5_TreeQueryAlphaFOLDER.asp?wid=' + wid + '&parentid='+parentid+'&xc=' + ajaxTimeStamp+ajaxIncrement;
			AjaxSimpleCheck(ajaxscript, '', 'ul_'+parentid,1,true,'FileManagerProcessFolder('+parentid+')');
		}
	}
	else {
		DisplayAjaxPage(0,'divFMContainer','DCFileManagerDrop',1,'&wid='+wid+'&xid='+parentid,'','','FileManagerProcessFolder('+parentid+')')
		//function DisplayAjaxPage	(seq,dest,pn,archives,params,i,NoImage,MoreParams,event)
		
	}
}
function fCloseProfileTabe(openTab) {
	pars=document.getElementsByTagName('div');
	for (i=0;i<pars.length;i++) {
		if (
				pars[i].id.indexOf('divFriendAvatars')!=-1
				|| pars[i].id.indexOf('divWall')!=-1
				|| pars[i].id.indexOf('divPhotos')!=-1
				|| pars[i].id.indexOf('divDiscussion')!=-1
				|| pars[i].id.indexOf('divInfo')!=-1
				|| pars[i].id.indexOf('divMusic')!=-1
				|| pars[i].id.indexOf('divVideo')!=-1
				|| pars[i].id.indexOf('divShout')!=-1
				|| pars[i].id.indexOf('divVisitors')!=-1
				|| pars[i].id.indexOf('divPrefs')!=-1
				)	{
			pars[i].style.display='none';
		}
	}
	$(openTab).style.display='';
} 
function fCreateSimpleEditor() {
	var browser = new Browser();
	if (!browser.isIPAD) {
		I_RenderEditor();
	}
}
function fSimpleEditInit() {

	fCreateSimpleEditor()

	if ($('__inpImgAlt')!=null) {
//		var oElem=
//			Builder.node('div', { id: 'divUploadedFilesObjContainer'},[
//				Builder.node('div', { id: 'divUploadedFilesObj'},[
//					Builder.node('a', {id:'a_element_1',href: 'javascript:void(0)', onclick:'addallitemstocart()'}),
// 					Builder.node('a',{id:'a_element_2',href: 'javascript:void(0)', onclick:'addallitemstocart()'})
// 				]),
// 				Builder.node('input', { id: 'DUPLOADEvalScript', name: 'DUPLOADEvalScript',value: 'DUploadPictures(1,\'\',\'0\',lPD_ConfCode)', type: 'hidden'}),
// 				Builder.node('div', { id: 'divIFrame'})
// 			])
		// Build Editor node
		sCC='0';
		if ($('divUploadedFilesObj')==null) {
			if ($('OwnerId')!=null) {
				sCC=lPD_ConfCode+'_AFF_'+$('OwnerId').value;
				sSp=-100
			}
			else {
				sCC=lPD_ConfCode
				sSp=0
			}
			var cElem = document.createElement('div');
			cElem.setAttribute('id','divUploadedFilesObj');
			cElem.innerHTML='<a class="StdList" onclick="DUploadPictures(1,\'\',\''+sSp+'\',sCC,\'divAvailableFiles\',\'__inpImgSrc\');$(\'aCloseAvail\').style.display=\'\';this.style.display=\'none\';" href="javascript:void(0);" id="aListAvail">List of Available Images/Pictures</a>'
			+'<a class="StdClose" onclick="$(\'aCloseAvail\').style.display=\'none\';$(\'aListAvail\').style.display=\'\';$(\'divAvailableFiles\').style.display=\'none\'" href="javascript:void(0);" style="display: none;" id="aCloseAvail">Close Images/Pictures List</a>'
			+'<input type="hidden" value="DUploadPictures(1,\'\',\''+sSp+'\',sCC,\'divAvailableFiles\',\'__inpImgSrc\')" id="DUPLOADEvalScript" name="DUPLOADEvalScript">'
			+'<div id="divAvailableFiles" style="display:none;"></div>'
			
			var oLinkNode = document.createElement('div');
			oLinkNode.setAttribute('id','divUploadedAssetsObj');
			oLinkNode.innerHTML='<a class="StdList" onclick="DUploadPictures(2,\'\',\''+sSp+'\',sCC,\'divAvailableFiles2\',\'__inpLnkSrc\');$(\'aCloseAvail2\').style.display=\'\';this.style.display=\'none\';" href="javascript:void(0);" id="aListAvail2">List of Available Images/Pictures</a>'
			+'<a class="StdClose" onclick="$(\'aCloseAvail2\').style.display=\'none\';$(\'aListAvail2\').style.display=\'\';$(\'divAvailableFiles2\').style.display=\'none\'" href="javascript:void(0);" style="display: none;" id="aCloseAvail2">Close Images/Pictures List</a>'
			+'<input type="hidden" value="DUploadPictures(2,\'\',\''+sSp+'\',sCC,\'divAvailableFiles2\',\'__inpImgSrc\')" id="DUPLOADEvalScript2" name="DUPLOADEvalScript">'
			+'<div id="divAvailableFiles2" class=""WizRow Boxed"" style="display:none;"></div>'			
			
			var newElem2 = document.createElement('div');
			newElem2.setAttribute('id','MoreOrLess');
			
			if (isIE!=1) {
				newElem2.onmousedown=function() {doClick(this);oEditorUtil.exeParaClass('p','DCMoreOrLessPX');};
			} else {
				newElem2.setAttribute('onmousedown',function() {doClick(this);oEditorUtil.exeParaClass('P','DCMoreOrLessPX');})	
			}
			newElem2.innerHTML='Add More or Less Process'
			newElem2.unselectable	='on';	
			
			pars=$('__tab1').getElementsByTagName('div');
			pars[0].id='ParaOptions';
			//$('ParaOptions').appendChild(newElem2);
			$('ParaOptions').insertBefore(newElem2, $('ParaOptions').firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling);
		}
		else	{
			cElem=$('divUploadedFilesObj');
		}
 			
		// Attach the approriate option for the picture selectio
		pElem=$('__tab3');
		pElemLink=$('__tab4');
		pCElem=$('__inpImgAlt');
		
		if ($('divUploadedFilesObj')!=null) {
			$('divUploadedFilesObj').style.display='none';
			$('aCloseAvail').style.display='none';
			$('aListAvail').style.display='';		
		}
		
		// Check for existence
		var bNoAdd=0
		var pars = $('__tab3').getElementsByTagName('div');
		for (var i=0;i<pars.length;i++) {
			if (pars[i].id=='divUploadedFilesObj') {
				bNoAdd=1
			}
		}	
		if (bNoAdd==0) {	
			try {
				pElem.insertBefore(cElem, pElem.firstChild);
				pElemLink.insertBefore(oLinkNode, pElemLink.firstChild);
				cElem.style.display='';
			}catch(E){}
		}
		
		$('__tab1').style.paddingRight='0px';
		$('__tab2').style.paddingRight='0px';
		$('__tab3').style.paddingRight='0px';
		$('__tab3').style.width='auto';
		$('__tab4').style.paddingRight='0px';
		
		
		if ($('divUploadedFilesObj')!=null) {
			$('divUploadedFilesObj').nextSibling.style.paddingRight='90px';
			$('divUploadedFilesObj').style.display='';
		}
	}
}
function fDoDBSearch() {
	
	var sDest=$('dest').value;
	if (sDest.length==0) {
		sDest='divWeb';
	}
	$('SUpdInd').value=1;
	
	ValidatefEmpApprov('formDBSearch','SUpdInd',sDest);	
	return false;		
}
function fSwitchClass(elemId,from,to) {
	var elem=$(elemId)
	elem.className=elem.className.replace(from,to);
}
function fGenDownLoad(fid) {
	dSimpleAjax('divGnrlAjax','/dc_includes/cp6_filedownloadgen.asp?fid='+fid, 'fGDLFile()')
}
function fGDLFile() {
	sFileName=$('divGnrlAjax').innerHTML
	sFileName=sFileName.replace('{FILEDOWNLOADNAME.','');
	sFileName=sFileName.replace('}','');
	x=window.open(sFileName,'FileDL');
}
function fSimpleUploadFormAction(strAction) {
	var elm;
							
	elm = document.getElementById("frmAction");
	elm.value = strAction;
	
	ValidatefEmpApprovTEST('formSimpleUpload','fsiUpdInd','divSimpleUpload');	
	return false;			
				
}
function ValidatefEmpApprovTEST(fid,uid,mid,f,field,mode) {
	if (mode==null) {
		var mode='true'
	}
	
	document.getElementById(uid).value=1;
	
    var oForm =document.getElementById(fid);
    var sBody = getRequestBodyTEST(oForm);
    alert (sBody);
    
    var oXmlHttp = zXmlHttp.createRequest();
    oXmlHttp.open("post", oForm.action, mode);
    oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    
    oXmlHttp.onreadystatechange = function () {
        if (oXmlHttp.readyState == 4) {
            if (oXmlHttp.status == 200) {
                saveResult(oXmlHttp.responseText, mid,f,field);
            } else {
                saveResult("An error occurred: " + oXmlHttp.statusText, mid,field);
            }
        }            
    };
    oXmlHttp.send(sBody);
    if (document.getElementById(mid)!=null) {
			document.getElementById(mid).value='';
		}
}
function getRequestBodyTEST(oForm) {
    var aParams = new Array();
    
    // Add radio buttom processing - currently ignoring "checked" status
    
    for (var i=0 ; i < oForm.elements.length; i++) {
        var sParam = encodeURIComponent(oForm.elements[i].name);
        sParam += "=";
        sParam += encodeURIComponent(oForm.elements[i].value);
        aParams.push(sParam);
    } 
    
    return aParams.join("&");  
}
function fProcess2020Func() {
	if ($('RankEval')!=null) {
		eval($('RankEval').value);
	}
	if ($('DefQidEval')!=null && $('CurQid')!=null ) {
		eval($('DefQidEval').value);
	}	
}
function fProcessEval(eObj) {
	if ($(eObj)!=null) {
		eval($(eObj).value);
	}	
}
function fSurvBuildNav() {
	eval($('SurvNavEval').value);
	aNQ=oSurvNav.Qids.split(',');
	aNS=oSurvNav.Spids.split(',');
}
function fSurvNav(dir,sid,event) {
	
	eval($('SurvNavEval').value);
	aNQ=oSurvNav.Qids.split(',');
	aNS=oSurvNav.Spids.split(',');	
	
	var qid=$('CurQid').value;
	
	iCurrOcc=0;
	for (i=1;i<aNQ.length;i++) {
		if (qid==aNQ[i] && aNQ[i]!='') {
			iCurrOcc=i;
		}
	}
	
	if (dir==0) {
		iCurrOcc++;
		if (iCurrOcc>=aNQ.length) {
			iCurrOcc=1;
		}
	}
	else {
		iCurrOcc--;
		if (iCurrOcc<1) {
			iCurrOcc=aNQ.length-1;
		}		
	}
	$('CurQid').value=aNQ[iCurrOcc];
	$('CurSpid').value=aNS[iCurrOcc];
	
	if ($('AnalyticUpdProgressBar')!=null) {
		$('AnalyticUpdProgressBar').style.display='';
	}
	
	ChangeClassCommBts($('CurSpid').value,'AnlysisBt');
	DisplayAjaxPage(-1,'divAnalyticWeb','DC2020KPI',9,'','&sid='+sid+'&spid='+$('CurSpid').value+'&qid='+$('CurQid').value,'','fRetrieve2020KPI('+sid+','+$('CurSpid').value+','+$('CurQid').value+')');
}
function fRetrieve2020KPI(sid,spid,qid,ts,qrowid, qcolid) {
	if (ts==null) {
		ts='';
	}
	if (qrowid==null) {
		qrowid='';
	}
	if (qcolid==null) {
		qcolid='';
	}
	if ($('AnalyticUpdProgressBar')!=null) {
		document.getElementById('AnalyticUpdProgressBar').style.display='';
	}
	if ($('CurQid')!=null) {
		$('CurQid').value=qid;
	}
	DisplayAjaxPage(-1,'divAnalyticWeb','DC2020KPI',9,'','&sid='+sid+'&spid='+spid+'&qid='+qid+'&ts='+ts+'&qrowid='+qrowid+'&qcolid='+qcolid,'','fProcess2020Func()');
}
function fRetrieve2020KPIROWS(sid,spid,qid,ts) {
	fRetrieve2020KPI(sid,spid,qid,ts,document.getElementById('selMDRow')[document.getElementById('selMDRow').selectedIndex].value,document.getElementById('selMDCol')[0].value)
}
function fMoveFuncInnerHtml(CurId,TarId) {
	if ($(CurId)!=null && $(TarId)!=null) {
		$(TarId).innerHTML=$(CurId).innerHTML;
	}
}
var fProjListTimer;
var TimeIsOn=false;
var svProjId=0;
function fProjListMouseOver(ProjId) {
	
	//fProjListTimer=window.setInterval('fProjListDisplay(\''+ProjId+'\')', 1000);	
	fProjListDisplay(ProjId);
}
function fProjListDisplay(ProjId) {
	
	if (TimeIsOn==false || ProjId!=svProjId) {
		var pars = $('ulDCProjList').getElementsByTagName('li');
		for (var i=0;i<pars.length;i++) {
			pars[i].style.zIndex=0;
		}
		var pars = $('ulDCProjList').getElementsByTagName('div');
		for (var i=0;i<pars.length;i++) {
			if (pars[i].className.indexOf('divProjListContainerstyle')==0) {
				pars[i].style.display='none';
			}
		}	
		
		$('divProjOpt'+ProjId).style.display='';
		$('divProjOpt'+ProjId).parentNode.style.zIndex=100;
		svProjId=ProjId;
		TimeIsOn=true;
		window.clearTimeout(fProjListTimer);
	}
}
function fProjListMouseOut(ProjId) {
	window.clearTimeout(fProjListTimer);
	$('divProjOpt'+ProjId).style.display='none';
	TimeIsOn=false;
}
function fProjListCloseAll() {
		var pars = $('ulDCProjList').getElementsByTagName('div');
		for (var i=0;i<pars.length;i++) {
			if (pars[i].className.indexOf('divProjListContainerstyle')==0) {
				pars[i].style.display='none';
			}
		}	
}		
function RefreshCaptchaImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}
function fBlindDown(did) {
	if ($(did).style.display=='none'){
		new Effect.BlindDown(did, {duration:.5});
	}
}
function fBlindUp(did) {
	if ($(did).style.display!='none'){
		new Effect.BlindUp(did);
	}
}
function fClearText(fText,did) {
	if ($(did).value.indexOf(fText)!=-1) {
		$(did).value='';
	}
	CloseByIdPattern('div','SUArea_',0,0);
}
function fRevertText(fText,did) {
	if ($(did).value.length==0) {
		$(did).value=fText;
	}
}
function fSaveMBInd(li) {
	fSaveMB(li);
}
function fSaveMB(li) {
	
	try {fSimpleEditorFix();}catch(E){};
	
	try {I_FinishEditing()}catch(E){;}
	if (document.getElementById('__divEditing')!=null) {
		document.getElementById('__divEditing').style.display='none';
		try{oEditorUtil.boxopen=false}catch(e){;}	
		try{oEditorUtil.onBoxClosed()}catch(e){;}	
	}	
	
	if ($('Subject_'+li).value.length==0 || $('Subject_'+li).value=='Post a New Message?') {
		alert ("You must enter a post subject");
		document.getElementById('Subject_'+li).select();
		document.getElementById('Subject_'+li).focus();
		return false;
	}
	
	if ($('Subject_'+li).value.length>255) {
		alert ("Subject may not exceed 255 characters");
		document.getElementById('Subject_'+li).select();
		document.getElementById('Subject_'+li).focus();
		return false;
	}
	
	if ($('Message_'+li).value.length==0 || $('Message_'+li).value=='Body of Message') {
		alert ("You must enter a message");
		document.getElementById('Message_'+li).select();
		document.getElementById('Message_'+li).focus();
		return false;
	}
	
	if ($('SelectForum_'+li)!=null) {
		if ($('SelectForum_'+li).selectedIndex==0) {
			alert ("You must select a forum");
			document.getElementById('SelectForum_'+li).select();
			return false;		
		}
	
		if ($('SelectForum_'+li).options[$('SelectForum_'+li).selectedIndex].value.indexOf('-2.')!=-1) {
			alert ("You have selected a forum area, this is incorrect. You must select an actual forum (non-bold)");
			document.getElementById('SelectForum_'+li).select();
			return false;		
		}
	}
	//if (lPD_MIFL!=6882) {
	//	$('Message_'+li).value=$('Message_'+li).value.replace(/(~|<br>|\r|\n)/gi,' <br/> ');
	//}
	var sArray = $('Message_'+li).value.split(' ');
	for (var n = 0; n < sArray.length; n++){
		if(isUrl(sArray[n])==true){
			//$('Message_'+li).value=$('Message_'+li).value.replace(sArray[n], '<a target=_blank href=\''+sArray[n]+'\'>'+sArray[n]+'</a>');
		}
	}	

	sDest=$('formMB_'+li).parentNode.parentNode.parentNode.id;

	// Temp Fix for MB w/in Afinity pages...
	if (sDest=='divFLC') {
		sDest=$('formMB_'+li).parentNode.parentNode.parentNode.parentNode.parentNode.id;
	}
	document.getElementById('MBUpdProgressBar_'+li).style.display='';	
	document.getElementById('MBUpd_'+li).value="1";
	
	if (sDest=='divEditBlog') {
		ValidatefEmpApprov('formMB_'+li,'MBUpd_'+li,sDest,'fDisplayBlog();',null,1);
	}
	else {
		ValidatefEmpApprov('formMB_'+li,'MBUpd_'+li,sDest,'fCreateSimpleEditor()',null,1);
	}
	
	return false;		
}
function fDisplayBlog() {

	eval($('BlogEval').value);
}
function fCheckForumType(li) {
	
	if ($('SelectForum_'+li).options[$('SelectForum_'+li).selectedIndex].value.indexOf('-2.')!=-1) {
		alert ("You have selected a forum area, this is incorrect. You must select an actual forum (non-bold)");
		document.getElementById('SelectForum_'+li).select();
		return false;		
	}
}	
function fSaveSubsInd() {
	 fSaveSubs();
}
function fSaveSubs() {
	$('SubUpdInd').value='1';

	sDest=$('divMBSubscriptions').parentNode.id;
	document.getElementById('SubUpdProgressBar').style.display='';	
	ValidatefEmpApprov('formSubscriptions','SubUpdInd',sDest);
	return false;	
}
function fOptOutUpdFormInd() {
	fOptOutUpdForm();
}
function fOptOutUpdForm() {
	$('SubUpdInd').value="1";
	document.getElementById('OptUpdProgressBar').style.display='';	
	ValidatefEmpApprov('formSubscriptions','SubUpdInd','divOptSubContainer');
	return false;		
}
function fChangeEmail() {
	
	if (document.getElementById('nEmail').value.length == 0){
		alert("Your new Email address is required");
		document.getElementById('nEmail').focus();
		document.getElementById('nEmail').select();
		return false;
	}	
			
	if (isValidEmail(document.getElementById('nEmail').value) == false){
		alert("Email address is invalid. Must be of the form name@company.com");
		document.getElementById('nEmail').focus();
		document.getElementById('nEmail').select();
		return false;
	}
	$('EMailUpdInd').value="1";
	document.getElementById('EMailUpdProgressBar').style.display='';	
	ValidatefEmpApprov('formEMailChange','EMailUpdInd','divChangeEmailContainer');
	return false;					
}
function fAppendTag(tagText,tagId,parId) {

	var tagFieldArray=$(tagId).value.split(' ');
	var sText='';
	var sSpace='';
	for (i=0;i<tagFieldArray.length-1;i++) {
		if (tagFieldArray[i].length>0) {
			sText=sText+sSpace+tagFieldArray[i];
			sSpace=' ';
		}
	}
	
	sText=sText+sSpace+tagText;
	$(tagId).value=sText;
	
	if ($(parId)!=null) {
		$(parId).style.display='none';
	}
	
}
function fUpdateMessageDate(cbid) {
	
	var ajaxscript = '/dc_includes/CP6_WallMessageUpdate.asp?cbid=' + cbid + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');	
}	
function fSubTagPersonalInd() {
	fSubTagPersonal();
}
function fSubTagPersonal() {
	
	$('TPUpdProgressBar').style.display='';	
	$('TPUpdInd').value='1';

	ValidatefEmpApprov('formTagPersonal','TPUpdInd','divTagPersonalContainer');	
	return false;
}
function fScrollToBottom(sDiv, sCompareDiv) {
	
	var objDiv = document.getElementById(sDiv);
	if (sCompareDiv!=null) {
		var cDiv = document.getElementById(sCompareDiv);
			objDiv.scrollTop = cDiv.offsetTop-30;
	}
	else	{
		objDiv.scrollTop = objDiv.scrollHeight;
	}
	try {
		fCreateSimpleEditor()	
	}catch(E){}
}
function fEditExistingPost(sDiv, sCompareDiv,sEditField) {
	
	//fScrollToBottom(sDiv, sCompareDiv);
	fCheckForEdit(sCompareDiv);
	
}
function fDelBlog(postId,iFpid) {
	
	var x=window.confirm('You are about a blog entry\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_MBPostDelete.asp?pid='+postId+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true','fRedispBlog('+iFpid+')');
	
	var pars = document.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf('divPostCont_'+postId)!=-1) {
			pars[i].style.display='none';
		}
	}		
}
function fRedispBlog(iFpid) {
	DisplayAjaxPage(0,'divWeb','DCFPBlogs','','','&uid='+iFpid+'&fpid='+iFpid+'&dest=divWeb&mc='+lPD_MarketCode,'','fSimpleEditInit()');	
}
function fDelPost (postId,DestPre) {
	var sDest=DestPre+postId;
	var x=window.confirm('You are about to delete a message/post\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP5_MBPostDelete.asp?pid='+postId+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff(sDest);
	CloseEmailWindow();		
	
	var pars = document.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf('divPostCont_'+postId)!=-1) {
			pars[i].style.display='none';
		}
	}		
}
function fDisplayFlash(DCFSWF, DCFNOSWF, DCFLoop, DCFWidth, DCFHeight, locSWF) {
	var canPlay = 0;
	var locSWF =DCFSWF;
	var locAlt =DCFNOSWF;
	if(window.navigator.mimeTypes["application/x-shockwave-flash"]) {
			canPlay = 1;
	} else {
			try {
				var objFlash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				canPlay = 1;
		}
		catch(e) {}
	}
	if(canPlay) {
		document.writeln('<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" style=border:0px;width:'+DCFWidth+';height:'+DCFHeight+' border=0>');
		document.writeln('<PARAM NAME=movie value=' + locSWF +'>');
		document.writeln('<PARAM NAME=wmode value=transparent>');
		document.writeln('<PARAM NAME=quality value=high>');
		document.writeln('<PARAM NAME=LOOP VALUE=" + DCFLoop + ">');
		document.writeln('<embed src='+locSWF+' loop='+DCFLoop+' wmode=transparent quality=high pluginspage="http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash" style="border:0px;width:'+DCFWidth+';height:'+DCFHeight+'"/>');
		document.writeln('</object>');
	} else {
		document.writeln('<img src=' + locAlt + ' alt="Alternate content for Flash" style="border:0px;width:'+DCFWidth+';height:'+DCFHeight+'">');
	}
}
function fAjaxFlashInit() {

	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('_FlashJson')>0) {
			eval(pars[i].value);
		}
	}	

}
function fCloudDriveSetup() {
	
	if (document.getElementById('Title').value.length == 0){
		alert("Title is required");
		document.getElementById('Title').focus();
		document.getElementById('Title').select();
		return false;
	}
	
	if (document.getElementById('Title').value.length>100){
		alert("Title cannot exceed 100 characters");
		document.getElementById('Title').focus();
		document.getElementById('Title').select();
		return false;
	}			
	if (document.getElementById('Purpose').value.length>500){
		alert("Description cannot exceed 500 characters");
		document.getElementById('Purpose').focus();
		document.getElementById('Purpose').select();
		return false;
	}				
	$('WikiUpdInd').value="1";
	document.getElementById('CDUpdProgressBar').style.display='';	
	var sDest=document.getElementById('CDDest').value;
	ValidatefEmpApprov('formCloudDriveSetup','WikiUpdInd',sDest);
	return false;			
}
function fCloudSearch() {
	
	$('CSUpdInd').value="1";
	ValidatefEmpApprov('formCloudSearch','CSUpdInd','divFMContainer');
	return false;		
	
}
function fCheckCascadeFunc(fid,sPrefix) {

	if (sPrefix!=null) {
		
		var primId=sPrefix+fid;
	}
	else	{
		var primId='libr_'+fid;
	}
	
	var cid='librCasc_'+fid;

	if ($(primId).value==1) {
		$(cid).style.display='';
	}
	else	{
		$(cid).style.display='none';
		$('librCascFunc_'+fid).checked=false;
		$('librCascFunc_'+fid).value=0;
		$('librOffLineFunc_'+fid).checked=false;
		$('librOffLineFunc_'+fid).value=0;		
	}
}
function AjxDisplayRegion(cb) {
	var displayRegion;
				
	document.getElementById("CA_Region").style.display = "none";
	document.getElementById("US_Region").style.display = "none";
	document.getElementById("Clear_Region").style.display = "none";

	if(document.getElementById(cb).checked) {
		switch(document.getElementById(cb).value) {
			case "US":
				AjxDisplayRegion = true;
				region = "US_Region";
				break;
								
			case "CA":
				AjxDisplayRegion = true;
				region = "CA_Region";
				break;
								
			default:
				AjxDisplayRegion = false;
				region = "";
				break;
		}
	}
		
	if(AjxDisplayRegion) {
		document.getElementById(region).style.display = "";
		document.getElementById("Clear_Region").style.display = "";
	}
}
function AjxClearSelection(elmName) {
	var elms, elm;
				
	elms = document.getElementsByName(elmName);
	for(var i = 0; i < elms.length; i++) {
		elm = elms[i];
		if(elm.type == "checkbox" && elm.checked == true) elm.checked = false;
	}
				
	if(elmName == "frmCountry") DisplayRegion();
}
function AjxNextPage(dest)
{
	var frmElm;
	if (dest==null) {
		dest='divWeb'
	}
			
	if(parseInt(document.getElementById('frmPageID').value) >= parseInt(document.getElementById('TotPages').value)){
		return;
	}
	frmElm = document.getElementById("frmPageID");
	frmElm.value = ++frmElm.value;
				
	frmElm = document.getElementById("DCPageRecordSet");
	$('UpdProgressBarFSO').style.display='';
	ValidatefEmpApprov('DCPageRecordSet','FSUpd',dest);	
	return false;		
}
function AjxPreviousPage(dest)
{
	var frmElm
	if (dest==null) {
		dest='divWeb'
	}	
				
	if(parseInt(document.getElementById('frmPageID').value) == 1){
		return;
	}
				
	frmElm = document.getElementById("frmPageID");
	frmElm.value = --frmElm.value;
				
	frmElm = document.getElementById("DCPageRecordSet");
	
	$('UpdProgressBarFSO').style.display='';
	ValidatefEmpApprov("DCPageRecordSet","FSUpd",dest);	
	return false;		
}
function AjxSortBy(sSortBy)
{
	var frmElm
			
	frmElm = document.getElementById("frmSortByID");
	frmElm.value = sSortBy;
					
	frmElm = document.getElementById("frmPageID");
	frmElm.value = --frmElm.value;
				
	frmElm = document.getElementById("DCPageRecordSet");
	
	$('UpdProgressBarFSO').style.display='';
	ValidatefEmpApprov("DCPageRecordSet","FSUpd","divWeb");	
	return false;		
	
}
// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}
function fCheckWikiEditPage(wid,commbts) {
	
	if ($('ViewerWCID')!=null) {
		if (parseInt($('WikiContentId').value)!=parseInt($('ViewerWCID').value)) {
			self.location='?p=210&confcode='+lPD_ConfCode+'&sp=62&wid='+wid+'&wcid='+document.getElementById('ViewerWCID').value;
			return;
		}
	}

	ChangeClassCommBts(commbts);
	HidePanel('AllWiki');
	HidePanel('WikiLogs');
	HidePanel('Archives');
	ShowPanel('WikiContent');

}
function fSaveMarketProfileInd() {
	fSaveMarketProfile();
}
function fSaveMarketProfile() {

	if (document.getElementById('MarketCode').value < 1) {
		alert ("Market Code is required")
		document.getElementById('MarketCode').select();
		document.getElementById('MarketCode').focus();
		return;
	}
	
	if (document.getElementById('MarketCode').value > 16) {
		alert ("Market Code cannot exceed 16 characters")
		document.getElementById('MarketCode').select();
		document.getElementById('MarketCode').focus();
		return;
	}
	
	if (document.getElementById('Description').value < 1) {
		alert ("Description is required")
		document.getElementById('Description').select();
		document.getElementById('Description').focus();
		return;
	}
	
	if (document.getElementById('Description').value > 100) {
		alert ("Description cannot exceed 100 characters")
		document.getElementById('Description').select();
		document.getElementById('Description').focus();
		return;
	}
	
	$('MCUpdProgressBar').style.display='';
	$('UpdInd').value='1';
	var dest=$('Dest').value;
	ValidatefEmpApprov('formMarketProfileManager','UpdInd',dest);	
	return false;	
}
function fUpdateMarketProfileFields() {
	for (i=0;i<document.getElementById('CustomerType').options.length;i++) {
		if (document.getElementById('CustomerType').options[i].value==document.getElementById('CustomerTypeVal')) {
			document.getElementById('CustomerType').selectedIndex=i;
		}
	}
}
function fSaveMarketMetaInd() {
	fSaveMarketMeta();
}
function fSaveMarketMeta() {
	
	if ($('Description').value.length==0) {
		alert ("Description is required")
		$('Description').select();
		$('Description').focus();
		return;
	}
	if ($('Description').value.length>50) {
		alert ("Description cannot exceed 50 characters")
		$('Description').select();
		$('Description').focus();
		return;
	}	
	
	if ($('ShortAlias').value.length>10) {
		alert ("Short Alias cannot exceed 10 characters")
		$('ShortAlias').select();
		$('ShortAlias').focus();
		return;
	}		
	
	$('MMUpdProgressBar').style.display='';
	$('MMUpdInd').value='1';
	var dest=$('MMDest').value;
	
	ValidatefEmpApprov('formMarketMeta','MMUpdInd',dest,'fRefreshMM()');	
	return false;		
}
function fRefreshMM() {
	if ($('MMRefreshListEval')!=null) {
		eval($('MMRefreshListEval').value);
	}
}

function fUpdMetaForm() {
	for (i=0;i<$('Class').options.length;i++) {
		if (parseInt($('ClassVal').value)==parseInt($('Class').options[i].value)) {
			$('Class').selectedIndex=i;
		}
	}
}
function fUpdateMMDesc() {
	if ($('ColumnKey').selectedIndex!=0) {
		$('Description').value=$('ColumnKey').options[$('ColumnKey').selectedIndex].text;
	}
}
function fDeleteMM(mmid) {
	
	var x=window.confirm("You are about to delete the selected Column Meta\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}	
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP6_MarketColumnDelete.asp?mmid=' + mmid + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divRow_'+mmid)	
	
}
function fToggleMarketMetaColumnOptions(elem,mmid,what) {
	
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_MarketColumnToggleOptions.asp?mmid='+mmid+'&what='+what+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
}
function fDispCalEventDays() {
	
	if (oCalJSON!=null) {
		delete oCalJSON;
	}
	
	var pars = document.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {

		if (pars[i].className.indexOf('EDateUID')==0) { 
			var sElemId='EDates_'+pars[i].value;
			try {
				eval($(sElemId).value);
			}
				catch(e){alert (e);}			
			
			for (i2=0;i2<oCalJSON.length;i2++) {
				iType=oCalJSON[i2].CalType;
				sElemId=oCalJSON[i2].CalElem;
				if ($(sElemId)!=null) {
					if (iType==0) {
						$(sElemId).className=$(sElemId).className+' MyEventsExist';
					}
					else {
						$(sElemId).className=$(sElemId).className+' EventsExist';
					}
				}
			}
		}
	}
}
function fDispCurrYear(yyyy) {
	if (yyyy==null) {
		var newday = new Date();
		yyyy = newday.getFullYear();				
	}
	
	var pars = $('divFullYearCal').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {	
		if (pars[i].id.indexOf('VCalendar_')==0) {
			pars[i].style.display='none';
		}
	}	
	for (var i=0;i<pars.length;i++) {	
		if (pars[i].id.indexOf('VCalendar_'+yyyy)==0) {
			pars[i].style.display='';
		}
	}	
	fDispCalEventDays();
}
function fDispCurrMM(mm,yyyy) {
	
	if (yyyy==null && iCalSelYYYY!=null) {
		yyyy=iCalSelYYYY
	}
	
	if (yyyy==null) {
		var newday = new Date();
		iCalSelYYYY = newday.getFullYear();			
	}
	else {
		iCalSelYYYY=yyyy;
	}
	
	if (mm==null) {
		iCalSelmonth=0;
		var newday = new Date();
		iCalSelYYYY = newday.getFullYear();			
	}
	else	{
		if (isNum(mm)) {
			if (mm==-1) {
				var newday = new Date();
				iCalSelmonth = newday.getMonth()+1;		
			}
			else	{
				iCalSelmonth=mm;
			}
		}
		else	{
			if (mm=='+') {
				iCalSelmonth=parseInt(iCalSelmonth)+1;
				if (iCalSelmonth>12) {
					iCalSelmonth=1;
					iCalSelYYYY=iCalSelYYYY+1
				}
			}
			else {
				iCalSelmonth=parseInt(iCalSelmonth)-1;
				if (iCalSelmonth<1) {
					iCalSelmonth=12;
					iCalSelYYYY=iCalSelYYYY-1
				}			
			}
		}
	}
	
	//var pars = $('divYearCalSel').getElementsByTagName('div');
	var pars = document.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {	
		if (pars[i].className.indexOf('VCalendar')==0) {
			pars[i].style.display='none';
		}
	}
	
	//var pars = $('divYearCalSel').getElementsByTagName('div');
	//alert('VCalendar_'+iCalSelYYYY+'_'+iCalSelmonth)
	var pars = document.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {	
		if (pars[i].id=='VCalendar_'+iCalSelYYYY+'_'+iCalSelmonth) {
			pars[i].style.display='';
		}
	}	
}
function fSaveDuesInd() {
	fSaveDues();
}
function fSaveDues() {
	
	if ($('Name').value.length<1) {
		alert('Name is required')
		$('Name').select();
		$('Name').focus();
		return false;
	}		
	
	if ($('Name').value.length>50) {
		alert('Name cannot exceed 50 characters')
		$('Name').select();
		$('Name').focus();
		return false;
	}	
	
	if ($('Description').value.length>255) {
		alert('Description cannot exceed 255 characters')
		$('Description').select();
		$('Description').focus();
		return false;
	}	
	if ($('Description').value.length==0) {
		alert('Description is required')
		$('Description').select();
		$('Description').focus();
		return false;
	}	
	if (!isNum($('Amount').value)) {
		alert ("Amount must be numeric");
		$('Amount').select();
		$('Amount').focus();
		return false;	
	}		
	
	if (!isDate(document.getElementById('StartDate').value)) {
		alert('Start Date is not a date')
		$('StartDate').select();
		$('StartDate').focus();
		return false;
	}
	if (!isDate(document.getElementById('EndDate').value)) {
		alert('End Date is not a date')
		$('EndDate').select();
		$('EndDate').focus();
		return false;
	}	
	l_StartDate_x= new Date(document.getElementById('StartDate').value)
	l_EndDate_x= new Date(document.getElementById('EndDate').value)
	
	if (l_StartDate_x > l_EndDate_x) {
		alert ("Start Date cannot be greater then End Date");
		document.getElementById('StartDate').focus();
		document.getElementById('StartDate').select();	
		return false;
	}		
	
	$('DueUpdInd').value='1';
	var dest='divMaint_'+$('ItemId').value;
	$('DuesProgressBar').style.display='';

	ValidatefEmpApprov('formDues','DueUpdInd',dest);	
	return false;			
}
function fSaveCompanyDuesInd() {
	fSaveCompanyDues();
}
function fSaveCompanyDues() {
	
	if ($('PONumber').value.length==0) {
		alert ('You must supply a PO Number');
		$('PONumber').focus();
		$('PONumber').select();	
		return false;
	}
	if ($('PONumber').value.length>50) {
		alert ('PO Number cannot exceed 50 characters');
		$('PONumber').focus();
		$('PONumber').select();	
		return false;
	}
	$('DuesUpdInd').value='1';
	var dest=$('dest').value;
	$('DuesUpdProgressBar').style.display='';

	ValidatefEmpApprov('formDues','DuesUpdInd',dest);	
	return false;		
}
function fDuesToggle(elem, iid,what) {
	if (elem.src.indexOf('DC_CheckBoxOn.gif')!=-1) {
		elem.src='/dc_images/DC_CheckBoxOff.gif';
	}
	else	{
		elem.src='/dc_images/DC_CheckBoxOn.gif';
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_MembershipToggleDues.asp?what='+what+'&iid='+iid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
		
}
function fDuesDelete(iid) {
	
	var x=window.confirm("You are about to delete the selected Dues row\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_MembershipDelDues.asp?iid='+iid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');

	new Effect.Puff('divDuesRow_'+iid)			
}
function fMemberCompanyDelete(gid,cid) {
	
	var x=window.confirm("You are about to delete the selected Member Company, this will delete all current contracts\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_MembershipDelMemberCompany.asp?gid='+gid+'&cid='+cid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');

	new Effect.Puff('divRow_'+iid)			
}
function fDeleteCompanyDue(gid,odrnum) {
	var x=window.confirm("You are about to delete the selected active dues row\n\n if correct, press OK, else CANCEL");
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_MembershipDelMembeOrder.asp?gid='+gid+'&odrnum='+odrnum+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');

	new Effect.Puff('divDueRow_'+odrnum)			
}
function fSaveMemberCompanyProfileInd() {
	fSaveMemberCompanyProfile();
}
function fSaveMemberCompanyProfile() {
	
	if ($('CompanyName').value.length>255) {
		alert ('Company Name cannot exceed 255 characters');
		$('CompanyName').focus();
		$('CompanyName').select();	
		return false;
	}
	if ($('Contact').value.length==0) {
		alert ('Company Name is required');
		$('CompanyName').focus();
		$('CompanyName').select();	
		return false;
	}	
	if ($('Contact').value.length>100) {
		alert ('Contact cannot exceed 100 characters');
		$('Contact').focus();
		$('Contact').select();	
		return false;
	}	
	if ($('ContactEmail').value.length==0) {
		alert ('Company Email is required');
		$('ContactEmail').focus();
		$('ContactEmail').select();	
		return false;
	}	
	if ($('ContactEmail').value.length>255) {
		alert ('Company Email cannot exceed 255 characters');
		$('ContactEmail').focus();
		$('ContactEmail').select();	
		return false;
	}	
	if ($('Addr1').value.length==0) {
		alert ('Address 1 is required');
		$('Addr1').focus();
		$('Addr1').select();	
		return false;
	}	
	if ($('Addr1').value.length>255) {
		alert ('Address 1 cannot exceed 255 characters');
		$('Addr1').focus();
		$('Addr1').select();	
		return false;
	}	
	if ($('Addr2').value.length>255) {
		alert ('Address 2 cannot exceed 255 characters');
		$('Addr2').focus();
		$('Addr2').select();	
		return false;
	}
	if ($('Addr3').value.length>255) {
		alert ('Address 3 cannot exceed 255 characters');
		$('Addr3').focus();
		$('Addr3').select();	
		return false;
	}
	if ($('City').value.length>255) {
		alert ('City cannot exceed 255 characters');
		$('City').focus();
		$('City').select();	
		return false;
	}
	if ($('ZipCode').value.length>50) {
		alert ('Postal Code cannot exceed 50 characters');
		$('ZipCode').focus();
		$('ZipCode').select();	
		return false;
	}
	if ($('PhoneArea').value.length>50) {
		alert ('Phone Area cannot exceed 50 characters');
		$('PhoneArea').focus();
		$('PhoneArea').select();	
		return false;
	}
	if ($('Phone').value.length>20) {
		alert ('Phone cannot exceed 20 characters');
		$('Phone').focus();
		$('Phone').select();	
		return false;
	}	
	if ($('Phone2Area').value.length>50) {
		alert ('Phone Area 2 cannot exceed 50 characters');
		$('Phone2Area').focus();
		$('Phone2Area').select();	
		return false;
	}
	if ($('Phone2').value.length>20) {
		alert ('Phone 2 cannot exceed 20 characters');
		$('Phone2').focus();
		$('Phone2').select();	
		return false;
	}
	if ($('FaxArea').value.length>50) {
		alert ('Fax cannot exceed 50 characters');
		$('FaxArea').focus();
		$('FaxArea').select();	
		return false;
	}
	if ($('Fax').value.length>20) {
		alert ('Fax cannot exceed 20 characters');
		$('Fax').focus();
		$('Fax').select();	
		return false;
	}	
	$('CUpdInd').value='1';
	var dest=$('dest').value;
	$('CMUpdProgressBar').style.display='';

	ValidatefEmpApprov('formCompanyProfile','CUpdInd',dest);	
	return false;																
}
function fSaveFanPageInd() {
	fSaveFanPage();
}
function fSaveFanPage () {
	
	if ($('FanPageName').value.length==0) {
		alert ('Name is required');
		$('FanPageName').focus();
		$('FanPageName').select();	
		return false;
	}	
	if ($('FanPageName').value.length>500) {
		alert ('Name cannot exceed 500 characters');
		$('FanPageName').focus();
		$('FanPageName').select();	
		return false;
	}
	if ($('FanPageDescription').value.length>4000) {
		alert ('Description cannot exceed 4000 characters');
		$('FanPageDescription').focus();
		$('FanPageDescription').select();	
		return false;
	}	
	if ($('UniqueAccessCode').value.length>100) {
		alert ('Optional Access Code cannot exceed 100 characters');
		$('UniqueAccessCode').focus();
		$('UniqueAccessCode').select();	
		return false;
	}	
	
	if ($('AccessCodeDomain').value.length>100) {
		alert ('Optional Domain for Access Code cannot exceed 255 characters');
		$('AccessCodeDomain').focus();
		$('AccessCodeDomain').select();	
		return false;
	}	
	
	if ($('UniqueAccessCode').value.length>0 && $('AccessCodeDomain').value.length<1) {			
		alert ('Optional Domain for Access Code is required for Optional Access Code');
		$('AccessCodeDomain').focus();
		$('AccessCodeDomain').select();	
		return false;		
	}
	
	$('FPUpd').value='1';
	var dest=$('divFanPageMaint').parentNode.id;
	$('FPUpdProgressBar').style.display='';

	ValidatefEmpApprov('formFanPage','FPUpd',dest,'fFanPageFunc()');	
	return false;					
}
function fFanPageFunc() {
	
	if ($('FanPageId')!=null) {
		if ($('FanPageId').value=='0') {
			fCanvasSetup('RightPane','fp');
			return false;
		}
	}
	fDisplayFanPageForumBlogExisting();
}
function fSaveFanWebPageInd() {
	//$('formFanWebPage').onsubmit();
	fSaveFanWebPage();
}
function fSaveFanWebPage() {
	try {fSimpleEditorFix();}catch(E){};
	try {I_FinishEditing()}catch(E){;}

	if (document.getElementById('__divEditing')!=null) {
		document.getElementById('__divEditing').style.display='none';
		try{oEditorUtil.boxopen=false}catch(e){;}	
		try{oEditorUtil.onBoxClosed()}catch(e){;}	
	}		
	
	if ($('Title').value.length==0) {
		alert ('Title is required');
		$('Title').focus();
		$('Title').select();	
		return false;
	}	
	if ($('Title').value.length>250) {
		alert ('Title cannot exceed 250 characters');
		$('Title').focus();
		$('Title').select();	
		return false;
	}
	if ($('PageHTML').value.length==0) {
		alert ('Body is required');
		$('PageHTML').focus();
		$('PageHTML').select();	
		return false;
	}	

	$('FPMUpd').value='1';
	var dest=$('divFanWebPageMaint').parentNode.id;
	$('FPMUpdProgressBar').style.display='';

	ValidatefEmpApprov('formFanWebPage','FPMUpd',dest,'fCreateSimpleEditor()');	
	return false;			
}
function fFPCleanUp() {
	// After query, this function removes duplicate elements that are already place on functional pane
	
	pars=$('RightPane').getElementsByTagName('div');
	pars2=$('AllLinks').getElementsByTagName('div');
	for (i=0;i<pars.length;i++) {
		if (pars[i].className.indexOf('Obj')!=-1) {
			for (i2=0;i2<pars2.length;i2++) {
				if (pars2[i2].id==pars[i].id) {
					$(pars2[i2]).parentNode.removeChild($(pars2[i2]))
				}
			}
		}
	}
	pars=$('AllLinks').getElementsByTagName('div');
	
	fCanvasSetup('RightPane','fp');
}
function fDelFanPage(fpid) {

var x=window.confirm("You are about to delete an Affinity Page\n\n if correct, press OK, else CANCEL")
if (!x) {
	return;
}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_DelFanPage.asp?fpid='+fpid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divRow_'+fpid)
}
function fSetProfilePic(uid,pType) {
	
	if (pType==null) {
		pType=0;
	}

	var iFid=0;
	var pars = $('divPictureList').getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		iId=pars[i]
		if (iId.id.indexOf('ProfPic_')==0) {
			if (iId.value.length>0) {
				iFid=iId.value
			}
		}
	}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_MakeProfilePic.asp?uid='+uid+'&fid='+iFid+'&type='+pType+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	alert('The selected picture is now your profile picture');
}
function fCanvasSetup(objId,PageType) {
	
	if (PageType==null) {
		PageType='';
	}
	
	var pars = $('divCanvas').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		iId=pars[i]
		if (iId.id.indexOf('divChip_')==0) {
			new Draggable(iId.id, { 
				snap: [40, 40]
			});
		}
	}
	
	var pars = $('divCanvas').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		iId=pars[i]
		if (iId.className.indexOf('CanvDropArea')==0) {
			Droppables.add(
				iId.id,
				{
					hoverclass: 'DropZoneActive',
  	  		onDrop: function(dragged, dropped, event) {
	    		//alert('Dragged: ' + dragged.id);
    			//alert('Dropped onto: ' + dropped.id);
    			//alert('Held ctrl key: ' + event.ctrlKey);
    			moveSurveyItem(dragged, dropped);
					dragged.className=dragged.className.replace('Move','');    	
    			sChipId=dragged.id.split('_')
    			fSortChips(PageType);
    			eval(document.getElementById('InpChip_'+sChipId[1]+'_'+sChipId[2]).value);
				}})
			}
		}
	
	Droppables.add(
		'AllLinks',
		{	
			hoverclass: 'DropZoneActive',
  	  onDrop: function(dragged, dropped, event) {
    	moveSurveyItem(dragged, dropped);
			dragged.className=dragged.className.replace('Move',''); 
			fSortChips(PageType);   	
  		}
		})
		
	if (oComponents!=null) {
		delete oComponents;
	}
	
	eval($('Components').value)
	
	for (i=0;i<oComponents.length;i++) {
		iTag=oComponents[i].FPTag
		iType=oComponents[i].FPType

		if (iTag!=null) {
			if (!isNum(iTag)) {
				var sChip='divChip_1_'+iTag
			}
			else	{
				var sChip='divChip_0_'+iTag
			}
		}
		switch (iType) {
			case '1':
				sFPDest='FPBody'
				break;
			case '2':
				sFPDest='TabsPane'
				break;			       			
			case '0':
				sFPDest='FPBasic'
		 		break;
		}				
		var oDrag=$(sChip)
		var oDrop=$(sFPDest)
		
		moveSurveyItem(oDrag,oDrop)
		if (iType==0||iType==1) {
			if (!isNum(iTag)) {
				eval($('InpChip_1_'+iTag).value);
			}
			else	{
				eval($('InpChip_0_'+iTag).value);
			}
		}
		delete oComponents[i].FPTag
		delete oComponents[i].FPType
	}
	
}
function fDragThis(obj) {
	CurrDragObj=new Draggable(obj.id, { snap: [40, 40] });
}	
function fDestroyDragThis() {
	CurrDragObj=null;
}
function fReSetMoveClass(obj) {
	if (obj.className.indexOf('Move')==-1) {
		obj.className=obj.className+' Move';
	}
}
function fSetMoveClass(obj) {
	obj.className=obj.className.replace('Move','');
}

function fBuildCanvasMeta() {
	
	var sBodyArray='';
	var sTabsArray='';
	var sBasicIntro='';
	var sLogoArray='';
	
	var sComma='';	
	
	var pars = $('FPBody').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		iId=pars[i]
		if (iId.id.indexOf('divChip_')==0) {
			sa=iId.id.split('_');
			sBodyArray=sBodyArray+sComma+sa[2];
			sComma=',';

		}
	}
	var sComma='';	
	var pars = $('FPBasic').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		iId=pars[i]
		if (iId.id.indexOf('divChip_')==0) {
			sa=iId.id.split('_');
			sBasicIntro=sBasicIntro+sComma+sa[2];
			sComma=',';

		}
	}
	var sComma='';	
	var pars = $('FPLogo').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		iId=pars[i]
		if (iId.id.indexOf('divChip_')==0) {
			sa=iId.id.split('_');
			sLogoArray=sLogoArray+sComma+sa[2];
			sComma=',';

		}
	}	
	var sComma='';	
	var pars = $('TabsPane').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		iId=pars[i]
		if (iId.id.indexOf('divChip_')==0) {
			sa=iId.id.split('_');
			sTabsArray=sTabsArray+sComma+sa[2];
			sComma=',';

		}
	}			
	
	$('bi').value=sBasicIntro;
	$('ba').value=sBodyArray;
	$('ta').value=sTabsArray;
	$('logo').value=sLogoArray;
	
	var apUid=$('apUid').value;
	$('CanvasUpd').value=1;
	$('CanvaseUpdProgressBar').style.display='';
	var sDest=$('APCdest').value;
	var fFunc='fCanvasSetup(\'RightPane\',\'fp\')'

	ValidatefEmpApprov('formCanvas','CanvasUpd',sDest,fFunc);	
	return false;		
		
}
function fToggleLike(eid,fpType,destOut,destLink,AK1,AK2) {
	
	if (AK1==null) {
		AK1='0';
	}
	if (AK2==null) {
		AK2='0';
	}	
	if (fpType==0) {
		var sLikeText='Follow';
		var sUnLikeText='Stop Following';
	}
	else	{
		var sLikeText='Like';
		var sUnLikeText='UnLike';
		
	}
	if ($(destLink).className=='StdLike') {
		$(destLink).className='StdUnLike';
		$(destLink+'Text').innerHTML=sUnLikeText;
	}
	else {
		$(destLink).className='StdLike';
		$(destLink+'Text').innerHTML=sLikeText;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_ToggleLikes.asp?eid='+eid+'&altkey1='+AK1+'&altKey2='+AK2+'&type='+fpType+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', destOut,1,'true');
				
}
function fSaveAdminsInd() {
	fSaveAdmins();
}
function fSaveAdmins() {
	
	if ($('Admins').value.length==0) {
		alert ('You must enter any new emails you want to have for administrators');
		$('Admins').focus();
		return false;
	}	
	if ($('Admins').value.length>7000) {
		alert ('The number of email characters exceeded the 7000 limit');
		$('Admins').focus();
		return false;
	}

	$('FPAUpd').value='1';
	var dest=$('FPADest').value;
	$('FPAUpdProgressBar').style.display='';

	ValidatefEmpApprov('formFPAdmins','FPAUpd',dest);	
	return false;				
	
}
function fDelFPAdmin(seq) {
	var x=window.confirm('You are about to delete a Administrator\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_AffinityAdminDelete.asp?seq='+seq+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divAdmin_'+seq)	

}
function fSaveNewsFeedOptionsInd() {
	fSaveNewsFeedOptions();
}
function fSaveNewsFeedOptions() {
	
	var pars = $('formNewsFeedOptions').getElementsByTagName('Input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].className
		if (sCN.indexOf('CBFilter')==0) {
			if (!pars[i].checked) {
				pars[i].value='';
			}
		}
	}
	
	$('NFUpd').value='1';
	$('NFUpdProgressBar').style.display='';

	ValidatefEmpApprov('formNewsFeedOptions','NFUpd','divFilterOptions','fUpdateFilteredAlerts()');	
	return false;		
	
}	
function fUpdateFilteredAlerts() {
	ToggleElement('divFilterOptions');
	fRefreshAlerts();
}
function fSetUpNewsFeedFilters() {
	var sAr=$('FilterJSON').value.split(',');
	for (i=0;i<sAr.length;i++) {
		
		sFilterOption=sAr[i]
		
		$('NFOpt_'+sFilterOption).checked=true;
	}
}
function fFeedFilterOnOff(fMode) {
	
	var pars = $('formNewsFeedOptions').getElementsByTagName('Input');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].className
		if (sCN.indexOf('CBFilter')==0) {
			if (fMode==0) {
				pars[i].checked=true;
			}
			else	{
				pars[i].checked=false;
			}
		}
	}	
}
function fSaveAlertCycleInd() {
	fSaveAlertCycle();
}
function fSaveAlertCycle() {
	
	$('NFAUpd').value='1';
	$('NFAUpdProgressBar').style.display='';

	ValidatefEmpApprov('formNFNotifications','NFAUpd','divFilterOptions');	
	return false;		
		
}
function fSaveAvatarInd() {
	fSaveAvatar();
}
function fSaveAvatar() {
	efuDoSubmit();	
	return false;
}
function fSaveAttachmentInd() {
	fSaveAttachment();
}
function fSaveAttachment() {
	efuDoSubmit();	
	return false;
}	
function fSavePPInd() {
	fSavePP();
}
function fSavePP() {
	
	var pars = $('formUpdatePreferences').getElementsByTagName('Input');
	var sSquig='';
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].className
		if (sCN.indexOf('PPOptionsCB')==0 && pars[i].value.length>0) {
			$('PPOptions').value=$('PPOptions').value+sSquig+pars[i].value;
			sSquig='~';
		}
	}
	
	$('PPPrefUpd').value='1';
	$('PPUpdProgressBar').style.display='';

	ValidatefEmpApprov('formUpdatePreferences','PPPrefUpd','divPrefs','fPPUpdate()');	
	return false;			
}
function fPPUpdate() {
	eval(document.getElementById('PPOJSON').value);
}
function fSendCXEmail (mode) {
		
	if (mode=='0') {
		document.getElementById('CXSendMail').value='0';
	}
	$('CXUpd').value='1';
	$('CXUpdProgressBar').style.display='';

	ValidatefEmpApprov('formCX','CXUpd','divIFrame','fCXComplete()');	
	return false;	
}	
function fCXComplete() {
	CloseEmailWindow();
	alert($('CXMessage').value);
}
function fShareInd() {
	fShare();
}
function fShare() {
	
	var pars = $('formShare').getElementsByTagName('Input');
	var sSquig='';
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].className
		if (sCN.indexOf('CBShare')==0 && pars[i].value.length>0 && pars[i].value!='on') {
			$('Shares').value=$('Shares').value+sSquig+pars[i].value;
			sSquig='~';
		}
	}	

	$('ShareUpd').value='1';
	$('ShareUpdProgressBar').style.display='';

	ValidatefEmpApprov('formShare','ShareUpd','divGnrlAjax','fShareComplete()');	
	return false;		
}
function fShareComplete() {
	
		if ($('divFriendAvatars')!=null) {
			CloseByIdPattern('div','divFriendAvatars',0,1);
		}
		if ($('divShout')!=null) {
			DisplayAjaxPage(0,'divShout','DCShareFriends','','','&mifl='+lPD_MIFL+'&type=7&mode=1')
			alert ('You have sent a Shout to your selected connections');
		}
		else	{
			alert ('You have shared this with your selected connections');
		}
}
function fSetELDays(ido) {
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_SetElDays.asp?DO='+ido+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
		
}
function fForgetPWDInd(mode) {
	fForgetPWD(mode);
}
function fForgetPWD(mode) {
	
	if (mode==null) {
		mode=''
	}
	
	$('FPWDMode').value=mode;
	
	$('FPWDUpd').value='1';
	$('FPWDUpdProgressBar').style.display='';

	ValidatefEmpApprov('formFPWD','FPWDUpd','divIFrame');	
	return false;		
}
function fDeleteAttachment(seq,mode) {
	var x=window.confirm('You are about to delete an attached item\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	
	if (mode==null) {
		mode=0;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_AttachmentDel.asp?mode='+mode+'&seq='+seq+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divAtt_'+seq)		
}
function fCapClick(whatid,mode) {
	if (mode==null) {
		mode=0;
	}
	ajaxTimeStamp=ajaxTimeStamp+1;
	var ajaxscript = '/dc_includes/CP6_Click.asp?mode='+mode+'&whatid=' + whatid + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
}
function fToggleShares() {
	
	var pars = $('FriendShare').getElementsByTagName('Input');
	var sSquig='';
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].id
		if (sCN.indexOf('FriendCheckVal_')==0) {
			sA=sCN.split('_');
			if ($('ToggleStatus').value!='1') {
				$('FriendCheck_'+sA[1]).checked=true;
				$('FriendCheck_'+sA[1]).value=pars[i].value;
			}
			else	{
				$('FriendCheck_'+sA[1]).checked=false;
				$('FriendCheck_'+sA[1]).value='';				
			}
		}
	}	
	if ($('ToggleStatus').value=='1') {
		$('ToggleStatus').value=0;
	}
	else	{
		$('ToggleStatus').value=1;
	}
}
function fRuleManagerValidateFormInd() {
	fRuleManagerValidateForm();
}
function fRuleManagerValidateForm() {
	
	if (document.getElementById('Name').value.length==0) {
		alert ("You must provide a name for your resource registry");
		document.getElementById('Name').focus();
		document.getElementById('Name').select();
		return false;
	}
	
	if (document.getElementById('Name').value.length>50) {
		alert ("Name cannot exceed 50 characters");
		document.getElementById('Name').focus();
		document.getElementById('Name').select();
		return false;
	}	
	
	if (document.getElementById('URL').value.length==0) {
		alert ("You must provide a Resource");
		document.getElementById('URL').focus();
		document.getElementById('URL').select();
		return false;
	}		
	
	if (document.getElementById('URL').value.length>250) {
		alert ("Resource cannot exceed 250 characters");
		document.getElementById('URL').focus();
		document.getElementById('URL').select();
		return false;
	}
	
	if (document.getElementById('Category').value.length>20) {
		alert ("Category cannot exceed 20 characters");
		document.getElementById('Category').focus();
		document.getElementById('Category').select();
		return false;
	}	
	
	$('RMUpd').value='1';
	$('RMUpdProgressBar').style.display='';
	var dest=$("RMDest").value;
	
	ValidatefEmpApprov('formRM','RMUpd',dest);	
	return false;		
}
function fRuleManagerDelFunc(Seq,mid) {

	var x=window.confirm("You are about to delete a Site Rule\n\n if correct, press OK, else CANCEL")
	if (!x) {
		return;
	}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_RuleManagerDelete.asp?mid='+mid+'&seq='+Seq+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divRMRow_'+Seq)	

}
function isUrl(s) {
	var sRE = /(ftp|http|https|www.):\/\//
	var re = new RegExp(sRE);
	if (s.match(re)) {
		return true;
	}
	else {
		return false;
	}
}

function fProcessNoteForURL(elemId){
	
	if ($(elemId).value.length<1) {
		return $(elemId).value;
	}
	
	$(elemId).value=$(elemId).value.replace(/(~|<br>|<br\/>|<br \/>|\r|\n)/gi,' <br/> ')
	var sArray = $(elemId).value.split(' ');
	for (var n = 0; n < sArray.length; n++){
		if(isUrl(sArray[n])==true){
			$(elemId).value=$(elemId).value.replace(sArray[n], '<a target=_blank href=\''+sArray[n]+'\'>'+sArray[n]+'</a>');
		}
	}
}
function fPanelSetUp() {
	var h = document.getElementById('divLFPanel').parentNode.clientHeight;	
	//document.getElementById('divLFPanel').style.height=h*.95;
	document.getElementById('divLFPanel').style.height='500px';
}
function fPanelHoverOver (obj,event) {

	if (document.getElementById('divLFAction').parentNode.id!=obj.id) {
		obj.style.backgroundColor='black';
		obj.style.color='white';
		PanelTimer = window.setInterval('fPanelAppend(\''+obj.id+'\')', 1000);			
	}
	event.cancelBubble=true;	
}	
function fPanelAppend(objId) {
	obj=$(objId);
	obj.appendChild(document.getElementById('divLFAction'));
	$('divLFAction').style.display='';
	$('LFId').innerHTML=objId;
	$('ObjId').value=objId;
	
	var pars = $('divLFPanel').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		pars[i].style.zIndex=1000;
	}	
	obj.style.zIndex=10000;
	obj.parentNode.style.zIndex=10000;
	
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP6_SiteLookFeelAttrQuery.asp?uid='+$('StylerUID').value+'&StyleId='+$('ObjId').value+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'FieldUpdates',1,'true','fUpdateStyleFields()');

}
function fUpdateStyleFields() {
	$('pick1150377437xfield').value='';
	$('BGImage').value='';
	$('BGVP').selectedIndex=0;
	$('BGHP').selectedIndex=0;
	$('BGRepeat').selectedIndex=0;
	
	eval(document.getElementById('FieldUpdates').innerHTML);
}
function fPanelHoverOut (obj) {
	obj.style.backgroundColor ='';
	obj.style.color='';
	window.clearInterval(PanelTimer);
	if (document.getElementById('divLFAction').parentNode.id!=obj.id) {
		if ($('colorpicker')!=null) {
			//$('colorpicker').style.display='none';
		}
	}
}
function fSaveStyler() {
	$('StyleUpd').value='1';
	$('StyleProgressBar').style.display='';
	var dest="divLFPanel";
	
	ValidatefEmpApprov('formStyler','StyleUpd',dest);	
	return false;			
}	
function fCalSelectorDay(calDate,mMode) {
	if (mMode==null) {
		mMode='0';
	}
		
	var ajaxscript = '/dc_includes/cp6_EventsListDay.asp?mMode='+mMode+'&sd='+calDate+'&cc='+lPD_ConfCode+'&mca='+lPD_MarketCode+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divIACBody',1);
}	
function fUpdateVISCALSEL(mm,yyyy) {
	fDispCurrMM(mm,yyyy);
	fDispCalEventDays();
}
function fSubmitForumRate(tid,fr) {
	ajaxIncrement=ajaxIncrement+1;
	var ajaxscript = '/dc_includes/CP6_ForumRating.asp?tid=' + tid + '&fr=' + fr + '&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divRating',1,'true');	
}
function fDisplayCalEditItem(seq) {
	
	if ($('AjxContent')!=null && $('HidePanel')!=null ) {
		CloseEmailWindow()
		ChangeClassCommBts(1010,'PPVBt');
		ShowPanel('HidePanel');
		HidePanel('AjxContent');
		DisplayAjaxPage(0,'AjxContent','DCCOMMCALMAINT',1,'','&e=1','','fDCEOpenItem('+seq+',0)')
	}
	else {
		DisplayShadowBox(0,'DCCOMMCALMAINT','&e=1','fDCEOpenItem('+seq+',0)');
	}
}
function fDCEOpenItem(seq,mode) {
	if (mode==0) {
		DisplayAjaxPage(0,'divCalWeb','MyCommCalendarlistv6','','','&e=1&mc='+lPD_MarketCode+'&dest=divCalWeb&sa=1&Title=','','fDCEOpenItem('+seq+',1)');
	}
	else {
		ChangeClassCommBts(555,'Calbt');
		CloseByIdPattern('div','divER_',0,1);
		DisplayAjaxPage(0,'divER_'+seq,'DCSAADDCALENDARITEM','','','&dest=divER_'+seq+'&ssid='+seq+'&sa=1&Title=Edit%20Community%20Calendar%20Item','','fCheckForEdit(\'divER_'+seq+'\')');
	}
}
function fGoToFullThread(threadId) {
	
	if ($('AjxContent')!=null && $('HidePanel')!=null ) {
		CloseEmailWindow();
	
		// checking for new style portal buttons
		if ($('PPVBtin1020')!=null) {
			ChangeClassCommBts('1020','PPVBt');
		}
		else {
			ChangeClassCommBts(4);
			HidePanel('HidePanel');
			ShowPanel('AjxContent');
		}
		
		DisplayAjaxPage(0,'AjxContent','CP6MBTHREADLIST','','','&dest=AjxContent&threadid='+threadId);
	}
	else {
		DisplayShadoBox(0,'CP6MBTHREADLIST','&dest=AjxContent&threadid='+threadId);
	}
}	
function fGetCurrHour() {

	var newday = new Date();
	var date = newday.getDate();
	var hours = newday.getHours()+1;
	if (hours>23)	hours=1;
	var eHours = hours+1
	if (eHours>23)	eHours=1;
	
	if (hours<12) {
		var amPm = 'am';
	}
	else {
		var amPm = 'pm';
	}	
	if (eHours<12) {
		var eAmPm = 'am';
	}
	else {
		var eAmPm = 'pm';
	}	
	if (lPD_MIFL==6882) {
		//alert(hours+':00'+amPm);
		//alert(eHours+':00'+eAmPm);
	}
	if ($('StartTime')!=null) {
		for (i=0;i<$('StartTime').options.length;i++) {
			if ($('StartTime').options[i].value==hours+':00') {
				$('StartTime').selectedIndex=i;
			}
		}
	}
	if ($('EndTime')!=null) {
		for (i=0;i<$('EndTime').options.length;i++) {
			if ($('EndTime').options[i].value==eHours+':00') {
				$('EndTime').selectedIndex=i;
			}
		}
	}	
}
function fSetFullCal(iMM, iMDay,tid,mmDdYy) {
	
	// checking for new style portal buttons
	if ($('PPVBtin1010')!=null) {
		ChangeClassCommBts('1010','PPVBt');
	}
	else {
		ChangeClassCommBts(19);
		HidePanel('HidePanel');
		ShowPanel('AjxContent');
	}
	var sAction='\''+iMM+'\',\''+iMDay+'\',\''+tid+'\',\''+mmDdYy+'\''
	DisplayAjaxPage(0,'AjxContent','DCCOMMCALMAINT','','','&cc='+lPD_ConfCode+'&sd='+mmDdYy,'','fUpdateVISCALSEL('+iMM+')');
}
function fCalSetMM(iMM,iMDay,tid,mmDdYy) {
	fDispCurrMM(iMM);
	fDispCalEventDays();
	ChangeClassCommBts(222,'Calbt');
	DisplayAjaxPage(0,'divCalWeb','DCInteractiveCalendar','','','&mmode=1&cc='+lPD_ConfCode+'&sd='+mmDdYy+'&mca='+lPD_MarketCode,'','fUpdateVISCALSEL('+iMM+')');
}
function fCalSetDay(iMM,iMDay,tid,mmDdYy) {
	fUpdateVISCALSEL(iMM);
	SetSelectedDay(tid);
	fCalSelectorDay(mmDdYy)
}	
function fUpdateTimes() {
	
	sTArray=$('StartTimeWk').value.split(':');
	if (sTArray[1]=='30') {
		$('StartTimeWk').value=sTArray[0]+':'+sTArray[1];
	}
	else	{
		$('StartTimeWk').value=sTArray[0]+':00';
	}	
	
	sTArray=$('EndTimeWk').value.split(':');
	if (sTArray[1]=='30') {
		$('EndTimeWk').value=sTArray[0]+':'+sTArray[1];
	}
	else	{
		$('EndTimeWk').value=sTArray[0]+':00';
	}
	
	if ($('StartTime')!=null) {
		for (i=0;i<$('StartTime').options.length;i++) {
			if ($('StartTime').options[i].value==$('StartTimeWk').value) {
				$('StartTime').selectedIndex=i;
			}
		}
	}
	if ($('EndTime')!=null) {
		for (i=0;i<$('EndTime').options.length;i++) {
			if ($('EndTime').options[i].value==$('EndTimeWk').value) {
				$('EndTime').selectedIndex=i;
			}
		}
	}
	fSimpleEditInit();		
	
	if ($('CalType')!=null) {
		if ($('CalType').value=='200') {
			$('GrpCodeTR').style.display='';
		}	
	}
}
function fAddEdit(gid,uid) {
	ChangeClass('SpecButtonLeftSel','SpecButtonLeftNoSel','div',0);
	fSpecialFunction('Tools','btin1200','a_SB_Tools');
	ChangeClass('sb_Tools','SpecButtonLeftSel','div',1);
	DisplayAjaxPage(-1,'divSpecialOps','CP6Tools','','','','1','fAddDispList(\''+uid+'\',\''+gid+'\')');
}

function fAddDispList(uid,gid) {
	ChangeClassCommBts('MyA6','ToolsBt');
	ShowPanel('divMyAccount');
	DisplayAjaxPage(0,'divMyAccount','DCAffinityPageList',1,'','&gid='+gid+'&dest=divMyAccount','','fAffEdit(\''+uid+'\')');
}
function fAffEdit(uid) {
	DisplayAjaxPage(0,'divRowCont_'+uid,'DCAffinityPageMaint',1,'','&uid='+uid+'&fpid='+uid+'&dest=divRowCont_'+uid,'','fCanvasSetup(\'RightPane\',\'fp\')');
}
function fDispGroupFanPage(fpid) {
	
	if ($('AjxContent')!=null && $('HidePanel')!=null ) {
		fSpecialFunction('My%20Account','btin1300','a_SB_Comm');
		DisplayAjaxPage(0,'divSpecialOps','DCAffinityPage','','','&fpid='+fpid);
	}
	else {
		DisplayShadoBox(0,'DCAffinityPage','&fpid='+fpid);
	}	
}
function fDisplayFanPageForumBlogExisting() {
	if ($('GroupId')!=null) {
		
		fDisplayFanPageForumBlog($('GroupId').value,$('FanPageId').value);
		
	}
	if ($('StartSocialVal')!=null) {
		for (i=0;i<$('StartSocial').options.length;i++) {
			if ($('StartSocial').options[i].value==$('StartSocialVal').value) {
				$('StartSocial').selectedIndex=i;
			}
		}
	}	
}
function fDisplayFanPageForumBlog(fbid,uid) {
	
	var sA=$('FPOptionsArray').value.split(',');
	for (var i=0;i<sA.length;i++) {
		if ($('FPOptions_'+sA[i])!=null) {
			$('FPOptions_'+sA[i]).value=sA[i];
			$('FPOptions_'+sA[i]).checked=true;
		}
	}		
	
	DisplayAjaxPage(0,'fForumBlog','DCForumBlog','','','&gid='+fbid+'&fpid='+uid);
	if ($('FPOptionsArray').value=='-1') {
		$('FPOptionsArray').value='1,2,3,4,5,6,7,8,9,10';
	}
}
function fChangeAddress(mode) {
	
	if (mode==null) {
		mode=1;
	}
	
	if (mode==1) {
		eval($('MMAddressEval').value);
		$('AddressOptionMyCB').checked=false;
	} else	{
		eval($('MYAddressEval').value);
		$('AddressOptionCB').checked=false;
	}
	$('Addr1').value=oMMAddress['Addr1'];
	$('Addr2').value=oMMAddress['Addr2'];
	$('Addr3').value=oMMAddress['Addr3'];
	$('City').value=oMMAddress['City'];
	$('ZipCode').value=oMMAddress['ZipCode'];
	$('CountryAreaCode').value=oMMAddress['CountryAreaCode'];
	
	for (i=0;i<$('StateCode').length;i++) {
		if ($('StateCode').options[i].value==oMMAddress['State']) {
			$('StateCode').selectedIndex=i;
		}
	}
	
	for (i=0;i<$('CountryCode').length;i++) {
		if ($('CountryCode').options[i].value==oMMAddress['CountryCode']) {
			$('CountryCode').selectedIndex=i;
		}
	}	
}
var iFadePic=0;
var bFirstTime=1;	
var tPicFader=6500;

function fFadePicSpecific (uid, transTime, iPicCnt) {
	
	fFadeClear();
	
	iFadePic=iPicCnt;
	
	// Turn everything off by changing z-index and classnames
	pars=$('RotatorContainer').getElementsByTagName('div')
	for (i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf('Rot_')==0) {
			pars[i].style.zIndex=1;
			pars[i].style.display='none';
		}
		if (pars[i].id.indexOf('RotCont_')==0) {
			pars[i].className='';
		}
	}
	
	// Show current selected picture
	$('Rot_'+uid+'_'+iFadePic).style.zIndex=2;
	$('Rot_'+uid+'_'+iFadePic).style.display='';
	$('RotCont_'+iFadePic).className='RotContSel';
	
	iFadePic--;

	//fFadeLoopx(sFLGuid,sFLTransTime);

}
function fFadePic(uid, transTime) {
	
	if (bFirstTime!=1) {
		
		iFadePic++;
		
		if (iFadePic>parseInt($('RotCnt_'+uid).value)) {
			iFadePic=1;
		}
		
		nextPicId=iFadePic+1;
		if (nextPicId>parseInt($('RotCnt_'+uid).value)) {
			nextPicId=1;
		}
	
		$('Rot_'+uid+'_'+nextPicId).style.zIndex=1;
		$('Rot_'+uid+'_'+nextPicId).style.display='';
		$('RotCont_'+nextPicId).className='';
		
		$('Rot_'+uid+'_'+iFadePic).style.zIndex=2;
		$('RotCont_'+iFadePic).className='';
		
		new Effect.Fade('Rot_'+uid+'_'+iFadePic)
		
		// Update selector indicators
		pars=$('RotatorContainer').getElementsByTagName('div')
		for (i=0;i<pars.length;i++) {
			if (pars[i].id.indexOf('RotCont_')==0) {
				if  (pars[i].id=='RotCont_'+nextPicId) {
					pars[i].className='RotContSel';
				}	
				else	{
					pars[i].className='';
				}
			}
		}		
	
		bFirstTime=0;
	}
	else {
		bFirstTime=0;
		nextPicId=1;
	}

//	$('Rot_'+nextPicId).parentNode.style.height=$('Rot_'+nextPicId).offsetHeight;
//	$('Rot_'+nextPicId).parentNode.style.width=$('Rot_'+nextPicId).offsetWidth;
	
	tPicFader=window.setTimeout('fFadePic(\''+uid+'\','+transTime+')',transTime);
}	
function fFadeLoop(uid,iTimer) {
	if (iTimer==null) {
		iTimer=6500;
	}
	bFirstTime=1;
	fFadePic(uid,iTimer);
}
function fFadeClear() {
	window.clearTimeout(tPicFader);
}
var iTotalGrps=3;
var iPanelWidth;
function fTileCanvas(objId,dMode) {
	
	if (dMode==null) {
		dMode=0;
	}
	
	iPanelWidth=$('divPanelInner').offsetWidth+'px';
	var oPanelJson = new Array();	
	
	if ($('JSPanelJSON')!=null) {
		if ($('JSPanelJSON').value.length>0) {
			
			eval($('JSPanelJSON').value);
		
			var iSvColId=0;
			var iSvLayoutId=-1;
			
			// Layout Processing
			for (i=0;i<oPanelJson.length;i++) {
				
				if (oPanelJson[i]['LayoutId']!=null) {
					if (oPanelJson[i]['LayoutId']!=0) {
						if (oPanelJson[i]['LayoutId']!=iSvLayoutId) {
							try {
								$('divPanelInner').insert($('PanelGridContId_'+oPanelJson[i]['LayoutId']))
							}catch(e){alert(e)}
							iSvLayoutId=oPanelJson[i]['LayoutId'];
							iSvColId=-1;
						}
								
						if (oPanelJson[i]['ColId']!=iSvColId) {
							try {$('brGridIdInner_'+oPanelJson[i]['LayoutId']).parentNode.insertBefore(
									$('PanelGridId_'+oPanelJson[i]['LayoutId']+'_'+oPanelJson[i]['ColId']),
									$('brGridIdInner_'+oPanelJson[i]['LayoutId'])
								);
							}catch(e){alert(e)}
							
							try {iSvColId=oPanelJson[i]['ColId']}catch(e){alert(e)};
						}
					}
				}
			}
			// Tile Processing
			for (i=0;i<oPanelJson.length;i++) {
				if (oPanelJson[i]['LayoutId']!=null && oPanelJson[i]['Class']!='TABS' ) {
					try{
						$('brGridIdInner_'+oPanelJson[i]['LayoutId']+'_'+oPanelJson[i]['ColId']).parentNode.insertBefore
						(
							$('divChip_'+oPanelJson[i]['ChipId']),
							$('brGridIdInner_'+oPanelJson[i]['LayoutId']+'_'+oPanelJson[i]['ColId'])
						);
					}catch(e){alert(e);alert($('PanelColDrop_'+oPanelJson[i]['LayoutId']+'_'+oPanelJson[i]['ColId']).firstChild.id+'-'+$('brGridIdInner_'+oPanelJson[i]['LayoutId']+'_'+oPanelJson[i]['ColId']).id+'-'+$('divChip_'+oPanelJson[i]['ChipId']).id);}
				}								
			}
		
			fExpandPanelSetup(dMode);
			
			// Tab Processing
			if ($('divMenuInner')!=null) {
				for (i=0;i<oPanelJson.length;i++) {
					if (oPanelJson[i]['Class']=='TABS' ) {
						try{
							$('divMenuInner').insertBefore
							(
								$('divChip_'+oPanelJson[i]['ChipId']),
								$('brDMI')
								);
							}catch(e){alert(e);alert($('PanelColDrop_'+oPanelJson[i]['LayoutId']+'_'+oPanelJson[i]['ColId']).firstChild.id+'-'+$('brGridIdInner_'+oPanelJson[i]['LayoutId']+'_'+oPanelJson[i]['ColId']).id+'-'+$('divChip_'+oPanelJson[i]['ChipId']).id);}
					}								
				}				
			}
		}	
	}	
	
	if (objId==null) {
		objId='divPanelTiles';
	}
	
	if (objId.length==0) {
		objId='divPanelTiles';
	}
	
	if (dMode==1) {
		// If portal and refreshing, cached page
		if (objId=='divCommunityBuilder') {
			//fPostCachedPortal();
		}		
		return;
	}
	
	var pars = $(objId).getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		iId=pars[i]
		if (iId.id.indexOf('divChip_')==0 || iId.id.indexOf('PanelGridContId_')==0) {
			new Draggable(iId.id, { 
				revert:true,scroll:window
			});
		}
	}
	
	var pars = $(objId).getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		iId=pars[i]
		if (
					iId.id=='divMenuInner'
			|| 	iId.className.indexOf('divPanelGroups')==0
			|| 	iId.className.indexOf('ColDrop')==0
			|| 	iId.className.indexOf('CanvMenuDropArea')==0
			|| 	iId.className.indexOf('CanvDropArea')==0
			){
			Droppables.add(
				iId.id,
				{
					hoverclass: 'DropZoneActive',
  	  		onDrop: function(dragged, dropped, event) {
	    		//alert('Dragged: ' + dragged.id);
    			//alert('Dropped onto: ' + dropped.id);
    			//alert('Held ctrl key: ' + event.ctrlKey);
    			 var bError=0;
    			
    			if ((dragged.id.indexOf('divChip_')==0 && dropped.id=='divPanelInner')
    				|| (dragged.id.indexOf('divChip_')==0 && !dragged.className.indexOf('TileMenuInner') && dropped.id!='divMenuInner'))
    			 	{
    					alert ('Sorry, you can only drop a tile into a layout');
    					bError=1;
    			}
    			
    			if (dragged.id.indexOf('PanelGridContId_')==0 && dropped.id.indexOf('PanelColDrop_')==0) {
    				alert ('Sorry, you can only drop a layout onto the full canvas');
    				bError=1;
    			} 
    			
    			if (dragged.id.indexOf('divChip_')==0 && dragged.className.indexOf('TileMenuInner')>=0 && dropped.id!='divMenuInner') {
    				alert ('Sorry, you can only drop an available menu into the tabs area');
    				bError=1;
    			} 
    			
    			if (dropped.id=='divMenuInner' && bError==0) {
   					moveSurveyItem(dragged, dropped)
   					revert:false;
   					if (dragged.className.indexOf('TilePagesInner')==-1) {
   						$('divMenuInner').removeChild($('brDMI'))
							var element = Builder.node('br', { id: 'brDMI', className: 'ClearFix'}, [
								]);	
							$('divMenuInner').insert(element);   				
						}    				
    			}
    			
   				if (dropped.id=='divTiles' && bError==0) {
   					moveSurveyItem(dragged, dropped)
   					revert:false;
   					if (dragged.className.indexOf('TilePagesInner')==-1) {
   						$('divTiles').removeChild($('brTiles'))
							var element = Builder.node('br', { id: 'brTiles', className: 'ClearFix'}, [
								]);	
							$('divTiles').insert(element);   				
						}
						else	{
   						$('divTiles').removeChild($('brPages'))
							var element = Builder.node('br', { id: 'brPages', className: 'ClearFix'}, [
								]);	
							$('divTiles').insert(element);  							
						}
					}
					if (dragged.id.indexOf('PanelGridContId_')==0 && dropped.id=='divPanelInner' && bError==0) {
					
						moveSurveyItem(dragged, dropped);
						revert:false;
					}
					if (dragged.id.indexOf('divChip_')==0 && dropped.id.indexOf('PanelColDrop_')==0 && bError==0) {
						moveSurveyItem(dragged, dropped);
						revert:false;
						var aAr=dropped.id.split('_');
						if ($('PanelGridIdInner_'+aAr[1])!=null) {
							$('PanelColDrop_'+aAr[1]+'_'+aAr[2]).removeChild($('brGridIdInner_'+aAr[1]+'_'+aAr[2]))
							var element = Builder.node('br', { id: 'brGridIdInner_'+aAr[1]+'_'+aAr[2], className: 'ClearFix'}, [
								]);	
							$('PanelColDrop_'+aAr[1]+'_'+aAr[2]).insert(element);
						}
						if ($('Expand')!=null) {
							if ($('Expand').checked) {
								var aAr=dragged.id.split('_');
								eval($('InputChip_'+aAr[1]).value);
							}
						}
					}
    			//fInstantiateGroups(dragged)
					//dragged.className=dragged.className.replace('Move','');    	
    			//sChipId=dragged.id.split('_')
    			//eval(document.getElementById('InpChip_'+sChipId[1]+'_'+sChipId[2]).value);
				}
			})
		}
	}
	fSortChips();
}	
function fSortChips(PageType) {
	if (PageType==null) {
		PageType='';
	}
	
// Not Working correctly, currently disabled
	try {
  	$A($('divPanelInner').getElementsByTagName('div')).each(
		  function(item) {
  		if (item.className.indexOf('ColDrop')!=-1) {  
	  		Sortable.create(item.id,{tag:'div',Hoverclass:'TabRoll',only:'divSmallTile'});
	   		}
  		}
		); 	  
	}catch(E){};

	if (PageType!='fp') {
  	Sortable.create('divMenuInner',{scroll:window,tag:'div',overlap:'horizontal',constraint:'horizontal',Hoverclass:'TabRoll',only:'divSmallTile'});
  }
	if (PageType=='fp') {
  	Sortable.create('TabsPane',{scroll:window,tag:'div',overlap:'horizontal',constraint:'horizontal',Hoverclass:'TabRoll',only:'Obj'});
  }  
  
  //Sortable.create('divPanelInner',{scroll:window,tag:'div',overlap:'vertical',constraint:'vertical',Hoverclass:'TabRoll',only:'divSmallTile'});	
	Sortable.create('divPanelInner',{scroll:window,tag:'div',overlap:'vertical',constraint:'vertical',Hoverclass:'TabRoll',only:'ColContainer'});
}
function fInstantiateGroups(iId) {
	
	Droppables.add(
		iId.id,
		{
			hoverclass: 'DropZoneActive',
 	 		onDrop: function(dragged, dropped, event) {
   			//alert('Dragged: ' + dragged.id);
  			//alert('Dropped onto: ' + dropped.id);
  			//alert('Held ctrl key: ' + event.ctrlKey);
  			dragged.revert = false;
  			moveSurveyItem(dragged, dropped);
				dragged.className=dragged.className.replace('Move','');    	
  			sChipId=dragged.id.split('_')
  			//eval(document.getElementById('InpChip_'+sChipId[1]+'_'+sChipId[2]).value);
		}
	})
}	
function fNewGroupTile(Cols) {
	iTotalGrps++
	
	switch(Cols) {
			
		case 3:
			var element = 
				Builder.node('div', { id: 'PanelGridContId_'+iTotalGrps, className: 'ColContainer ThreeColContainer'}, [
					Builder.node('div', { id: 'PanelGridIdInner_'+iTotalGrps},[
			  		Builder.node('div', { id: 'PanelGridId_'+iTotalGrps+'_1', className: 'Col'},[
		  				Builder.node('div', { id: 'PanelColDrop_'+iTotalGrps+'_1', className: 'ColDrop ThreeCol'},[
			  				Builder.node('br', { id: 'brGridIdInner_'+iTotalGrps+'_1', className: 'ClearFix'})
			  			])
				  	]),
						Builder.node('div', { id: 'PanelGridId_'+iTotalGrps+'_2', className: 'Col ThreeCol'},[
			  			Builder.node('div', { id: 'PanelColDrop_'+iTotalGrps+'_2', className: 'ColDrop'},[
			  				Builder.node('br', { id: 'brGridIdInner_'+iTotalGrps+'_2', className: 'ClearFix'})
			  			])
			  		]),
						Builder.node('div', { id: 'PanelGridId_'+iTotalGrps+'_3', className: 'Col ThreeCol'},[
			  			Builder.node('div', { id: 'PanelColDrop_'+iTotalGrps+'_3', className: 'ColDrop'},[
			  				Builder.node('br', { id: 'brGridIdInner_'+iTotalGrps+'_3', className: 'ClearFix'})
			  			])
		  			]),
						Builder.node('br', { id: 'brGridIdInner_'+iTotalGrps, className: 'ClearFix'})
					])
				]);
			break;	
					
		case 2:
			var element = 
				Builder.node('div', { id: 'PanelGridContId_'+iTotalGrps, className: 'ColContainer TwoColContainer'}, [
					Builder.node('div', { id: 'PanelGridIdInner_'+iTotalGrps},[
		  			Builder.node('div', { id: 'PanelGridId_'+iTotalGrps+'_1', className: 'Col TwoCol'},[
			  			Builder.node('div', { id: 'PanelColDrop_'+iTotalGrps+'_1', className: 'ColDrop'},[
			  				Builder.node('br', {id: 'brGridIdInner_'+iTotalGrps+'_1', className: 'ClearFix'})
			  			])
		  			]),
						Builder.node('div', { id: 'PanelGridId_'+iTotalGrps+'_2', className: 'Col TwoCol'},[
			  			Builder.node('div', { id: 'PanelColDrop_'+iTotalGrps+'_2', className: 'ColDrop'},[
			  				Builder.node('br', {id: 'brGridIdInner_'+iTotalGrps+'_2', className: 'ClearFix'})
			  			])
		  			]),
						Builder.node('br', {id: 'brGridIdInner_'+iTotalGrps, className: 'ClearFix'})
					])
				]);
			break;					
								
		default:
			var element = 
				Builder.node('div', { id: 'PanelGridContId_'+iTotalGrps, className: 'ColContainer OneColContainer'}, [
					Builder.node('div', { id: 'PanelGridIdInner_'+iTotalGrps},[
		  			Builder.node('div', { id: 'PanelGridId_'+iTotalGrps+'_1', className: 'Col OneCol'},[
			  			Builder.node('div', { id: 'PanelColDrop_'+iTotalGrps+'_1', className: 'ColDrop'},[
			  				Builder.node('br', {id: 'brGridIdInner_'+iTotalGrps+'_1', className: 'ClearFix'})
			  			])
		  			])
		  		]),
		  		Builder.node('br', {id: 'brGridIdInner_'+iTotalGrps, className: 'ClearFix'})
				]);
			break;
	}	
	
	$('divPanelGroups').insert(element);
	$('divPanelGroups').removeChild($('brGroups'));
	
	var element = Builder.node('br', { id: 'brGroups', className: 'ClearFix'}, []);	
	$('divPanelGroups').insert(element);
	
	fTileCanvas('divPanelTiles');

}
function fChangePct(pct,tileId) {
	
	switch(pct) {
		case "33":
			$('divChip_'+tileId).style.width=($('divPanelInner').offsetWidth/3);
			break;
			
		case "100":
			$('divChip_'+tileId).style.width=$('divPanelInner').offsetWidth;
			break;			
								
		default:
			$('divChip_'+tileId).style.width=($('divPanelInner').offsetWidth/2);
			break;
	}
}
function fExpandPanelSetup(dMode) {	
var bExpand=0;

	if (dMode==null) {
		dMode=0;
	}
	
	if (!$('Expand').checked) {
		// Collapse
		var pars = $('divPanel').getElementsByTagName('div');
		for (var i=0;i<pars.length;i++) {
			if (pars[i].id.indexOf('divPB_')==0) {
				pars[i].style.display='none';
			}
		}
		bExpand=0;
	}		
	else	{
		var pars = $('divPanel').getElementsByTagName('input');
		for (var i=0;i<pars.length;i++) {
			if (pars[i].id.indexOf('InputChip_')==0) {
				if (pars[i].value.length>0) {
					sAr=pars[i].id.split('_');
					if ($('divPB_'+sAr[1]).innerHTML.length>0) {
						$('divPB_'+sAr[1]).style.display='';
					} 
					else {
						eval(pars[i].value);
					}
				}
			}
		}
		bExpand=1;
	}
	
	// Cleanup Boxes
	var pars = $('divPanel').getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className=='ColDrop') {
			pars[i].style.width=pars[i].parentNode.offsetWidth;
		}
	}	
	
	var newday = new Date();
	var iCurMM = newday.getMonth();		
	
	if (dMode==0) {
		ajaxIncrement=ajaxIncrement+1;
		ajaxscript='/dc_includes/CP6_TileSetExpand.asp?exp='+bExpand+'&xc='+ajaxTimeStamp+ajaxIncrement;
		//AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true','fUpdateVISCALSEL('+iCurMM+')');	
		AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');	
	}
}
function fRemoveTabItem(tileId,whereId,whereBrId) {
	
	if (whereId==null) {
		whereId='divMenus'
		whereBrId='brMenus'
	}
	
	cElem=$('divChip_'+tileId);
	pElem=$(whereId);
	pElem.insertBefore(cElem, $(whereBrId));
	
	new Effect.Appear(cElem);

}
function fRemovePanelItem(tileId) {
	
	cElem=$('divChip_'+tileId);
	
	if (cElem.className.indexOf('TilePagesInner')!=-1) {
		pElem=$('divPages');
	}
	else	{
		pElem=$('divTiles');
	}
	
	$('divPB_'+tileId).innerHTML='';
	$('divPB_'+tileId).style.display='none';
	$('divPBOptions_'+tileId).innerHTML='';
	$('divPBOptions_'+tileId).style.display='none';	
	cElem.style.display='none';
	
	/// Remove Children
	var elem = $('divPB_'+tileId);
	if (lPD_MIFL==6882) {
		//alert('elem:'+elem.id);
	}
	if ( elem.hasChildNodes() ) {
    while ( elem.childNodes.length >= 1 ) {
        elem.removeChild( elem.firstChild );       
    } 
	}	
	
	if (cElem.className.indexOf('TilePagesInner')!=-1) {
		pElem.insertBefore(cElem, $('brPages'));
	}
	else	{
		pElem.insertBefore(cElem, $('brTiles'));
	}
	
	new Effect.Appear(cElem);

}
function fRemovePanelGroupItem(tileId) {
	pElem=$('divTiles');
	cElem=$('divChip_'+tileId);
	
	$('divPB_'+tileId).innerHTML='';
	$('divPB_'+tileId).style.display='none';
	cElem.style.display='none';
	
	pElem.insertBefore(cElem, $('brTiles'));
	
	new Effect.Appear(cElem);
}
function fRemoveGroupFromPanel(elem) {
	var sTest='';
	
	pElem=$('divPanelGroups');
	cElem=elem.parentNode.parentNode;
	
	//Remove Chips
	var pars = cElem.getElementsByTagName('div');	
	var aPI=new Array();
	for (var i=0;i<pars.length;i++) {

		if (pars[i].id.indexOf('PanelGridId_')==0) {
			var pars2=pars[i].getElementsByTagName('div');
			for (var i2=0;i2<pars2.length;i2++) {
				if (pars2[i2].id.indexOf('divChip_')==0) {
					sAr=pars2[i2].id.split('_');
					aPI.push(sAr[1]);
				}
			}
    } 
	}	
	for (i=0;i<aPI.length;i++) {
		fRemovePanelItem(aPI[i]);	        
	}
	
	pElem=$('divPanelGroups');
	cElem=elem.parentNode.parentNode;	
	cElem.style.display='none';
	pElem.appendChild(cElem);	
	
	pElem.insertBefore(cElem, $('brGroups'));
	
	new Effect.Appear(cElem);
	
}
function fSerializePanelInd() {
	if ($('divPanelSaveForm').style.display=='') {
		fSerializePanel();
	}
	else	{
		new Effect.BlindDown($('divPanelSaveForm'));
		//$('divPanelSaveForm').style.display='';
	}
}	
function fSerializePanel() {

var sDelim='';
var sPanelMeta='';
var sComma='';
var sLayoutDelim='';

var oPanelJson = new Array();	

	//Build JSON/ASP Value=Pairs
	// Find Layouts
	var sTabs='';
	sDelim=''
	var aTabs = $('divMenu').getElementsByTagName('div');
	for (var i=0;i<aTabs.length;i++) {
		if (aTabs[i].id.indexOf('divChip_')==0) {
			var aAr=aTabs[i].id.split('_')
			var sTabsId=aAr[1]
			var sTabVal=$('InputChipType_'+sTabsId).value;
			sTabs=sTabs+sDelim+sTabVal;
			sDelim='~'
		}
	}
	
	$('PanelTabJSON').value=sTabs;
	
	var aLayouts = $('divPanelInner').getElementsByTagName('div');
	for (var i=0;i<aLayouts.length;i++) {

		if (aLayouts[i].id.indexOf('PanelGridContId')==0) {
			var aAr=aLayouts[i].id.split('_')
			var sLayoutColumns=aAr[1]
			oPanelJson[i] = new Object();
			oPanelJson[i]['Layout']=sLayoutColumns;			
			//sPanelMeta=sPanelMeta+sLayoutDelim+sLayoutColumns+',';
			sPanelMeta=sPanelMeta+sLayoutDelim;
			sLayoutDelim='|';
			sDelim='';
			// Find Columns
			var aCols = aLayouts[i].getElementsByTagName('div');
			//alert(aCols.length);
			for (var i2=0;i2<aCols.length;i2++) {
				if (aCols[i2].id.indexOf('PanelGridId_')==0) {
					var aAr=aCols[i2].id.split('_')
					var sLayoutColumns=aAr[1]
				
					oPanelJson[i]['Cols']=sLayoutColumns;
					sPanelMeta=sPanelMeta+sDelim+sLayoutColumns;
					sDelim='~';
					sComma=',';
					
					//Find Chips/Tiles
					var aChips = aCols[i2].getElementsByTagName('input');
					for (var i3=0;i3<aChips.length;i3++) {
						if (aChips[i3].id.indexOf('InputChipType_')==0) {
							oPanelJson[i]['Chips']=aChips[i3].value;
							sPanelMeta=sPanelMeta+sComma+aChips[i3].value;
							sComma=',';
						}
					}
				}
			}
		}
	}
	$('PanelJSON').value=sPanelMeta;
	
	if ($('PanelJSON').value.length==0) {
		alert ("It appears you did not place anything on the canvas");
		return false;
	}
	
	if (document.getElementById('PanelName').value.length==0) {
		alert ("Panel Name is required");
		document.getElementById('PanelName').select();
		document.getElementById('PanelName').focus();
		return false;
	}
	
	if (document.getElementById('PanelName').value.length>100) {
		alert ("Panel Name cannot exceed 100 characters");
		document.getElementById('PanelName').select();
		document.getElementById('PanelName').focus();
		return false;
	}				
	
	$('PanelUpd').value='1';
	$('PanelUpdProgressBar').style.display='';
	var dest=$("PanelDest").value;
	
	ValidatefEmpApprov('formPanel','PanelUpd',dest,'fTileCanvas(\'divCommunityBuilder\')');	
	return false;		
		
}
function fDelPanel(pid,pt) {
	
	var x=window.confirm('You are about to delete a portal item\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_TileDelete.asp?pid='+pid+'&pt='+pt+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divRow_'+pid)		
}
function fToggleTileView(tid) {
	
	if ($('divPB_'+tid).innerHTML.length>0) {
		if ($('divPB_'+tid).style.display=='') {
			$('divPB_'+tid).style.display='none';
		}
		else {
			$('divPB_'+tid).style.display='';
		}
	}
	else	{
		eval(document.getElementById('InputChip_'+tid).value);
	}
}
function fSelBlog(elem) {
	
	var pars = $('ulBlogList').getElementsByTagName('li');
	for (var i=0;i<pars.length;i++) {
		pars[i].className='';
	}
	elem.className='BlogSel';
}
function ToggleElementsOff(parId,idMatch,SelElem) {
	
	
	var pars = $(parId).getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf(idMatch)!=-1) {
			//alert (idMatch+' - '+SelElem);
			pars[i].style.display='none';
		}
	}
	ToggleElement(SelElem);
}
function fMarketProfileSearch() {
	$('MPUpdProgressBar').style.display='';
	$('ExistingSearch').value='';
	
	ValidatefEmpApprov('formMarketProfiles','MPUpd',$('dest').value);	
	return false	
}
function fProcessSurvPageRequest(page,processed) {
	
	if (processed==null) {
		processed=0;
	}
	
	if (processed==0) {
		var x=window.confirm('You may not skip to this page at this time.  The system will navigate you to this page when appropriate.  Once you have processed the page, you can then navigate.');
		return;
	}
	
	$('UpdSVProgressBar').style.display='';
	var ajaxscript = '/dc_includes/CP6_SurveyPageFormDisplay.asp?confcode='+lPD_ConfCode+'&page='+page+'&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divFormDisplay',1,'true');	
}
function fDispAnalytic(gid,sid,pn) {
	if (pn==null) {
		pn='DC2020';
	}
	DisplayAjaxPage(-1,'divAnalytic',pn,'','','&pubMode=1&gid='+gid+'&sid='+sid+'&st=1&dest=divAnalytic','','fSurvBuildNav()');
	ToggleElement('divFormDisplay');
}	
function fTileOptions(tid,tileType) {
	
	if (tileType==null) {
		tileType=0;
	}
	
	if ($('divTileOptions')!=null) {
		$('divTileOptions').parentNode.style.display='none';
		$('divTileOptions').parentNode.parentNode.parentNode.style.zIndex=0;
		$('divTileOptions').parentNode.removeChild($('divTileOptions'));
	}
	$('divPBOptions_'+tid).parentNode.parentNode.style.zIndex=2000;

	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_TilesSmallPortletOptions.asp?tileType='+tileType+'&tileid='+tid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	ajaxDest='divPBOptions_'+tid;
	AjaxSimpleCheck(ajaxscript, '', ajaxDest,1);
}
function fSaveTileOptions() {
	
	if ($('AltName')!=null) {
		if ($('AltName').value.length>200) {
			alert ("Alternate Name may not exceed 200 characters");
			$('AltName').select();
			$('AltName').focus();
			return false;
		}
	}

	$('TOUpd').value='1';
	$('TOUpdProgressBar').style.display='';
	var sDest='divPBOptions_'+$('TileId').value;

	ValidatefEmpApprov('formTileOptions','TOUpd',sDest,'fTileOptionAfterUpd()');	
	return false;	
		
}
function fTileOptionAfterUpd() {

	if ($('TileId')!=null) {
		var sTileId=$('TileId').value;
	}
	if ($('aCOG_'+sTileId)!=null) {
		
		if ($('MustBeMember').value!=0) {
			$('aCOG_'+sTileId).className='ImgCOG ImgCOGHasOptions';
		}
		else	{
			$('aCOG_'+sTileId).className='ImgCOG';
		}
	}
}
function fScrollUp() {
	
	if ($('VArrows')!=null) {
		if ($('VArrows').className=='VUpArrows') {
			$('VArrows').className='VDownArrows';
		}
		else	{
			$('VArrows').className='VUpArrows';
		}
	}	
				
	if ($('VelocityVendorLogos1').style.display=='none') {
		fScrollDown();
		return;
	}
	
	Effect.SlideUp('VelocityVendorLogos1', { queue: { position: 'end', scope: 'ArrowScope',limit: 1 }} );
	
}
function fScrollDown() {
	

	Effect.SlideDown('VelocityVendorLogos1', { queue: { position: 'end', scope: 'ArrowScope',limit: 1 }} );
}
function fSignOutOAuth() {
	$('sign_in_container').style.display='';
	$('sign_out_container').style.display='none';
	dSimpleAjax('divGnrlAjax','/dc_oauth/sign_out.asp');
}
function fCheckForOAuthLoggedIn() {
	if ($('sign_in_container')!=null) {
		if (OAUTH_VBSCRIPT.loggedIn) {
			$('sign_in_container').style.display='none';
			$('sign_out_container').style.display='';
		}
		else	{
			$('sign_in_container').style.display='';
			$('sign_out_container').style.display='none';		
		}
	}
}
function fSaveBioInd(mode) {
	fSaveBio(mode);
}
function fSaveBio(mode) {
	
	I_ViewHTML('__div0')
	try {I_FinishEditing()}catch(E){;}
	if ($('Title').value.length>200) {
		alert ("Title cannot exceed 200 characters");
		$('Title').select();
		$('Title').focus();
		return false;
	}

	$('PBUpdMode').value=mode;
	$('PBUpdProgressBar').style.display='';
	var sDest=$('Dest').value;

	ValidatefEmpApprov('formBio','PBUpd',sDest,'fSimpleEditInit()');	
	return false;		
	
}
function fClearEmailSubscription() {
	if ($('EMSBoxDirty').value!=1) {
		$('inpEmailSubscription').value='';
	}
}
function fSaveEmailSubscriptionInd() {
	$('formGetUpdates').onsubmit();
	fSaveEmailSubscription();
}
function fSaveEmailSubscription() {
	
	if ($('EMSBoxDirty').value!=1) {
		alert ("You must enter an email to update");
		$('inpEmailSubscription').select();
		$('inpEmailSubscription').focus();
		return false;
	}	
	if ($('inpEmailSubscription').value.length==0) {
		alert ("You must enter an email to update");
		$('inpEmailSubscription').select();
		$('inpEmailSubscription').focus();
		return false;
	}
	if (!isValidEmail($('inpEmailSubscription').value)) {
		alert ("Must be a valid email format");
		$('inpEmailSubscription').select();
		$('inpEmailSubscription').focus();
		return false;
	}	
	return true;	
}
function fEditSelectedPageFromLink(gid) {
	if ($('WebPageLinkDD').selectedIndex==0) {
		alert ('You must select a page to edit');
		$('WebPageLinkDD').focus();
		return false;
	}
	fDispWebPageShadow($('WebPageLinkDD').value,gid);
}
function fUpdateNotificationOptions(elemId) {
	UpdateCheckValueID(elemId);
	if ($(elemId).checked) {
		$('NotificationsListRow').style.display='';
	}
	else {
		$('NotificationsListRow').style.display='none';
	}
}
function fEventNotificationsInd() {
	fEventNotifications();
}
function fEventNotifications() {
	
	if ($('FriendlyName').value.length>255) {
		alert ('Friendly Name cannot exceed 255 characters');
		$('FriendlyName').select();
		$('FriendlyName').focus();
		return false;
	}
	
	if ($('ReplyTo').value.length>255) {
		alert ('Reply To email cannot exceed 255 characters');
		$('ReplyTo').select();
		$('ReplyTo').focus();
		return false;
	}	
	if ($('ReplyToFriendlyName').value.length>255) {
		alert ('Reply To friendly name cannot exceed 255 characters');
		$('ReplyToFriendlyName').select();
		$('ReplyToFriendlyName').focus();
		return false;
	}		
	
	$('ENUpd').value=1;
	$('ENUpdProgressBar').style.display='';
	var sDest=$('Dest').value;

	ValidatefEmpApprov('formEventNotifications','ENUpd',sDest,'fUpdEmailNotif()');	
	return false;		
	
}
function fUpdEmailNotif() {
	aA=$('ENJSON').value.split(',')
	for (i=0;i<aA.length;i++) {
		sTokens=aA[i].split('~');
		$('SelTemplate_'+sTokens[0]).nextSibling.style.display='none';
		for (i2=0;i2<$('SelTemplate_'+sTokens[0]).length;i2++) {
			if ($('SelTemplate_'+sTokens[0]).options[i2].value==sTokens[1]) {
				$('SelTemplate_'+sTokens[0]).selectedIndex=i2;
				if (i2>0) {
					$('SelTemplate_'+sTokens[0]).nextSibling.style.display='';
				}
			}
		}
	}
}
function fUpdatePages() {
	
	var pars = $('divOpts_Pages').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		iId=pars[i]
		if (iId.id.indexOf('divChip_')==0) {
			new Draggable(iId.id, { 
				revert:true,scroll:window
			});
		}
	}	
}
function fKeyUpdates() {
	if (document.getElementById('divKeyUpdateContainer')!=null && lPD_Domain != 'LOCALHOST') {
		var ajaxscript = '/dc_includes/cp_CheckKeyUpdates.asp?ConfCode='+lPD_OrigConfCode+'&MarketCode=' + lPD_OrigMarketCode + '&xc=' + ajaxTimeStamp+ajaxIncrement;
		AjaxSimpleCheck(ajaxscript, '', 'divKeyUpdateContainer',1,'true','fCheckForImDisplay()');
	}	
}
function fDelLocation(locId) {
	var x=window.confirm('You are about to delete a location definition\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_LocationDelete.asp?locid='+locId+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divLocRow_'+locId)		
}
function fSaveLocationInd() {
	fSaveLocation();
}
function fSaveLocation() {
	
	if ($('Name').value.length==0) {
		alert ('Name is required');
		$('Name').select();
		$('Name').focus();
		return false;
	}
	if ($('Name').value.length>255) {
		alert ('Name cannot exceed 255 characters');
		$('Name').select();
		$('Name').focus();
		return false;
	}
	if ($('Addr1').value.length==0) {
		alert ('Address1 is required');
		$('Addr1').select();
		$('Addr1').focus();
		return false;
	}
	if ($('Addr1').value.length>255) {
		alert ('Address 1 cannot exceed 255 characters');
		$('Addr1').select();
		$('Addr1').focus();
		return false;
	}	
	if ($('Addr2').value.length>255) {
		alert ('Address 2 cannot exceed 255 characters');
		$('Addr2').select();
		$('Addr2').focus();
		return false;
	}	
	if ($('Addr3').value.length>255) {
		alert ('Address 3 cannot exceed 255 characters');
		$('Addr3').select();
		$('Addr3').focus();
		return false;
	}			
	if ($('City').value.length>255) {
		alert ('City cannot exceed 255 characters');
		$('City').select();
		$('City').focus();
		return false;
	}		
	
	$('LMUpd').value=1;
	$('LMUpdProgressBar').style.display='';
	var sDest=$('LMDest').value;

	ValidatefEmpApprov('formLocations','LMUpd',sDest);	
	return false;		
}
function fLocationListByLetter(sletter) {
	var ajaxscript = $('inpLocListEval').value+'&mode=1&l='+sletter+'&xc=' + ajaxTimeStamp+ajaxIncrement
	AjaxSimpleCheck(ajaxscript, '', 'divLocListContainer',1,'true');	
}
function fGeoCodeToField() {
	geocoder = new google.maps.Geocoder();
 	var address = $('Addr1').value+','+$('City').value+','+$('StateCode').value+','+$('PostalCode').value;
 	geocoder.geocode({
    'address': address,
    'partialmatch': true}, fgeocodeResult);
    
   geocoder=null;
}
function fgeocodeResult(results, status) {
	if (status == 'OK' && results.length > 0) {
		latLng=results[0].geometry.viewport
		$('txtLatLng').value=latLng
		a=$('txtLatLng').value.split('),');
		sLL=a[0];
		sLL=sLL.replace(/\(|\)/gi,'')
		$('txtLatLng').value=sLL;
	} else {
  	alert("Geocode was not successful for the following reason: " + status);
	}
}
function fLoadScript(sSrc) {
	
	var bScriptFound=0;
	
	// Check for script availability
	var pars = document.getElementsByTagName('script');
	for (var i=0;i<pars.length;i++) {
		if (pars.src!=null) {
			if (pars.src.indexOf(sSrc)==0) {
				bScriptFound=1;
			}
		}
	}
	if (bScriptFound==0) {
  	var script = document.createElement("script");
  	script.type = "text/javascript";
  	script.src = sSrc;
  	document.body.appendChild(script);
  }
  $('map_canvas').style.width=$('divIGoogleMap').style.offsetWidth;
  $('map_canvas').style.height=$('divIGoogleMap').style.offsetHeight;
}
function fInitGoogleMap() {
	var myLatlng = new google.maps.LatLng(40, -98);
	var myOptions = {
		zoom: 4,
	  center: myLatlng,
	  mapTypeId: google.maps.MapTypeId.ROADMAP
	}
	map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	

}
function fMoreNotes(elem) {
	var ajaxscript=elem.parentNode.lastChild.value;
	var sDest=elem.parentNode.parentNode.parentNode.id;
	ajaxscript='/dc_includes/CP_WebResource.asp?'+ajaxscript+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', sDest,1,'true');
}
function fGetGeoCodeAddress(addr) {
	geocoder = new google.maps.Geocoder();
 	var address = addr;
 	geocoder.geocode({
    'address': address,
    'partialmatch': true}, fgeocodeResult);
}
	var sLocation;
  var sPosition;
  var mapOptions;
  var markersArray = [];

function fGetGoogleMapAddr(addr,addrArray) {
	
	mapOptions = {
  	zoom: 4,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    center: sLocation
  };
  
  if ($('aTabUG2')!=null) {
  	$('aTabUG2').style.display='none';
  }
  
  if (addrArray.length==0) {
  	return false;
  }
  
  if (geocoder==null) {
  	fUGTabsProcess('divUGMap',2);
  	f6Initialize()
  }
  else	{
  	fClearOverlays();
  }
  
  // Split address array for more locations
	sA=addrArray.split('~');
	for (i=0;i<sA.length;i++) {
		sA2=sA[i].split('^');
		address=sA2[0];
  	geocoder.geocode( { 'address': address}, function(results, status) {
	    if (status == google.maps.GeocoderStatus.OK) {
      	map.setCenter(results[0].geometry.location);
      	var marker = new google.maps.Marker({
		      map: map, 
        	position: results[0].geometry.location
      	});
      	markersArray.push(marker);

    	} else {
	      //alert("Geocode was not successful for the following reason: " + status);
    	}
  	});
  }
  if (markersArray) {
  	$('aTabUG2').style.display='';
  }
  
// map: an instance of GMap2
// latlng: an array of instances of GLatLng
//	var latlngbounds = new GLatLngBounds( );
//	for ( var i = 0; i < latlng.length; i++ )	{
//  	latlngbounds.extend( latlng[ i ] );
//	}
//	map.setCenter( latlngbounds.getCenter( ), map.getBoundsZoomLevel( latlngbounds ) );

	try {
  	$('map_canvas').style.width=$('divIGoogleMap').style.offsetWidth;
  	$('map_canvas').style.height=$('divIGoogleMap').style.offsetHeight;  
  }catch(e){}
}

  function f6Initialize() {

		geocoder=new google.maps.Geocoder();
    map = new google.maps.Map(document.getElementById("map_canvas"),
            mapOptions);
  }

  function toggleBounce() {

    if (marker.getAnimation() != null) {
      marker.setAnimation(null);
    } else {
      marker.setAnimation(google.maps.Animation.BOUNCE);
    }
  }
function fUGTabsProcess(tab,tabIdPart,tId) {
	ChangeClassCommBts(tabIdPart,'UGBt');
	$('divUGHome').style.display='none';
	$('divUGInfo').style.display='none';  
	$('divUGMap').style.display='none';
	
	if (tabIdPart==2) {
		//fProcessMap();
		//fSetPolygons();
	}	 
	 
	$(tab).style.display='';
}
function fProcessMap () {
	var sTid=$('inpUGEvalId').value;
	sClickEvent=$(sTid).getAttribute("onclick");
	
	sClickEvent2=sClickEvent.replace('$(\'inpUGEvalId\').value=\''+sTid+'\';','');

	alert (sClickEvent2)
	var sRE=/DisplayAjaxPage.+\b[\)\;]/
	var re = new RegExp(sRE);
	alert (sRE)
	sClickEvent=sClickEvent2.replace(re,'');
	sClickEvent=sClickEvent.left
	

	alert (sClickEvent)
	eval(sClickEvent);
}
function fSetPolygons() {
  // Read the data from states.xml
  var request = GXmlHttp.create();
  request.open("GET", "/dc_includes/STATEPOLYGONS.xml", true);
	request.onreadystatechange = function() {
  
  	if (request.readyState == 4) {
	  	var xmlDoc = GXml.parse(request.responseText);
    	// ========= Now process the polylines ===========
    	var states = xmlDoc.documentElement.getElementsByTagName("state");
	
    	// read each line
    	for (var a = 0; a < states.length; a++) {
	      // get any state attributes
      	var label  = states[a].getAttribute("name");
      	var colour = states[a].getAttribute("colour");
      	// read each point on that line
      	var points = states[a].getElementsByTagName("point");
      	var pts = [];
      	for (var i = 0; i < points.length; i++) {
         	pts[i] = new GLatLng(parseFloat(points[i].getAttribute("lat")),
                             	parseFloat(points[i].getAttribute("lng")));
      	}
      	var poly = new GPolygon(pts,"#000000",1,1,colour,0.5,{clickable:false});
      	polys.push(poly);
      	labels.push(label);
      	map.addOverlay(poly);
    	}
    	// ================================================           
		request.send(null);
		}
    
	  // display a warning if the browser was not compatible
	  else {
      	alert("Sorry, the Google Maps API is not compatible with this browser");
  	}

		// This Javascript is based on code provided by the
		// Community Church Javascript Team
		// http://www.bisphamchurch.org.uk/   
		// http://econym.org.uk/gmap/
		//]]>
	}
}
// Removes the overlays from the map, but keeps them in the array
function fClearOverlays() {
  if (markersArray) {
    for (i in markersArray) {
    	try{markersArray[i].setMap(null)}catch(e){}
    }
   }
    markersArray.length = 0;
  }
function fBuldStateSel() {
	
	//Not ready...
	return false;
		
	if (lPD_MIFL==6882) {
	//	alert ('I am here');
	}

	sCountryCode=$('CountriesSel').value;
	sType=0;
	
	// Remove Items in State Select Box
	var elemSB=$('States');
	for (i=0;i<elemSB.options.length;i++) {
		elemSB.remove[i];
	}
	
	// Build new State  Selection based on selected country code
	eval ($('evalStateJSON').value);
	for (i=0;i<oStateCodes.length;i++) {
		if (oStateCodes[i].CountryCode==sCountryCode && oStateCodes[i].Type==sType) {
			fAddOption('StatesSel',sStateName,sStateCode);
		}
	}
}
function fAddOption(selectbox,text,value ) {
	//Add options to select box
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;
	selectbox.options.add(optn);
}
function fSortPictures(event) {
	Sortable.create('divPictListContainer',{tag:'div',only:'Item',Hoverclass:'TabRoll',
   onUpdate: function() {
		$('aSaveSort').style.display='';
   }		
	});
	if (event!=null) {
		event.cancelBubble=true;
	}	
}
function fSaveSortedPictures() {
	var sArray=Sortable.serialize('divPictListContainer');
	sArray=sArray.replace(/divPictListContainer\[\]\=/g,'');
	var sA=sArray.split('&');
	
	var sComma='';
	var sNArray='';
	for (i=0;i<sA.length;i++) {
		sNArray=sNArray+sComma+sA[i];
		sComma=',';
	}
	var ajaxscript = '/dc_includes/CP6_SortImages.asp?filesetid='+$('FileSetID').value+'&FileIds='+sNArray+'&xc=' + ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');	
	alert ('Your sorted images have been saved');
}
function fCheckImageForProcessing (iId,fid) {

	UpdateCheckValueIDWithValue(iId,fid);
	if ($(iId).checked) {
		$('ItemImageContainer_'+fid).style.border = 'red 1px solid';
	}
	else	{
		$('ItemImageContainer_'+fid).style.border = '#ccc 1px solid';
	}
}
function fDispAssetAttributes(elem,assId,divMainContainer,divRowClass) {
	
	if (divMainContainer==null) {
		divMainContainer='divPictListContainer';
	}
	if (divRowClass==null) {
		divRowClass='Item';
	}

	var pars = document.getElementById(divMainContainer).getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		sCN=pars[i].className
		if (sCN.indexOf(divRowClass)>=0) {
			pars[i].style.zIndex=900;
		}
	}
	
	$('divAssetForm').style.display='none';
	cElem=document.getElementById('divAssetForm')
	pElem=elem.parentNode;
	pElem.style.zIndex=1000;
	
	pElem.appendChild(cElem);	
	
	DisplayAjaxPage(0,'divAssetForm','CP6AssetForm','','','&fileid='+assId,'','fScrollTo(\'divAssetForm\')');

}
function fScrollTo(ElemId) {
	Effect.ScrollTo(ElemId); 
	return false;
}
function fSaveAsset() {
	
	if ($('Title').value.length>100) {
		alert ('Title cannot exceed 100 characters');
		$('Title').select();
		$('Title').focus();
		return false;
	}		
	if ($('ShortDesc').value.length>500) {
		alert ('Description cannot exceed 500 characters');
		$('ShortDesc').select();
		$('ShortDesc').focus();
		return false;
	}			
	
	$('AUpd').value=1;
	$('AUpdProgressBar').style.display='';
	var sDest=$('FileContainer').parentNode.id;

	ValidatefEmpApprov('formFileAttr','AUpd',sDest);	
	return false;		
}
function fDelSelectedFileSetItem(fsid,delDivId) {
	var x=window.confirm('You are about to delete an image from the gallery\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_FileSetItemDelete.asp?fsid='+fsid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff(delDivId)		
}
function fSaveHotelInd() {
	fSaveHotel();
}
function fSaveHotel() {
	
	I_FinishEditing();
	
	if ($('Name').value.length < 1) {
		alert("Hotel Name is a required field")
		$('Name').select();
		$('Name').focus();
		return false;
	}
	if ($('Name').value.length > 100) {
		alert("Hotel Name cannot exceed 100 characters")
		$('Name').select();
		$('Name').focus();
		return false;
	}	
	if ($('Addr1').value.length > 100) {
		alert("Address 1 cannot exceed 100 characters")
		$('Addr1').select();
		$('Addr1').focus();
		return false;
	}
	if ($('Addr2').value.length > 100) {
		alert("Address 2 cannot exceed 100 characters")
		$('Addr2').select();
		$('Addr2').focus();
		return false;
	}	
	if ($('City').value.length > 100) {
		alert("City cannot exceed 100 characters")
		$('City').select();
		$('City').focus();
		return false;
	}	
	if ($('State').value.length > 2) {
		alert("State cannot exceed 2 characters")
		$('State').select();
		$('State').focus();
		return false;
	}	
	if ($('Zip').value.length > 11) {
		alert("Zip Code cannot exceed 11 characters")
		$('Zip').select();
		$('Zip').focus();
		return false;
	}			
	$('HMUpd').value='1';
	$('HMUpdProgressBar').style.display='';
	
	var sDest=$('divHotelManager').parentNode.id;

	ValidatefEmpApprov('formHotelMaint','HMUpd',sDest,'fSimpleEditInit()');	
	return false;		

}
function fEvalDBEditor() {
	if ($('EvalWYSIWYGEditor')!=null) {
		eval($('EvalWYSIWYGEditor').value);
	}
}
function fFormManagerSetUp () {
	
//Remove editThis class from current database columns
	pars=$('divResizeArea').getElementsByTagName('textarea')
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='editThis' && pars[i].parentNode.className.indexOf('WYSIWYGEditor')!=-1) {
			pars[i].className='';
		}
	}	

 $A($('divWireFrame').getElementsByTagName('div')).each (
	  function(item) {
	  	if (item.id.indexOf('divCol_')!=-1 || item.className.indexOf('divWidgets')!=-1) {
  	  	new Draggable(
    	  	item,
      			{
//          	revert: true,
//            ghosting: true,
							revert:true,
							handle:'StdSmallMove',
            	scroll: window,
				    	onEnd: function() {
				    		//Cleanup Array holding the divs
				    		parDivs=[];
				    		parDivsCnt=[];
				    		parDivsJSON=[];
				    		parDivsJSONIdx=0;

	  						// Find items on same level
								//Adjust Initial Widths to auto width
								var pars = $('divItemArea').getElementsByTagName('div');
								for (var i=0;i<pars.length;i++) {
									if (pars[i].className.indexOf('Col')==0) {
										pars[i].style.width='auto';
										//pars[i].style.left=0;
										//pars[i].style.position='static';
									}
								}
								//Rip through first set of items comparing to self set of items looking for matches
								
								var iLen=0;
								for (i=0;i<parDivs.length;i++) {
									
								}
								var pars = $('divItemArea').getElementsByTagName('div');
								for (var i=0;i<pars.length;i++) {
									var iW=$('divItemArea').offsetWidth;
									if (pars[i].className.indexOf('Col')==0) {
							
										// Ripping through comparison divs... going to match on .top (+variance) and place id's in array for final processing
										// We will capture an array of matches for later processing
										var pars2 = $('divItemArea').getElementsByTagName('div');
										for (var i2=0;i2<pars2.length;i2++) {	
											if (pars2[i2].className.indexOf('Col')==0) {				
												if ((pars[i].offsetTop>pars2[i2].offsetTop-10) && (pars[i].offsetTop<pars2[i2].offsetTop+10) && (pars[i].id!=pars2[i2].id) ) {

													fFindParDivInArray(pars[i],pars2[i2],pars2[i2].offsetTop)
												}
											}
										}
									}
								}
								// Let's see what's in the array
								parDivsJSON.sort(sort_by('KeyTop', false));
								sSvKeyTop=0;
								for (i=0;i<parDivsJSON.length;i++) {
									
									if (parseInt(parDivsJSON[i]['KeyTop'])<parseInt(sSvKeyTop)-10 || parseInt(parDivsJSON[i]['KeyTop'])>parseInt(sSvKeyTop)+10) {
										sSvKeyTop=parDivsJSON[i]['KeyTop'];
									}
									parDivsJSON[i]['KeyTop']=sSvKeyTop;
									
									//Trash and rebuild elements to place in natural order
									
									//Update Elements	
									iDivCnt=0;
									var iW=$('divItemArea').offsetWidth;
									for (i2=0;i2<parDivsJSON.length;i2++) {
										if (parDivsJSON[i2]['KeyTop']==sSvKeyTop) {
											
											var iKnt=0;
											//elem.style.cssFloat='none';
											for (i3=0;i3<parDivsJSON.length;i3++) {
												if (parDivsJSON[i3]['KeyTop']==sSvKeyTop) {
													iKnt++
												}
											}
											parDivsJSON[i2]['Processed']=1;
											var elem=$(parDivsJSON[i2]['cmpId']);
											var iWidth=(iW/iKnt-10)
											//elem.style.width=iWidth+'px';
											if (iDivCnt>0) {
												//elem.style.left=((iWidth*iDivCnt)+10)+'px';
												//elem.style.cssFloat='left';
												
												
											}
											else {
												//elem.style.left=((iWidth*iDivCnt))+'px';
												//elem.style.cssFloat='left';
											}
											
											if (iKnt>0) {
												//elem.style.cssFloat='left';
											}
										//	alert (sSvKeyTop+'/'+iWidth+'/'+iDivCnt)
											iDivCnt++;
										}
										else {
											iDivCnt=0;
										}
									}		
									//alert ('keyTop/Id:'+ parDivsJSON[i]['KeyTop']+'/'+parDivsJSON[i]['id']+'/Top:'+parDivsJSON[i]['OffSetTop']+'/cmpTop:'+parDivsJSON[i]['cmpOffSetTop']+'/Cnt:'+parDivsJSON[i]['KTCnt']);
								}
    					}            	
      			}
    			);      		
    	}
		}
   );	

 $A($('divResizeArea').getElementsByTagName('div')).each (
	  function(item) {
	  	if (item.id.indexOf('Col_')==0 || item.id=='divFormFields') {
  			Droppables.add(item.id, { 
    			accept: ['Col','divWidgets'],
    			hoverclass: 'hover',
    			hoverclass: 'DropZoneActive',

    			onDrop: function(draggable,droparea) { 
  					draggable.parentNode.removeChild(draggable);
  					droparea.appendChild(draggable); 
  					draggable.style.left='0px';
  					draggable.style.top='0px';
  					
  					if (droparea.offsetHeight>droparea.parentNode.offsetHeight) {
  						droparea.parentNode.style.height='auto';
  						droparea.parentNode.style.height=droparea.parentNode.offsetHeight;
  					}
			    }
  			});
  		}
		})
 
 $A($('divResizeArea').getElementsByTagName('div')).each (
	  function(item) {
	  	if (item.className=='Col') {
	  		Sortable.destroy(item.id);
	  	}
	  })		 
}
function fFindParDivInArray(oItem,oCmpItem,sKeyTop) {
	
	for (i=0;i<parDivs.length;i++) {
		sA=parDivs[i].split(',')
		for (i2=0;i2<sA.length;i2++) {
			if (sA[i2].indexOf(oCmpItem.id)>0) {
				return;
			}
		}
	}

	parDivs.push(sKeyTop+'~'+oCmpItem.id);
	
	parDivsJSON[parDivsJSONIdx] = new Object();
	parDivsJSON[parDivsJSONIdx]['KeyTop']=sKeyTop;		
	parDivsJSON[parDivsJSONIdx]['id']=oItem.id;	
	parDivsJSON[parDivsJSONIdx]['cmpId']=oCmpItem.id;	
	parDivsJSON[parDivsJSONIdx]['cmpOffSetTop']=oCmpItem.offsetTop;	
	parDivsJSON[parDivsJSONIdx]['OffSetTop']=oItem.offsetTop;	
	parDivsJSON[parDivsJSONIdx]['Processed']=0;	
	
	parDivsJSONIdx++;		
	
	for (i=0;i<parDivs.length;i++) {
		sA=parDivs[i].split(',')
		for (i2=0;i2<sA.length;i2++) {
			if (sA[i2].indexOf(oCmpItem.id)>0) {
				return;
			}
		}
	}	
	parDivs.push(sKeyTop+'~'+oItem.id);

}
function  fMoveFormItem(draggable,droparea) {

  if (!droparea.cleared) {
	 // droparea.innerHTML = '';
   // droparea.cleared = true;
  }
  draggable.parentNode.removeChild(draggable);
  droparea.appendChild(draggable);

}
function fInitResize(elemId) {
	
// Build Columns
	oElems=new Array()
	
	eval(document.getElementById('FormJSON').value);
	
//Create Top Level Items - Frames	
	if (oElems!=null) {
		for (i=0;i<oElems.length;i++) {
			if (oElems[i]['Type']=='0') {
				var newElem = document.createElement('div');
				newElem.setAttribute('id',oElems[i]['PanelId']);
  			newElem.className='drsElement';
				newElem.style.width=oElems[i]['width'];
				newElem.style.height=oElems[i]['height'];
				newElem.style.left=oElems[i]['left'];
				newElem.style.top=oElems[i]['top'];
				newElem.style.zIndex=oElems[i]['zIndex'];
				
				sA=oElems[i]['PanelId'].split('_');
				sStdFrameInnerHTML='<div style="display: none;" class="WizRow Options">';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<h4>Container Frame</h4>';
 				sStdFrameInnerHTML=sStdFrameInnerHTML+'<a onclick="fCloneNode(document.getElementById(\'BaseBox\'),20,\'StdFrame_\',\'divResizeArea\');" href="javascript:void(0);">Clone</a>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'</div>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<div class="RAOptions">';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<div class="WizRow Options">';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<h4 onclick="fUpdateZIndex(this.parentNode.parentNode.parentNode.id);" class="drsMoveHandle">Drag</h4>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<input type="checkbox" onclick="UpdateCheckValueID(this.id,\'\',\'\',this.parentNode.parentNode.parentNode.id,\'\')" class="inpFrameContainerOpts" id="inpFrameContainerOpts_'+sA[1]+'">';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<div onclick="fExpandElement(this.parentNode.parentNode.parentNode.id);" class="StdExpand" title="Expand Full Width"><img src="/dc_images/dc_spacer.gif"></div>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<div onclick="" class="StdCog" title="Frame Properties"><img src="/dc_images/dc_spacer.gif"></div>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<div onclick="fSplitContainer(this.parentNode.parentNode.parentNode.id)" class="StdSplit" title="Split Vertical"><img src="/dc_images/dc_spacer.gif"></div>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<div onclick="fDelFormFrame(this.parentNode.parentNode.parentNode.id)" class="StdTrash" title="Delete Frame"><img src="/dc_images/dc_spacer.gif"></div>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<br style="clear: both;">';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'</div>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'</div>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<div class="ContainerBox">';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<div style="padding: 5px;" id="divCB_'+sA[1]+'"><br id="brCB_'+sA[1]+'" class="ClearFix"/></div>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'</div>';
				
				newElem.innerHTML=sStdFrameInnerHTML;		
		
				$('divResizeArea').appendChild(newElem);
			}
		}
	}		

//Create Second Level Items - Columns w/in Frames	
	if (oElems!=null) {
		for (i=0;i<oElems.length;i++) {
			if (oElems[i]['Type']=='1') {

				var newElem = document.createElement('div');
				newElem.setAttribute('id',oElems[i]['ColId']);
  			newElem.className='Container';
  			if (oElems[i]['width']=='') {
  				oElems[i]['width']='100%';
  			}
				newElem.style.width=oElems[i]['width'];
				newElem.style.cssFloat='left';
				newElem.style.position='relative';
				
				sA=oElems[i]['ColId'].split('_');
				sStdFrameInnerHTML='<div id="ContO_'+sA[1]+'" class="WizRow ContainerOptions">';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<h4>Drop Area</h4>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<input type="checkbox" onclick="UpdateCheckValueID(this.id,\'\',\'\',this.parentNode.parentNode.id,\'\')" class="inpFrameOpts" id="inpFrameOpts_'+sA[1]+'_'+sA[2]+'">';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<div onclick="fDelFormCol(this.parentNode.parentNode.id);" class="StdTrash" title="Delete Split"><img src="/dc_images/dc_spacer.gif"></div>';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'<br id="brC_'+sA[1]+'" style="clear: both;">';
				sStdFrameInnerHTML=sStdFrameInnerHTML+'</div>';
				newElem.innerHTML=sStdFrameInnerHTML;

				$('divCB_'+sA[1]).insertBefore(newElem,$('brCB_'+sA[1]));
				
			}
		}
	}	
	
	if (oElems!=null) {
		for (i=0;i<oElems.length;i++) {
			
			// Database Columns
			if (oElems[i]['Type']=='2') {
				//Create Third Level Items - Objects w/in Columns
				sA=oElems[i]['ColId'].split('_');

				try {
					if (sA[2]!=null) {
						$('Col_'+sA[1]+'_'+sA[2]).appendChild($(oElems[i]['DetailId']));
					}
					else	{
						$('Col_'+sA[1]).insertBefore($(oElems[i]['DetailId']),$('brCF_'+sA[1]));
					}
				}catch(e){}
			}
			// Text Areas
			try {
				if (oElems[i]['Type']=='3') {
					//Create Third Level Items - Objects w/in Columns
					sA=oElems[i]['ColId'].split('_');
					sADetailId=oElems[i]['DetailId'].split('_');
					
					var newElem = document.createElement('div');
					newElem.setAttribute('id',oElems[i]['DetailId']);
  				newElem.className='WizRow ListItem divWidgets StdContent divTextArea';
					newElem.style.width='auto';
					//newElem.style.height=oElems[i]['height'];
					newElem.style.position='relative';				
				
					sStdElemInnerHTML='<div class="QText">Content</div>';
					sStdElemInnerHTML=sStdElemInnerHTML+'<div class="AttachedFields">';
					sStdElemInnerHTML=sStdElemInnerHTML+'<textarea class="editThisx" style="display:none;overflow: hidden;" id="elem_ta_'+sADetailId[1]+'">'+unescape(oElems[i]['innerHTML'])+'</textarea>';
					sStdElemInnerHTML=sStdElemInnerHTML+'<div>';
					sStdElemInnerHTML=sStdElemInnerHTML+'<div style="word-wrap: break-word;" class="TempStorage" id="elem_ts_'+sADetailId[1]+'">'+unescape(oElems[i]['innerHTML'])+'</div>';
					sStdElemInnerHTML=sStdElemInnerHTML+'</div>';
					sStdElemInnerHTML=sStdElemInnerHTML+'</div>';
					sStdElemInnerHTML=sStdElemInnerHTML+'<div id="divEO_'+sADetailId[1]+'" style="display:none;">';
					sStdElemInnerHTML=sStdElemInnerHTML+'<div class="BoxUpArrow">&nbsp;</div>'
					sStdElemInnerHTML=sStdElemInnerHTML+'<div class="EditOptions">'
					sStdElemInnerHTML=sStdElemInnerHTML+'<img src="/dc_images/dc_spacer.gif" class="StdSmallMove"/>'
					sStdElemInnerHTML=sStdElemInnerHTML+'<img src="/dc_images/dc_spacer.gif" class="StdEdit" onclick="fToggleWFEditor('+sADetailId[1]+');"/>'
					sStdElemInnerHTML=sStdElemInnerHTML+'</div>';					
						
				
					newElem.innerHTML=sStdElemInnerHTML;
								
					//$(oElems[i]['ColId']).insertBefore(newElem,$('brCF_'+sA[1]));
					if (sA[2]!=null) {
						$('Col_'+sA[1]+'_'+sA[2]).appendChild(newElem);
					}
					else	{
						$('Col_'+sA[1]).insertBefore(newElem,$('brCF_'+sA[1]));
					}				
	
					$('elem_ta_'+sADetailId[1]).style.height=($('elem_ts_'+sADetailId[1]).offsetHeight+20)+'px';
				}			
			}catch(e){}
		}
	}			
	
	if (elemId==null) {
		elemId='divResizeArea';
	}
	
	iMaxTop=$(elemId).offsetHeight;
	iMaxLeft=$(elemId).offsetWidth;

	var dragresize = new DragResize('dragresize',
 	{ minWidth: 50, minHeight: 50, minLeft: 0, minTop: 0, maxLeft: iMaxLeft, maxTop: iMaxTop});

	dragresize.isElement = function(elm)
		{	
 			if (elm.className && elm.className.indexOf('drsElement') > -1 && elm.id!='BaseBox') return true;
		};
	dragresize.isHandle = function(elm)
		{
 			if (elm.className && elm.className.indexOf('drsMoveHandle') > -1 && elm.id!='BaseBox') return true;
		};

	dragresize.ondragfocus = function() { };
	dragresize.ondragstart = function(isResize) { };
	dragresize.ondragmove = function(isResize) { };
	dragresize.ondragend = function(isResize) {fSnapObjs()}
	dragresize.ondragblur = function() { };

	dragresize.apply($(elemId));
	
	fAttachFormFields();
	fAttachFormFields();
	
	if (oElems) {
		delete oElems;
	}
	
	// add editoptions to fields
	var pars = $('divResizeArea').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className=='Col') {
			oNewNode=$('EditOptions').cloneNode(true);
			oNewNode.id='';
	
			pars[i].appendChild(oNewNode);
			sA=pars[i].id.split('_');
			oNewNode.id='divEO_'+sA[1];
			
			// Add Editing Options to Columns
			if (oNewNode.addEventListener) {  // all browsers except IE before version 9
				pars[i].addEventListener ('mouseover', function () {sA=this.id.split('_');$('divEO_'+sA[1]).style.display='block';this.style.backgroundColor='lightblue';}, false);
			}
			else {
				if (oNewNode.attachEvent) {   // IE before version 9
					pars[i].attachEvent ('mouseover', function () {sA=this.id.split('_');$('divEO_'+sA[1]).style.display='block';this.style.backgroundColor='lightblue';});
				}
			}
			
			if (oNewNode.addEventListener) {  // all browsers except IE before version 9
				pars[i].addEventListener ('mouseout', function () {sA=this.id.split('_');$('divEO_'+sA[1]).style.display='none';this.style.backgroundColor='#fff';}, false);
			}
			else {
				if (oNewNode.attachEvent) {   // IE before version 9
					pars[i].attachEvent ('mouseout', function () {sA=this.id.split('_');$('divEO_'+sA[1]).style.display='none';this.style.backgroundColor='#fff';});
				}
			}			
		}
	}
	
	// Process Other Elements
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className.indexOf('divTextArea')!=-1) {
			
			// Add Editing Options to Columns
			if (oNewNode.addEventListener) {  // all browsers except IE before version 9
				pars[i].addEventListener ('mouseover', function () {sA=this.id.split('_');$('divEO_'+sA[1]).style.display='block';this.style.backgroundColor='lightblue'}, false);
			}
			else {
				if (oNewNode.attachEvent) {   // IE before version 9
					pars[i].attachEvent ('mouseover', function () {sA=this.id.split('_');$('divEO_'+sA[1]).style.display='block';this.style.backgroundColor='lightblue';});
				}
			}
			if (oNewNode.addEventListener) {  // all browsers except IE before version 9
				pars[i].addEventListener ('mouseout', function () {sA=this.id.split('_');$('divEO_'+sA[1]).style.display='none';this.style.backgroundColor='#fff';}, false);
			}
			else {
				if (oNewNode.attachEvent) {   // IE before version 9
					pars[i].attachEvent ('mouseout', function () {sA=this.id.split('_');$('divEO_'+sA[1]).style.display='none';this.style.backgroundColor='#fff';});
				}
			}		
			
		}
	}			

	
	fFormManagerSetUp();
	fSimpleEditInit();

}
var iDomCnt=0;
function fCloneNode(oNode,sOffSet,nId,appendNodeId) {
	
	if (sOffSet==null) {
		sOffSet='20';
	}
	if (nId==null) {
		nId='StdFrame_';
	}
	if (appendNodeId==null) {
		appendNodeId='divResizeArea';
	}
	
	oNewNode=oNode.cloneNode(true);
	document.getElementById(appendNodeId).appendChild(oNewNode);
	oNewNode.id=nId+iDomCnt;

	oNewNode.style.left=oNode.offsetLeft+sOffSet+'px';
	oNewNode.style.top=oNode.offsetTop+sOffSet+'px';
	oNewNode.style.visibility='visible';
	
	// Lower z-Indexes
	var pars = $('divResizeArea').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className!=null) {
			if (pars[i].className=='Container') {
				pars[i].parentNode.parentNode.parentNode.style.zIndex=1;
			}
		}
	}	
	// Update Container ID	
	var pars = oNewNode.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className!=null) {
			if (pars[i].className=='Container') {
				pars[i].id='Col_'+iDomCnt;
				pars[i].parentNode.parentNode.parentNode.style.zIndex=1000;
				pars[i].parentNode.id='divCB_'+iDomCnt;
			}
		}
	}
	// Update split link ID
	var pars = oNewNode.getElementsByTagName('a');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className!=null) {
			if (pars[i].className.indexOf('StdSplit')!=-1) {
				pars[i].id='aSplit_'+iDomCnt;
			}
		}
	}
	// Update frame checkbox ID
	var pars = oNewNode.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className!=null) {
			if (pars[i].className==('inpFrameContainerOpts')) {
				pars[i].id='inpFrameContainerOpts_'+iDomCnt;
			}
		}
	}	
	// Update split checkbox ID
	var pars = oNewNode.getElementsByTagName('input');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className!=null) {
			if (pars[i].className==('inpFrameOpts')) {
				pars[i].id='inpFrameOpts_'+iDomCnt;
			}
		}
	}		

	// Update BR ClearFix ID
	var pars = oNewNode.getElementsByTagName('br');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className!=null) {
			if (pars[i].className.indexOf('ClearFix')!=-1) {
				pars[i].id='brCF_'+iDomCnt;
			}
		}
	}
	iDomCnt++;
}
function fSnapObjs() {
	
	var pars = document.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].id!=null) {
			if (pars[i].id.indexOf('StdFrameX_')!=-1) {
			
				//Right Side Snap
				
				var sDelta=pars[i].offsetTop/100;
				sDelta=Math.round(sDelta);
				sDelta=sDelta*100;
				pars[i].style.top=sDelta+'px';
					
				//Left Side Snap
				var sDelta=pars[i].offsetLeft/100;
				sDelta=Math.round(sDelta);
				sDelta=sDelta*100;
				pars[i].style.left=sDelta+'px';	
				
				
			}
		}
	}
}
function fAttachFormFields() {

	var pars = document.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf('SVQC_')==0) {
			sA=pars[i].id.split('_')
			$('divFA_'+sA[1]).appendChild(pars[i]);
		}
	}
}
function fSortFrames(fid) {
	
	for (i=0;i<Draggables.drags.length;i++) {
		Draggables.drags[i].destroy();
	}	
 
 	$A($('divResizeArea').getElementsByTagName('div')).each (
	  function(item) {
	  	if (item.id.indexOf('Col_')==0 || item.id=='divFormFields') {
				Droppables.remove(item.id);  			
   		}
   	})
  
  Droppables.remove('divItemArea');
	pars=$('divResizeArea').getElementsByTagName('div')
	for (i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf('divCB_')==0) {
			Sortable.create(pars[i].id,{tag:'div',Hoverclass:'TabRoll',only:'Col',constraint:'vertical', overlap:'vertical'});  
		}
	}
}
function fDelFormFrame(frameId) {
	
	var aElems=new Array();
	pars=$(frameId).getElementsByTagName('div');
	
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='Container') {
			// Remove and put back any elements attached - Build List
			pars2=$(pars[i].id).getElementsByTagName('div');
			for (i2=0;i2<pars2.length;i2++) {
				try {
					if (pars2[i2].className=='Col') {
						aElems.push(pars2[i2].id)
					}
				}
				catch(e){}
			}
		}
	}
	
	// Remove Elements
	for (i=0;i<aElems.length;i++) {
		$('divFormFields').appendChild($(aElems[i]));
	}
	
	$(frameId).parentNode.removeChild($(frameId));
}
function fDelFormCol(colId) {
	
	var ePar=$(colId).parentNode;	
	var iColCnt=0;
	
// Remove and put back any elements attached - Build List
	pars=$(colId).getElementsByTagName('div');
	var aElems=new Array();
	for (i=0;i<pars.length;i++) {
		try {
			if (pars[i].className=='Col') {
				aElems.push(pars[i].id)
			}
		}
		catch(e){}
	}

// Remove Elements
	for (i=0;i<aElems.length;i++) {
		$('divFormFields').appendChild($(aElems[i]));
	}
	
	$(colId).parentNode.removeChild($(colId));

// Count Columns

	var pars=ePar.getElementsByTagName('div')	
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='Container') {
			iColCnt++;	
		}
	}
	
// Update existing Columns w/ new percentages	
	pars=ePar.getElementsByTagName('div')
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='Container') {
			iNewWidth=pars[i].offsetWidth/iColCnt;
			iNewWidthPct=(iNewWidth/pars[i].offsetWidth)*100;
			pars[i].style.width=iNewWidthPct+'%'
		}
	}
}
function fSplitContainer(splitId) {
	
//Count Columns
	var sSa=splitId.split('_');
	var pars=$('divCB_'+sSa[1]).getElementsByTagName('div')
	var iColCnt=0;
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='Container') {
			iColCnt++;	
		}
	}
	
	var oNode;
	
	//Find First child
	pars=$('divCB_'+sSa[1]).getElementsByTagName('div');
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='Container' && oNode==null) {
			oNode=pars[i]
		}
	}

	var oNewNode=oNode.cloneNode(true);
	$('divCB_'+sSa[1]).appendChild(oNewNode);

	var aElems=new Array();
	
	// Remove innapropriate BR 
	var pars = $('divCB_'+sSa[1]).getElementsByTagName('br');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className=='ClearFix') {
				//pars[i].parentNode.removeChild(pars[i]);       
				aElems.push(pars[i]);   
		}
	}	
	
	// Remove innapropriate children
	var pars = oNewNode.getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className=='Col' || pars[i].className.indexOf('StdContent')>0) {
				//pars[i].parentNode.removeChild(pars[i]);    
				aElems.push(pars[i]);   
		}
	}		

	for (i=0;i<aElems.length;i++) {
		try {
			aElems[i].parentNode.removeChild(aElems[i]); 
		}catch(e){alert(aElems[i].id)}
	}
	
	iColCnt++;
	
	pars=$('divCB_'+sSa[1]).getElementsByTagName('div')
	var iColCntId=0;
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='Container') {
			pars[i].id='Col_'+sSa[1]+'_'+iColCntId;	
			iNewWidth=pars[i].offsetWidth/iColCnt;
			iNewWidthPct=(iNewWidth/pars[i].offsetWidth)*100;
			pars[i].style.width=iNewWidthPct+'%'
			pars[i].style.cssFloat='left';
			iColCntId++;
		}
	}
	pars=$('divCB_'+sSa[1]).getElementsByTagName('input')
	var iColCntId=0;
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='inpFrameOpts') {
			pars[i].id='inpFrameOpts_'+sSa[1]+'_'+iColCntId;	
			iColCntId++;
		}
	}	
	
	nArray=fBubbleSortIds('divCB_'+sSa[1],'div','Container');
	pars=$('divCB_'+sSa[1]).getElementsByTagName('div')
	pars=nArray;
	var iColCntId=0;
	for (i=0;i<pars.length;i++) {
		$('divCB_'+sSa[1]).appendChild($(pars[i]));
	}	

	var elemBr = document.createElement('br');
	elemBr.className='ClearFix';
	$('divCB_'+sSa[1]).appendChild(elemBr);

// Set variables for resize	
//	elmX=$(splitId).parentNode.parentNode.offsetLeft;
//  elmW=$(splitId).parentNode.parentNode.offsetWidth;
//  elmY=$(splitId).parentNode.parentNode.offsetTop;
//  elmH=$(splitId).parentNode.parentNode.offsetHeight;
	
	fFormManagerSetUp();
}
function fBubbleSortIds(bsid,sType,sClass) {

	var sIDArray=new Array;
	var sLowestFound;
	var pars=$(bsid).getElementsByTagName(sType)

	for (var i=0;i<pars.length;i++) {
		if (pars[i].className==sClass) {
			for (var i2=0;i2<pars.length;i2++) {
				sLowestFound='';
				if (pars[i2].className==sClass) {
					if (pars[i].id<pars[i2].id) { 
						bAlreadyThere=0;
						for (var i3=0;i3<sIDArray.length;i3++) {
							if (sIDArray[i3]==pars[i].id) {
								bAlreadyThere=1;
							}
						}
						if (bAlreadyThere==0) {
							sLowestFound=pars[i].id;
						}
					}
					else {
						sLowestFound=pars[i].id;
					}
				}
			}
			//alert(sLowestFound);
			if (sLowestFound.length>0) {
				sIDArray.push(sLowestFound)
			}
		}
	}
	return sIDArray;
}
function fPageDeckDragDropInit() {

  $A($('divAvailPages').getElementsByTagName('div')).each(
	  function(item) {
  	  new Draggable(
    	  item,
      		{
          	revert: true,
            ghosting: true,
            scroll: window
      		}
    	);
		}
   );
  $A($('divSortArea').getElementsByTagName('div')).each(
	  function(item) {
  	  new Draggable(
    	  item,
      		{
          	revert: true,
            ghosting: true,
            scroll: window
      		}
    	);
		}
   );   

  Droppables.add(
   'divSortArea',
  	{
    	hoverclass: 'DropZoneActive',
    	onDrop: function(draggable,droparea) { 
  			draggable.parentNode.removeChild(draggable);
  			droparea.appendChild(draggable); 
			}
    }
  );
  Droppables.add(
   'divAvailPages',
  	{
    	hoverclass: 'DropZoneActive',
    	onDrop: function(draggable,droparea) { 
  			draggable.parentNode.removeChild(draggable);
  			droparea.appendChild(draggable); 
			}
    }
  );  
  
  Sortable.destroy ('divSortArea');
  
  $('divSortArea').cleared = false;
}
function fSortDeck(mode) {
	if (mode==1) {
		fPageDeckDragDropDestroy();
		Sortable.create('divSortArea',{tag:'div',overlap:'vertical',constraint:'vertical',Hoverclass:'TabRoll'});
		$('aSortMode').className='StdSort Select';
		$('aDragMode').className='StdOrganizer';
		$('divDMLeft').style.display='none';
		$('divDMRight').className='';
	} else {
		fPageDeckDragDropInit();
		$('aSortMode').className='StdSort';
		$('aDragMode').className='StdOrganizer Select';
		$('divDMLeft').style.display='';
		$('divDMRight').className='RightPane';		
	}

}
function fPageDeckDragDropDestroy() {
	
	for (i=0;i<Draggables.drags.length;i++) {
		Draggables.drags[i].destroy();
	}
   
  Droppables.remove('divSortArea');
  Droppables.remove('divAvailPages');
}
function fSaveDeckInd() {
	fSaveDeck();
}
function fSaveDeck() {
	
	if ($('Name').value.length==0) {
		alert ("Name is required");
		$('Name').select();
		$('Name').focus();
		return false;
	}		
	
	if ($('Name').value.length>200) {
		alert ("Name cannot exceed 200 characters");
		$('Name').select();
		$('Name').focus();
		return false;
	}
	
	pars=$('divSortArea').getElementsByTagName('div')
	var aSort=new Array
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className.indexOf('PDItem')==0 ) {
			aSort.push(pars[i].id.replace('PDItem_',''));
		}
	}
	$('SortKeys').value=aSort;
	$('DUpd').value='1';
	$('DUpdProgressBar').style.display='';
	
	var sDest=$('divDeckMaint').parentNode.id;

	ValidatefEmpApprov('formDeckMaint','DUpd',sDest);	
	return false;			
}
function fDeckDelete(Did) {
	var x=window.confirm('You are about to delete a page deck\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_DeckDelete.asp?did='+Did+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divDMRow_'+Did)	

}
function fUpdateZIndex(elemId) {
	
	var pars = $('divWireFrame').getElementsByTagName('div');
	var hiIndex=0;
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='drsElement') {
			if (parseInt(pars[i].style.zIndex)>parseInt(hiIndex)) {
				hiIndex=parseInt(pars[i].style.zIndex)
			}
		}
	}
	$(elemId).style.zIndex=hiIndex++;
}
function fExpandElement(elemId) {
	
	var elem=$(elemId)
	
	elem.style.left=0;
	elem.style.width='100%';
	
}
function fSaveDBFormLayoutInd() {
	fSaveDBFormLayout();
}
function fSaveDBFormLayout() {
	
	if ($('FormName').value.length==0) {
		alert ("Form Name is required");
		$('FormName').select();
		$('FormName').focus();
		return false;
	}		
	if ($('FormName').value.length>200) {
		alert ("Form Name cannot exceed 200 characters");
		$('FormName').select();
		$('FormName').focus();
		return false;
	}	
	
	var oElems = new Array();	
	var iElemCnt=0;
	
	try {I_FinishEditing()}catch(e){};
	
	// Find Large Elements and place in array
	pars=$('divResizeArea').getElementsByTagName('div')
	for (i=0;i<pars.length;i++) {
		try {
			//alert ('Class: '+pars[i].className);			
			if (pars[i].id.indexOf('StdFrame_')!=-1) {
				oElems[iElemCnt] = new Object();
				oElems[iElemCnt]['PanelId']=pars[i].id;			
				oElems[iElemCnt]['ColId']=0;			
				oElems[iElemCnt]['DetailId']=0;
				oElems[iElemCnt]['Type']=0;
				oElems[iElemCnt]['width']=pars[i].offsetWidth;
				oElems[iElemCnt]['height']=pars[i].offsetHeight;
				oElems[iElemCnt]['left']=pars[i].offsetLeft;
				oElems[iElemCnt]['top']=pars[i].offsetTop;
				oElems[iElemCnt]['zIndex']=pars[i].style.zIndex;
				oElems[iElemCnt]['innerHTML']='';
				iElemCnt++;
			}
		} catch(e){}
	}
	
	// Find Column Elements and place in array
	for (i=0;i<oElems.length;i++) {
		if (oElems[i]['Type']==0) {
			pars=$(oElems[i]['PanelId']).getElementsByTagName('div')
			for (i2=0;i2<pars.length;i2++) {
				
				try {
					if (pars[i2].className=='Container') {
						//alert (pars[i2].id + ' - accepted');
						oElems[iElemCnt] = new Object();
						oElems[iElemCnt]['PanelId']=oElems[i]['PanelId'];			
						oElems[iElemCnt]['ColId']=pars[i2].id;			
						oElems[iElemCnt]['DetailId']=0;
						oElems[iElemCnt]['Type']=1;	
						oElems[iElemCnt]['width']=pars[i2].style.width;
						oElems[iElemCnt]['height']=pars[i2].offsetHeight;
						oElems[iElemCnt]['left']=pars[i2].offsetLeft;
						oElems[iElemCnt]['top']=pars[i2].offsetTop;	
						oElems[iElemCnt]['zIndex']=pars[i2].style.zIndex;
						oElems[iElemCnt]['innerHTML']='';				
						iElemCnt++;			
					}
				}catch(e){alert(e);}
			}
		}
	}
	
	// Find Detail Elements and place in array
	for (i=0;i<oElems.length;i++) {
		if (oElems[i]['Type']==1) {
			pars=$(oElems[i]['ColId']).getElementsByTagName('div')
			//alert('elem2:'+oElems[i]['ColId']+',length:'+pars.length)
			for (i2=0;i2<pars.length;i2++) {
				if (pars[i2].id.indexOf('divCol_')==0 || pars[i2].className.indexOf('divTextArea')!=-1) {
					//alert (pars[i2].id);
					oElems[iElemCnt] = new Object();
					oElems[iElemCnt]['PanelId']=oElems[i]['PanelId'];			
					oElems[iElemCnt]['ColId']=oElems[i]['ColId'];			
					oElems[iElemCnt]['DetailId']=pars[i2].id;
					oElems[iElemCnt]['Type']=2;	
					oElems[iElemCnt]['width']=pars[i2].offsetWidth;
					oElems[iElemCnt]['height']=pars[i2].offsetHeight;
					oElems[iElemCnt]['zIndex']=pars[i2].style.zIndex;
					oElems[iElemCnt]['innerHTML']='';
					
					if (pars[i2].className!=null) {
						if (pars[i2].className.indexOf('divTextArea')!=-1) {
							try {
								sA=pars[i2].id.split('_');
								sText=escape($('elem_ta_'+sA[1]).value);
								oElems[iElemCnt]['innerHTML']=sText;
								oElems[iElemCnt]['Type']=3;	
							}catch(e){alert(pars[i2].id);}
						}
					}
					iElemCnt++;			
				}
			}
		}
	}

	
	// Build final JSON
	
	var sSC=''
	var sJSON='';
	iElemCnt=0;
	for (i=0;i<oElems.length;i++) {
		sJSON=sJSON+ "oElems["+iElemCnt+"] = new Object();";
		sJSON=sJSON+ "oElems["+iElemCnt+"]['PanelId']='"+oElems[i]['PanelId']+"';";
		sJSON=sJSON+ "oElems["+iElemCnt+"]['ColId']='"+oElems[i]['ColId']+"';";
		sJSON=sJSON+ "oElems["+iElemCnt+"]['DetailId']='"+oElems[i]['DetailId']+"';";
		sJSON=sJSON+ "oElems["+iElemCnt+"]['Type']='"+oElems[i]['Type']+"';";
		sJSON=sJSON+ "oElems["+iElemCnt+"]['width']='"+oElems[i]['width']+"';";
		sJSON=sJSON+ "oElems["+iElemCnt+"]['height']='"+oElems[i]['height']+"';";
		sJSON=sJSON+ "oElems["+iElemCnt+"]['left']='"+oElems[i]['left']+"';";
		sJSON=sJSON+ "oElems["+iElemCnt+"]['top']='"+oElems[i]['top']+"';";
		sJSON=sJSON+ "oElems["+iElemCnt+"]['zIndex']='"+oElems[i]['zIndex']+"';";
		sJSON=sJSON+ "oElems["+iElemCnt+"]['innerHTML']='"+oElems[i]['innerHTML']+"';";
		
		iElemCnt++;
	}
	// Set outbound form w/ new JSON - we will store JSON in db for later processing
	$('FormJSON').value=sJSON;
	$('FUpd').value='1';
	$('FUpdProgressBar').style.display='';
	
	var sDest=$('divWireFrame').parentNode.id;

	ValidatefEmpApprov('formWireFrame','FUpd',sDest,'fInitResize()');	
	return false;				
}
function fDelFormDesign(formId,sid) {
	
	var x=window.confirm('You are about to delete a Form Design\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_WireFrameDelete.asp?formid='+formId+'&sid='+sid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divRow_'+formId)		
}
function fCloneObject(elem) {
	
	if (elem.parentNode.id=='divResizeArea' || elem.parentNode.className=='Container') {
		return false;
	}
	
	frmClone = elem.cloneNode(true);	
	elem.parentNode.insertBefore(frmClone, elem.nextSibling);
		
  if (frmClone.removeEventListener) {    // all browsers except IE before version 9
	  frmClone.removeEventListener ('click', fCloneObject, false);
  }
  else {
  	if (frmClone.detachEvent) {        // IE before version 9
    	frmClone.detachEvent ('onclick', fCloneObject);
    }
	}

	// Find highest level non dbelement - need to create a guid for this fiekd.
	
	pars=$('divResizeArea').getElementsByTagName('div');
	for (i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf('elem_')==0) {
			sA=pars[i].id.split('_');
			if (parseInt(sA[1])>iHighId) {
				iHighId=parseInt(sA[1])+1;
			}
		}
	}
	
	frmClone.className='WizRow ListItem divWidgets StdContent divTextArea';
	frmClone.id='elem_'+iHighId;

	//$('divFormFields').insertBefore(frmClone, $('divResizeArea').firstChild);
	$('divFormFields').appendChild(frmClone);
	
	// Update GUID for Temp Storage
	var bTextAreaFound=0;
	pars=frmClone.getElementsByTagName('div');
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='TempStorage') {
			pars[i].id='elem_ts_'+iHighId;
		}
	}
	// Update GUID for TextArea
	pars=frmClone.getElementsByTagName('textarea');
	for (i=0;i<pars.length;i++) {
		pars[i].id='elem_ta_'+iHighId;
		pars[i].className='editThis';
		bTextAreaFound=1;

	}
	if (bTextAreaFound==1) {
		pars=frmClone.getElementsByTagName('img');
		for (i=0;i<pars.length;i++) {
			if (pars[i].className=='StdEdit') {
				// Attach Events - fToggleWFEditor
				if (pars[i].addEventListener) {  // all browsers except IE before version 9
					pars[i].addEventListener ('click', function () {fToggleWFEditor(fGetId(this.parentNode.parentNode.id,1));}, false);
				}
				else {
					if (pars[i].attachEvent) {   // IE before version 9
						pars[i].attachEvent ('click', function () {fToggleWFEditor(fGetId(this.parentNode.parentNode.id,1));});
					}
				}			
			}
		}
	}
	
	fFormManagerSetUp();
	iHighId++;
	
	if (bTextAreaFound==1) {
		//fSimpleEditInit();
	}	
}
function fSetTextAreaHeight(elem) {
	
	sA=elem.parentNode.parentNode.id.split('_');
	$('elem_ts_'+sA[1]).innerHTML=elem.value;
	if (elem.offsetHeight<$('elem_ts_'+sA[1]).offsetHeight) {
		elem.style.height=($('elem_ts_'+sA[1]).offsetHeight+20)+'px';
	}
}
function fGetId(fGid,fNode) {
	var sA=fGid.split('_');
	return sA[fNode];
}
function fEditWFText(elem) {
	alert(elem.id);
	}
function fToggleWFEditor(guid) {
//	pars=$('divResizeArea').getElementsByTagName('textarea');
//	for (i=0;i<pars.length;i++) {
//		pars[i].className=pars[i].className.replace('editThis','');
//	}

	//fCloseWFEditors();
	
	$('elem_ta_'+guid).style.display='';
	$('elem_ts_'+guid).style.display='none';
	$('elem_ta_'+guid).className='editThis';
	
	var elemId='elem_'+guid;
	
	var bFoundEditor=0;
	// Look for Editors and unhide
	pars=$(elemId).getElementsByTagName('iframe');
	for (i=0;i<pars.length;i++) {
		//pars[i].parentNode.removeChild(pars[i]);
		pars[i].style.display='';
		bFoundEditor=1;
	}
	// Remove Editor Image
	pars=$(elemId).getElementsByTagName('img');
	for (i=0;i<pars.length;i++) {
		try {
			if (pars[i].src.indexOf('editing.png')!=-1) {
				//pars[i].parentNode.removeChild(pars[i]);
				pars[i].style.display='';
			}
		}catch(e){};
	}
	// Remove extraneous Editor Link
	pars=$(elemId).getElementsByTagName('a');
	for (i=0;i<pars.length;i++) {
			try {
			if (pars[i].href.indexOf('I_ViewHTML')!=-1) {
				//pars[i].parentNode.removeChild(pars[i]);
				pars[i].style.display='';
			}
		}catch(e){};
	}	
	
	if (bFoundEditor==0) {
		fSimpleEditInit();
	}
}
function fCloseWFEditors() {

	// Remove Editors
	pars=$('divResizeArea').getElementsByTagName('iframe');
	for (i=0;i<pars.length;i++) {
		//pars[i].parentNode.removeChild(pars[i]);
		pars[i].style.display='none';
	}
	// Remove Editor Image
	pars=$('divResizeArea').getElementsByTagName('img');
	for (i=0;i<pars.length;i++) {
		try {
			if (pars[i].src.indexOf('editing.png')!=-1) {
				//pars[i].parentNode.removeChild(pars[i]);
				pars[i].style.display='none';
			}
		}catch(e){};
	}
	// Remove extraneous Editor Link
	pars=$('divResizeArea').getElementsByTagName('a');
	for (i=0;i<pars.length;i++) {
			try {
			if (pars[i].href.indexOf('I_ViewHTML')!=-1) {
				//pars[i].parentNode.removeChild(pars[i]);
				pars[i].style.display='none';
			}
		}catch(e){};
	}
}
var bBUDMode=0;
var ListTimer;
function fBlindUpDown (elemId, mode, hideClass, parentId, event) {
			
	if (mode==1 && bBUDMode==0) {			
		ListTimer=window.setInterval(function(){fBlindUpDownProcess(elemId, mode, event);window.clearTimeout(ListTimer);bBUDMode=1;},200);
	} 
	if (mode==0) {
		window.clearTimeout(ListTimer);		
		if ($(elemId).style.display!='none') {
			Effect.Queues.get('hoverItems').invoke('cancel');
			new Effect.SlideUp(elemId, { queue: 'end', scope: 'hoverItems', limit: 2, fps:30, duration:.1 });
		}
		// Close any remaining open item
		
		pars=$(elemId).parentNode.getElementsByTagName($(elemId).nodeName.toLowerCase());
		for (i=0;i<pars.length;i++) {
			if (pars[i].className.indexOf(hideClass)!=-1) {
				pars[i].style.display='none';
			}
		}
		
		bBUDMode=0;
		Effect.Queues.get('hoverItems').invoke('cancel');
	}
	if (mode==2) {
		window.clearTimeout(ListTimer);		
		Effect.Queues.get('hoverItems').invoke('cancel');
		// Close all open items

		pars=$(elemId).getElementsByTagName('div');
		for (i=0;i<pars.length;i++) {
			if (pars[i].className.indexOf(hideClass)!=-1) {
				//pars[i].style.display='none';
				if (pars[i].style.display!='none') {
					new Effect.SlideUp(pars[i].id, { queue: 'end', scope: 'hoverItemsClose', fps:30, duration:.1 });
				}				
			}
		}
		
		bBUDMode=0;
	}	
}
function fBlindUpDownProcess(elemId, mode, event) {
		
	if (bBUDMode==0) {
		Effect.Queues.get('hoverItems').invoke('cancel');
		new Effect.SlideDown(elemId, { queue: 'end', scope: 'hoverItems', limit: 2,fps:30, duration:.1 });
		bBUDMode=1;
		window.clearTimeout(ListTimer);
	}
	
	if (event!=null) {
		event.cancelBubble=true;
	}		
}
function fCSSRemove () {
	
	var sA=new Array();
	var pars=document.getElementsByTagName('link');
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='DCCSS') {
			sA.push(pars[i].id);
			
		}
	}
	
	for (i=0;i<sA.length;i++) {
		$(sA[i]).parentNode.removeChild($(sA[i]))
	}
}
function fCSSAdd(cssPId,mode) {
	
	if (mode==null) {
		mode=0;
	}
	
	if (mode==0) {
		$('CSSSelectedId').value=cssPId;
		var ajaxscript = '/dc_includes/CP6_CSSGetPackage.asp?CSSPId=' + cssPId + '&xc=' + ajaxTimeStamp;
		AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true','fCSSAddProcess()');	
	
		$('aSaveStyle').style.display='';
		pars=$('divCSSOptions').getElementsByTagName('div');
		for (i=0;i<pars.length;i++) {
			if (pars[i].id.indexOf('divCSSOptionRow_')!=-1) {
				pars[i].style.backgroundColor='transparent';
			}
		}		
		$('divCSSOptionRow_'+cssPId).style.backgroundColor='#f0f0f0';
	}
	
	if (mode==1) {
		$('CSSSelectedId').value=cssPId;
		var ajaxscript = '/dc_includes/CP6_CSSGetPackage.asp?CSSPId=' + cssPId + '&xc=' + ajaxTimeStamp;
		AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true','fCSSUpdateWebSiteBasic()');			
		
		pars=$('divCSSOptions').getElementsByTagName('div');
		for (i=0;i<pars.length;i++) {
			if (pars[i].id.indexOf('divCSSOptionRow_')!=-1) {
				pars[i].style.backgroundColor='transparent';
			}
		}		
		
		$('divCSSOptionRow_'+cssPId).style.backgroundColor='#f0f0f0';
	}
}
function fCSSUpdateWebSiteBasic() {
	sCSS=$('divGnrlAjax').innerHTML.replace(/~/gi,'\n');
	$('AlternateCSS').value=sCSS;
}

function fCSSAddProcess() {
	
	//alert ($('divGnrlAjax').innerHTML);
	//eval($('CSSGROUP').innerHTML);
	

	
	sA=$('divGnrlAjax').innerHTML.split('~');
	for (i=0;i<sA.length;i++) {
	  var elem = document.createElement("link");
		elem.setAttribute("rel", "stylesheet")
  	elem.setAttribute("type", "text/css")
  	elem.setAttribute("href", sA[i])
  	elem.setAttribute("className", 'DCCSSNew')
		document.getElementsByTagName("head")[0].appendChild(elem);
		
		callBack=null;
    if(callBack != undefined){
        elem.onload = function(){
            callBack();
        };
    }
		
	}
	
	fCSSRemove ();
	
	var pars=document.getElementsByTagName('link');
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='DCCSSNew') {
			pars[i].className='DCCSS';
		}
	}
	
}
function fCSSSave() {

	var iStyleId=$('CSSSelectedId').value;
	
	if (iStyleId.length==0) {
		alert ("You have need to select a style");
		return false;
	}
	
	var ajaxscript = '/dc_includes/CP6_CSSSaveStyleOption.asp?confCode=' + lPD_ConfCode + '&StyleId=' + iStyleId + '&xc=' + ajaxTimeStamp;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');	
	
	alert ("Style Saved");

}
function fDelHotel(hid) {

var x=window.confirm("You are about to delete a hotel\n\n if correct, press OK, else CANCEL")
if (!x) {
	return;
}
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_DelHotel.asp?hid='+hid+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divRowContainer_'+hid)
}
var iCarouselCntr=1;
var iCarouselWidth=0;
var iCarouselNewPos=0;
var oCarouselTimer;
var iCarouselTransTime=5000;
var iCarouselIdPat;

function fCarouselDiv(idPat) {

	iCarouselWidth=parseInt($('Car_'+idPat+'_'+iCarouselCntr).offsetWidth);
	iCarouselNewPos=parseInt($('Car_'+idPat+'_'+iCarouselCntr).offsetLeft)+iCarouselWidth;
	if (iCarouselNewPos>=$('divBannerContainer').offsetWidth) {
		iCarouselNewPos=0;
	}

	new Effect.Move('divBannerContainer', { x: -iCarouselNewPos, y: 0, mode: 'absolute' });
	iCarouselCntr++;
	if (iCarouselCntr>4) {
		iCarouselCntr=1;
	}
	oCarouselTimer=window.setTimeout(function() {fCarouselDiv(idPat)},iCarouselTransTime);
	iCarouselIdPat=idPat;
}
function fCarouselLoop(idPat,transTime) {
	oCarouselTimer=window.setTimeout(function() {fCarouselDiv(idPat)},transTime);
	iCarouselIdPat=idPat;
}
function fBuildCarouselParams() {
var iCarouselMaxWidth=0;
var iCarouselContainerMaxWidth=0;
var iCarouselMaxHeight=0;
	
	var pars=$('divBannerContainer').getElementsByTagName('div');
	for (var i=0;i<pars.length;i++) {
		if (pars[i].className=='Carousel') {
			//alert('pars[i].offsetWidth:'+pars[i].offsetWidth);
			iCarouselMaxWidth=iCarouselMaxWidth+parseInt(pars[i].offsetWidth)
			iCarouselContainerMaxWidth=parseInt(pars[i].offsetWidth)
		}
		if (parseInt(pars[i].offsetHeight)>iCarouselMaxHeight) {
			iCarouselMaxHeight=parseInt(pars[i].offsetHeight);
		}
	}
	
	if (iCarouselMaxWidth!=0) {
		$('divBannerContainer').style.width=iCarouselMaxWidth;
	}
	if (iCarouselMaxHeight!=0) {
		$('divBannerContainer').style.height=iCarouselMaxHeight;	
	}
	if (iCarouselContainerMaxWidth!=0) {
		$('divBanner').style.width=iCarouselContainerMaxWidth;
	}
}	
function fCloneNew(elemId,targetId) {
	var nRow=$('FlNew_0').cloneNode(true);
	$(elemId).appendChild(nRow);		
	$(elemId).insertBefore(nRow, $(targetId));
	nRow.id='FLNew_'+$(elemId).childElementCount;
	
	pars=nRow.getElementsByTagName('input');
	for (i=0;i<pars.length;i++) {
		pars[i].value='';
	}
	pars=nRow.getElementsByTagName('textarea');
	for (i=0;i<pars.length;i++) {
		pars[i].value='';
	}
	
}
function fMoveMobileBody(divContainer, px, dur, yPx) {
	if (dur==null) {
		dur='.05'
	}
	
	if (yPx==null) {
		yPx=0;
	}
	
	new Effect.Move(divContainer, { x: -px, y: yPx, mode: 'absolute', duration:dur });
	$('DCMainBG').scrollTop=0;
}
function fSaveCSSContentInd() {
	fSaveCSSContent();
}
function fSaveCSSContent() {
	
	if ($('FileName').value.indexOf('.css')==-1) {
		alert ("File Name must have a '.CSS' suffix, please correct");
		$('FileName').select();
		$('FileName').focus();
		return false;
	}

	$('CSSUpd').value='1';
	$('CSSProgressUpdBar').style.display='';
	
	var sDest=$('divCSSEditor').parentNode.id;

	ValidatefEmpApprov('formCSSEditor','CSSUpd',sDest);	
	return false;			
}
function fPostCachedPortal() {
	
	// Only grab main page portals
	if ($('PPVBtout0')==null) {
		return;
	}
	
	if ($('PPVBtout0').className!='BtOutS') {
		return;
	}

	sCACHEHTML=$('divMainPanelTiles').innerHTML;
	$('PCacheUpd').value=1;
	
	var sRE = /\n/g
	var re = new RegExp(sRE);
	$('PortalCache').value=sCACHEHTML.replace(re,'');
	ValidatefEmpApprov('formPortalCache','PCacheUpd','divGnrlAjax');	
	return false;		
}
function fPostCachePage() {
	
	sCACHEHTML=document.documentElement.innerHTML;
	$('PCacheUpd').value=1;
	
	var sRE = /\n/g
	var re = new RegExp(sRE);
	$('PageCache').value=sCACHEHTML.replace(re,'');
	$('PageCache').value=sCACHEHTML
	ValidatefEmpApprov('formPageCache','PCacheUpd','divGnrlAjax');	
	return false;		
}
function fCloneStdAdds(obj) {	

	oClone=obj.parentNode.previousSibling;
	oParent=obj.parentNode.parentNode;
	
	oNewNode=oClone.cloneNode(true);
	oParent.insertBefore(oNewNode, obj.parentNode);
	
	iCElemCnt=oParent.childElementCount

	var sRE = /.*_/g
	var sNewIdPref =sRE.exec(oNewNode.id);
	iCnt=parseInt(oParent.childElementCount)-1
	
	oNewNode.id=sNewIdPref+iCnt;

  pars=oNewNode.getElementsByTagName('input');
  for (i=0;i<pars.length;i++) {
  	pars[i].value='';
  }
}
function fSaveVIPProfileInd() {
	fSaveVIPProfile();
}
function fSaveVIPProfile() {
	
	$('VIPUpd').value=1;
	$('vipProgressUpdBar').style.display='';
	
	ValidatefEmpApprov('formVIPProfile','VIPUpd',$('divVIPProfile').parentNode.id,'fRefreshVIPList');	
	return false;			
}
function fRefreshVIPList() {
	DisplayAjaxPage(1,$('divVIPList').parentNode.id,'DCVIPPROFILELIST','','&gid='+$('GID').value);
}
function fDeleteVIP(vipId) {
	var x=window.confirm('You are about to delete a V.I.P.\n\n if correct, press OK, else CANCEL');
	if (!x) {
		return;
	}
	
	ajaxIncrement=ajaxIncrement+1;
	ajaxscript='/dc_includes/CP6_VIPProfileDelete.asp?vipid='+vipId+'&xc='+ajaxTimeStamp+ajaxIncrement;
	AjaxSimpleCheck(ajaxscript, '', 'divGnrlAjax',1,'true');
	
	new Effect.Puff('divRow_'+vipId)		
}

function fToggleElementBlinds(elem) {
	
	if ($(elem).style.overflow=='visible') {
		$(elem).style.overflow='hidden';
	}
	else {
		fBlindDown(elem);
	}
}
function fProcessMobileDMailUpd() {
	var iFirstItem=0;
	var sDMail='';
	pars=$('InboxTable').getElementsByTagName('div');
	for (i=0;i<pars.length;i++) {
		if (pars[i].className=='Subject' && parseInt(iFirstItem)<3) {
			iFirstItem=iFirstItem+1
			sDMail=sDMail+pars[i].firstChild.innerHTML;
		}
	}	

	$('LatestEmail').innerHTML=sDMail;	
}
function fPrepCachePage() {
	
	if ($('divMBDetails_9999')!=null) {
		pars=$('divMBDetails_9999').getElementsByTagName('span')
		for (var i=0;i<pars.length;i++) {
			pars[i].className
			if (pars[i].className.indexOf('WizInput')!=-1) {
				pars[i].innerHTML='<textarea name=Message id=Message_9999 style=width:100%;height:250px; class=editThis></textarea>';
			}
		}
	}
	
	fCreateSimpleEditor();
	
}
function fPrimeNewsFeed() {

	if ($('DCMainDiv').addEventListener) {  // all browsers except IE before version 9
		$('DCMainDiv').addEventListener ('click', function () {fClosePulseFunctions('')}, false);
	}
	else {
		try {
			//$('DCMainDiv').attachEvent ('click', function (event) {fClosePulseFunctions});
			sFunc='fClosePulseFunctions()'
			$('DCMainDiv').onclick=function () {eval(sFunc)};
		}catch(e){alert(e);}
	}	
	
	if (bStreamSet==0) {	
		// The following works on all browsers - had trouble w/ click set attribute, come back to that later.
		//$('aPulse_Stream').setAttribute ("onclick", $('aPulse_Stream').onclick=$('aPulse_Stream').attributes[0].nodeValue+$('PPVBtout0').parentNode.attributes[0].nodeValue);
		sFunc='javascript:fPulseOpenOptions(\'aPulse_Stream\',0);'+$('StreamFunc').value;
		$('aPulse_Stream').href=sFunc;
		bStreamSet=1;
	}	
		
	if ($('PPVBtin0')!=null) {
		$('PPVBtin0').innerHTML='Stream';
	}
	
	if ($('PulseBanner')==null) {
		var sHTML='<div id=PulseBannerContainer>';
		sHTML=sHTML+'<div id=PulseBannerInner>';
		sHTML=sHTML+'<div id=PulseLogo>';
		sHTML=sHTML+'<img src=/dc_images/dc_spacer.gif />';
		sHTML=sHTML+'</div>';
		
		sHTML=sHTML+'<div id=PulseNewMessageInd onclick=javascript:fPulseOpenOptions(\'aPulse_MyProfile\',1);  class=NoMessages></div>';
		sHTML=sHTML+'<div id=PulseMailInd onclick=fClosePulseFunctions(\'\');DisplayShadowBox(0,\'SimpleDMailBox\'); class=NoMessages></div>';
		
		//Pulse My Spaces
		sHTML=sHTML+'<div id=PulseMySpacesContainer>'
		sHTML=sHTML+'<div id=PulseLink><a href=javascript:void(0) onclick=fClosePulseFunctions(\'PulseMySpaces\');ToggleElement(\'PulseMySpaces\');>My Spaces</a></div>'
		sHTML=sHTML+'<div id=PulseMySpaces class=x_PulseFunc style=display:none;><div id=PulseMySpacesInner>'
		
		eval($('dcPulseSpaces').value);
		for (i=0;i<oPulseSpaces.length;i++) {
			sHTML=sHTML+'<div class=MySpaces><a target=_blank href=?confcode='+oPulseSpaces[i]['PS_MasterMarketTemplateCode']+'><div>'+oPulseSpaces[i]['PS_Description']+'</div></a></div>'
		}
		
		sHTML=sHTML+'</div></div></div>';
		
		//Pulse Profile
		sHTML=sHTML+'<div id=PulseProfileInfo>';
		sHTML=sHTML+'<a href=javascript:void(0) onclick=fClosePulseFunctions(\'PulseProfileFunctionsContainer\');ToggleElement(\'PulseProfileFunctionsContainer\');>';
		sHTML=sHTML+'<div id=PulseProfileAvatar></div>';
		sHTML=sHTML+'<div id=PulseProfileName></div>';
		sHTML=sHTML+'</a>';
		
		//Pulse Functions
		sHTML=sHTML+'<div id=PulseProfileFunctionsContainer class=x_PulseFunc style=display:none;><div id=PulseProfileInner><div>'
		sHTML=sHTML+'<div class=MySpaces><a href=javascript:void(0) onclick=ToggleElement(\'PulseProfileFunctionsContainer\');DProfile('+lPD_LoggedInIdForLife+');><div>My Account</div></a></div>'
		sHTML=sHTML+'<div class=MySpaces><a href=javascript:void(0) onclick=ToggleElement(\'PulseProfileFunctionsContainer\');DCBMySimpleAccount();><div>More Account Options</div></a></div>'
		sHTML=sHTML+'<div class=MySpaces><a target=_blank onclick=ToggleElement(\'PulseProfileFunctionsContainer\'); href=?sp=10010&confcode='+lPD_OrigConfCode+'><div>Report an Issue</div></a></div>'
		sHTML=sHTML+'<div class=MySpaces><a target=_blank onclick=ToggleElement(\'PulseProfileFunctionsContainer\'); href=?sp=10020&confcode='+lPD_OrigConfCode+'><div>Enhancement Request</div></a></div>'
		sHTML=sHTML+'<div class=MySpaces><a onclick=fShowTools()><div>Tools</div></a></div>'
		sHTML=sHTML+'<div class=MySpaces><a onclick=fShowSearch() onclick=fShowTools()><div>Full Search</div></a></div>'
		sHTML=sHTML+'<div class=MySpaces id=PulseHelp><a href=javascript:void(0) onclick=ToggleElement(\'PulseProfileFunctionsContainer\');DCBHelpText(\'DCGetStarted\');><div>Help</div></a></div>'
		sHTML=sHTML+'<div class=MySpaces id=PulseLogOut><a target=_blank onclick=ToggleElement(\'PulseProfileFunctionsContainer\'); href=?p=210&sp=999&confcode='+lPD_OrigConfCode+'><div>Log Out</div></a></div>'
		
		sHTML=sHTML+'</div></div></div>';		
		
		sHTML=sHTML+'</div>';
		
		sHTML=sHTML+'<br class=ClearFix /></div></div>';
		
		var newLi = document.createElement('div');
		newLi.className='PulseInd';
		newLi.id='PulseBanner';	
		newLi.innerHTML=sHTML;
		
		$('DCMainBG').insertBefore(newLi, $('DCMainBG').firstChild);
	}		
		
	//FirstTime Through
	eval(document.getElementById('dcPulseProfileInfo').value);
	eval(document.getElementById('dcNewsFeedRefresh').value);
	
	if ($('PulseProfileInfo')!=null) {
		$('PulseProfileAvatar').innerHTML='<img src='+oPulseProfileInfo['P_Avatar']+' />'
		$('PulseProfileName').innerHTML='<span>'+oPulseProfileInfo['P_FullName']+'</span>'
	}

// Add Admin Links to pull down
	if (parseInt(oPulseProfileInfo['P_AdminVendorTot'])>0 && $('PulseAdminVendorLink')==null) {
		var sHTML='<a target=_blank href=?p=210&sp=2021&confcode=1332>'
		+ '<div>BackStage Administration</div>'
		+ '</a>'
		var newDiv = document.createElement('div');
		newDiv.innerHTML=sHTML;
		newDiv.className='MySpaces AdminLink'
		newDiv.id='PulseAdminVendorLink';
		$('PulseProfileInner').firstChild.insertBefore(newDiv, $('PulseHelp'));			
	}
	
	if (parseInt(oPulseProfileInfo['P_AdminTot'])>0 && $('PulseAdminLink')==null) {
		var sHTML='<a target=_blank href=?p=210&sp=400&confcode='+lPD_OrigConfCode+'>'
		+ '<div>Vendor Administration</div>'
		+ '</a>'
		var newDiv = document.createElement('div');
		newDiv.innerHTML=sHTML;
		newDiv.className='MySpaces AdminLink'
		newDiv.id='PulseAdminLink';
		$('PulseProfileInner').firstChild.insertBefore(newDiv, $('PulseHelp'));							
	}		
	
// DMail Counts
	if ($('PulseMailInd')!=null) {
		$('PulseMailInd').className='PulseMailInd NoMessages';
		$('PulseMailInd').innerHTML='';
		if (parseInt(oPulseProfileInfo['P_TotEmail'])>0) {
			$('PulseMailInd').innerHTML='<span>'+oPulseProfileInfo['P_TotEmail']+'</span>'
			$('PulseMailInd').className='PulseMailInd';
		}
	}	
// Close unneded divs
	
	if ($('divKeyInfo')!=null) {
		$('divKeyInfo').style.display='none';
	}
	if ($('divSpecHeader')!=null) {
		$('divSpecHeader').style.display='none';	
	}
	
//-- Online Users Update	
	if ($('divPulseOnlineUsersArea')!=null) {
		fPulseUpdateOnlineUsers();
	}
	
//-- My Registered Events	
	if ($('divPulseMyRegistrationsContainer')!=null) {
		fPulseUpdateMyRegistrations();
	}
	
//-- Market Events	
	if ($('divPulseEventsContainer')!=null) {
		fPulseUpdateEvents();
	}
	
//-- Affinity Pages
	if ($('divPulseAffinityContainer')!=null) {
		fPulseUpdateAffinityPages();
	}	

// Stream	
	fPulseBuildStream();
	
// Comments	& Attachments
	fBuildAllComments();
}	
function fPulseBuildStream(pMode,sJson) {
	
	var sHTML='';
	if (pMode==1) {
		eval(sJson);
		if (oPulseGuestProfileInfo['P_MIFL']!=lPD_LoggedInMIFL) {
			var sHTML=fBuildInitGUESTForm('1','form_1',oPulseGuestProfileInfo['P_MIFL']);
		}
		else {
			var sHTML=fBuildInitStatusForm();
		}
	}
	else {
		eval(document.getElementById('dcPulseProfileInfo').value);
		eval(document.getElementById('dcNewsFeedRefresh').value);
		var sHTML=fBuildInitStatusForm();
	}

	for (i=0;i<oNewsFeed.length;i++) {
		
		if (oNewsFeed[i]['Type']=='-4' || oNewsFeed[i]['Type']=='-25' || oNewsFeed[i]['Type']=='-2' || oNewsFeed[i]['Type']=='-24' || oNewsFeed[i]['Type']=='-23') {
			continue;
		}
		
		var sPulseKey=oNewsFeed[i]['Type']+'_'+oNewsFeed[i]['WhatId']+'_'+oNewsFeed[i]['OptId']+'_'+oNewsFeed[i]['OptId2']
		
		if (oNewsFeed[i]['Type']==5 || oNewsFeed[i]['Type']==-5) {
			sHTML=sHTML+'<div class=\'WizRow ListItem NoAvatar Pulse'+oNewsFeed[i]['Type']+'\' id=divNFRow_'+sPulseKey+'>'
		}
		else	{
			sHTML=sHTML+'<div class=\'WizRow ListItem Pulse'+oNewsFeed[i]['Type']+'\' id=divNFRow_'+sPulseKey+'>'
		}
		if (oNewsFeed[i]['Avatar'].length>0) {
			sHTML=sHTML+'<span class=Avatar><img src=\''+oNewsFeed[i]['Avatar']+'\'/></span>'
		}	
		if (oNewsFeed[i]['Avatar2'].length>0 && (oNewsFeed[i]['Type']==-7 || oNewsFeed[i]['Type']==-18)) {
			sHTML=sHTML+'<span class=Avatar2><img src=\''+oNewsFeed[i]['Avatar2']+'\'/></span>'
		}				
		sHTML=sHTML+'<span class=RightArea>'
		
		if (oNewsFeed[i]['Type']!='-8') {
			sHTML=sHTML+'<span class=FullName>'+oNewsFeed[i]['FullName']+'</span>'
		}
		
		if (oNewsFeed[i]['Type']=='-18' || oNewsFeed[i]['Type']=='-7') {
			sHTML=sHTML+'<span class=FullName2>'+oNewsFeed[i]['FullName2']+'</span>'
		}
		var sWhat=oNewsFeed[i]['What']
		
		if (sWhat.indexOf('StdRSS')!=-1) {
			sWhat=sWhat.replace(oNewsFeed[i]['FullName']+' - ','')
		}
		if (sWhat.indexOf('StdStatusUpdate')!=-1) {
			sWhat=sWhat.replace(oNewsFeed[i]['FullName']+' has updated Status: ','')
		}	
		if (oNewsFeed[i]['Type']=='-29') {
			sWhat=sWhat.replace('<img style=style=height:20px;margin-top:0px;margin-right:5px;margin-bottom:5px;margin-left:0px;vertical-align:middle;width:20px; src='+oNewsFeed[i]['Avatar'],'')
		}	
		
		if (oNewsFeed[i]['Type']=='-7') {
			sWhat=sWhat.replace('<span class=StdMessage>'+oNewsFeed[i]['FullName']+' Left you a new message - ','');
			sWhat=sWhat.replace('<span class=StdMessage>'+oNewsFeed[i]['FullName']+' Replied to your message - ','');
		}		
		
		// Make page breaks
		sWhat=sWhat.replace(/~/g,'<br/>');	
		
		// Change back selectors
		sWhat=sWhat.replace(/&lt;/g,'<');	
		sWhat=sWhat.replace(/&gt;/g,'>');	

		sHTML=sHTML+'<span class=What>'
		sHTML=sHTML+'<a href='+oNewsFeed[i]['pLink']+'>'
		sHTML=sHTML+sWhat;
		sHTML=sHTML+'</a></span>'
		
		if (oNewsFeed[i]['Pinned']=='True') {
			sHTML=sHTML+'<span class=Date>'+oNewsFeed[i]['pFlagType']+' - Pinned'
		}
		else	{
			if ((oNewsFeed[i]['Type']==-3 || oNewsFeed[i]['Type']==-7) && oNewsFeed[i]['OptId2']==lPD_MIFL) {
				sHTML=sHTML+'<span class=Date><a class=PulseDel href=javascript:void(0) onclick=DelWallMsg('+oNewsFeed[i]['OptId']+',0,\'divNFRow_'+sPulseKey+'\')>Delete</a><a class=PulseLike href=#>Like</a><a class=PulseCmt href=javascript:void(0); onclick=fOpenPulseComments(\'form_'+sPulseKey+'\')>Comment</a><span id=spanDate_'+sPulseKey+'>'+oNewsFeed[i]['pFlagType']+' - '+oNewsFeed[i]['pPubDate']+'</span>'
			}
			else if (oNewsFeed[i]['Type']==-4 || oNewsFeed[i]['Type']==-2) {
				sHTML=sHTML+'<span class=Date>'+oNewsFeed[i]['pFlagType']+' - '+oNewsFeed[i]['pPubDate']+'</span>'
			}
			else {
				sHTML=sHTML+'<span class=Date><a class=PulseLike href=#>Like</a><a class=PulseCmt href=javascript:void(0); onclick=fOpenPulseComments(\'form_'+sPulseKey+'\')>Comment</a><span id=spanDate_'+sPulseKey+'>'+oNewsFeed[i]['pFlagType']+' - '+oNewsFeed[i]['pPubDate']+'</span>'
			}
		}
					
		sHTML=sHTML+'</span>'
		sHTML=sHTML+'<div class=divPulseForm id=divPulseForm_'+sPulseKey+'>'
		sHTML=sHTML+'<form style=display:none; name=PulseForm id=\'form_'+sPulseKey+'\' method=Post action=\'/dc_includes/cp6_PulseComment.asp\' onsubmit=return(fUpdatePulseComment(\''+sPulseKey+'\'))>'
		sHTML=sHTML+'<input type=hidden name=PNFUpd id=\'PNFUpd_'+sPulseKey+'\'>'
		sHTML=sHTML+'<input type=hidden name=PulseKey id=\'PNFPulseKey_'+sPulseKey+'\' value=\''+sPulseKey+'\'>'
		sHTML=sHTML+'<input type=hidden name=PulsePubDate value=\''+oNewsFeed[i]['PubDate']+'\' id=\'PulsePubDate_'+sPulseKey+'\'>'
		sHTML=sHTML+'<input type=hidden name=PulseGUID value=\''+$('PulseGUID').value+'\'>'
		sHTML=sHTML+'<input type=hidden name=PulseOwnerChronicleKey value=\''+oNewsFeed[i]['OptId']+'\' id=\'PulseOwnerChronicleKey_'+sPulseKey+'\'>'
		sHTML=sHTML+'<div style=display:none; id=\'PulseFormJSON_'+sPulseKey+'\'></div>'
		sHTML=sHTML+'<input type=hidden name=PulseChronicle id=PulseChronicle_'+sPulseKey+'>'
		sHTML=sHTML+'<div class=WizRow>'
		sHTML=sHTML+'<textarea class=StdInput onfocus=\'try{$(\"StatusUpdFooter\").style.display=\"none\"}catch(e){};fClearText(\"Write a comment...\",this.id);\' name=PulseComment id=PulseReply_'+sPulseKey+' onkeypress=\'$(\"StdShare_'+sPulseKey+'\").className=\"StdShare FocusButton\";\'>Write a comment...</textarea>'
		sHTML=sHTML+'</div>'
		sHTML=sHTML+'<div class=\'WizRow Footer Options\'>'
		sHTML=sHTML+'<a class=StdUpload href=javascript:void(0); onclick=\'divSBEval=fRebuildPulse();DisplayShadowBox(0,\"CP6SINGLEUPLOAD\",\"&sid=Personal_DCP_'+lPD_MIFL+'&formguid='+$('PulseGUID').value+'&marketcode=PERSONAL&t=image\/jpeg,image\/gif,image\/bmp,image\/bmp,image\/png,image\/pjpeg&xc=&isp=-110\");\'>Add File</a><a id=StdShare_'+sPulseKey+' class=StdShare href=javascript:void(0); onclick=fUpdatePulseCommentInd(\''+sPulseKey+'\')>Share</a>'
		sHTML=sHTML+'</div>'
		sHTML=sHTML+'</form>'
		sHTML=sHTML+'</div>'
		sHTML=sHTML+'</div></div>'
	
	}

	$('divNFData').innerHTML=sHTML

}	
function fCountNews() {
	
	if ($('HidePanel').style.display=='none') {
		return;
	}

	for (i=0;i<oNewsFeed.length;i++) {
		delete oNewsFeed[i];
	}
	
	var sHTML='';	
	var iNewItems=0;
	var iNewMessagesCount=0;
	var iNewMailCount=0;

// Count New Messages	
	eval($('dcNewsFeedCommentsRefresh').value);	
	for (i=0;i<oNewsFeedComments.length;i++) {
		if (oNewsFeedComments[i]['PK_OwnerId']==lPD_MIFL && oNewsFeedComments[i]['PK_MessageRead']!=1) {
			iNewMessagesCount=iNewMessagesCount+1
		}
	}
	
	if ($('PulseNewMessageInd')!=null) {
		$('PulseNewMessageInd').className='PulseInd NoMessages';
		$('PulseNewMessageInd').innerHTML='';
		if (iNewMessagesCount>0) {
			$('PulseNewMessageInd').innerHTML='<span>'+iNewMessagesCount+'</span>'
			$('PulseNewMessageInd').className='PulseInd';
		}
	}
	
// Count New Items	
	eval(document.getElementById('dcNewsFeedRefresh').value);
	for (i=0;i<oNewsFeed.length;i++) {
		if (oNewsFeed[i]['Type']=='-4' || oNewsFeed[i]['Type']=='-25' || oNewsFeed[i]['Type']=='-2' || oNewsFeed[i]['Type']=='-24') {
			continue;
		}
		
		if ($('divNFRow_'+oNewsFeed[i]['Type']+'_'+oNewsFeed[i]['WhatId']+'_'+oNewsFeed[i]['OptId']+'_'+oNewsFeed[i]['OptId2'])==null) {
			iNewItems=iNewItems+1;
		}
	}	
	
	eval(document.getElementById('dcPulseProfileInfo').value);
// DMail Counts
	if ($('PulseMailInd')!=null) {
		$('PulseMailInd').className='PulseMailInd NoMessages';
		$('PulseMailInd').innerHTML='';
		if (parseInt(oPulseProfileInfo['P_TotEmail'])>0) {
			$('PulseMailInd').innerHTML='<span>'+oPulseProfileInfo['P_TotEmail']+'</span>'
			$('PulseMailInd').className='PulseMailInd';
		}
	}	

	if (parseInt(iNewItems)>1) {
			if ($('divNFNote')==null) {
				var newLi = document.createElement('div');
				newLi.className='NewMessagesNotification';
				newLi.id='divNFNote';		
				sHTML='<a href=javascript:fUpdateNews(1);>'+iNewItems+' New Items</a>';
				newLi.innerHTML=sHTML;
				$('divNFData').insertBefore(newLi, $('divNFData').firstChild);
			}
			else	{
				sHTML='<a href=javascript:fUpdateNews();>'+iNewItems+' new items</a>';
				$('divNFNote').innerHTML=sHTML;
			}
	}
	else {
		fUpdateNews();
	}
}
function fUpdateNews(bMode) {

//-- Online Users	
	if ($('divPulseOnlineUsersArea')!=null) {
		fPulseUpdateOnlineUsers();
	}	
	
//-- My Registered Events	
	if ($('divPulseMyRegistrationsContainer')!=null) {
		fPulseUpdateMyRegistrations();
	}	
	
//-- Market Events	
	if ($('divPulseEventsContainer')!=null) {
		fPulseUpdateEvents();
	}
	
//-- Affinity Pages
	if ($('divPulseAffinityContainer')!=null) {
		fPulseUpdateAffinityPages();
	}	
	
	if ($('divNFNote')!=null) {
		$('divNFNote').parentNode.removeChild($('divNFNote'));
	}
	for (i=0;i<oNewsFeed.length;i++) {
		delete oNewsFeed[i];
	}
	var sHTML='';
	eval(document.getElementById('dcNewsFeedRefresh').value);
	
// Build List	
	for (i=0;i<oNewsFeed.length;i++) {
		if (oNewsFeed[i]['Type']=='-4' || oNewsFeed[i]['Type']=='-25' ||  oNewsFeed[i]['Type']=='-2' ||  oNewsFeed[i]['Type']=='-24') {
			continue;
		}		
		
		var sPulseKey=oNewsFeed[i]['Type']+'_'+oNewsFeed[i]['WhatId']+'_'+oNewsFeed[i]['OptId']+'_'+oNewsFeed[i]['OptId2']
		if ($('divNFRow_'+sPulseKey)==null) {
			var newLi = document.createElement('div');
			
			if (oNewsFeed[i]['Type']==5 || oNewsFeed[i]['Type']==-5 || oNewsFeed[i]['Type']==-2) {
				newLi.setAttribute('class', 'WizRow ListItem NoAvatar Pulse'+oNewsFeed[i]['Type']);
			}
			else {
				newLi.setAttribute('class', 'WizRow ListItem Pulse'+oNewsFeed[i]['Type']);
			}
			newLi.setAttribute('id', 'divNFRow_'+sPulseKey);
			newLi.style.display='none';
			
			sHTML='';
			if (oNewsFeed[i]['Avatar'].length>0) {
				sHTML=sHTML+'<span class=Avatar><img src=\''+oNewsFeed[i]['Avatar']+'\'/></span>'
			}	
			sHTML=sHTML+'<span class=RightArea>'				
			sHTML=sHTML+'<span class=FullName>'+oNewsFeed[i]['FullName']+'</span>'
			if (oNewsFeed[i]['Type']=='-18') {
				sHTML=sHTML+'<span class=FullName2>'+oNewsFeed[i]['FullName2']+'</span>'
			}
			sWhat=oNewsFeed[i]['What']
			if (sWhat.indexOf('StdRSS')!=-1) {
				sWhat=sWhat.replace(oNewsFeed[i]['FullName']+' - ','')
			}
			if (sWhat.indexOf('StdStatusUpdate')!=-1) {
				sWhat=sWhat.replace(oNewsFeed[i]['FullName']+' has updated Status: ','')
			}							
			sHTML=sHTML+'<span class=What>'
			sHTML=sHTML+'<a href='+oNewsFeed[i]['pLink']+'>'
			sHTML=sHTML+sWhat;
			sHTML=sHTML+'</a></span>'
		
			if (oNewsFeed[i]['Pinned']=='True') {
				sHTML=sHTML+'<span class=Date>'+oNewsFeed[i]['pFlagType']+' - Pinned'
			}
			else	{
				if (oNewsFeed[i]['Type']==-3 && oNewsFeed[i]['OptId2']==lPD_MIFL) {
					sHTML=sHTML+'<span class=Date><a class=PulseDel href=javascript:void(0) onclick=DelWallMsg('+oNewsFeed[i]['OptId']+',0,\'divNFRow_'+sPulseKey+'\')>Delete</a><a class=PulseLike href=#>Like</a><a class=PulseCmt href=javascript:void(0); onclick=fOpenPulseComments(\'form_'+sPulseKey+'\')>Comment</a><span id=spanDate_'+sPulseKey+'>'+oNewsFeed[i]['pFlagType']+' - '+oNewsFeed[i]['pPubDate']+'</span>'
				}
				else if (oNewsFeed[i]['Type']==-4 || oNewsFeed[i]['Type']==-2 || oNewsFeed[i]['Type']==-7) {
					sHTML=sHTML+'<span class=Date>'+oNewsFeed[i]['pFlagType']+' - '+oNewsFeed[i]['pPubDate']+'</span>'
				}				
				else {
					sHTML=sHTML+'<span class=Date><a class=PulseLike href=#>Like</a><a class=PulseCmt href=javascript:void(0); onclick=fOpenPulseComments(\'form_'+sPulseKey+'\')>Comment</a><span id=spanDate_'+sPulseKey+'>'+oNewsFeed[i]['pFlagType']+' - '+oNewsFeed[i]['pPubDate']+'</span>'
				}
			}
			
			sHTML=sHTML+'</span>'
			sHTML=sHTML+'<div class=divPulseForm id=divPulseForm_'+sPulseKey+'>'
			sHTML=sHTML+'<form style=display:none; name=PulseForm id=\'form_'+sPulseKey+'\' method=Post action=\'/dc_includes/cp6_PulseComment.asp\' onsubmit=return(fUpdatePulseComment(\''+sPulseKey+'\'))>'
			sHTML=sHTML+'<input type=hidden name=PNFUpd id=\'PNFUpd_'+sPulseKey+'\'>'
			sHTML=sHTML+'<input type=hidden name=PulseKey id=\'PNFPulseKey_'+sPulseKey+'\' value=\''+sPulseKey+'\'>'
			sHTML=sHTML+'<input type=hidden name=PulsePubDate value=\''+oNewsFeed[i]['PubDate']+'\' id=\'PulsePubDate_'+sPulseKey+'\'>'
			sHTML=sHTML+'<input type=hidden name=PulseGUID value=\''+$('PulseGUID').value+'\'>'
			sHTML=sHTML+'<input type=hidden name=PulseOwnerChronicleKey value=\''+oNewsFeed[i]['OwnerChronicleKey']+'\' id=\'PulseOwnerChronicleKey_'+sPulseKey+'\'>'
			sHTML=sHTML+'<div style=display:none; id=\'PulseFormJSON_'+sPulseKey+'\'></div>'
			sHTML=sHTML+'<input type=hidden name=PulseChronicle id=PulseChronicle_'+sPulseKey+'>'
			sHTML=sHTML+'<div class=WizRow>'
			sHTML=sHTML+'<textarea class=StdInput onfocus=\'try{$(\"StatusUpdFooter\").style.display=\"none\"}catch(e){};fClearText(\"Write a comment...\",this.id);\' name=PulseComment id=PulseReply_'+sPulseKey+' onkeypress=\'$(\"StdShare_'+sPulseKey+'\").className=\"StdShare FocusButton\";\'>Write a comment...</textarea>'
			sHTML=sHTML+'</div>'
			sHTML=sHTML+'<div class=\'WizRow Footer Options\'>'
			sHTML=sHTML+'<a class=StdUpload href=javascript:void(0); onclick=\'DisplayShadowBox(0,\"CP6SINGLEUPLOAD\",\"&sid=Personal_DCP_'+lPD_MIFL+'&formguid='+$('PulseGUID').value+'&marketcode=PERSONAL&t=image\/jpeg,image\/gif,image\/bmp,image\/bmp,image\/png,image\/pjpeg&xc=&isp=-110\");\'>Add File</a><a id=StdShare_'+sPulseKey+' class=StdShare href=javascript:void(0) onclick=fUpdatePulseCommentInd(\''+sPulseKey+'\')>Share</a>'
			sHTML=sHTML+'</div>'
			sHTML=sHTML+'</form>'
			sHTML=sHTML+'</div>'
			sHTML=sHTML+'</div>'
			
			sNewDate=new Date(oNewsFeed[i]['PubDate'])
			sTmpId=$('divNFData').firstChild.id
			sTmpId=sTmpId.replace('divNFRow_','PulsePubDate_');
			sTargetDate=new Date($(sTmpId).value);
			
			if (sTargetDate<sNewDate) {

				newLi.innerHTML=sHTML;
			
				$('divNFData').insertBefore(newLi, $('divNFData').firstChild);
				//Effect.BlindDown(newLi.id, { duration: .5, queue: { position: 'end', scope: 'NewsScope'}});		
				newLi.style.display='';
			}
		}
		else {
			if (oNewsFeed[i]['Pinned']!='True') {
				$('spanDate_'+sPulseKey).innerHTML=oNewsFeed[i]['pFlagType']+' - '+oNewsFeed[i]['pPubDate'];
			}			
		}
	}
	fBuildAllComments()
}
function fOpenPulseComments(elemId) {
	CloseByIdPattern('div','SUArea_',0,0);
	CloseByIdPattern('form','form_',0,0);
	if ($('StatusUpdFooter')) {
		$('StatusUpdFooter').style.display='none';
	}

	//Reopen Status Update Form.. sheez!
	if ($('form_0')) {
		$('form_0').style.display='';
	}
	if ($('form_1')) {
		$('form_1').style.display='';
	}	
// Remove unwanted divs - avoiding conflict
  if ($('HidePanel').style.display=='none') {
		pars=$('divNFData').getElementsByTagName('div');
		for (i=0;i<pars.length;i++) {
			if (pars[i].id.indexOf('divPulseForm_')!=-1 || pars[i].id.indexOf('divPulseForm_')!=-1) {
				pars[i].innerHTML='';
				if (pars[i].id.indexOf('divPulseForm_')!=-1) {
					pars[i].parentNode.innerHTML='';
				}
			}
		}
		pars=$('divNFData').getElementsByTagName('a');
		for (i=0;i<pars.length;i++) {
			if (pars[i].id.indexOf('StdShare_')!=-1) {
				pars[i].parentNode.innerHTML='';
			}
		}		
	}
	if ($(elemId)) {
		$(elemId).style.display='';
	}
	
	//Reset All Sharebutton classes
	pars=$('divNewsPulseContainer').getElementsByTagName('a');
	for (i=0;i<pars.length;i++) {
		if (pars[i].className.indexOf('FocusButton')!=-1) {
			pars[i].className='StdShare';
		}
	}	
}
function fOpenPulseOptions (elemId) {
	var sDispMode='';
	if ($(elemId)!=null) {
		sDispMode=$(elemId).style.display;
	}
	CloseByIdPattern('div','SUArea_',0,0);
	if ($(elemId)!=null) {
		if (sDispMode=='none') {
			$(elemId).style.display='none';	
		}
		else {
			$(elemId).style.display='';	
		}
	}
}
function fUpdatePulseCommentInd(pulsekey) {
	fUpdatePulseComment(pulsekey);
}
function fUpdatePulseComment(pulseKey) {
	
	CloseByIdPattern('div','SUArea_',0,0);
	
	$('PNFUpd_'+pulseKey).value="1";
	var sDest='PulseFormJSON_'+pulseKey;
	
	if ($('PulseReply_'+pulseKey).value=='Write a comment...') {
		alert ('You did not add a comment');
		$('PulseReply_'+pulseKey).focus();
		return false;
	}
	if (pulseKey==0) {
		ValidatefEmpApprov('form_'+pulseKey,'PNFUpd_'+pulseKey,sDest,'fBuildNewStatusUpdate(\''+pulseKey+'\')');
	}
	else if	(pulseKey==1){
		pars=$('HidePanel').getElementsByTagName('div')
		for (i=0;i<pars.length;i++) {
			if (pars[i].id=='divPulseGuestForm_1') {
				pars[i].parentNode.removeChild(pars[i]);
			}
		}
		ValidatefEmpApprov('formGuest_'+pulseKey,'PNFUpd_'+pulseKey,sDest,'fBuildNewStatusUpdate(\''+pulseKey+'\')');
	}
	else {
		ValidatefEmpApprov('form_'+pulseKey,'PNFUpd_'+pulseKey,sDest,'fBuildPulseComment(\''+pulseKey+'\')');
	}
	
	return false;			
}
function fBuildAllComments(pMode) {

	for (i=0;i<oNewsFeedComments.length;i++) {
		delete oNewsFeedComments[i];
	}

	if (pMode==1) {
		eval($('divPulseJSON').innerHTML);
	}
	else {
		var sKey='dcNewsFeedCommentsRefresh';
		eval($('dcNewsFeedCommentsRefresh').value);
	}

// Count New Messages	
	var iNewMessagesCount=0;
	for (i=0;i<oNewsFeedComments.length;i++) {
		if (oNewsFeedComments[i]['PK_OwnerId']==lPD_MIFL && oNewsFeedComments[i]['PK_MessageRead']!=1) {
			iNewMessagesCount=iNewMessagesCount+1
		}
	}
	
	if ($('PulseNewMessageInd')!=null) {
		$('PulseNewMessageInd').className='PulseInd NoMessages';
		$('PulseNewMessageInd').innerHTML='';
		if (iNewMessagesCount>0) {
			$('PulseNewMessageInd').innerHTML='<span>'+iNewMessagesCount+'</span>'
			$('PulseNewMessageInd').className='PulseInd';
		}
	}

// Build Out Comments	

	for (i=0;i<oNewsFeedComments.length;i++) {
		if ($('WM_'+oNewsFeedComments[i]['PK_CBID'])==null) {			
			sPK_Message=oNewsFeedComments[i]['PK_Message'].replace(/~/g,'<br/>')
			
			var sHTML='<div class=PulseComment>'
			sHTML=sHTML+'<span class=Avatar><img class=SmallAvatar src='+oNewsFeedComments[i]['PK_Avatar']+'></span><div class=WizRow>'
			sHTML=sHTML+'<span class=Message><span class=FullName>'+oNewsFeedComments[i]['PK_FullName']+'</span>'+sPK_Message+'</span>'
			sHTML=sHTML+'<br class=ClearFix>'
			sHTML=sHTML+'</div>'
			if (oNewsFeedComments[i]['PK_GuestMIFL']==lPD_MIFL) {
				sHTML=sHTML+'<div class=Date><a href=javascript:DelWallMsg('+oNewsFeedComments[i]['PK_CBID']+',0,\''+'WM_'+oNewsFeedComments[i]['PK_CBID']+'\')>Delete</a><a href=#>Like</a> - <span id=PCD_'+oNewsFeedComments[i]['PK_CBID']+'>'+oNewsFeedComments[i]['PK_PubDate']+'</span></div>'
			}
			else {
				sHTML=sHTML+'<div class=Date><a href=#>Like</a> - <span id=PCD_'+oNewsFeedComments[i]['PK_CBID']+'>'+oNewsFeedComments[i]['PK_PubDate']+'</span></div>'
			}
			sHTML=sHTML+'<div id=wmf_'+oNewsFeedComments[i]['PK_CBID']+' style=display:none;"></div></div>'
	
			var newLi = document.createElement('div');
			newLi.setAttribute('id', 'WM_'+oNewsFeedComments[i]['PK_CBID']);
			newLi.className='WM1';
			newLi.innerHTML=sHTML;
	
			if ($('divPulseForm_'+oNewsFeedComments[i]['PK_PulseKey'])!=null) {
				
				$('divPulseForm_'+oNewsFeedComments[i]['PK_PulseKey']).insertBefore(newLi, $('form_'+oNewsFeedComments[i]['PK_PulseKey']));
		
				$('PNFUpd_'+oNewsFeedComments[i]['PK_PulseKey']).value='';
				$('PulseReply_'+oNewsFeedComments[i]['PK_PulseKey']).value='Write a comment...';
				$('form_'+oNewsFeedComments[i]['PK_PulseKey']).style.display='none';
			}
		}
		else {
			$('PCD_'+oNewsFeedComments[i]['PK_CBID']).innerHTML=oNewsFeedComments[i]['PK_PubDate']
		}
	}	
	// Attachments					
	fPulseUpdateAttachments(0);
}

function fBuildPulseComment(pulseKey,CBID) {

	for (i=0;i<oNewsFeedComments.length;i++) {
		delete oNewsFeedComments[i];
	}
	
	var sKey='PulseFormJSON_'+pulseKey;
	eval($(sKey).innerHTML);
	
	sPK_Message=oNewsFeedComments['PK_'+pulseKey+'_Message'].replace(/~/g,'<br/>')
	
	var sHTML='<div class=PulseComment>'
	sHTML=sHTML+'<span class=Avatar><img class=SmallAvatar src='+oNewsFeedComments['PK_'+pulseKey+'_Avatar']+'></span><div class=WizRow>'
	sHTML=sHTML+'<span class=Message><span class=FullName>'+oNewsFeedComments['PK_'+pulseKey+'_FullName']+'</span>'+sPK_Message+'</span>'
	sHTML=sHTML+'<br class=ClearFix>'
	sHTML=sHTML+'</div>'
	if (oNewsFeedComments['PK_'+pulseKey+'_GuestMIFL']==lPD_MIFL) {	
		sHTML=sHTML+'<div class=Date><a href=javascript:DelWallMsg('+oNewsFeedComments['PK_'+pulseKey+'_CBID']+',0,\''+'WM_'+oNewsFeedComments['PK_'+pulseKey+'_CBID']+'\')>Delete</a><a href=#>Like</a> - <span id=PCD_'+oNewsFeedComments['PK_'+pulseKey+'_CBID']+'>'+oNewsFeedComments['PK_'+pulseKey+'_PubDate']+'</span></div>'
	}
	else {
		sHTML=sHTML+'<div class=Date><a href=#>Like</a> - <span id=PCD_'+oNewsFeedComments['PK_'+pulseKey+'_CBID']+'>'+oNewsFeedComments['PK_'+pulseKey+'_PubDate']+'</span></div>'
	}
	sHTML=sHTML+'<div id=wmf_'+oNewsFeedComments['PK_'+pulseKey+'_CBID']+' style=display:none;"></div></div>'	
	
	var newLi = document.createElement('div');
	newLi.setAttribute('id', 'WM_'+oNewsFeedComments['PK_'+pulseKey+'_CBID']);
	newLi.className='WM1';
	newLi.innerHTML=sHTML;
	//newLi.style.display='none';
	
	$('divPulseForm_'+pulseKey).insertBefore(newLi, $('form_'+pulseKey));
	//new Effect.Appear(newLi.id, {duration:.5, queue: { position: 'end', scope: 'PulseScope'}});
	
	$('PNFUpd_'+pulseKey).value='';
	$('PulseReply_'+pulseKey).value='Write a comment...';
	$('form_'+pulseKey).style.display='none';
	
	fPulseUpdateAttachments(0);
	
}
function fBuildNewStatusUpdate(pulseKey,CBID) {

	for (i=0;i<oNewsFeedComments.length;i++) {
		delete oNewsFeedComments[i];
	}
	
	var sKey='PulseFormJSON_'+pulseKey;
	var sSvSrc=$(sKey).innerHTML;
	eval($(sKey).innerHTML);
	
	sPK_Message=oNewsFeedComments['PK_0_Message'].replace(/~/g,'<br/>')
	
	var sHTML=fBuildInitStatusForm(1);
 	sHTML=sHTML+'<div class=\'WizRow ListItem Pulse0\' id=divNFRow_'+oNewsFeedComments['PK_0_PulseKey']+'>'
	if (oNewsFeedComments['PK_0_Avatar'].length>0) {
		sHTML=sHTML+'<span class=Avatar><img src=\''+oNewsFeedComments['PK_0_Avatar']+'\'/></span>'
	}		
	sHTML=sHTML+'<span class=RightArea>'
		
	sHTML=sHTML+'<span class=What>'
	sHTML=sHTML+'<a href=DProfile('+oNewsFeedComments['PK_0_GuestIFL']+');>'
	sHTML=sHTML+sPK_Message;
	sHTML=sHTML+'</a></span>'
		
	sHTML=sHTML+'<span class=Date><a class=PulseDel href=javascript:void(0) onclick=DelWallMsg('+oNewsFeedComments['PK_0_CBID']+',0,\'divNFRow_'+oNewsFeedComments['PK_0_PulseKey']+'\')>Delete</a><a class=PulseLike href=#>Like</a><a class=PulseCmt href=javascript:void(0); onclick=fOpenPulseComments(\'form_'+oNewsFeedComments['PK_0_PulseKey']+'\')>Comment</a><span id=spanDate_'+oNewsFeedComments['PK_0_PulseKey']+'>Status Change - '+oNewsFeedComments['PK_0_PubDate']+'</span>'
					
	sHTML=sHTML+'</span>'
	sHTML=sHTML+'<div class=divPulseForm id=divPulseForm_'+oNewsFeedComments['PK_0_PulseKey']+'>'
	sHTML=sHTML+'<form style=display:none; name=PulseForm id=\'form_'+oNewsFeedComments['PK_0_PulseKey']+'\' method=Post action=\'/dc_includes/cp6_PulseComment.asp\' onsubmit=return(fUpdatePulseComment(\''+oNewsFeedComments['PK_0_PulseKey']+'\'))>'
	sHTML=sHTML+'<input type=hidden name=PNFUpd id=\'PNFUpd_'+oNewsFeedComments['PK_0_PulseKey']+'\'>'
	sHTML=sHTML+'<input type=hidden name=PulseKey id=\'PNFPulseKey_'+oNewsFeedComments['PK_0_PulseKey']+'\' value=\''+oNewsFeedComments['PK_0_PulseKey']+'\'>'
	sHTML=sHTML+'<input type=hidden name=PulsePubDate value=\''+oNewsFeedComments['PK_0_PubDate']+'\' id=\'PulsePubDate_'+oNewsFeedComments['PK_0_PulseKey']+'\'>'
	sHTML=sHTML+'<input type=hidden name=PulseGUID value=\''+$('PulseGUID').value+'\'>'
	sHTML=sHTML+'<input type=hidden name=PulseOwnerChronicleKey value=\''+oNewsFeedComments['PK_0_CBID']+'\' id=\'PulseOwnerChronicleKey_'+oNewsFeedComments['PK_0_PulseKey']+'\'>'
	sHTML=sHTML+'<div style=display:none; id=\'PulseFormJSON_'+oNewsFeedComments['PK_0_PulseKey']+'\'></div>'
	sHTML=sHTML+'<input type=hidden name=PulseChronicle id=PulseChronicle_'+oNewsFeedComments['PK_0_PulseKey']+'>'
	sHTML=sHTML+'<div class=WizRow>'
	sHTML=sHTML+'<textarea class=StdInput onfocus=\'try{$(\"StatusUpdFooter\").style.display=\"none\"}catch(e){};fClearText(\"Write a comment...\",this.id);\' name=PulseComment id=PulseReply_'+oNewsFeedComments['PK_0_PulseKey']+' onkeypress=\'$(\"StdShare_'+oNewsFeedComments['PK_0_PulseKey']+'\").className=\"StdShare FocusButton\";\'>Write a comment...</textarea>'
	sHTML=sHTML+'</div>'
	sHTML=sHTML+'<div class=\'WizRow Footer Options\'>'
	sHTML=sHTML+'<a class=StdUpload href=javascript:void(0); onclick=\'DisplayShadowBox(0,\"CP6SINGLEUPLOAD\",\"&sid=Personal_DCP_'+lPD_MIFL+'&formguid='+$('PulseGUID').value+'&marketcode=PERSONAL&t=image\/jpeg,image\/gif,image\/bmp,image\/bmp,image\/png,image\/pjpeg&xc=&isp=-110\");\'>Add File</a><a id=Share_'+oNewsFeedComments['PK_0_PulseKey']+' class=StdShare href=javascript:void(0); onclick=fUpdatePulseCommentInd(\''+oNewsFeedComments['PK_0_PulseKey']+'\')>Share</a>'
	sHTML=sHTML+'</div>'
	sHTML=sHTML+'</form>'
	sHTML=sHTML+'</div>'
	sHTML=sHTML+'</div></div>'
	
	if ($('divPulseForm_1')) {
		$('divPulseForm_1').innerHTML=sHTML;
	}
	else {
		$('divPulseForm_0').innerHTML=sHTML;
	}

	fPulseUpdateAttachments(1,sSvSrc);
	
}
function fClosePulseFunctions (elemId) {
	//CloseEmailWindow();
	
	pars=$('PulseBannerInner').getElementsByTagName('div');
	for (i=0;i<pars.length;i++) {
		if (pars[i].className.indexOf('x_PulseFunc')!=-1 && pars[i].id!=elemId) {
			pars[i].style.display='none';
		}
	}
}
function fPulseUpdateEvents() {

	if (oPulseEvents!=null) {
		for (i=0;i<oPulseEvents.length;i++) {
			delete oPulseEvents[i];
		}
	}
			
	eval($('dcPulseEvents').value)
	var sHTML='';
	for (i=0;i<	oPulseEvents.length;i++) {
		sHTML=sHTML+'<div class=\"WizRow ListItem\">';
		if (oPulseEvents[i]['PE_Type']==0) {
			sHTML=sHTML+'<a href=javascript:void(0); onclick=DisplayShadowBox(0,\'CP6PURPOSE\',\'&mode=1&sid='+oPulseEvents[i]['PE_SID']+'\');>'
		}
		else {
			sHTML=sHTML+'<a href=javascript:void(0); onclick=DSimpSched(\''+oPulseEvents[i]['PE_SID']+'\');>'
		}
		sHTML=sHTML+'<span class=EventTitle>'+oPulseEvents[i]['PE_Title']+'</span></a>'
		+'<div class=PulseAddlInfo>'
		+'<span class=Date>'+oPulseEvents[i]['PE_StartDate']+'</span>'
		if (parseInt(oPulseEvents[i]['PE_TotReg'])>0) {
			sHTML=sHTML+' - <span class=Reg>'+oPulseEvents[i]['PE_TotReg']+'</span>';
		}
		if (oPulseEvents[i]['PE_State'].length>0) {
			sHTML=sHTML+' - <span class=State>'+oPulseEvents[i]['PE_State']+'</span>';
		}
		sHTML=sHTML+'</div></div>';
	}
	if (sHTML.length>0) {
		sHTML='<div class=PulseBox id=divPulseEvents>'
		+'<h4>Events/Activities</h4>'
		+'<div class=divPulseEventsInner>'		
		+sHTML
		+'</div></div>';
		
		$('divPulseEventsContainer').innerHTML=sHTML;	
	}	
	else {
		$('divPulseEventsContainer').innerHTML='';
	}		
}
function fPulseUpdateAttachments(pMode,evalSrc) {
	
	if (oPulseAttachments!=null) {
		for (i=0;i<oPulseAttachments.length;i++) {
			delete oPulseAttachments[i];
		}
	}	
	
	if (pMode!=1) {
		eval($('dcPulseAttachments').value)
	}
	else {
		eval(evalSrc)
	}
	
	var sHTML='';
	for (i=0;i<	oPulseAttachments.length;i++) {
		sHTML='<div class=\"WizRow PATTFRow\">'
		+ '<div class=PATT_Left><div class=ImgArea>'
		+ '	<img src=\''+oPulseAttachments[i]['PAAtt_RelativePath']+'\' class=PATT_File>'
		+ '</div></div>'
		+ '<div class=PATT_Right><div class=PATT_RightInner>'
		+ '</div></div><br class=ClearFix />'
		+ '<div class=PulseAddlInfo>File: '+oPulseAttachments[i]['PAAtt_FileName']+' - Created: '+oPulseAttachments[i]['PAAtt_FileDate']+'</div>'
		+ '</div>'
		
		if (sHTML.length>0 && $('PATT_'+oPulseAttachments[i]['PAAtt_AssocId'])==null) {
			var newDiv = document.createElement('div');
  		newDiv.setAttribute('id','PATT_'+oPulseAttachments[i]['PAAtt_AssocId']);
  		newDiv.innerHTML=sHTML;
			try {
				var sKey=oPulseAttachments[i]['PAAtt_PulseKey']
				if ($('divPulseForm_'+sKey)!=null) {
					$('divPulseForm_'+sKey).insertBefore(newDiv, $('divPulseForm_'+sKey).firstChild);
				}
			}catch(e){alert(e)}
		}			
	}
}
function fPulseUpdateAffinityPages() {

	if (oPulseAffSpaces!=null) {
		for (i=0;i<oPulseAffSpaces.length;i++) {
			delete oPulseAffSpaces[i];
		}
	}
			
	eval($('dcPulseAffSpaces').value)
	var sHTML='';
	for (i=0;i<	oPulseAffSpaces.length;i++) {
		sHTML=sHTML+'<div class=\"WizRow PAFFRow\">'
		+ '<div class=PAff_Left>'
		+ '	<img src=\''+oPulseAffSpaces[i]['PAFF_Avatar']+'\' class=PAFF_Pic>'
		+ '</div>'
		+ '<div class=PAff_Link><a onclick=fDispGroupFanPage('+oPulseAffSpaces[i]['PAFF_Id']+'); href=javascript:void(0);>'+oPulseAffSpaces[i]['PAFF_Name']+'</a></div>'
		+ '<div class=PAff_Desc>'+oPulseAffSpaces[i]['PAFF_Description']+'</div>'
		+ '<div class=\'WizRow Options Footer RightLight\'>'
		+ '<span>'
		if (oPulseAffSpaces[i]['PAFF_LatestPost'].length>0) {
			sHTML=sHTML+'Last Post: '+oPulseAffSpaces[i]['PAFF_LatestPost'];
		}
		if (oPulseAffSpaces[i]['PAFF_TotPosts'].length>0) {
			sHTML=sHTML+' Blogs - '+oPulseAffSpaces[i]['PAFF_TotPosts'];
		}
		sHTML=sHTML+'</span>'
		+ '</div>'
		+ '</div>'
	}
	if (sHTML.length>0) {
		sHTML='<div class=PulseBox id=divPulseAffinityPages>'
		+'<h4>Affinity Pages</h4>'
		+'<div class=divPulseAffinityInner>'		
		+sHTML
		+'</div></div>';		
		$('divPulseAffinityContainer').innerHTML=sHTML;	
	}	
	else {
		$('divPulseAffinityContainer').innerHTML='';
	}		
}	
function fPulseUpdateMyRegistrations() {
var sWhat='';	
	
	for (i=0;i<oNewsFeed.length;i++) {
		delete oNewsFeed[i];
	}	
	eval($('dcNewsFeedRefresh').value);
		
	var sHTML='';
	for (i=0;i<	oNewsFeed.length;i++) {
		if (oNewsFeed[i]['Type']=='-24') {
			sWhat=oNewsFeed[i]['What']
			sWhat=sWhat.replace('You are registered for: ','')
			sHTML=sHTML+'<div class=\"WizRow ListItem\">';
			sHTML=sHTML+'<div class=Avatar>'
			sHTML=sHTML+'<img src=\''+oNewsFeed[i]['Avatar']+'\'/>'
			sHTML=sHTML+'</div>'
			sHTML=sHTML+'<a href='+oNewsFeed[i]['pLink']+'><div class=Event>'+sWhat+'</a></div>';
			sHTML=sHTML+'<div class=PulseAddlInfo>'+oNewsFeed[i]['FullName2']+'<br/>'+oNewsFeed[i]['FullName']+'</div>'
			sHTML=sHTML+'<div class=PulseAddlInfo>Attendees: '+oNewsFeed[i]['OptId']+'</div>'
			sHTML=sHTML+'</div>'
		}
	}	
	
	if (sHTML.length>0) {
		sHTML='<div class=PulseBox id=divPulseMyRegistrations>'
		+'<h4>My Registered Events</h4>'
		+'<div class=divPulseMyRegInner>'		
		+sHTML
		+'</div></div>';
		$('divPulseMyRegistrationsContainer').innerHTML=sHTML;	
	}
	else {
		$('divPulseMyRegistrationsContainer').innerHTML='';
	}
}
function fPulseUpdateOnlineUsers() {

		eval($('dcPulseOnlineUsers').value);
		
		var sHTML='<div id=divPulseOnlineContainer>'
		sHTML=sHTML+'<h4>'+oPulseOnlineUsers[0]['POL_OnlineNow']+' Online Now</h4>'
		sHTML=sHTML+'<div class=divPulseOnlineInner>'
		for (i=0;i<	oPulseOnlineUsers.length;i++) {
			sHTML=sHTML+'<div class=ListItem>'
			sHTML=sHTML+'	<div class=img>'
			sHTML=sHTML+'		<img src=\''+oPulseOnlineUsers[i]['POL_Avatar']+'\' onclick=DProfile('+oPulseOnlineUsers[i]['POL_IdForLife']+');>'
			sHTML=sHTML+'	</div>'
			sHTML=sHTML+'	<div class=LeftArea>'
			sHTML=sHTML+'		<div class=UserName>'
			if (oPulseOnlineUsers[i]['POL_FriendStat']=='2') {
				sHTML=sHTML+'			<a onclick=fPulseOpenOptions(\'\',1,'+oPulseOnlineUsers[i]['POL_MIFL']+'); href=javascript:void(0); class=FSFriend title=You are connected with this person>'
			}
			else {
				sHTML=sHTML+'			<a onclick=fPulseOpenOptions(\'\',1,'+oPulseOnlineUsers[i]['POL_MIFL']+'); href=javascript:void(0);>'
			}
			sHTML=sHTML+'				<span class=Name title=\'Review Profile for '+oPulseOnlineUsers[i]['POL_Name']+'\'>'+oPulseOnlineUsers[i]['POL_Name']
			if (oPulseOnlineUsers[i]['POL_CompanyName'].length>0) {
				sHTML=sHTML+'<br/><span class=CoName>'+oPulseOnlineUsers[i]['POL_CompanyName']+'</span>'
			}
			sHTML=sHTML+'				</span>'
			sHTML=sHTML+'			</a>'
			sHTML=sHTML+'		</div>'
			if (oPulseOnlineUsers[i]['POL_Message'].length>0) {
				sHTML=sHTML+'		<div class=Message>'+oPulseOnlineUsers[i]['POL_Message']+' - '+oPulseOnlineUsers[i]['POL_MessageUpdDate']+'</div>'
			}
			if (parseInt(+oPulseOnlineUsers[i]['POL_FriendsTot'])>0) {
				sHTML=sHTML+'		<div class=\'Friends PulseAddlInfo\'>Friends: '+oPulseOnlineUsers[i]['POL_FriendsTot']+'</div>'
			}
			sHTML=sHTML+'	</div>'
			sHTML=sHTML+'	<div class=ClearFix>&nbsp;</div>'
			sHTML=sHTML+'</div>'
		}	
		sHTML=sHTML+'</div></div>'
		
		sHTML='<div class=PulseBox id=divPulseOnlineNow>'
		+'<div class=divPulseOnline>'		
		+sHTML
		+'</div></div>';		
		
		$('divPulseOnlineUsersArea').innerHTML=sHTML;
}		
function fBuildInitStatusForm(Mode,elemId) {
	
	if (Mode==1) {
		var sHTML=''
		sNElemId=elemId
	}
	else {
		var sHTML='<div class=divPulseForm id=divPulseForm_0>'
		sNElemId='StatusUpdFooter'
	}
	sHTML=sHTML+'<div class=WizRow>Share <div id=SUCont class=ShareBoxes>'
	sHTML=sHTML+'	<a href=javascript:void(0) onclick=fOpenPulseOptions(\'SUArea_ContDetails\');ToggleElement(\'SUArea_ContDetails\')>an update</a>'
	sHTML=sHTML+'	<div id=SUArea_ContDetails style=display:none;>'
	sHTML=sHTML+'		<div class=SUA>'
	sHTML=sHTML+'			<div class=SUAUpArrow></div>'
	sHTML=sHTML+'			<a href=#><div>Update</div></a><span class=SUOption>an update</span>'
	sHTML=sHTML+'			<a href=#><div>Question</div></a><span class=SUOption>a question</span>'
	sHTML=sHTML+'			<a href=#><div>Kudos</div></a><span class=SUOption>a kudo</span>'
	sHTML=sHTML+'			<a href=#><div>Poll</div></a><span class=SUOption>a poll</span>'
	sHTML=sHTML+'		</div></div></div>'
	sHTML=sHTML+'	&nbsp;with <div id=SUWho class=ShareBoxes>'
	sHTML=sHTML+'		<a href=javascript:void(0) onclick=fOpenPulseOptions(\'SUArea_WhoDetails\');ToggleElement(\'SUArea_WhoDetails\')>my connections</a>'
	sHTML=sHTML+'	<div id=SUArea_WhoDetails style=display:none;>'
	sHTML=sHTML+'		<div class=SUA>'
	sHTML=sHTML+'			<div class=SUAUpArrow></div>'
	sHTML=sHTML+'			<a href=#><div>Connections</div></a><span class=SUOption>my connections</span>'
	sHTML=sHTML+'			<a href=#><div>Community</div></a><span class=SUOption>this community</span>'
	sHTML=sHTML+'			<a href=#><div>All My Communities</div></a><span class=SUOption>all my communities</span>'
	sHTML=sHTML+'			<a href=#><div>@Person</div></a><span class=SUOption>a person</span>'
	sHTML=sHTML+'		</div></div>'	
	sHTML=sHTML+'	</div></div>'
	sHTML=sHTML+'<form name=PulseForm id=form_0 method=Post action=/dc_includes/cp6_PulseComment.asp onsubmit=return(fUpdatePulseComment(0))>'
	sHTML=sHTML+'<input type=hidden name=PNFUpd id=PNFUpd_0>'
	sHTML=sHTML+'<input type=hidden name=PulseKey id=\'PNFPulseKey_0\' value=0>'
	sHTML=sHTML+'<input type=hidden name=PulsePubDate value=0>'
	sHTML=sHTML+'<input type=hidden name=PulseType value=0>'
	sHTML=sHTML+'<input type=hidden name=PulseGUID value=\''+$('PulseGUID').value+'\'>'
	sHTML=sHTML+'<div style=display:none; id=\'PulseFormJSON_0\'></div>'
	sHTML=sHTML+'<input type=hidden name=PulseChronicle id=PulseChronicle_0>'
	sHTML=sHTML+'<div class=WizRow>'
	sHTML=sHTML+'<textarea class=StdInput onfocus=\'fOpenPulseComments(\"'+sNElemId+'\");try{$(\"StatusUpdFooter\").style.display=\"\"}catch(e){};\' onclick=\'this.setSelectionRange(0,0)\' onkeypress=\'fClearText(\"Share what you are doing...\",this.id);$(\"StdShare_0\").className=\"StdShare FocusButton\";\' name=PulseComment id=PulseReply_0>Share what you are doing...</textarea>'
	sHTML=sHTML+'</div>'
	sHTML=sHTML+'<div id=StatusUpdFooter class=\'WizRow Footer Options\' style=display:none;>'
	sHTML=sHTML+'<a class=StdUpload href=javascript:void(0); onclick=\'DisplayShadowBox(0,\"CP6SINGLEUPLOAD\",\"&sid=Personal_DCP_'+lPD_MIFL+'&formguid='+$('PulseGUID').value+'&marketcode=PERSONAL&t=image\/jpeg,image\/gif,image\/bmp,image\/bmp,image\/png,image\/pjpeg&xc=&isp=-110\");\'>Add File</a><a id=StdShare_0 class=StdShare href=javascript:void(0); onclick=fUpdatePulseCommentInd(0)>Share</a>'
	sHTML=sHTML+'</div>'
	sHTML=sHTML+'</form>'
	
	if (Mode!=1) {
		sHTML=sHTML+'</div>'
	}
		
	return sHTML;
}
function fBuildInitGUESTForm(Mode,elemId,gMIFL) {
	
	var sHTML='<div class=divPulseForm id=divPulseForm_1>'
	sNElemId='form_1'
	
	sHTML=sHTML+'<form name=PulseForm id=formGuest_1 method=Post action=/dc_includes/cp6_PulseComment.asp onsubmit=return(fUpdatePulseComment(1))>'
	+'<input type=hidden name=PNFUpd id=PNFUpd_1>'
	+'<input type=hidden name=PulseKey id=\'PNFPulseKey_1\' value=0>'
	+'<input type=hidden name=PulsePubDate value=0>'
	+'<input type=hidden name=PulseType value=1>'
	+'<input type=hidden name=PulseGUID value=\''+$('PulseGUID').value+'\'>'
	+'<input type=hidden name=PulseOwnerId value=\''+gMIFL+'\'>'
	
	+'<div style=display:none; id=\'PulseFormJSON_1\'></div>'
	+'<input type=hidden name=PulseChronicle id=PulseChronicle_1>'
	+'<div class=WizRow>'
	//+'<textarea class=StdInput onfocus=\'fOpenPulseComments(\"form_1\"); onclick=this.setSelectionRange(0,0); onkeypress=\'fClearText(\'Send a message...\',this.id);$(\'StdShare_1\').className=\'StdShare FocusButton\';\' name=PulseComment id=PulseReply_1>Send a message...</textarea>'
	+'<textarea class=StdInput onfocus=\'fOpenPulseComments(\"'+'form_1'+'\");try{$(\"StatusUpdFooter\").style.display=\"\"}catch(e){};\' onclick=\'this.setSelectionRange(0,0)\' onkeypress=\'fClearText(\"Send a message...\",this.id);$(\"StdShare_1\").className=\"StdShare FocusButton\";\' name=PulseComment id=PulseReply_1>Send a message...</textarea>'
	+'</div>'
	+'<div id=StatusGuesUpdFooter class=\'WizRow Footer Options\'>'
	+'<a class=StdUpload href=javascript:void(0); onclick=\'DisplayShadowBox(0,\"CP6SINGLEUPLOAD\",\"&sid=Personal_DCP_'+lPD_MIFL+'&formguid='+$('PulseGUID').value+'&marketcode=PERSONAL&t=image\/jpeg,image\/gif,image\/bmp,image\/bmp,image\/png,image\/pjpeg&xc=&isp=-110\");\'>Add File</a><a id=StdShare_1 class=StdShare href=javascript:void(0); onclick=fUpdatePulseCommentInd(1)>Share</a>'
	+'</div>'
	+'</form>'
	
	if (Mode!=1) {
		sHTML=sHTML+'</div>'
	}
		
	return sHTML;
}
function fShowTools() {
		//ChangeClass('SpecButtonLeftSel','SpecButtonLeftNoSel','div',0);
		fSpecialFunction('Tools','btin1200','a_SB_Tools');
		//ChangeClass('sb_Tools','SpecButtonLeftSel','div',1);
		DisplayAjaxPage(-1,'divSpecialOps','CP6Tools','','','','1','');
		fClosePulseFunctions();
}
function fShowSearch() {
	fBlindDown('divCommunityAdvancedSearch');
}
function fRebuildPulse() {
	ajaxIncrement=ajaxIncrement+1;
	DisplayAjaxPage(-1,'divNFContainer','DCNEWSFEEDPULSE','','&refresh=1&C='+lPD_OrigConfCode+'&xc='+ajaxTimeStamp+ajaxIncrement,'','1','fCountNews()');
}
function fPulseProfile(pMifl) {

	if (pMifl==null) {
		pMifl=lPD_MIFL;
	}
	if (pMifl==lPD_MIFL) {
		var pMode=1;
	}	
	else {
		var pMode=0;
	}

// Remove unwanted items
	pars=$('divTagSearchResults').getElementsByTagName('div');
	for (i=0;i<pars.length;i++) {
		if (pars[i].id.indexOf('divNFRow_')!=-1) {
			fRemoveChildren(pars[i].id);
		}
	}
	
	for (i=0;i<oPulseAttachments.length;i++) {
		delete oPulseAttachments[i];
	}
	
	for (i=0;i<oNewsFeedComments.length;i++) {
		delete oNewsFeedComments[i];
	}	
	
	for (i=0;i<oNewsFeed.length;i++) {
		delete oNewsFeed[i];
	}	
	
	eval($('divPulseJSON').innerHTML);
	
// Stream	
	fPulseBuildStream(1,$('divPulseJSON').innerHTML);

// Comments	& Attachments
	fBuildAllComments(1,$('divPulseJSON').innerHTML);

	$('divSpecialOps').innerHTML=$('divNewsPulseContainer').innerHTML;

	$('divSpecialOps').style.display='';
	
	var bFriend=0;
	if (pMode==1) {
		eval($('dcPulseProfileInfo').value);
		sAvatar=oPulseProfileInfo['P_Avatar'];
		sFullName=oPulseProfileInfo['P_FullName'];
		sCompanyName=oPulseProfileInfo['P_CompanyName'];
		sTitle=oPulseProfileInfo['P_Title'];
		sCreateDate=oPulseProfileInfo['P_CreateDate'];
		iIdForLife=oPulseProfileInfo['P_IdForLife'];
	}
	else {
		eval($('divPulseJSON').innerHTML);
		sAvatar=oPulseGuestProfileInfo['P_Avatar'];
		sFullName=oPulseGuestProfileInfo['P_FullName'];
		sCompanyName=oPulseGuestProfileInfo['P_CompanyName'];
		sTitle=oPulseGuestProfileInfo['P_Title'];
		bFriend=oPulseGuestProfileInfo['P_bFriend'];
		sMIFL=oPulseGuestProfileInfo['P_MIFL'];
		sCreateDate=oPulseGuestProfileInfo['P_CreateDate'];
		iIdForLife=oPulseGuestProfileInfo['P_IdForLife'];
	}

// Build out Profile Area
	
	var sHTML='<div id=PulseMyProfileArea>'
	+ '<div class=LeftPane>'
	+ '<div class=Inner>'
	+ '<div class=Image><img src=\''+sAvatar+'\' /></div>'
	+ '</div></div>'
	+ '<div class=RightPane>'
	+ '<div class=Inner>'
	+ '<div class=Name>'+sFullName+'</div>'
	+ '<div class=CompanyName>'+sCompanyName+'</div>'
	+ '<div class=Title>'+sTitle+'</div>'
	+ '<div class=MemberSince>Member since:'+sCreateDate+'</div>'
	+ '<input type=hidden name=PulseOwnerId id=PulseOwnerId value='+sMIFL+' />'
	
	if (pMode==1) {
		sHTML=sHTML+'<div class=SpecButtonLeftSel id=sb_Profile><div>'
		+ '<a href=\'javascript:DProfile(lPD_LoggedInIdForLife);\' class="StdEdit" id="a_SB_Profile">Edit Profile</a>'
		+ '</div></div>'
	}
	else if (bFriend!=1) {
		sHTML=sHTML+'<div class=SpecButtonLeftSel id=divFriend><div>'
		+ '<a href=javascript:AddConnection('+sMIFL+'); class=AddConnection>Add as Friend</a>'
		+ '</div></div>'
	}
	else {
		sHTML=sHTML+'<div class=SpecButtonLeftSel id=divFriend><div>'
		+ '<a href=javascript:DProfile('+iIdForLife+'); class=StdView>View Profile</a>'
		+ '</div></div>'		
	}
		
	sHTML=sHTML+'</div></div>'
	+ '<div class=ClearFix>&nbsp;</div>'
	+ '</div>'
		
	var newDiv = document.createElement('div');
	newDiv.innerHTML=sHTML;
	$('divSpecialOps').insertBefore(newDiv, $('divSpecialOps').firstChild);	
	//$('HidePanel').innerHTML='';
	
}	
function fPulseOpenOptions(elemId,pOptions,iMifl) {
	
	if (iMifl==null) {
		iMifl=lPD_MIFL;
	}
	if (elemId.length>0) {
		var pulseElem=$(elemId);
		fChangeClassByClass(pulseElem.parentNode.id,'Selected','');
		pulseElem.className='Selected';
	}
	$('divSpecialOps').style.visibility='';
	//$('divSpecialOps').innerHTML=oProgressBar;

	// Open Stream
	if (pOptions==0) {
		$('divSpecialOps').innerHTML=oProgressBar;
		$('divSpecialOps').style.visibility='hidden';
		fChangeClassByClass(pulseElem.parentNode.id,'Selected','');
		pulseElem.className='Selected';$('HidePanel').style.display='';		
	}
	
	//Open Profile
	if (pOptions==1) {
		$('divSpecialOps').innerHTML=oProgressBar;
		DisplayAjaxPage(-1,'divPulseJSON','CP6PulseProfileMessages','','','&mifl='+iMifl,'1','fPulseProfile('+iMifl+')');
		$('HidePanel').style.display='none';
		//$('HidePanel').innerHTML=oProgressBar;
	}
	
	// Open Tools
	if (pOptions==2) {
		fChangeClassByClass(pulseElem.parentNode.id,'Selected','');
		pulseElem.className='Selected';
		DisplayAjaxPage(0,'divSpecialOps','CP6Tools','','','','','');
		$('HidePanel').style.display='none';	
	}	
}
