
//DHTML Window script- Copyright Dynamic Drive (http://www.dynamicdrive.com)
//For full source code, documentation, and terms of usage,
//Visit http://www.dynamicdrive.com/dynamicindex9/dhtmlwindow.htm

var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){

document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
document.getElementById("dwindowcontent").style.display="none" //extra
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.getElementById("dwindow").onmousemove=drag_drop
}

function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display=''
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
document.getElementById("dwindow").style.left="30px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
document.getElementById("cframe").src=url
}
}

function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}
function addFolderToCategory(form){
	var mform=window.document.category;
	var folderid=window.document.getElementById("menufolderid").value;
	var foldername=window.document.getElementById("fname").value;
	var icount=0;
	var type=""
		for(var i=0;i<=mform.catchoice.length;i++){
			var checkItem = mform.catchoice[i]; 
         if(checkItem != null && checkItem.checked){ 
			    icount=icount+1;
				var catid=checkItem.value;
				type="existing";
				addFolderToCat(catid,type,folderid,foldername);
			}
		}
	if(icount==0){//means a new cat is going to be added or they need to make a selection
	  icount=icount+1;
	  var catname=mform.catNew.value;
	  type="new";
	  addFolderToCat(catname,type,folderid,foldername);
	}
	if(icount==0){
		alert("Select a category or enter a new category for this folder.");
		return;
	}
	hidePopupNew('cat_popup');
}

function addCatItem(){
 var catItems=window.document.getElementById("catItem").value;
 addNewCatItems(catItems);
 window.document.getElementById("catItem").value="";
}
function closeit(){
document.getElementById("dwindow").style.display="none"
}

function stopdrag(){
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display="" //extra
}

function noContent(){
   alert("the content you are uploading to this site is not correct");
 }
function editNotePopup(){
var mform=window.document.notesform;
var icount=0;
var x=document.getElementsByName("removeNOte2"); 
//alert(x.length);
if(x.length==1){
    icount=icount+1;  
	var note = mform.removeNOte2.value;
	//alert(note);
	 var len=note.length;
	 var position=note.indexOf("/");
	 //this will get the message;
	 var newnote=Mid(note,position+1,note.length-position);	
	 var positionsub=newnote.indexOf("@");
	 
	 var newnote2=Mid(newnote,0,positionsub);
	// alert(newnote);
	 //alert(newnote2);
	 //this will get the subject
	 var subj=Mid(newnote,positionsub+1,newnote.length);
	 
	 var positionfileid=subj.indexOf("#");
	 var fileid=Mid(subj,positionfileid+1,subj.length);
	 subj=Mid(subj,0,positionfileid);
	 var noteid=Mid(note,0,position);	
	 contentSectionNotes('contentnav3','2',"N")
	 //alert("after contentsection");
	 //alert(subj);
	 //alert("fileid " + fileid);
	 window.document.notesform.notes.value=newnote2;	 
	 mform.notes.value=newnote2;
	 mform.notesubject.value=subj;
	 mform.uploadid.value=fileid;
	 mform.noteid.value=noteid;
	 mform.Add.value="Update";
	 mform.noteaction.value="Edit";
}

if(x.length>1){

 for (var i=0; i < mform.removeNOte2.length; i++) {	
	var checkItem = mform.removeNOte2[i]; 
  if(checkItem != null && checkItem.checked){ 
  
	 icount=icount+1;
	 //alert(icount);
	}
   }
   if(icount==0){
     alert("Select a note to edit!");
   }
   if(icount>1){
     alert("Only select one note for editing!");
   }
  }
if (icount==1){
   for (var i=0; i < mform.removeNOte2.length; i++) {	
	var checkItem = mform.removeNOte2[i]; 
    if(checkItem != null && checkItem.checked){ 
	//get the value being passed
	 var note = checkItem.value;
	 var len=note.length;
	 var position=note.indexOf("/");
	 var newnote=Mid(note,position+1,note.length-position);
	
	 var positionsub=newnote.indexOf("@");	
	 var newnote2=Mid(newnote,0,positionsub);
	 
	 //this will get the subject
	 var subj=Mid(newnote,positionsub+1,newnote.length);
	 var positionfileid=subj.indexOf("#");
	 var fileid=Mid(subj,positionfileid+1,subj.length);
	 subj=Mid(subj,0,positionfileid);
	 //alert(subj);
	
	 var noteid=Mid(note,0,position);
	
	 //alert(fileid);
	 contentSectionNotes('contentnav3','2',"N")	 
	 mform.notes.value=newnote2;
	 mform.notesubject.value=subj;
	 mform.noteid.value=noteid;
	 mform.uploadid.value=fileid;
	 mform.Add.value="Update";
	 mform.noteaction.value="Edit";
	 
	 }}
   }
   
} 

function checkLocation(library){
	
	if(library=="0"){
	   document.getElementById("options").style.display="block";
	   document.getElementById("versionHistory").style.display="none";
	   document.getElementById("addcontentborder").style.display="block";
	   document.getElementById("singleline").style.display="block";
	   document.getElementById("greyline").style.display="block";
	   //document.getElementById("singleline").style.display="block";
	   document.getElementById("filetypesline").style.display="block";
	   document.getElementById("filetypes").style.display="block";
	   document.getElementById("infoborderrow").style.display="block";
	   //document.getElementById("updateContent").style.display="none";
	   document.getElementById("showtitle").style.display="none";
	   document.getElementById("comments").style.display="none";
	   document.getElementById("uploadflash").style.display="block";
	   document.getElementById("updateflash").style.display="none";
	   document.getElementById("customflash").style.display="none";
	   document.getElementById("uploadfinish").style.display="none";
	   document.getElementById("updatefinish").style.display="none";
	   document.getElementById("infoborder").innerHTML="";
	}else{
		 document.getElementById("uploadflash").style.display="none";
		 document.getElementById("customflash").style.display="block";
	}
	
}

