function validateWordLength(txt, fieldName) {	var arry = txt.split(" ");	for (i = 0; i < arry.length; i++) {		if (arry[i].length > 30) {			//alert(arry[i]);						var arry2 = txt.split("\n");			for (k = 0; k < arry2.length; k++) {				if (arry2[k].length > 30) {					alert("In "							+ fieldName							+ " field you have entered a text that contains a word ("							+ arry[k].length							+ " characters) which is longer in length than allowed (30 characters) by the system, please enter the text again.");					return true;				}			}					}	}	return false;}function trimAll(sString) {	return sString.replace(/^\s+|(\s+(?!\S))/mg,"");}function isFireFox(){	if(navigator.appName.indexOf("Netscape")!= -1)	{		return true;	}	else		return false;}function isIEBrowser() {    if (navigator.appVersion.indexOf("MSIE")!=-1)    {        return true;    }    return false;}/** * Creates an xml http object. */function getXmlHttpObject() {    var xml = null;    try {        xml = new ActiveXObject("Msxml2.XMLHTTP");    } catch (e) {        try {            xml = new ActiveXObject("Microsoft.XMLHTTP");           } catch (d) {        }    }    if (xml == null) {        xml = new XMLHttpRequest();    }    return xml;}/** * sends an ajax xml request. */function sendAJAXRquest(xmlHttpObject, url, getOrPost, responseMethodName ) {    if (xmlHttpObject == null || xmlHttpObject == undefined) {        alert('XML Http object must be provided');        return;    }    xmlHttpObject.onreadystatechange=responseMethodName;     xmlHttpObject.open(getOrPost,url,true);    xmlHttpObject.send(null);}/** * The following function parse xml string and returns a document object. * Please note that the following code has been obtained from the following  * url: http://www.webreference.com/programming/javascript/definitive2/2.html */function getDocumentObjectFromString(xmlString) {	    if (document.implementation && document.implementation.createDocument) {         //  alert(1);        // Mozilla, Firefox, and related browsers         return (new DOMParser()).parseFromString(xmlString, "application/xhtml+xml");     }     else if (typeof ActiveXObject != undefined) {         //    alert(2);        // Internet Explorer.         // var doc = XML.newDocument();  // Create an empty document         var doc = new ActiveXObject("Microsoft.XMLDOM");         doc.async = false;        doc.loadXML(xmlString);            // Parse text into it         //var pi = doc.createProcessingInstruction("xml"," version='1.0' encoding='UTF-8'");        //doc.appendChild(pi);        return doc;                   // Return it     }     else {         //   alert(3);        // As a last resort, try loading the document from a data: URL         // This is supposed to work in Safari. Thanks to Manos Batsis and         // his Sarissa library (sarissa.sourceforge.net) for this technique.         var url = "data:text/xml;charset=utf-8," + encodeURIComponent(xmlString);         var request = new XMLHttpRequest();         request.open("GET", url, false);         request.send(null);         return request.responseXML;     } }/** * The following function returns an empty document object if arguments are not * provided. * Please note that the following code has been obtained from the following  * url: http://www.webreference.com/programming/javascript/definitive2/2.html */function getNewDocumentObject(rootTagName, namespaceURL) {             if (!rootTagName) rootTagName = "";     if (!namespaceURL) namespaceURL = "";     if (document.implementation && document.implementation.createDocument) {         // This is the W3C standard way to do it         return document.implementation.createDocument(namespaceURL, rootTagName, null);     }     else { // This is the IE way to do it         // Create an empty document as an ActiveX object         // If there is no root element, this is all we have to do                         //var doc = new ActiveXObject("MSXML2.DOMDocument");         var doc = new ActiveXObject("Microsoft.XMLDOM");         // If there is a root tag, initialize the document         if (rootTagName) {             // Look for a namespace prefix             var prefix = "";             var tagname = rootTagName;             var p = rootTagName.indexOf(':');             if (p != -1) {                 prefix = rootTagName.substring(0, p);                 tagname = rootTagName.substring(p+1);             }             // If we have a namespace, we must have a namespace prefix             // If we don't have a namespace, we discard any prefix             if (namespaceURL) {                 if (!prefix) prefix = "a0"; // What Firefox uses             }             else prefix = "";             // Create the root element (with optional namespace) as a             // string of text             var text = "<" + (prefix?(prefix+":"):"") +  tagname +                 (namespaceURL                 ?(" xmlns:" + prefix + '="' + namespaceURL +'"')             :"") +                 "/>";             // And parse that text into the empty document             doc.loadXML(text);         }         return doc;     }}function getStringFromDocumentObject(doc) {        /*/// Mozilla        var serializer = new XMLSerializer();    var output = serializer.serializeToString(doc);    alert("dfldl\n"+output)     */    ///IE    //alert(doc.xml);        if (document.implementation && document.implementation.createDocument) {                var serializer = new XMLSerializer();        var output = serializer.serializeToString(doc);        return output;    } else {        return doc.xml;    }}function contactEmail(emailId){    if(document.getElementById(emailId).value != "")    {        if (validateEmail(emailId))            return true;        else        {            document.getElementById(emailId).focus();            document.getElementById(emailId).value = "";            return false;        }    }    return true;}function validateEmail(id){    var x = document.getElementById(id).value;    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;    if (filter.test(x))    {        //alert('YES! Correct email address');        return true;    }    else    {        alert('Incorrect Email Address');        //document.getElementById('userid2').focus();        return false;    }}        function validatePassword(pwd){    var x = pwd;    if(x.length < 6)    {        alert('Minimum Password length is 6 characters');        document.getElementById('password2').focus();        return false;    }    return true;}            function containCharectar(value){                }            function containNumber(value){                }            function isValidEmailAddr(email){                                    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;    if (filter.test(email))    {        //alert('YES! Correct email address');        return true;                            }    else    {                                       return false;    }}//Kashif Nov 2,2007/* * Please note that the following code of functions   * getSelectedRadio() * getSelectedRadioValue() * getSelectedCheckbox() * getSelectedCheckboxValue() * has been obtained from the following  * http://www.breakingpar.com/bkp/home.nsf/0/CA99375CC06FB52687256AFB0013E5E9 *  */function getSelectedRadio(buttonGroup) {    // returns the array number of the selected radio button or -1 if no button is selected    if (buttonGroup[0]) { // if the button group is an array (one button is not an array)        for (var i=0; i<buttonGroup.length; i++) {            if (buttonGroup[i].checked) {                return i            }        }    } else {        if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero    }    // if we get to this point, no radio button is selected    return -1;} // Ends the "getSelectedRadio" function                function getSelectedRadioValue(buttonGroup) {    // returns the value of the selected radio button or "" if no button is selected    var i = getSelectedRadio(buttonGroup);    if (i == -1) {        return "";    } else {        if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)            return buttonGroup[i].value;        } else { // The button group is just the one button, and it is checked            return buttonGroup.value;        }    }} // Ends the "getSelectedRadioValue" function        function getSelectedCheckbox(buttonGroup) {    // Go through all the check boxes. return an array of all the ones    // that are selected (their position numbers). if no boxes were checked,    // returned array will be empty (length will be zero)    var retArr = new Array();    var lastElement = 0;    if (buttonGroup[0]) { // if the button group is an array (one check box is not an array)        for (var i=0; i<buttonGroup.length; i++) {            if (buttonGroup[i].checked) {                retArr.length = lastElement;                retArr[lastElement] = i;                lastElement++;            }        }    } else { // There is only one check box (it's not an array)        if (buttonGroup.checked) { // if the one check box is checked            retArr.length = lastElement;            retArr[lastElement] = 0; // return zero as the only array value        }    }    return retArr;} // Ends the "getSelectedCheckbox" function    function getSelectedCheckboxValue(buttonGroup) {    // return an array of values selected in the check box group. if no boxes    // were checked, returned array will be empty (length will be zero)    var retArr = new Array(); // set up empty array for the return values    var selectedItems = getSelectedCheckbox(buttonGroup);    if (selectedItems.length != 0) { // if there was something selected        retArr.length = selectedItems.length;        for (var i=0; i<selectedItems.length; i++) {            if (buttonGroup[selectedItems[i]]) { // Make sure it's an array                retArr[i] = buttonGroup[selectedItems[i]].value;            } else { // It's not an array (there's just one check box and it's selected)                retArr[i] = buttonGroup.value;// return that value            }        }    }    return retArr;} // Ends the "getSelectedCheckBoxValue" function//End Kashif//check for integerfunction isInteger(value){    if(parseInt(value)==value-0)    return true;return false;}function putFocusIntoTextField(fieldId) {    document.getElementById(fieldId).focus();}function validate_Date(id){var today = new Date();var temp = new Array();temp = document.getElementById(id).value.split("-");var day = temp[0];var month = temp[1]-1;var year = temp[2];var inputDate = new Date(year,month,day);if(inputDate > today){    alert("Select Proper Date!");    document.getElementById(id).value = "";    return false;}return true;}function validateInviteEmail(emailAdress){var x = emailAdress;    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if (filter.test(x)){    //alert('YES! Correct email address');    return true;            }else{    alert('Incorrect Email Address');    return false;}}function fixSpecialCharacter ( value ) {return value.replace("'", "//'");}function isNegative(integer){if(integer < 0)    return true;else    return false;}   /*** validate Phone number format*/function validatePhoneNumber(field_id,field_name) {var field_value = document.getElementById(field_id).value;if(field_value != ""){    if(!field_value.match(PhoneRE))    {        alert(field_name + '! The format is incorrect');        document.getElementById(field_id).focus();                  return false;    }}return true;}function validatePhoneNumberStr(phStr) {var field_value = document.getElementById(field_id).value;if(field_value != ""){    if(phStr.match(PhoneRE))    {        alert(field_name + '! The format is incorrect');        document.getElementById(field_id).focus();                  return false;    }}return true;}function getSelectedValue( objectName ) {for(i=0;i<document.getElementById(objectName).options.length;i++) {    var current = document.getElementById(objectName).options[i];    if (current.selected)        return current.value;   }return -1;}function getSelectedIndex( objectName ) {for(i=0;i<document.getElementById(objectName).options.length;i++) {    var current = document.getElementById(objectName).options[i];    if (current.selected)        return i;   }return -1;}function setSelectedValue( objectName, value ) {for(i=0;i<document.getElementById(objectName).options.length;i++) {    var current = document.getElementById(objectName).options[i];    if (current.value == value)        document.getElementById(objectName).options[i].selected = true;   }}function allLetters(str){var noalpha = /^[a-zA-Z]*$/;if (noalpha.test(str)) {    return true;       }    return false; }function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}function MM_preloadImages() { //v3.0  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}function MM_findObj(n, d) { //v4.01  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}function TextScroll(scrollname, div_name, up_name, down_name) {	this.div_name = div_name;	this.name = scrollname;	this.scrollCursor = 0;	this.speed = 5;	this.timeoutID = 0;	this.div_obj = null;	this.up_name = up_name;	this.dn_name = down_name;	{				if (document.getElementById) {			div_obj = document.getElementById(this.div_name);						if (div_obj) {				this.div_obj = div_obj;				this.div_obj.style.overflow = 'hidden';			}						div_up_obj = document.getElementById(this.up_name);			div_dn_obj = document.getElementById(this.dn_name);							 if (div_up_obj && div_dn_obj) {													div_up_obj.onmouseover = function () { window[scrollname].scrollUp(); };				div_up_obj.onmouseout = function () { window[scrollname].stopScroll(); };				div_dn_obj.onmouseover = function () { window[scrollname].scrollDown(); };				div_dn_obj.onmouseout = function () { window[scrollname].stopScroll(); };			}		}	}	this.stopScroll = function() {		clearTimeout(this.timeoutID);	};	this.scrollUp = function() {		if (this.div_obj) {			this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0					: this.scrollCursor - this.speed;			this.div_obj.scrollTop = this.scrollCursor;			this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);		}	};	this.scrollDown = function() {		if (this.div_obj) {			this.scrollCursor += this.speed;			this.div_obj.scrollTop = this.scrollCursor;			this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);		}	};	this.resetScroll = function() {		if (this.div_obj) {			this.div_obj.scrollTop = 0;			this.scrollCursor = 0;		}	};}var dragapproved=false;var minrestore=0;var initialwidth,initialheight;ie5=document.all&&document.getElementById;ns6=document.getElementById&&!document.all;function iecompattest(){return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body}function drag_drop(e){if (ie5&&dragapproved&&event.button==1){document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"}else if (ns6&&dragapproved){document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"}}function initializedrag(e){offsetx=ie5? event.clientX : e.clientXoffsety=ie5? event.clientY : e.clientYdocument.getElementById("dwindowcontent").style.display="none" //extratempx=parseInt(document.getElementById("dwindow").style.left)tempy=parseInt(document.getElementById("dwindow").style.top)dragapproved=truedocument.getElementById("dwindow").onmousemove=drag_drop}function loadwindow(url,width,height){if (!ie5&&!ns6)window.open(url,"","width=width,height=height,scrollbars=1")else{document.getElementById("dwindow").style.display=''document.getElementById("dwindow").style.width=initialwidth=width+"px"document.getElementById("dwindow").style.height=initialheight=height+"px"document.getElementById("dwindow").style.left="30px"document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"document.getElementById("cframe").src=url}}function maximize(){if (minrestore==0){minrestore=1 //maximize windowdocument.getElementById("maxname").setAttribute("src","restore.gif")document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"}else{minrestore=0 //restore windowdocument.getElementById("maxname").setAttribute("src","max.gif")document.getElementById("dwindow").style.width=initialwidthdocument.getElementById("dwindow").style.height=initialheight}document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"}function closeit(){document.getElementById("dwindow").style.display="none"}function stopdrag(){dragapproved=false;document.getElementById("dwindow").onmousemove=null;document.getElementById("dwindowcontent").style.display="" //extra}/* *  select box js */function selectReplacement(obj) {        // append a class to the select    obj.className += ' replaced';    // create list for styling    var ul = document.createElement('ul');    ul.className = 'selectReplacement';        if(document.getElementById("selectTimePeriod_ul"))    	Element.Methods.remove("selectTimePeriod_ul");        ul.id= obj.id+'_ul';        var opts = obj.options;    for (var i=0; i<opts.length; i++) {      var selectedOpt;      if (opts[i].selected) {        selectedOpt = i;        break;      } else {        selectedOpt = 0;      }    }    for (var i=0; i<opts.length; i++) {      var li = document.createElement('li');      var txt = document.createTextNode(opts[i].text);      li.appendChild(txt);      li.selIndex = opts[i].index;           li.style.textAlign="left";           li.selectID = obj.id;                  li.onclick = function() {        //setVal(this.selectID, this.selIndex);                    selectMe(this);      }      if (i == selectedOpt) {        li.className = 'selected';        li.onclick = function() {          this.parentNode.className += ' selectOpen';          this.onclick = function() {          	            selectMe(this);          }        }      }      if (window.attachEvent) {        li.onmouseover = function() {          this.className += ' hover';        }        li.onmouseout = function() {          this.className =             this.className.replace(new RegExp(" hover\\b"), '');        }      }      ul.appendChild(li);    }    // add the input and the ul    obj.parentNode.appendChild(ul);  }  function selectMe(obj) {        var lis = obj.parentNode.getElementsByTagName('li');    for (var i=0; i<lis.length; i++) {      if (lis[i] != obj) { // not the selected list item        lis[i].className='';                lis[i].onclick = function() {                    selectMe(this);        }     } else {        obj.className='selected';        obj.parentNode.className =           obj.parentNode.className.replace(new RegExp(" selectOpen\\b"), '');          var ulId = obj.parentNode.id;          var selectId = ulId.replace('_ul','');         var selectElement= document.getElementById(selectId);       // alert(selectId+"   "+ulId);			//alert(obj.innerHTML+"  "+obj.id+"  parentNodeId"+obj.parentNode.name+"  index="+i +"  selectPlatform="+selectPlatform.selectedIndex);			selectElement.selectedIndex=i;			                        obj.onclick = function() {          obj.parentNode.className += ' selectOpen';          this.onclick = function() {            selectMe(this);          }        }      }    }  }    function setForm() {    var s = document.getElementsByTagName('select');    for (var i=0; i<s.length; i++) {              selectReplacement(s[i]);    }  }  function setVal(objID, selIndex) {  	  var obj = document.getElementById(objID);  	  obj.selectedIndex = selIndex;  	 // alert("setVal("+objID+", "+selIndex+")");  	   	}    function LogOut()  {      window.location.href = "logout.action";      //window.opener.location=window.opener.location;     // window.close();            if(getMyCookie("user") == "loggedInUser")      {    	  deleteMyCookie("user");      }  }  function setMyCookie(c_name,value,expiredays)  {      var exdate=new Date();      exdate.setDate(exdate.getDate()+expiredays);      document.cookie=c_name+ "=" +escape(value)+          ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());  }  function getMyCookie(cookieName){		/*var cookieJar=document.cookie.split(";");		for(var x=0;x<cookieJar.length;x++) {			var oneCookie=cookieJar[x].split("=");			if(oneCookie[0]==escape(cookieName)){				return unescape(oneCookie[1]);			}		}		return null; */	  	  if (document.cookie.length>0)	    {	        c_start=document.cookie.indexOf(cookieName + "=");	        if (c_start!=-1)	        { 	            c_start=c_start + cookieName.length+1; 	            c_end=document.cookie.indexOf(";",c_start);	            if (c_end==-1) c_end=document.cookie.length;	            return unescape(document.cookie.substring(c_start,c_end));	        } 	    }	    return null; }    function deleteMyCookie( cookie_name )  {          var cookie_date = new Date ();  // current date & time      cookie_date.setTime ( cookie_date.getTime() - 1 );      document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();      //alert('deleted ' + cookie_name);  }   function checkMyCookie(cookie_name, cookie_value)  {	  //alert('getMyCookie(cookie_name) ' + getMyCookie(cookie_name) + ' cookie_value ' + cookie_value);	  if(getMyCookie(cookie_name) == cookie_value)	  {						return true;	  }	  else		  	return false;  }