 function URLEncode(str)
 {
 var ms = "%25#23 20?3F<3C>3E{7B}7D[5B]5D|7C^5E~7E`60+2B"
 var msi = 0
 var i,c,rs,ts
 while (msi < ms.length)
 {
 c = ms.charAt(msi)
 rs = ms.substring(++msi, msi +2)
 msi += 2
 i = 0
 while (true)
 {
 i = str.indexOf(c, i)
 if (i == -1) break
 ts = str.substring(0, i)
 str = ts + "%" + rs + str.substring(++i, str.length)
 }
 }
 return str
 }
 function MM_openBrWindow(theURL,winName,features) {
 window.open(theURL,winName,features);
 }
 // This function provides the same conversion as that obtained from
 // java.net.URLEncoder.encode(). The function converts a string into
 // the x-www-form-urlencoded MIME format.
 //
 // To convert the string, each character is examined in turn:
 //
 // o The ASCII characters 'a' through 'z', 'A' through 'Z',
 // '0' through '9', and '.', '-', '*', '_' remain the same.
 // o The space character (' ') is converted into a plus sign ('+').
 // o All other characters are converted into the 3-character string
 // %XY, where XY is the two-digit hexadecimal representation of the
 // lower 8-bits of the character.
 //
 // NB: The list of characters that are not encoded have been determined by
 // referencing O'Reilly's "HTML: The Definitive Guide" (page 164).
 //
 // The implementation is derived from that found at
 // <http://summerholiday.org/freecode/JavaScript_URL_Encode.html>
 // (which appears to share significant DNA with the code at
 // <http://www.blooberry.com/indexdot/html/topics/urlencoding.htm>).
 //
 function URLEncodeParamValue (paramValue)
 {
 var len = paramValue.length;
 var i = 0;
 var newStr = "";
 var paramChar = "";
 for (i=0;i<len;i++) 
 {
 paramChar = paramValue.substring (i, i + 1)
 if (isUrlOK (paramChar))
 {
 newStr = newStr + paramChar;
 }
 else if (paramChar.charCodeAt(0) == 32)
 {
 newStr = newStr + "+";
 }
 else
 {
 tval1 = paramChar;
 newStr = newStr + "%" + decToHex (tval1.charCodeAt(0), 16);
 }
 }
 return newStr;
 }
 // part of URLEncodeParamValue()
 var hexVals = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
 function decToHex(num, radix)
 {
 var hexString = "";
 while (num >= radix)
 {
 temp = num % radix;
 num = Math.floor(num / radix);
 hexString += hexVals[temp];
 }
 hexString += hexVals[num];
 return reversal(hexString);
 }
 // part of URLEncodeParamValue()
 function reversal (s)
 {
 var len = s.length;
 var trans = "";
 for (i=0; i<len; i++)
 {
 trans = trans + s.substring(len-i-1, len-i);
 }
 s = trans;
 return s;
 }
 // part of URLEncodeParamValue()
 function isUrlOK(compareChar)
 {
 var charCode = compareChar.charCodeAt(0);
 if ((charCode >= 97 && charCode <= 122)         // 'a'-'z'
 || (charCode >= 65 && charCode <= 90)   // 'A'-'Z'
 || (charCode >= 48 && charCode <= 57)   // '0'-'9'
 || charCode == 46                               // '.'
 || charCode == 45                               // '-'
 || charCode == 95                               // '_'
 || charCode == 42)                              // '*'
 {
 return true;
 }
 else
 {
 return false;
 }
 }

 function submitenter(myfield,e)
 {
 var keycode;
 if (window.event) keycode = window.event.keyCode;
 else if (e) keycode = e.which;
 else return true;
 if (keycode == 13)
 {
// submitForm();
 return false;
 }
 else
 return true;
 }
// function submitForm(){
// var first_name = URLEncode(document.QuickRegistration.QREG_FIRST_NAME.value);
// var last_name = URLEncode(document.QuickRegistration.QREG_LAST_NAME.value);
// var email = URLEncode(document.QuickRegistration.QREG_EMAIL.value);