function showStartFiles(action,uploadid){

//var mform=window.document.stf;

 if(action=="Yes"){
   window.document.getElementById("startfiles").style.display="block";
   window.document.getElementById("submitreview").style.display="block";
   window.document.getElementById("finish").style.display="none";
   
 }else if(action=="No"){
   window.document.getElementById("startfiles").style.display="none";
   window.document.getElementById("submitreview").style.display="none";
   window.document.getElementById("finish").style.display="block";
   
 }else if(action=="Finish"){
   
	deleteReviewFiles(uploadid);
	
 }
}
function validateMessage(){
	var mform=window.document.messageform;
	var tofield=window.document.getElementById("tofield").value;
	var subject=window.document.getElementById("messsubject").value;
	var fullname=window.document.getElementById("fullname").value;
   
	var message=window.document.getElementById("emailmess").value;
	
	sendMessage(tofield,subject,message,fullname,"");
	window.document.getElementById("email_popup").style.display="none";
	
}
function validateNotePopup(){

 var mform=window.document.notesform;
 var form=window.document.menu;
 var vform=window.document.fileslist;
 //alert(vform);
 var contentid=document.getElementById("menucontentid").value;
 var action = document.getElementById("noteaction").value;
 if(action != "Edit"){
   action="Add";
 }
 var teamcontacts="";
//alert(mform.Update.value);
 if (mform.notesubject.value==""){
  alert("Please enter a subject for the note");
  return false;
 }else{
   var subj=mform.notesubject.value;
 }
 if(mform.notes.value==""){
   alert("Please enter a text in the notes section");
   return false;
  }else{
    var note=mform.notes.value;
  }
 if(mform.sendmess.value==""){
  alert("Select a value for Notify Contacts");
 }else{
   for (var i=0; i<mform.sendmess.length; i++)  { 
		if (mform.sendmess[i].checked)  {
		  var notify=mform.sendmess[i].value;
		 }
    }

 }

if(notify=="Yes"){
  
 for (var ii = 0; ii <= mform.contacts.options.length; ii++){
  if(mform.contacts[ii] != null && mform.contacts[ii].selected){
     
	  if(teamcontacts != ""){
        teamcontacts += "," + mform.contacts[ii].value ;
     }else{
       teamcontacts = mform.contacts[ii].value;
   }
  
   }//if null
  }//for loop
 }
//need an ajax function call here
  var noteid=window.document.getElementById("note").value;
  //alert(teamcontacts);
  addNotes(subj,note,contentid,teamcontacts,action,noteid,notify);
  javascript:contentSectionNotes('contentnav3','2','N')
 
  
}
function removeCommentPopup(){

var mform=window.document.notesform;
var icount=0;
var x=document.getElementsByName("removeNOte2");

if(x.length==0){
 alert("There are no notes to delete.");
 return;
}
if(x.length==1){
  var fRet; 
  fRet = confirm('Remove this Note?'); 
  
  if ( fRet==1 ){ 
  icount=1;
  var note=mform.removeNOte2.value;
 	 var len=note.length;
	 var position=note.indexOf("/");
	 var newnote=Mid(note,position+1,note.length-position);
	
	 var positionsub=newnote.indexOf("@");	
	 var newnote2=Mid(newnote,0,positionsub);
	 
	 //this will get the subject
	 var subj=Mid(newnote,positionsub+1,newnote.length);
	 var positionfileid=subj.indexOf("#");
	 var fileid=Mid(subj,positionfileid+1,subj.length);
	 subj=Mid(subj,0,positionfileid);
	 var noteid=Mid(note,0,position);
	 //alert(newnote2);
      removeNotePopup(subj,newnote2,fileid,noteid);
  }else{
  
	return;
 }
}
if(x.length>1){
for (var i=0; i <=mform.removeNOte2.length; i++) {
 
   var checkItem = mform.removeNOte2[i]; 
  if(checkItem != null && checkItem.checked){ 	
	  icount=icount+1;
	  //alert(icount);
	 var note = checkItem.value;
	 var len=note.length;
	 var position=note.indexOf("/");
	 var newnote=Mid(note,position+1,note.length-position);
	
	 var positionsub=newnote.indexOf("@");	
	 var newnote2=Mid(newnote,0,positionsub);
	 
	 //this will get the subject
	 var subj=Mid(newnote,positionsub+1,newnote.length);
	 var positionfileid=subj.indexOf("#");
	 var fileid=Mid(subj,positionfileid+1,subj.length);
	 subj=Mid(subj,0,positionfileid);
	 //alert(subj);
	
	 var noteid=Mid(note,0,position);
	 removeNotePopup(subj,newnote2,fileid,noteid);
	  
  }
 }	
}
 
if (icount==0){
    alert("Please select the notes to remove!");
return false;
   }
  
 //mform.submit();
}
function SFU(fid,form,uid,org,versionnum){

var startf="";
	  for (var i=0; i < form.addToUpload.length; i++) {
	   	
	   if(form.addToUpload[i].checked && form.addToUpload.length!=null){	 
	        var checkItem = form.addToUpload[i]; 
		    if(checkItem != null){
			 if(startf != ""){
       			 startf += "," + form.addToUpload[i].value ;
    		 }else{
       			 startf = form.addToUpload[i].value;
   			}//end of if sf!=''	    
	        
		    			
		 }//end of if checkitem!=null
	   }//end of if
	   //addtofolder(fid,uid,org);
	   }//end of four
	  // alert(folderid);
	
	   updateReviewSF(fid,startf,uid,org,versionnum);	   
	
}

function SF(fid,form,uid,org,folderid,notify,type,foldertype,subdoctype,contacts){

var startf="";
	  for (var i=0; i < form.addToUpload.length; i++) {
	   	
	   if(form.addToUpload[i].checked && form.addToUpload.length!=null){	 
	        var checkItem = form.addToUpload[i]; 
		    if(checkItem != null){
			 if(startf != ""){
       			 startf += "," + form.addToUpload[i].value ;
    		 }else{
       			 startf = form.addToUpload[i].value;
   			}//end of if sf!=''	    
	        
		    			
		 }//end of if checkitem!=null
	   }//end of if
	   //addtofolder(fid,uid,org);
	   }//end of four
	  // alert(folderid);
	
	  if(folderid==""){
	    addtofolder(fid,uid,org);
	  }
	  
	   addSF(fid,startf,uid,org,folderid,notify,type,foldertype,subdoctype,contacts);	   
	
}

function expandList(selection,action){
 if(selection=="Y"){
   window.document.getElementById("contactList").style.display="block";
   
 }else{
   window.document.getElementById("contactList").style.display="none";
 }
 if(action=="update"){
 window.document.getElementById("Update").disabled=false;
 }else{
  window.document.getElementById("finish").disabled=false;
 }
}
function disableUpdate(){ 
//alert("here");
 window.document.getElementById("Update").disabled=true;
 
}

