function trim(value) {
   var temp = value;
   var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
   if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
   var obj = / +/g;
   temp = temp.replace(obj, " ");
   if (temp == " ") { temp = ""; }
   return temp;
}

function checkcontactform(passForm) { 
       if (trim(passForm.firstname.value) ==""){
         alert("Please enter your first name")
         passForm.firstname.focus()
         return false
}
       if (trim(passForm.surname.value) ==""){
         alert("Please enter your surname")
         passForm.surname.focus()
         return false
}
       if (trim(passForm.email.value) ==""){
         alert("Please enter your e-mail address")
         passForm.email.focus()
         return false
}
       if (trim(passForm.telephone.value) ==""){
         alert("Please enter your telephone number")
         passForm.telephone.focus()
         return false
}
      return true
}


function UpdateFrame(page_id)
{

//alert(parent.frames[0].name)
parent.frames[0].location.href = url_address + "admin/website_admin/edit_page_tabs.cfm?dsp=edit_page&web_page_id=" + page_id;
}

function usrfunc(usr,page_id,mode)
{
if((mode=="edit" || mode=="preview" || mode=="audit") && (window.name!="edit_page" && window.name!="preview_page" && window.name!="audit" && window.name!="current" && window.name!="preview" && window.name!="mainFrame") && usr!=0)
{
window.parent.location.href=url_address + 'index.cfm?page=' + page_id + '&mode=normal';
//alert('        You had not logged out of Refresh. \n\n Refresh has now logged you out automatically.');
}
if(window.name=="edit_page" && mode!="edit")
{
window.location.href=url_address + 'index.cfm?page=' + page_id + '&mode=edit';
}

if(window.name=="edit_page" || window.name=="preview_page")
{
UpdateFrame(page_id);
}

}


// Add to favourites

function CreateBookmarkLink() {
 
title = document.title; 
url = window.location.href;

if (window.sidebar) { // Mozilla Firefox Bookmark
	window.sidebar.addPanel(title, url,"");
} else if( window.external ) { // IE Favorite
	window.external.AddFavorite( url, title); }
else if(window.opera && window.print) { // Opera Hotlist
	return true; }
}