// var style = URLEncode(document.QuickRegistration.QREG_STYLE.value);
// var includeInterests = URLEncode(document.QuickRegistration.QREG_INCLUDE_INTERESTS.value);
// var externalContent = URLEncode(document.QuickRegistration.QREG_EXTERNAL_CONTENT.value);
// var buttonText = URLEncode(document.QuickRegistration.QREG_BUTTON_TEXT.value);
// var nexturl = document.QuickRegistration.NEXTURL_FOR_JS.value;
// var complete = URLEncode(document.QuickRegistration.QREG_COMPLETE.value);
// var theTime = new Date().getTime();     // used to make URL unique
// var url = "http://kcet.convio.net/site/QuickReg?QREG_SUBMIT=TRUE&QREG_FIRST_NAME=" + first_name + "&QREG_LAST_NAME=" + last_name + "&QREG_EMAIL=" + email  + "&QREG_STYLE=" + style + "&QREG_INCLUDE_INTERESTS=" + includeInterests + "&QREG_EXTERNAL_CONTENT=" + externalContent + "&QREG_BUTTON_TEXT=" + buttonText + "&QREG_COMPLETE=" + complete + "&TS=" + theTime + "&NEXTURL=" + nexturl;

 //document.QuickRegistration.QREG_EMAIL.value = "";

//	MM_openBrWindow(url, 'Select', 'scrollbars=yes,resizable=yes,alwaysRaised=yes,dependent=yes,width=' + width + ',height=' + height) 
// return false;
// }
 
 function popupForm(){
 var style = URLEncode(document.QuickRegistration.QREG_STYLE.value);
 var includeInterests = URLEncode(document.QuickRegistration.QREG_INCLUDE_INTERESTS.value);
 var externalContent = URLEncode(document.QuickRegistration.QREG_EXTERNAL_CONTENT.value);
 var buttonText = URLEncode(document.QuickRegistration.QREG_BUTTON_TEXT.value);
 var nexturl = document.QuickRegistration.NEXTURL_FOR_JS.value;
 var complete = URLEncode(document.QuickRegistration.QREG_COMPLETE.value);
 var theTime = new Date().getTime();     // used to make URL unique
 var url = "http://kcet.convio.net/site/QuickReg?QREG_STYLE=" + style + "&QREG_INCLUDE_INTERESTS=" + includeInterests + "&QREG_EXTERNAL_CONTENT=" + externalContent + "&QREG_BUTTON_TEXT=" + buttonText + "&QREG_COMPLETE=" + complete + "&TS=" + theTime + "&NEXTURL=" + nexturl;

 var width = 523; var height = 400; 

 MM_openBrWindow(url, 'Select', 'scrollbars=yes,resizable=yes,alwaysRaised=yes,dependent=yes,width=' + width + ',height=' + height) 
 }
                            /*
														// Registration form code
														<form name="QuickRegistration" action="http://kcet.convio.net/site/QuickReg" method="get">



                            <input type="button" class="Button" name="QREG_DISPLAY" value="Register" onClick="popupForm()" />

                            <input type="hidden" name="QREG_STYLE" value="4">
                            <input type="hidden" name="QREG_INCLUDE_INTERESTS" value="TRUE">
                            <input type="hidden" name="QREG_EXTERNAL_CONTENT" value="TRUE">
                            <input type="hidden" name="QREG_BUTTON_TEXT" value="Register">
                            <input type="hidden" name="QREG_COMPLETE" value = "NONE">
                            <input type="hidden" name="NEXTURL_FOR_JS" value="http%3A%2F%2Fwww.kcet.org">
                            <input type="hidden" name="NEXTURL" value="http://www.kcet.org">
                            <input type="hidden" name="BUTTON_IMAGE" value="null">
                            </form>
														*/