function downloadzipfile(sid,orgid){
 var url="zip3.php?site="+sid + "&org="+orgid;
 window.open(url);

}
function editNote(){
var mform=window.document.addNotes;
var icount=0;
var x=document.getElementsByName("removeNOte2"); 
//alert(x.length);
if(x.length==1){
    icount=icount+1;  
	var note = mform.removeNOte2.value;
	//alert(note);
	 var len=note.length;
	 var position=note.indexOf("/");
	 //this will get the message;
	 var newnote=Mid(note,position+1,note.length-position);	
	 var positionsub=newnote.indexOf("@");
	 
	 var newnote2=Mid(newnote,0,positionsub);
	// alert(newnote);
	 //alert(newnote2);
	 //this will get the subject
	 var subj=Mid(newnote,positionsub+1,newnote.length);
	 
	 var positionfileid=subj.indexOf("#");
	 var fileid=Mid(subj,positionfileid+1,subj.length);
	 subj=Mid(subj,0,positionfileid);
	 var noteid=Mid(note,0,position);	
	 contentSectionNotes('contentnav3','2',"N")
	 //alert("after contentsection");
	 //alert(subj);
	 //alert("fileid " + fileid);
	 window.document.addNotes.notes.value=newnote2;	 
	 mform.notes.value=newnote2;
	 mform.notesubject.value=subj;
	 mform.uploadid.value=fileid;
	 mform.noteid.value=noteid;
	 mform.Update.value="Update";
}

if(x.length>1){

 for (var i=0; i < mform.removeNOte2.length; i++) {	
	var checkItem = mform.removeNOte2[i]; 
  if(checkItem != null && checkItem.checked){ 
  
	 icount=icount+1;
	 //alert(icount);
	}
   }
   if(icount==0){
     alert("Select a note to edit!");
   }
   if(icount>1){
     alert("Only select one note for editing!");
   }
  }
if (icount==1){
   for (var i=0; i < mform.removeNOte2.length; i++) {	
	var checkItem = mform.removeNOte2[i]; 
    if(checkItem != null && checkItem.checked){ 
	//get the value being passed
	 var note = checkItem.value;
	  var len=note.length;
	 var position=note.indexOf("/");
	 var newnote=Mid(note,position+1,note.length-position);
	
	 var positionsub=newnote.indexOf("@");	
	 var newnote2=Mid(newnote,0,positionsub);
	 
	 //this will get the subject
	 var subj=Mid(newnote,positionsub+1,newnote.length);
	 var positionfileid=subj.indexOf("#");
	 var fileid=Mid(subj,positionfileid+1,subj.length);
	 subj=Mid(subj,0,positionfileid);
	 //alert(subj);
	 var noteid=Mid(note,0,position);
	
	 //alert(fileid);
	 contentSectionNotes('contentnav3','2',"N")	 
	 mform.notes.value=newnote2;
	 mform.notesubject.value=subj;
	 mform.noteid.value=noteid;
	 mform.uploadid.value=fileid;
	 mform.Update.value="Update";
	 
	 
	 }}
   }
}

function getsiteAction(action,siteid,tempid){
//alert(tempid);

var url;
if(action=="Edit"){

  url="edit_sites.php?id=" + siteid + "&temp=" + tempid;
  window.location=url;
  
}
 if(action=="Delete"){
  deleteSite(siteid);
  //window.location="view_sites.php";
}
 if(action=="View"){
 url="siteindex.php?id=" + siteid;
 window.open(url);
}
}

function deleteSite(siteid) 
{ 
var mform=window.document.siteslist;
var fRet; 
fRet = confirm('Remove this site from your account?'); 
//alert(fRet);
if (fRet==1){
   removeSite(siteid);
   //mform.submit();  
}else if(fRet==false){
//alert("here");
return false;
}
}


function ExpandSection(divID, imgID)  {


	var StyleHandle = "";
	var StyleObject = "";
	
	if (window.document.layers)  {
		StyleHandle = "window.document.layers";
		StyleObject = " ";
	}
	else {
		StyleHandle = "document.all";
		StyleObject = ".style";
	}
	
	var tmp = eval(StyleHandle + "['" + divID  + "']" + StyleObject  + ".display");
	if ( tmp == "none" || tmp == "" ) {
		eval (StyleHandle + "['" + divID  + "']" + StyleObject  + ".display='block'");
		//swapImg(imgID, minusImg, glbPlusImgAlt);
	} else {
		eval (StyleHandle + "['" + divID  + "']" + StyleObject  + ".display='none'");
		//swapImg(imgID, plusImg, glbMinusImgAlt);
	}
}
function contentSections(id,i,type,nosub)  {


   if ((type=="W" )|| ( type=="SFNC" )|| (type=="SFY")){
    var plusImg="images/icon-workspaces.jpg";
    var minusImg="images/icon_workspaceopen.jpg";
	 var name=i+'anav';
   }else if (type=="R"){
     var plusImg="images/icon-recyclebin-small.jpg";
	 var minusImg="images/icon-recyclebin-small.jpg";
	 var name=i+'anav';
	}else if (type=="H"){
     var plusImg="NavImages/contraction.png";
	 var minusImg="NavImages/xpanded.png";
	  var name=i+'anav';
	}else if (type=="A"){
     var plusImg="images/icon-archive.jpg";
	 var minusImg="images/icon-archive.jpg";
	  var name=i+'anav';
	 alert("Your account does not allow access to this feature!");
	 return;
	 }else if(type=="SF"){
	
	  var plusImg="/images/icon-subfolderclosed.gif";
	  var minusImg="/images/icon-subfolderopen.gif";
	  var name= i + "subanav";
	  
	 }else if(type=="PM"){
	  var plusImg = "/images/plusIcon.gif";
      var minusImg = "/images/minusIcon.gif";
	  var name=i+'exsanav';
	 }else if(type=="EX"){
	  var plusImg = "/images/plusIcon.gif";
      var minusImg = "/images/minusIcon.gif";
	  var name=i+'exanav';
	 }else if(type=="SFEX"){
	  var plusImg = "/images/plusIcon.gif";
      var minusImg = "/images/minusIcon.gif";
	  var name=i+'exsfanav';
	  }else if(type=="SHSFEX"){
	  var plusImg = "/images/plusIcon.gif";
      var minusImg = "/images/minusIcon.gif";
	  var name=i+'exshsfanav';
	 }else if(type=="SHEX"){
	  var plusImg = "/images/plusIcon.gif";
      var minusImg = "/images/minusIcon.gif";
	  var name=i+'exshanav';
	  }else if(type=="C"){
	  var plusImg = "/images/plusIcon.gif";
      var minusImg = "/images/minusIcon.gif";
	  var name=i+'anav';
    }else{
    var plusImg = "/images/bt-makeFolderButton.gif";
    var minusImg = "/images/folder.gif";
	var name=i+'anav';
	
   }
  //alert(name);
	var StyleHandle = "";
	var StyleObject = "";
	
	    expMsg = "Click to Expand Section";
	    colMsg = "Click to Collapse Section";
	
	//alert(name);
	if (window.document.layers)  {
		StyleHandle = "window.document.layers";
		StyleObject = " ";
	}
	else {
		StyleHandle = "document.all";
		StyleObject = ".style";
	}
    temp=window.document.getElementById(id).style.display;
	alert("name " + name + " temp " + temp );
	if(temp=="none" || temp==""){
    
	    if(type=="FY"){
			window.document.getElementById(nosub).style.display="block";
		}else{
            alert("HERE" + id);
			window.document.getElementById(id).style.display="block";
		}
	    if(type!="R"){
		// alert("here");			
		 swapImg(name, minusImg, colMsg);
		}
	}else{
	   	
		if(type=="FY"){
		  window.document.getElementById(nosub).style.display="none";
		}else{
		  window.document.getElementById(id).style.display="none";
		}
		if(type!="R"){
		 swapImg(name, plusImg, expMsg);		 
		}
	}
	//var tmp = eval(StyleHandle + "['" + id  + "']" + StyleObject  + ".display");
    
	//if ( (tmp == "none") || (tmp == "" )) {
	 //  if((type=="FY")){
		
	//	eval (StyleHandle + "['" + nosub  + "']" + StyleObject  + ".display='block'");
	//	}else{
		
	//	 eval (StyleHandle + "['" + id  + "']" + StyleObject  + ".display='block'");
	//	}
	//	if(type!="R"){
						
	//	 swapImg(name, minusImg, colMsg);
	//	}
		
	/// } else {
	  // if(type=="FY"){
	//	eval (StyleHandle + "['" + nosub  + "']" + StyleObject  + ".display='none'");
		//}else{
	//	eval (StyleHandle + "['" + id  + "']" + StyleObject  + ".display='none'");
	//	}
	//	if(type!="R"){
	//	 swapImg(name, plusImg, expMsg);		 
		//}
		
	//}
	
}

