var ns4 = (document.layers)? true:false
var ns6 = (!document.all && document.getElementById)? true:false
var ie4 = (document.all)? true:false
//alert("ns4  "+ns4)
//alert("ns6  "+ns6)
//alert("ie4  "+ie4)
function URLEncode(value)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = value ;//document.URLForm.F1.value;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	//document.URLForm.F2.value = encoded;
	return encoded;
};
function findObj(divID) {
    if( ns4) { //Netscape layers
        return document.layers[divID];
    }
    if( ns6 ) { //DOM; IE5, NS6, Mozilla, Opera
        return document.getElementById(divID); 
    }
    if(ie4 ) { //Proprietary DOM; IE4
        return document.all[divID]; 
    }
    if( document[divID] ) { //Netscape alternative
        return document[divID]; 
    }
    return false;
}
function cancel()
{
  	document.location.href="../NewPort/Reg/AllView.aspx"
}
function findElement(frm, ID) 
{
 // alert("Here")
 // alert(frm +"  " + ID)
   var elements= findObj(frm).elements;
  // alert(elements.length)
   var obj = null;
    for (i=0;i< elements.length; i++)
    {
      // alert("value "+elements[i].id)
       if (elements[i].id == ID)
       {
         obj = elements[i];
         break;
       }    
    }
   // alert(obj.value)
    return obj;
   
}
function showT(divID_as_a_string) 
{
	var myReference = findObj(divID_as_a_string);
	if( !myReference ) 	{ 
	    window.alert('Nothing works in this browser'); 
		return; 
	}
	if( myReference.style ) { 
		myReference.style.visibility = 'visible'; 
	} else {
		if( myReference.visibility ) { 
			myReference.visibility = 'show'; 
		} else {
			//window.alert('Nothing works in this browser');
		    return; 
		} 
	}
}
function IsVisible(divID_as_a_string) 
{
	var myReference = findObj(divID_as_a_string);
	if( !myReference ) 
	{ 
	   // window.alert('Nothing works in this browser'); 
		return false; 
	}
	if( myReference.style && myReference.style.visibility == 'visible') { 
	   return true;
		 
	} else {
		if( myReference.visibility && myReference.visibility == 'show') { 
			  return true;
		} else {
			//window.alert('Nothing works in this browser');
		    return  false; 
		} 
	}
}
function hide(divID_as_a_string) {
	var myReference = findObj(divID_as_a_string);
	if( !myReference ) 
	{ 
		//window.alert('Nothing works in this browser'); 
		return; 
	}
	if( myReference.style ) 
	{ 
		myReference.style.visibility = 'hidden'; 
	} else {
		if( myReference.visibility ) 
		{ 
			myReference.visibility = 'hide'; 
		} else {
			//window.alert('Nothing works in this browser'); 
			return; 
		} 
	}
}
function OpenHelpWindow(URL)
{
    w = 450;
    h = 500;
	l = (screen.availWidth-10 - w) / 2;
	t = (screen.availHeight-20 - h) / 2;

	features = "width="+w+",height="+h+",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	features += ",scrollbars=1,resizable=1,location=0";
	features += ",menubar=0,toolbar=0,status=0";

	window.name = "Help"
	window.open(URL,"",features);
}
function OpenHelp(URL)
{
    w = 600;
    h = 500;
	l = (screen.availWidth-10 - w) / 2;
	t = (screen.availHeight-20 - h) / 2;

	features = "width="+w+",height="+h+",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	features += ",scrollbars=1,resizable=1,location=0";
	features += ",menubar=0,toolbar=0,status=0";

	window.name = "Help"
	window.open(URL,"",features);
}
function OpenHelpWindow1(URL)
{
	w = 650;
    h = 500;
	l = (screen.availWidth-10 - w) / 2;
	t = (screen.availHeight-20 - h) / 2;

	features = "width="+w+",height="+h+",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	features += ",scrollbars=1,resizable=1,location=0";
	features += ",menubar=1,toolbar=0,status=1";

	window.name = "Help"
	window.open(URL,"",features);
}

function OpenCustomizeWindow(URL)
{
    w = 300;
    h = 150;
	l = (screen.availWidth-10 - w) / 2;
	t = (screen.availHeight-20 - h) / 2;

	features = "width="+w+",height="+h+",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	features += ",scrollbars=0,resizable=0,location=0";
	features += ",menubar=0,toolbar=0,status=0";

	window.name = "Help"
	window.open(URL,"",features);
}
/// trim string function
function LTrim(str)
{
  var whitespace = new String(" \t\n\r");

  var s = new String(str);

  if (whitespace.indexOf(s.charAt(0)) != -1) {
    // We have a string with leading blank(s)...

    var j=0, i = s.length;

    // Iterate from the far left of string until we
    // don't have any more whitespace...
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
    j++;


    // Get the substring from the first non-whitespace
    // character to the end of the string...
    s = s.substring(j, i);
  }

  return s;
}

// --------------------------------------------------------------------------
function RTrim(str)
{
  // We don't want to trip JUST spaces, but also tabs,
  // line feeds, etc.  Add anything else you want to
  // "trim" here in Whitespace
  var whitespace = new String(" \t\n\r");

  var s = new String(str);

  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
    // We have a string with trailing blank(s)...

    var i = s.length - 1;       // Get length of string

    // Iterate from the far right of string until we
    // don't have any more whitespace...
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
      i--;


    // Get the substring from the front of the string to
    // where the last non-whitespace character is...
    s = s.substring(0, i+1);
  }

  return s;
}
// --------------------------------------------------------------------------
function Trim(str)
{
  return RTrim(LTrim(str));
}

// EOF

