function RefreshCaptchaImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}

function ChangeLeftMenuCellColor(bcol,d_name)
{
 document.getElementById(d_name).style.backgroundColor=bcol;
 }

function CallCGIScript(Value,strVAR,AsciValue) {

  // This variable holds the decoded cookie value
  var returnValue = ""
  var tempValue =""
  
  // Use + to split the coded string into an array
  var code_array = strVAR.split("+")
  
  //Start:Decode Special encoding  
  for (var counter = 0; counter < 42; counter++) {

    // Convert the code into a character and 
    // add it to the cookie value string
    tempValue += String.fromCharCode(code_array[counter]+AsciValue+42)
    tempValue = tempValue - 23
  }  
  //End:Decode Special encoding 

  
  // Loop through the array
  for (var counter = 0; counter < code_array.length; counter++) {

    // Convert the code into a character and 
    // add it to the cookie value string
    returnValue += String.fromCharCode(code_array[counter]-AsciValue)
  }
 if (Value==1) 
	{document.write(returnValue);
 
	}
 else document.write('<a href="mailto:'+returnValue+'">'+returnValue+'</a>');
}  
 
 
 function isEmptyField(FieldName)
    {
 
    if(trimvalue(FieldName.value) == "")
    return true;
    else
    return false;
    }
function trimvalue(strValue)
	{
   return strValue.replace(/^\s*/, '').replace(/\s*$/,'');
	}

function isEmailAddressValid(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }
 		 return true					
	}
	
function isValidInput(value)
{	
var strValidChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
var strChar; 
var blnResult = true; 
if (value.length != 0)  
	{
		// test value consists of valid characters listed above 
		for (i = 0; i < value.length && blnResult == true; i++) 
			{ 
				strChar = value.charAt(i); 
				if (strValidChars.indexOf(strChar) == -1) 
				{ 
					blnResult = false; 
				} 
			} 
	}
return blnResult;
}	
	 
function Display_Hide_Section(SectionID,Action) 
{
if (Action=='SHOW'){
	document.getElementById(SectionID).style.display="block";}
else{
	document.getElementById(SectionID).style.display="none";
}
}
 function CountText(field, countfield, maxlimit) {

if (field.value.length > maxlimit)   field.value = field.value.substring(0, maxlimit);
 
else countfield.value = maxlimit - field.value.length;
}

function CountTextInitialize(field,countfield,maxlimit){
document.getElementById(countfield).value = maxlimit - document.getElementById(field).value.length

}
function OnClickSubmitForm(form,Action) {
	form.action = Action;
	form.submit();
 }
  