function contentSectionNotes(id,i,type)  {
var mform=window.document.notesform;
if(type !="N"){
if(window.document.getElementById("notesubject").value !=""){
    window.document.getElementById("notesubject").value="";
}

if(mform.notes.value != ""){
	mform.notes.value="";
}
}
	if (type=="W"){
	 var plusImg="images/icon-workspaces.jpg";
	 var minusImg="images/icon_workspaceopen.jpg";
	}
     var plusImg="NavImages/contraction.png";
	 var minusImg="NavImages/xpanded.png";
	
   	var StyleHandle = "";
	var StyleObject = "";
	  if(type=="C"){
	    expMsg = "Click to Expand Section and select content.";
	    colMsg = "Click to Collapse Section.";
	 }else{
	    expMsg = "Click to Expand Section.";
	    colMsg = "Click to Collapse Section.";
	 }
	
	if (window.document.layers)  {
		StyleHandle = "window.document.layers";
		StyleObject = " ";
	}
	else {
		StyleHandle = "document.all";
		StyleObject = ".style";
	}
	if(type=="DRR"){
	  var name=i+"anavReject";
	}else if(type=="DR"){
	  var name=i+"anavReview";
	  }else if(type=="DRIR"){
	  var name=i+"anavreviewDate";
	  }else if(type=="DRAD"){
	  var name=i+"anavApproveDate";
	  }else if(type=="DRRD"){
	  var name=i+"anavrejectDate";
	}else if(type=="DRA"){
	  var name=i+"anavApprove";
	}else{
	  var name=i+'anav';
	}
	
	 var tmp=window.document.getElementById(id).style.display;
	//var tmp = eval(StyleHandle + "['" + id  + "']" + StyleObject  + ".display");
   
	if ( tmp == "none" || tmp == "" ) {	
		//eval (StyleHandle + "['" + id  + "']" + StyleObject  + ".display='block'");
		window.document.getElementById(id).style.display="block";
		if(type!="N"){
		//alert("not N");		
		swapImg(name, minusImg, colMsg);
		}
	} else {
		//eval (StyleHandle + "['" + id  + "']" + StyleObject  + ".display='none'");
		window.document.getElementById(id).style.display="none";
		if(type!="N"){
		swapImg(name, plusImg, expMsg);
		}
	}
	
}
function swapImg(imgName, imgSrc, alttext) 
{ 
// alert("here in image");
        if (document.images) { 
		    
                document[imgName].src = imgSrc; 
				document[imgName].alt = alttext; 
				
        } 
} 

function addSubCat(action,subcatid,siteid,count,catid){
  //alert(siteid);
   var iform = document.details;	
   if(iform.subcatname.value==""){
    alert("Please enter a subcategory name");
	return;
   }else {
   //the name of the subcategory to add
   var sc=iform.subcatname.value;
   //if editing we get the id
   //var id=iform.subcatid.value;
   //if(iform.mode.value=="edit"){
    // action="edit";
  // }
   if(action=='edit'){
   addsubcat(sc,"edit",siteid,subcatid,catid);
   }else{
   addsubcat(sc,action,siteid,subcatid,catid);
   }
   iform.subcatname.value="";
   //iform.subcatid.value="";
   //iform.mode.value="";
   iform.submitSubCat.value="Add SubCategory";
   //SubCatLabel.innerText="Add SubCategory";
   }
   //iform.submit();
  
}
function addCat(action,siteid){
   //alert("test");
   var iform = document.details;
  if(action=="add"){	
   if(iform.catname.value==""){
    alert("Please enter a category name");
	return;
   }else {
   var sc=iform.catname.value;
   var id=iform.catid.value;
   //alert(iform.modec.value);
   
   iform.catname.value="";
   iform.catid.value="";
   iform.modec.value="";
   iform.submitCat.value="Create Category";
   CatLabel.innerText="Add Category";
   }}
   if(iform.modec.value=="editc"){
     action="edit";
   }
   //alert(action);
   if(action=='edit'){
   var sc=iform.subcatname.value;
   var id=iform.catid.value;
   addcat(sc,"edit",siteid,id);
   }else{
   addcat(sc,action,siteid,"");
   }
  //}
   //iform.submit();
  
}
function viewMess(action){
if (action=="2"){
  var url="view_mess.php";
 }else{
 var url="view_files.php";
 }
  window.location=url;
}
function Mid(str, start, len)
{
// Make sure start and len are within proper bounds
    if (start < 0 || len < 0) return "";
    var iEnd, iLen = String(str).length;
    if (start + len > iLen)
          iEnd = iLen;
    else
          iEnd = start + len;
    return String(str).substring(start,iEnd);
}

