 
function SetUrl(link) 
{ 
eval('document.' + getcookie('ffbform') + '.' + getcookie('ffbfield') + '.value = link');
eval('document.' + getcookie('ffbform') + '.' + getcookie('ffbfield') + '.fireEvent("onchange")');
//txtBox = document.getElementById('file1'); 
//txtBox.value=link; 
} 
 
function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}

function getcookie(cookiename) {
 var cookiestring=""+document.cookie;
 var index1=cookiestring.indexOf(cookiename);
 if (index1==-1 || cookiename=="") return ""; 
 var index2=cookiestring.indexOf(';',index1);
 if (index2==-1) index2=cookiestring.length; 
 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}

function SHfileBrowser(xformname, xfieldname, xType) { 
SetCookie('ffbform', xformname);
SetCookie('ffbfield', xfieldname);
URL ='/Editor/Editor/filemanager/browser/default/browser.html?Connector=/Editor/editor/filemanager/connectors/aspx/connector.aspx&Type='+ xType +'&Command=GetFolders&CurrentFolder=/&basepath=/Editor/&xformname=/'+ xformname +'&xfieldname=/'+ xfieldname; 
//URL ='/fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/asp/connector.asp&Command=GetFolders&Type=Images&CurrentFolder=/images&xformname=/'+ xformname +'&xfieldname=/'+ xfieldname; 
Mypopup = open(URL, 'browserpopup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=500');
} 

function fileBrowser(xformname, xfieldname) { 
SetCookie('ffbform', xformname);
SetCookie('ffbfield', xfieldname);
URL ='/fckeditor/editor/filemanager/browser/default/browser.html?Connector=/globalscripts/FCKeditor/editor/filemanager/connectors/asp/connector.asp&Command=GetFolders&Type=Images&CurrentFolder=/images&basepath=/globalscripts/FCKeditor/&xformname=/'+ xformname +'&xfieldname=/'+ xfieldname; 
//URL ='/fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/asp/connector.asp&Command=GetFolders&Type=Images&CurrentFolder=/images&xformname=/'+ xformname +'&xfieldname=/'+ xfieldname; 
Mypopup = open(URL, 'browserpopup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=300');
} 

function SetSwatch(xsource, xtarget) { 
    var xcolor = document.getElementById(xsource).value;
    document.getElementById(xtarget).style.background = xcolor; 
//	alert('Color of '+ xtarget + ' set to '+ xcolor);
} 

function setButton(buttonValue) 
{ 
    document.EditNLForm.buttonChoice.value = buttonValue; 
    document.EditNLForm.submit();
} 

function setAdButton(buttonValue) 
{ 
    document.EditAdForm.buttonChoice.value = buttonValue; 
    document.EditAdForm.submit();
} 

function ConfirmCustomize(pagearea, buttonValue) 
{ 
	//alert('Pagearea: '+ pagearea + ' buttonValue: '+ buttonValue);

var agree=confirm('This page currently uses the website default '+ pagearea +'. Do you want to customize the '+ pagearea +' for this page?');
if (agree)
	{
    document.EditNLForm.buttonChoice.value = buttonValue;
    document.EditNLForm.submit();
	}
else
	return false ;
} 

function ConfirmCustomizeContent(pagearea, buttonValue) 
{ 
	//alert('Pagearea: '+ pagearea + ' buttonValue: '+ buttonValue);

var agree=confirm('This page currently uses the website default design for the Main Content area. Do you want to customize the Main Content area design for this page?');
if (agree)
	{
    document.EditNLForm.buttonChoice.value = buttonValue;
    document.EditNLForm.submit();
	}
else
	return false ;
} 

function ConfirmCustomizeLayout(pagearea, buttonValue) 
{ 
	//alert('Pagearea: '+ pagearea + ' buttonValue: '+ buttonValue);

var agree=confirm('This page currently uses the website default design for the page layout. Do you want to customize the page layout design for this page?');
if (agree)
	{
    document.EditNLForm.buttonChoice.value = buttonValue;
    document.EditNLForm.submit();
	}
else
	return false ;
} 

function toggleChecked(oElement) 
{ 
  oForm = oElement.form; 
  oElement = oForm.elements[oElement.name]; 
  if(oElement.length) 
  { 
    bChecked = oElement[0].checked; 
    for(i = 1; i < oElement.length; i++) 
      oElement[i].checked = bChecked; 
  } 
} 

function toggleIndeterminate(oElement) 
{ 
  oForm = oElement.form; 
  oElement = oForm.elements[oElement.name]; 
  if(oElement.length) 
  { 
    bIndeterminate = false; 
    bChecked = true; 
    nChecked = 0; 
    for(i = 1; i < oElement.length; i++) 
      if(oElement[i].checked) 
        nChecked++; 
    if(nChecked < oElement.length - 1) 
    { 
      if(nChecked) 
        bIndeterminate = true; 
      else 
      { 
        bIndeterminate = false; 
        bChecked = false; 
      } 
    } 
    else 
    { 
      bIndeterminate = false; 
    } 
    oElement[0].indeterminate = bIndeterminate; 
    oElement[0].checked = bChecked; 
  } 
}

function AlertDeleteEmail(AlertDeleteEmailCount) 
{ 

if (AlertDeleteEmailCount == 0)
	{
	alert('Deleted email accounts will be disabled and all associated email message will be deleted from the server');
	AlertDeleteEmailCount = 1
	};
} 


function dopopup(url, windowname, properties)
{
    mywindow = window.open(url,windowname,properties);
}