
var jcErrEmailNotEntered="Please enter the email address.";var jcErrBlankSpaceInEmailAddr="Sorry, blank spaces is not allowed in the email address.";var jcErrAtSignMissingInEmailAddr="Sorry, the email address is invalid. Please make sure that the '@' sign is present.";var jcErrInvalidEmailAddr="Sorry, the email address is invalid. Please verify it.";var jcErrInvalidCharInEmailAddr="Sorry, the email address contains invalid characters. Please verify it.";var jcInvalidEmailChars="\"|&;<>!*\\";function validateEmailField(formName,emailField){var emailValue;emailValue=document.forms[formName].elements[emailField].value;if(emailValue.length==0){alert(jcErrEmailNotEntered);setFocusTo(formName,emailField);return false;}
if(!validateAsciiData(emailValue)){alert(jcErrInvalidCharInEmailAddr);setFocusTo(formName,emailField);return false;}
var invalidChars=jcInvalidEmailChars;for(var i=0;i<invalidChars.length;i++){if(emailValue.indexOf(invalidChars.charAt(i))!=-1){alert(jcErrInvalidCharInEmailAddr);setFocusTo(formName,emailField);return false;}}
if(emailValue.indexOf("@")==-1){alert(jcErrAtSignMissingInEmailAddr);setFocusTo(formName,emailField);return false;}
if(emailValue.indexOf(" ")!=-1){alert(jcErrBlankSpaceInEmailAddr);setFocusTo(formName,emailField);return false;}
if(window.RegExp){var reg1str="(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";var reg2str="^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";var reg1=new RegExp(reg1str);var reg2=new RegExp(reg2str);if(reg1.test(emailValue)||!reg2.test(emailValue)){alert(jcErrInvalidEmailAddr);setFocusTo(formName,emailField);return false;}}
return true;}
function validateAsciiData(testStr){for(var i=0;i<testStr.length;i++){if((testStr.charAt(i)<" ")||(testStr.charAt(i)>"~")){return false;}}
return true;}
function createWindow(url,name,x,y,w,h,props){if(!x){x=100;}
if(!y){y=100;}
if(!w){w=650;}
if(!h){h=500;}
var properties="toolbar=no,directories=no,resize=yes,resizable=yes,menubar=yes,location=no,scrollbars=yes,status=yes,";if(props!=null){properties=props;}
properties+="screenX="+x+",screenY="+y+",";properties+="left="+x+",top="+y+",";properties+="width="+w+",height="+h;myPopup=window.open(url,name,properties);if(!myPopup.opener){myPopup.opener=self;}
if(window.focus){myPopup.focus();}}
function showHideElement(id,show){if(show){showElement(id);}else{hideElement(id);}}
function showElement(id){var el=document.getElementById(id);if(el){el.style.display='';}}
function hideElement(id){var el=document.getElementById(id);if(el){el.style.display='none';}}
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");}
String.prototype.replaceAll=function(pcFrom,pcTo){var i=this.indexOf(pcFrom);var c=this;while(i>-1){c=c.replace(pcFrom,pcTo);i=c.indexOf(pcFrom);}
return c;}
function getTruncateString(inputStr,length){if(inputStr!=null){inputStr=inputStr.trim();var len=parseInt(inputStr.length);if(len<length){return inputStr;}
var lastSpaceIx=parseInt(inputStr.lastIndexOf(" ",length));if(lastSpaceIx!=-1){var firstLine=inputStr.substring(0,lastSpaceIx);return firstLine+"...";}else{return inputStr.substring(0,length)+"...";}
return"";}}
function getFormattedDescription(description,type){if(type=="original"){description=description.replace('####',"\"",'g');description=description.replace("\\\'","'",'g');description=description.replace(/<br>/g,"\n");}else{description=description.replace(/\'/g,"\\\'");description=description.replace(/\"/g,"####");description=description.replace(/\n/g,"<br>");}
return description;}
function createSpacerTd(widthStr){var width=parseInt(widthStr);if(!isNaN(width)){var tdSpacer=document.createElement("td");tdSpacer.width=width;tdSpacer.innerHTML='<img src="'+spacerGif+'" width="'+width+'" height="1" />';return tdSpacer;}}
function checkURL(value){var urlregex=new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");if(urlregex.test(value)){return true;}
return false;}
function initSelect(formName,fieldName,fieldValue){if(document.forms[formName].elements[fieldName]){for(i=0;i<document.forms[formName].elements[fieldName].length;i++){if(document.forms[formName].elements[fieldName][i].value==fieldValue){document.forms[formName].elements[fieldName].selectedIndex=i;break;}}}}
function setSelectedIndex(formName,fieldName,selIndex){if(document.forms[formName].elements[fieldName]){if(document.forms[formName].elements[fieldName].options.length>=selIndex){document.forms[formName].elements[fieldName].selectedIndex=selIndex;}}}
function getSelectedIndex(formName,fieldName){if(document.forms[formName].elements[fieldName]){return document.forms[formName].elements[fieldName].selectedIndex;}
return-2;}
function getSelectedText(formName,fieldName){var ix=getSelectedIndex(formName,fieldName);if(document.forms[formName].elements[fieldName]){return document.forms[formName].elements[fieldName][ix].text;}
return null;}
function getSelectedValue(formName,fieldName){var ix=getSelectedIndex(formName,fieldName);if(document.forms[formName].elements[fieldName]){return document.forms[formName].elements[fieldName][ix].value;}
return-2;}
function setFieldValue(formName,fieldName,fieldValue){if(document.forms[formName].elements[fieldName]){document.forms[formName].elements[fieldName].value=fieldValue;}}
function getFieldValue(formName,fieldName){if(document.forms[formName].elements[fieldName]){return document.forms[formName].elements[fieldName].value;}
return null;}