function removeUser(id){

 fRet = confirm('Remove this user from your contact list?'); 
if (fRet==1){ 
   removeUserfromList(id);
   //mform.submit();  
}

}
function noAccess(){
  alert("Your account does not allow access to this feature!");
  
}
function loadExternal(url,name) {
  if ( window.frames[name] ) {
    window.frames[name].location = url;
    return false;
  } else if ( document.layers ) {
    document.layers['outer'].document.layers['inner'].src = url;
    return false;
  } else return true;
}
/*
function loadLC( form, name, siteid,catid,type ){
 //alert("wrong");
 if (window.frames[name]){
  
   iframeWin = window.frames[name];  
   
     for (var i=0; i < iframeWin.contLib.length; i++) {
	 //alert("in for loop");
	var checkItem = iframeWin.contLib[i]; 
	//alert(iframeWin.contLib[i].value);
  if(checkItem != null && checkItem.checked){ 	
	  var id=(iframeWin.contLib[i].value);
	  //alert(id);	  
      update_LC(id,siteid,catid,type);
	 }
   }
  }

//window.document.details.submit();
 }*/

function loadContent( form, name, siteid,catid,type ){

 var id="";
 if (window.frames[name]){
  
   iframeWin = window.frames[name];  
   
  for (var i=0; i < iframeWin.contLib.length; i++) {
	 //alert("in for loop");
	var checkItem = iframeWin.contLib[i]; 
	//alert(iframeWin.contLib[i].value);
   if(checkItem != null && checkItem.checked){ 	
	  
	  if(id != ""){
        id += "," + iframeWin.contLib[i].value ;
      }else{
       id = iframeWin.contLib[i].value;
      }   
	  
	 }
   }
  }
  update_LCBK(id,siteid,catid,type);
//window.document.details.submit();
 }

function loadLC( form, name, siteid ){
var id = "";
var icount = 0;
 if (window.frames[name]){
  iframeWin = window.frames[name];
   //alert(iframeWin.contLib.length);  
  if(iframeWin.contLib.length==undefined){
    id=iframeWin.contLib.value;
	icount=icount + 1;
  }else{
    for (var i=0; i <= iframeWin.contLib.length; i++) {	
	if(iframeWin.contLib[i] != null && iframeWin.contLib[i].checked){
	  icount = icount + 1;
	 if(id != ""){
        id += "," + iframeWin.contLib[i].value ;
     }else{
        id = iframeWin.contLib[i].value;
  	 }
	 //alert(id);
     
	 }
   }
  }
  }
if(icount > 0){
update_LC(id,siteid);
alert("Files have been added!");
form.submit();
}
if(icount==0){
form.submit();
}
}
function removeSpaces(string) {
 return string.split(' ').join('+');
}
function validateReg(form){
  if (form.orgci_name.value==""){
    alert("Please enter a company name");
	form.orgci_name.focus();
	return;
  }else if(form.orgci_address.value==""){
    alert("Please enter an address");
	form.orgci_address.focus();
	return;
  }else if(form.orgci_city.value==""){
    alert("Please enter the city name");
	return;
  }
}
function validateCat(form){
   
  if (form.file_upload_category_description.value==""){
      alert("Please enter a category");
	  form.file_upload_category_description.focus();
	  return;
	}
	// window.document.forms[0].submit6.value="6";
	 //alert(window.document.forms[0].submit6.value);
	 form.submit();
}
function validateTitle(form){
   if (form.file_upload_title.value==""){
      alert("Please enter a title for your content");
	  form.file_upload_title.focus();
	  return;
	}
	//uploadControl();
}
function validateDescription(form){
   if (form.file_upload_title.value==""){
      alert("Please enter a title for your content");
	  form.file_upload_title.focus();
	  return;
	}
   //if (form.file_description.value==""){
   //   alert("Please enter a description for your content");
	//  form.file_description.focus();
	//  return;
	//}
}
function validatesubDocType(form){

  if (form.file_upload_subdoctype.selectedIndex==0){
      alert("Please indentify the Content Type.");
	  form.file_upload_subdoctype.focus();
	  return false;
	}
}
function validateAll(form){   
    if (form.file_upload_subdoctype.selectedIndex==0){
      alert("Please indentify the Content Type.");
	  window.document.forms[0].file_upload_subdoctype.focus();
	  return false;
	}     
  // if (form.file_upload_title.value==""){
    //  alert("Please enter a title for your content.");
	//  form.file_upload_title.focus();
	//  return false;
	 
	//}
  // if (form.file_description.value==""){
  //    alert("Please enter a description for your content.");
	// form.file_description.focus();
	//  return false;
//	}
	   
	return true;
   //create_window('','500','500')
}

