// try {
//  document.execCommand('BackgroundImageCache', false, true);
// } catch(e) {}

function CreateHelpText() {
	var myTips = new Tips($$('.helptext'), {
	maxTitleChars: 50, //I like my captions a little long        
	maxOpacity: 0.9, //let's leave a little transparancy in there 
	timeOut: 500
	});
}

/* ############## CLEAR SEARCH BOX ############################ */
function doClear(theText) {
	if (theText.value == theText.defaultValue) {
         theText.value = ""
     }
 }
 function PageNameToPageTitle() {
    if (!document.getElementById) return false;
    var pagenametextbox = document.getElementById("PageNameTextBox");
    var pagetitletextbox = document.getElementById("PageTitleTextBox");
    pagetitletextbox.value = pagenametextbox.value;
}
 function ProductNameToPageTitle() {
    if (!document.getElementById) return false;
    var pagenametextbox = document.getElementById("ProductNameTextBox");
    var pagetitletextbox = document.getElementById("PageTitleTextBox");
    pagetitletextbox.value = pagenametextbox.value;
}
 
function OpenImageBrowser(url) {
    window.open(url,'_blank','height=600,width=600,status=yes,toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes');
}

function showPic(whichpic) {
	  //Check to see if the color text box is on the screen
	  if (!document.getElementById("LargeProductImage")) return false;
	  var lgImage
	  lgImage = document.getElementById("LargeProductImage");
	  lgImage.src = whichpic.src
}


/* ------------------ CUSTOM ON PAGE LOAD ---------------------------------- */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function addUnLoadEvent(func) {
	var oldonunload = window.onunload;
	if (typeof window.onunload != 'function') {
	  window.onunload = func;
	} else {
	  window.onunload = function() {
	    oldonunload();
	    func();
	  }
	}
}

