﻿addEvent(window,'load',addLinks);

function addLinks() {
  if ((document.getElementById && document.createTextNode && document.createElement && document.appendChild) && (target = document.getElementById("pagetools"))) {
    var newListItem2 = document.createElement("li");
    newListItem2.className = "backlink";
    var newLink2 = document.createElement("a");
    newLink2.href="javascript:history.back();";
    var newLinkText2 = document.createTextNode("Back to the previous page");
    newLink2.appendChild(newLinkText2);
    newListItem2.appendChild(newLink2);
    target.appendChild(newListItem2);

    var newListItem = document.createElement("li");
    newListItem.className = "printlink";
    var newLink = document.createElement("a");
    newLink.href="javascript:window.print();";
    var newLinkText = document.createTextNode("Print page");
    newLink.appendChild(newLinkText);
    newListItem.appendChild(newLink);
    target.appendChild(newListItem);
  }
}

/* helper functions */
function addEvent(obj, evType, fn){
 if (obj.addEventListener){
   obj.addEventListener(evType, fn, false);
   return true;
 } else if (obj.attachEvent){
   var r = obj.attachEvent("on"+evType, fn);
   return r;
 } else {
   return false;
 }
}

function clearInput(box,text){
	if (box.value==text)
		box.value="";
}

function changeToUpperCase(controlName){
    document.getElementById(controlName).value = document.getElementById(controlName).value.toUpperCase()
}

function Count(text, nlong) {
    var maxlength = new Number(nlong); // Change number to your max length.
    if (document.getElementById('<%=textBox.ClientID%>').value.length > maxlength) {
        text.value = text.value.substring(0, maxlength);
        alert(" Only " + nlong + " chars");
    }
}

function popUpNonScrolling(url, w, h) {
    if (typeof w == 'undefined' || w == '') { w = '450' }
    if (typeof h == 'undefined' || h == '') { h = '350' }
    window.name = "Condell_Ltd_Main";
    var toolbar = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,width=" + w + ",height=" + h;
    var myPopup = window.open(url, "Condell_Ltd_Popup", toolbar);
    myPopup.focus();
}