function validateClient(form){

 if(form.client_name.value==""){
   alert("Please enter a name");
   return;
   }
   if(form.client_email_address.value==""){
   alert("Please enter an email address for the user.");
   return;
   }
  
  form.submit();
}
function validateUpdate(form,action){
 var contentid=window.document.getElementById("menucontentid").value;
 var folderid=window.document.getElementById("menufolderid").value;
 var type=window.document.getElementById("menutype").value;
 var title=form.file_upload_title.value;
// var desc=form.file_description.value;

 var comments=form.comments.value;
 var teamcontacts="";
 
 if(form.sendmess.value==""){
  alert("Select whether you want to notify any of your contacts.");
 }else{
   for (var i=0; i<form.sendmess.length; i++)  { 
		if (form.sendmess[i].checked)  {
		  var notify=form.sendmess[i].value;
		 }
    }

 }

if(notify=="Y"){

 for (var ii = 0; ii <= form.contacts.options.length; ii++){
  if(form.contacts[ii] != null && form.contacts[ii].selected){
     
	  if(teamcontacts != ""){
        teamcontacts += "," + form.contacts[ii].value ;
     }else{
       teamcontacts = form.contacts[ii].value;
   }
  
   }//if null
  }//for loop
 }

 updateDoc(contentid,title,comments,notify,teamcontacts,folderid,type);
 hidePopupNew('upload_popup');

}
function validateFields(form,action){    
 
var type="";
var useraction="";
var fname="";
var urllink="";

var foldertype=window.document.getElementById("menutype").value;
var folderid=window.document.getElementById("menufolderid").value;
var spanid=window.document.getElementById("spanid").value;
var spannum=window.document.getElementById("spannum").value;
var spantype=window.document.getElementById("spantype").value;
var subs=window.document.getElementById("spansubs").value;

var teamcontacts="";
for(var ii=0 ; ii<form.folder.length;ii++){
  if(form.folder[ii].checked){
    useraction=form.folder[ii].value;
  }
}

    if (form.file_upload_subdoctype.selectedIndex==0){
      alert("Please indentify the Content Type.");
	  form.file_upload_subdoctype.focus();
	  return false;
	} else{
	 for (var isub=0; isub<form.file_upload_subdoctype.length; isub++){
	   if(form.file_upload_subdoctype[isub].selected){
	    var doctype=form.file_upload_subdoctype[isub].value;
		if(doctype=="URL"){
		  urllink=form.urllink.value;
		  
		}
		}
	 }
	} 
	

   //radio button selection for adding a folder
if(useraction=="FolderExist"){
//if (window.frames['ifrlibraryupload']){
  // iframeWin = window.frames['ifrlibraryupload']; 
   foldertype= form.ifoldertype.value;
   folderid=form.ifolderid.value;
   
   //alert(iframeWin.iframefolder6.length);
if(form.iframefolder5.length==undefined){
    fname=form.iframefolder5.value;
	
  }else if(form.iframefolder5 != null){
   for (var i=0; i < form.iframefolder5.length; i++) {	
	if(form.iframefolder5[i].checked){
	//alert(i);
	 fname=(form.iframefolder5[i].value);
	 type="existing";
	  var temp=new Array();
	  temp=fname.split('.');
	 //alert(temp[0]);
	}
  }
}
}
//}
if(useraction=="FolderCreate"){
  var x=document.getElementsByName("folderchoice"); 
  if(x.length!=0){
   if(form.folderchoice.selectedIndex==0){
     alert("no folder chosen");
   }else{
    
	 fname=window.document.getElementById("folderchoice").value;
	 type="new";
   }
  }
}
if((useraction=="FolderNone") || (useraction=="")){ 
 if(fname==""){
   fname=document.getElementById("fname").value;
   type="existing";
  }
}
if(form.sendmess.value==""){
  alert("Select whether you want to notify any of your contacts.");
 }else{
   for (var i=0; i<form.sendmess.length; i++)  { 
		if (form.sendmess[i].checked)  {
		  var notify=form.sendmess[i].value;
		 }
    }

 }

if(notify=="Y"){

 for (var ii = 0; ii <= form.contacts.options.length; ii++){
  if(form.contacts[ii] != null && form.contacts[ii].selected){
     
	  if(teamcontacts != ""){
        teamcontacts += "," + form.contacts[ii].value ;
     }else{
       teamcontacts = form.contacts[ii].value;
   }
  
   }//if null
  }//for loop
 }

 
  addFilestoFolder(fname,type,foldertype,folderid,doctype,urllink,notify,teamcontacts,spanid,spantype,spannum,subs);
 // hidePopupNew('upload_popup');
}
function validateCustom(form,action){
	var teamcontacts="";
	var urllink="";
	var doctype="";
	if(action=="custom"){
	//get category/custom nav item
	if(form.custom.selectedIndex==0){
	  alert("Please select a category from the drop down menu.");
	  form.custom.focus();
	  return;
	}else{
	  for (var i=0; i<form.custom.length; i++){
	   if(form.custom[i].selected){
	    var category=form.custom[i].value;
	   }
	  }
	}
	//get subdoctype
	if (form.file_upload_subdoctype.selectedIndex==0){
      alert("Please indentify the Content Type.");
	  form.file_upload_subdoctype.focus();
	  return false;
	} else{
	 for (var isub=0; isub<form.file_upload_subdoctype.length; isub++){
	   if(form.file_upload_subdoctype[isub].selected){
	     doctype=form.file_upload_subdoctype[isub].value;
			if(doctype=="URL"){
			  urllink=form.urllink.value;
			}
		}
	 }
	} 
	if(form.sendmess.value==""){
	  alert("Select whether you want to notify any of your contacts.");
	}else{
	   for (var i=0; i<form.sendmess.length; i++)  { 
			if (form.sendmess[i].checked)  {
			  var notify=form.sendmess[i].value;
			 }
		}

   }	
   
	if(notify=="Y"){

 	for (var ii = 0; ii <= form.contacts.options.length; ii++){
  	  if(form.contacts[ii] != null && form.contacts[ii].selected){
     
		  if(teamcontacts != ""){
			teamcontacts += "," + form.contacts[ii].value ;
		  }else{
		   teamcontacts = form.contacts[ii].value;
		  }
  
     }//if null
    }//for loop
   }//if notify=Y
   
   addToCustom(notify,teamcontacts,category,urllink,doctype);
   hidePopupNew('upload_popup');
		
  }//if action = custom
}
function validateAllSingle(form){    
   //if (form.file_upload_title.value==""){
   //   alert("Please enter a title for your content.");
	//  form.file_upload_title.focus();
//	  return false;
	 
//	}
   //if (form.file_description.value==""){
   //   alert("Please enter a description for your content.");
	//  form.file_description.focus();
	//  return false;
	//}
    if (form.file_upload_subdoctype.selectedIndex==0){
      alert("Please indentify the Content Type.");
	  form.file_upload_subdocType.focus();
	  return false;
	}
  
}
function view_teamList(id,contactuserid) {
			//alert(name);
		if (window.popup_window && !window.popup_window.closed) {
			//window.popup_window.resizeTo(width, height);
		} 
		width="500";
		height="500";
		
		// Set the window properties.
		var window_specs = "location=no, scrollbars=yes, menubars=no, toolbars=yes, resizable=yes, left=400, top=150, width=" + width + ", height=" + height;
		
		var url="view_team.php?id="+id + "&contact=" + contactuserid;
		
		// Create the pop-up window.
		popup_window = window.open(url, "PictureWindow", window_specs);
		popup_window.focus();
		
	} // End of function.

function create_windowprop (uploadid,filename,fileid, width, height,name) {
			//alert(name);
			//alert("file id " + fileid);
			//alert("upload id " + uploadid);
		if (window.popup_window && !window.popup_window.closed) {
			//window.popup_window.resizeTo(width, height);
		} 
		//alert(width);
		
		// Set the window properties.
		var window_specs = "location=no, scrollbars=yes, menubars=no, toolbars=yes, resizable=yes, left=400, top=150, width=" + width + ", height=" + height;
		
		// Set the URL.
		
		//var url = "image_window.php?image=" + image;
		if (name=="space"){
		var url="spaceusage.php?id=" + filename;
		}else if(name=='teamshare'){
		var url="teamsharefolder.php?id=" + uploadid + "&fid=" + filename + "&uid=" + uploadid;
		//alert(url);
		}else if(name=='teamlist'){
		 var url="orgusers.php";
		}else if(name=='share'){
		var url="file_share2.php?id=" + filename + "&fid=" + fileid + "&uid=" + uploadid;
		//alert(url);
		}else {
		var url="view_filedetails.php?id=" + filename+ "&fid=" + uploadid;
		}
		// Create the pop-up window.
		popup_window = window.open(url, "PictureWindow", window_specs);
		popup_window.focus();
		
	} // End of function.
function create_window (image, width, height) {
	
		// Add some pixels to the width and height.
		//width = width + 25;
		//height = height + 50;
		width="500";
		height="500";
		
		// If the window is already open, resize it to the new dimensions.
		if (window.popup_window && !window.popup_window.closed) {
			window.popup_window.resizeTo(width, height);
		} 
		
		// Set the window properties.
		var window_specs = "location=no, scrollbars=no, menubars=no, toolbars=no, resizable=yes, left=0, top=0, width=" + width + ", height=" + height;
		
		// Set the URL.
		//var url = "image_window.php?image=" + image;
		
		var url="./MultiPowUpload/UploadTest.php";
		
		// Create the pop-up window.
		popup_window = window.open(url, "PictureWindow", window_specs);
		popup_window.focus();
}
function createNewLC(siteid){
         //var url="http://localhost/view_logos.php";
		 alert(siteid);
		 return;
		 //window.location="add_sites.php";
}

function pick(choice){
	  //alert(choice);
	  
	    if (choice=="title"){		     
		     window.document.getElementById("logoLib").disabled=true;
		   window.document.getElementById("upload").disabled=true;
		    //window.document.getElementById("pick2").style.visibility="visible";
		   
			//window.document.forms[0].color2.disabled=true;
			//document.form.color2.style.backgroundColor='#CCCCCCC';

			window.document.getElementById("pick2").style.visibility="visible";
			//window.document.forms[0].pick2.disabled=true;			
		}else if (choice=="logo"){
		   //window.document.forms[0].color2.disabled=true;
		   //alert(choice);
		   window.document.getElementById("logoLib").disabled=true;
		   window.document.getElementById("upload").style.display="block";
		    window.document.getElementById("pick2").style.visibility="hidden";
		   
		//window.document.getElementById("pick2").style.display="none";
		}else if (choice=="Lib") {
		  // window.document.forms[0].color2.disabled=true;
		  window.document.getElementById("logoLib").disabled=false;
		   window.document.getElementById("upload").style.visibility="visible";
		    window.document.getElementById("pick2").style.visibility="hidden";
		  // window.document.getElementById("pick2").style.display="none";
		}
}
function getUrl(){
	var url="view_files.php";
    window.location="view_files.php";
}
function saveInfo(){
	var userrole="";
	//var location=window.document.getElementById("grprovince").value;
	//if(location==""){
	//	alert("Select a Group location.");
	//	return;
	//}
	var name=window.document.getElementById("org_group_name").value;
	if(name==""){
	 alert("Identify the group name.");
	 return;
	}
	//get the values from the check box
    var mform=window.document.addgroups;

 for (var i=0; i < mform.role.length; i++) {	
	var checkItem = mform.role[i]; 
  if(checkItem != null && checkItem.checked){ 
    if(userrole==""){
      userrole=checkItem.value;
	  checkItem.checked=false;
	}else{
	  userrole+="," + checkItem.value;	
	  checkItem.checked=false;
	}
	
 
  }
 }
 if(userrole==""){
	alert("Please select the roles associated with this group");
	return;
 }
	
window.document.getElementById("org_group_name").value="";
for (var i=0; i < mform.role.length; i++) {	
	var checkItem = mform.role[i]; 
  if(checkItem != null && checkItem.checked){ 
      checkItem.value="";
 
  }
 }
	saveGroupInfo(name,userrole);
}
/*function validateContent(){
	  var sitename = window.document.forms[0].org_site_name.value;
      var ft = window.document.forms[0].file_upload_title.value;
	  //var fsdt = window.document.forms[0].file_upload_subdocType.value;
	  //var fsdt="";
	  var fut = window.document.forms[0].uploadfile.value;
	  var fd = window.document.forms[0].file_description.value;
	 if(sitename==""){
	   alert("Enter a site name")
	   return false;
	  }else if(ft =="" ) {
	 alert("Enter a content title");
	 return false;
	 }else	 if (fut == ""){
	  alert("Browse for content");
	  return false;
	 }else if (fd == ""){
	  alert("Enter a description for your content");
	  return false;
	 }
	 //window.document.forms[0].submit();
	  //addContent(sitename)
	}*/
 function validateUser(){
      var cn = window.document.forms[0].client_name.value;
	  var en = window.document.forms[0].client_email_address.value;
	  var window_specs = "location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,top=120,left=300,width=400,height=250";
	 if(cn =="" ) {
	 alert("please enter a client name to add to this LC");
	 return;
	 }
	if (en == ""){
	  alert("please enter a valid email address for this user");
	  return;
	 }
	 var URL = "sendEmail.php?id=" +cn + "&add="+en;
	 alert(URL);
	 window.open(URL,"SendEmail",window_specs);
	}
	 function validateFAQ(){
      var fq = window.document.forms[0].FAQ_question.value;
	  var fa = window.document.forms[0].FAQ_answer.value;
	  if(fq =="" ) {
	 alert("please enter an FAQ question");
	 return;
	 }
	if (fa == ""){
	  alert("please enter the answer");
	  return;
	 }
	addFAQ(fq,fa);
	
	}
	function siteAccess(acc){
	
	    if (acc=="public"){
		  			
		    window.document.forms[0].client_name.disabled=true;		
			window.document.forms[0].client_email_address.disabled=true;	
			//window.document.forms[0].client_username.disabled=true; 
			//window.document.forms[0].client_password.disabled=true; 
			
			//for(var i=0;i<window.document.forms[0].Addusers.length;i++){
			//    window.document.forms[0].Addusers[i].checked="";
			//	window.document.forms[0].Addusers[i].disabled=true;
			//}
		
		}else if (acc=="priv"){
				window.document.forms[0].client_name.disabled=false;		
				window.document.forms[0].client_email_address.disabled=false;	
				//window.document.forms[0].client_username.disabled=false; 
				//window.document.forms[0].client_password.disabled=false; 
				//for(var i=0;i<window.document.forms[0].Addusers.length;i++){		    
				//	window.document.forms[0].Addusers[i].disabled=false;
				//}
				
		  
		}
	}
	function siteUsers(action){
	      if (action=="UAdd"){
		      
				window.document.forms[0].client_name.disabled=false;		
				window.document.forms[0].client_email_address.disabled=false;	
				//window.document.forms[0].client_username.disabled=false; 
				//window.document.forms[0].client_password.disabled=false; 
				
		 }else if (action=="ULibrary"){
				 
		   		window.document.forms[0].client_name.value="";		
				window.document.forms[0].client_email_address.value="";	
				window.document.forms[0].client_username.value="";
				window.document.forms[0].client_password.value="";
				window.document.forms[0].client_name.disabled=true;		
				window.document.forms[0].client_email_address.disabled=true;	
				//window.document.forms[0].client_username.disabled=true; 
				//window.document.forms[0].client_password.disabled=true; 
		 }
		 }
		 function siteContent(option){
		    if (option == "CAdd"){              
		 	window.document.forms[0].file_upload_docType.value="";
			window.document.forms[0].file_upload_title.value=""; 
			window.document.forms[0].file_upload_start_filename.value=""; 
			window.document.forms[0].uploadfile.value=""; 
			window.document.forms[0].file_upload_docType.disabled=false;		
			window.document.forms[0].file_upload_title.disabled=false; 
			window.document.forms[0].file_upload_start_filename.disabled=false; 
			window.document.forms[0].uploadfile.disabled=false; 		
			
			}else if (option=="CLibrary"){			
			
			window.document.forms[0].file_upload_docType.disabled=true;				
			window.document.forms[0].file_upload_title.disabled=true; 
			window.document.forms[0].file_upload_start_filename.disabled=true; 
			window.document.forms[0].uploadfile.disabled=true; 
			
		 }
		}
		
		function siteLogos(act){
		   if (act=="LAdd"){
		     window.document.forms[0].upload1.disabled=false;
			  window.document.forms[0].upload2.disabled=false;
		   }else if (act=="LLibrary"){
		     
		      window.document.forms[0].upload1.disabled=true;
			  window.document.forms[0].upload2.disabled=true;			
			
		   }
		}
		function siteContact(option){
		
		  if(option=="NoContact"){
		    window.document.forms[0].org_site_contact_name.disabled=true;
			window.document.forms[0].org_site_contact_emailaddress.disabled=true;
			window.document.forms[0].org_site_contact_text.disabled=true;
		  }else if (option=="OrgContact"){
		    window.document.forms[0].org_site_contact_name.disabled=true;
			window.document.forms[0].org_site_contact_emailaddress.disabled=true;
			window.document.forms[0].org_site_contact_text.disabled=true;
		  }else{
		    window.document.forms[0].org_site_contact_name.disabled=false;
			window.document.forms[0].org_site_contact_emailaddress.disabled=false;
			window.document.forms[0].org_site_contact_text.disabled=false;		  
		  }
		  
		}
		function siteFAQ(option) {
		 if(option=="NoFAQ"){
		    window.document.forms[0].FAQ_question.disabled=true;
			window.document.forms[0].FAQ_answer.disabled=true;
			
		  }else{
		    window.document.forms[0].FAQ_question.disabled=false;
			window.document.forms[0].FAQ_answer.disabled=false;
		}}
		
	function upperCase(x){ 
			var y=document.getElementById(x).value
			document.getElementById(x).value=y.toUpperCase()
	}
function AdminSection(id,Lang)  {

   var plusImg = "/images/plus.jpg";
   var minusImg = "/images/minus.jpg";
   
	var StyleHandle = "";
	var StyleObject = "";
	if (Lang == "E"){
	    expMsg = "Click to Expand Section";
	    colMsg = "Click to Collapse Section";
	}
	else {
	    expMsg = "cliquez pour élargir la section";
	    colMsg = "Cliquez pour réduire la section";
	}
	
	if (window.document.layers)  {
		StyleHandle = "window.document.layers";
		StyleObject = " ";
	}
	else {
		StyleHandle = "document.all";
		StyleObject = ".style";
	}
	
	
	var tmp = eval(StyleHandle + "['" + id  + "']" + StyleObject  + ".display");

	if ( tmp == "none" || tmp == "" ) {
		eval (StyleHandle + "['" + id  + "']" + StyleObject  + ".display='block'");
		//swapImg("anav", minusImg, colMsg);
	} else {
		eval (StyleHandle + "['" + id  + "']" + StyleObject  + ".display='none'");
		//swapImg("anav", plusImg, expMsg);
	}
}
function PCase(STRING){ 
//alert("String = " + STRING);
	var strReturn_Value = ""; 
	var iTemp = STRING.length; 
	alert(string);
	if(iTemp==0){ 
		return""; 
	} 
	var UcaseNext = false; 
		strReturn_Value += STRING.charAt(0).toUpperCase(); 
		//alert(strReturn_Value);
	for(var iCounter=1;iCounter < iTemp;iCounter++){ 
		if(UcaseNext == true){ 
			strReturn_Value += STRING.charAt(iCounter).toUpperCase(); 
		} 
		else{ 
			strReturn_Value += STRING.charAt(iCounter).toLowerCase(); 
		} 
		var iChar = STRING.charCodeAt(iCounter); 
		if(iChar == 32 || iChar == 45 || iChar == 46){ 
			UcaseNext = true; 
	    } 
		else{ 
		UcaseNext = false 
		} 
		if(iChar == 99 || iChar == 67){ 
		if(STRING.charCodeAt(iCounter-1)==77 || STRING.charCodeAt(iCounter-1)==109){ 
			UcaseNext = true; 
		} 
		} 
}
//alert(strReturn_Value);
window.document.forms[0].client_name.value=strReturn_Value;
return strReturn_Value; 
}
