function GetCookie(name) {
				var arg=name+"=";
				var alen=arg.length;
				var clen=document.cookie.length;
				var i=0;
				while (i<clen) {
					var j=i+alen;
					if (document.cookie.substring(i,j) == arg) {
						return GetCookieVal(j);
						}
					i=document.cookie.indexOf(" ",i) + 1;
					if (i === 0) {break;}
				}
			}
			function GetCookieVal(offset) {
				var endstr=document.cookie.indexOf(";",offset);
				if (endstr == -1) {endstr=document.cookie.length;}
				return unescape(document.cookie.substring(offset,endstr));
			}
function RomoveColen(inputString) {
		var retValue = inputString;
		var ch = retValue.substring(0, 1);
			
			while (ch == ":") { // Check for spaces at the beginning of the string
				retValue = retValue.substring(1, retValue.length);
				ch = retValue.substring(0, 1);
			}
			ch = retValue.substring(retValue.length-1, retValue.length);
			while (ch == ":") { // Check for spaces at the end of the string
				retValue = retValue.substring(0, retValue.length-1);
				ch = retValue.substring(retValue.length-1, retValue.length);
			}
   
		return retValue; // Return the trimmed string back to the user
	}
function ShowBaseCurrencyPop(FormName )
	{
	switch (GetCookie("UserLanguage")){   
		case "en-us":       
			//code here for english lang
		return "Previous " + FormName + " will no longer be the base currency" +  "?";
			break;   
		case "fr":       
			//code here for lang
			return "Précédent " + FormName + " la volonté ne soit plus la devise basse" +  "?";
			break;
      default: 
			return "Previous " + FormName + " will no longer be the base currency" +  "?";
      }
		
	}	
//Function Call for confirmation of new default Carrier
function ShowDefaultCarrierPop(FormName )
	{
		
		switch (GetCookie("UserLanguage")){   
		case "en-us":       
			//code here for english lang
			return "Previous " + FormName + " will no longer be the Default " + FormName +  "?";
			break;   
		case "fr":       
			//code here for lang
			return "Précédent " + FormName + " la volonté ne soit plus le défaut " + FormName +  "?";
			break;
      default: 
		return "Previous " + FormName + " will no longer be the Default " + FormName +  "?";
      }
	
	}

function ShowEmptyPop(ColumnName)
	{
	switch (GetCookie("UserLanguage")){   
		case "en-us":       
			//code here for english lang
			return "Please provide the " +RomoveColen(ColumnName) + ".";
			break;   
		case "fr":       
			//code here for lang
			return "Veuillez fournir" +RomoveColen(ColumnName) + ".";
			break;
      default: 
			return "Please provide the " +RomoveColen(ColumnName) + ".";
      }
	
		
	}

function ShowPercentPop(ColumnName)
	{
	switch (GetCookie("UserLanguage")){   
		case "en-us":       
			//code here for english lang
			return RomoveColen(ColumnName) + ' must be between 0-100' + '.';
			break;   
		case "fr":       
			//code here for lang
			return RomoveColen(ColumnName) + ' doit être entre 0-100' + '.';
			break;
      default: 
		return RomoveColen(ColumnName) + ' must be between 0-100' + '.';
      }
		
	}
	
function ShowDeActivatePop(FormName )
	{
	switch (GetCookie("UserLanguage")){   
		case "en-us":       
			//code here for english lang
			return "Are you sure you want to deactivate " + FormName +  "?";
			break;   
		case "fr":       
			//code here for lang
			return "Êtes vous sûr vous voulez mettre hors tension " + FormName +  "?";
			break;
      default: 
		return "Are you sure you want to deactivate " + FormName +  "?";
      }
		
	}	
	
function ShowNumPop(ColumnName)
	{
	switch (GetCookie("UserLanguage")){   
		case "en-us":       
			//code here for english lang
			return ColumnName + " Contains invalid characters." ;
			break;   
		case "fr":       
			//code here for lang
			return ColumnName + " Contient les caractères inadmissibles." ;
			break;
      default: 
		return ColumnName + " Contains invalid characters." ;
      }
		
	}	


function checkEmailList(EmailTextBox)
{
	emailList = new String(EmailTextBox.value);
	if (emailList.charAt(emailList.length - 1) == ",")
		emailList = emailList.substring(0, (emailList.length - 1));
	emailList = emailList.split(",");
	for (var a = 0; a < emailList.length; a++)
	{
		if (!checkEmailAddress(trims(emailList[a])))
			return false;
	}
	return true;
}

function checkEmail(emailField)
{
	return checkEmailAddress(emailField.value);
}

function checkEmailAddress(email)
{
	for (var i = 0; i < email.length; i++)
	{
		var chr = email.charAt(i);

		if (!(((chr >= 'a') && (chr <= 'z')) || ((chr >= 'A') && (chr <= 'Z')) ||
			(chr == '.') || (chr == '@') || (chr == '_') || (chr == '-') ||
			((chr >= '0') && (chr <= '9'))))
		{
			alert("Invalid Email address '" + email + "'.");
			return false;
		}
	}
	if ((email == "") || (email.indexOf('@', 0) == -1) ||
		(email.indexOf('@', 0) == 0) || (email.indexOf('.', 0) == -1) ||
		(email.indexOf('.', 0) == (email.length - 1)) ||
		(email.indexOf('@', 0) == (email.length - 2)) ||
		(email.charAt(0) == '.') || (email.charAt(email.length - 1) == '.'))
	{
		alert("Invalid Email address '" + email + "'.");
		return false;
	}
	// Added by san... 241201 checking for invalid emails due to '.' placement
	var temp = email.substring(email.indexOf('@', 0) + 1, email.length);

	if (temp.length > 2)
	{
		if (temp.indexOf('.', 1) == -1)
		{
			alert("Invalid Email address '" + email + "'.");
			return false;
		}
		else
		{
			if (temp.indexOf('.', 1) == temp.length - 1)
			{
				alert("Invalid Email address '" + email + "'.");
				return false;
			}
		}
	}
	else
	{
		alert("Invalid Email address '" + email + "'.");
		return false;
	}

	var charIndex = email.indexOf('@', 0);
	if (email.indexOf('@', charIndex + 1) != -1)
	{
		alert("Invalid Email address '" + email + "'.");
		return false;
	}
	else
	{
		charIndex = email.indexOf('@', 0);
		if (email.charAt(charIndex - 1) == '.')
		{
			switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert("Invalid Email address '" + email + "'.");
				return false;
				break;   
			case "fr":       
				//code here for lang
				alert("Email address inadmissible '" + email + "'.");
				return false;
				break;
			default: 
				alert("Invalid Email address '" + email + "'.");
				return false;
			}
		}
	}
	// This case checks that 2 dots can't be consective
	var previousChar;
	var currentChar;

	for (var i = 0; i < email.length; i++)
	{
		currentChar = email.charAt(i);
		if (currentChar == '.')
		{
			if (currentChar == previousChar)
			{
				
			switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert("Invalid Email address '" + email + "'.");
				return false;
				break;   
			case "fr":       
				//code here for lang
				alert("Email address inadmissible '" + email + "'.");
				return false;
				break;
			default: 
				alert("Invalid Email address '" + email + "'.");
				return false;
			}
		}
		}
		previousChar = currentChar;
	}
	return true;
}
function VerifyUserNameCharacters(field)
{

	var invalidChar = new String("\\~!@#$^%&*()}{[]' /\"><,?;:.=|`+");
	
	for (var i = 0; i < invalidChar.length; i++)
	{
		if (field.indexOf(invalidChar.charAt(i), 0) >= 0)
		{
			//return invalidChar.charAt(i);
			return false;
		}
	}
	//return '0';
	return true;

}

function VerifyURLText(field)
{

	var invalidChar = new String("\\!@#$^%&*()}{[]' \"><,?;=|`+");
	
	for (var i = 0; i < invalidChar.length; i++)
	{
		if (field.indexOf(invalidChar.charAt(i), 0) >= 0)
		{
			//return invalidChar.charAt(i);
			return false;
		}
	}
	//return '0';
	return true;

}

function VerifyCharacters(field)
{
	var invalidChar = new String("\\~!@#$%^&*()+}{[]'/\"><,?;:.");

	for (var i = 0; i < invalidChar.length; i++)
	{
		if (field.indexOf(invalidChar.charAt(i), 0) > 0)
		{
			return invalidChar.charAt(i);
		}
	}
	return '0';
}	// End of function

function VerifyUserName(userName,sName)
{
	
	var name=trims(userName.value);
	thisName= RomoveColen(sName);
	var chr;
	if (name == "")
	{
		switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert("Please provide the "+thisName+".");
				break;   
			case "fr":       
				//code here for lang
				alert("Veuillez fournir "+thisName+".");
				break;
			default: 
				alert("Please provide the "+thisName+".");
			}
		
		userName.value = "";
		userName.focus();
		return false;
	}
	if (name.length < 2)
	{
		switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert( thisName +" must be at least 2 characters long.");
				break;   
			case "fr":       
				//code here for lang
				alert( thisName +" doivent être au moins 2 caractères longtemps.");
				break;
			default: 
				alert( thisName +" must be at least 2 characters long.");
			}
		userName.focus();
		return false;
	}
	
	
	//1. Cannot begin with a hyphen
	
	if(name.charAt(0)=="-")
	{
		switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert("The "+thisName+" can not begin with a hyphen.")
				break;   
			case "fr":       
				//code here for lang
				alert("The "+thisName+" ne peut pas commencer par un trait d'union.")
				break;
			default: 
				alert("The "+thisName+" can not begin with a hyphen.")
			}
		
		userName.focus();
		return false;	
	}
	//	2. Cannot end with a hyphen
	else if(name.charAt(name.length-1)=="-")
	{
		switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert("The "+thisName+" can not end with a hyphen.")
				break;   
			case "fr":       
				//code here for lang
				alert("Le "+thisName+" ne peut pas finir avec un trait d'union.")
				break;
			default: 
				alert("The "+thisName+" can not end with a hyphen.")
			}
		
		userName.focus();
		return false;	
	}
	else if(!VerifyUserNameCharacters(name))
	{
		//----------------------Transelated Version------------------(Malik)//
		switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert("The " +thisName+ " can not contain special characters.")
				break;   
			case "fr":       
				//code here for lang
				alert("Le " +thisName+ " ne peut pas contenir les caractères spéciaux.")
				break;
			default: 
				alert("The " +thisName+ " can not contain special characters.")
			}
		//----------------------End Transelated Version------------------(Malik)//
		userName.focus();
		return false;
	}
	//3. Cannot be all numeric
	else if(!isNaN(name))
	{
		//----------------------Transelated Version------------------(Malik)//
		switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert("The "+thisName+" can not be all numeric.");
				break;   
			case "fr":       
				//code here for lang
				alert("The "+thisName+" ne peut pas être tout numérique.");
				break;
			default: 
				alert("The "+thisName+" can not be all numeric.");
			}
		//----------------------End Transelated Version------------------(Malik)//
		userName.focus();
		return false;	
	}	
	
	// 4. Can not contain successive hyphens
	for(i=0;i<name.length;i++)
	{
			chr=name.charAt(i);
			if(chr=="-" && name.charAt(i-1)=="-")
			{
		//----------------------Transelated Version------------------(Malik)//
		switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert("The "+thisName+" can not have successive hyphens.");
				break;   
			case "fr":       
				//code here for lang
				alert("The "+thisName+" ne peut pas avoir des traits d'union successifs.");
				break;
			default: 
				alert("The "+thisName+" can not have successive hyphens.");
			}
		//----------------------End Transelated Version------------------(Malik)//
				
				//userName.focus();
				return false;	
			}
	}
	
	
	return true;
}	// End of function

function VerifyPassword(password, confirmPassword,FirstLabel, SecondLabel)
{
	var FirstPop = RomoveColen(FirstLabel.innerText);
	var secondPop = RomoveColen(SecondLabel.innerText); 
	
	if (trims(password.value) == "")
	{
		alert(ShowEmptyPop(FirstPop));
		password.value = "";
		confirmPassword.value = "";
		password.focus();
		return false;
	}
	if (trims(password.value).length < 4)
	{
		//----------------------Transelated Version------------------(Malik)//
		switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert(FirstPop+ " must be at least 4 characters long.");
				break;   
			case "fr":       
				//code here for lang
				alert(FirstPop+ " doivent être au moins 4 caractères longtemp.");
				break;
			default: 
				alert(FirstPop+ " must be at least 4 characters long.");
			}
		//----------------------End Transelated Version------------------(Malik)//
		
		password.focus();
		return false;
	}
	if (password.value != confirmPassword.value)
	{
		//----------------------Transelated Version------------------(Malik)//
		switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert("The "+ FirstPop +" and "+ secondPop +" do not match.");
				break;   
			case "fr":       
				//code here for lang
				alert("le "+ FirstPop +" et "+ secondPop +" n'assortissez pas.");
				break;
			default: 
				alert("The "+ FirstPop +" and "+ secondPop +" do not match.");
			}
		//----------------------End Transelated Version------------------(Malik)//
		//confirmPassword.value = "";
		password.focus();
		return false;
	}
	return true;
}	// End of function

function VerifyCreditCard(CreditCard)
{
	if (trims(CreditCard.value) == "")
	{
		alert("Please provide the credit card number.");
		CreditCard.focus();
		return false;
	}
	else
	{
		temp = new String(trims(CreditCard.value));
		if ((temp.length < 14) || isNaN(CreditCard.value) ||
			(temp.substr(0, 1) < "3") || (temp.substr(0, 1) > "6"))
		{
			alert("Please provide a valid credit card number.");
			CreditCard.focus();
			return false;
		}
	}
	return true;
}	// End of function

function VerifyZip(Zip)
{
	if (trims(Zip.value) == "")
	{
		//----------------------Transelated Version------------------(Malik)//
		switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert("Please provide the zip code.");
				break;   
			case "fr":       
				//code here for lang
				alert("Veuillez fournir le code postal.");
				break;
			default: 
				alert("Please provide the zip code.");
			}
		//----------------------End Transelated Version------------------(Malik)//
		Zip.focus();
		return false;
	}
	/*else
	{
		temp = new String(trims(Zip.value));
		if ((temp.length != 10) || isNaN(Zip.value))
		{
			alert("Please provide a valid zip code.");
			Zip.focus();
			return false;
		}
	}*/
	return true;
}	// End of function

function VerifyInfo(EmailAddr, Update, Question, Answer, FirstName, LastName,
					Day, Month, Year, City, Zip)
{
	if (trims(EmailAddr.value) != "")
	{
		if (!checkEmail(EmailAddr))
		{
			EmailAddr.focus();
			return false;
		}
	}
	if ((trims(Question.value) == "") &&
		(!Update || (trims(Answer.value) != "")))
	{
		alert("Please provide the secret question.");
		Question.focus();
		return false;
	}
	if (!Update && (trims(Answer.value) == ""))
	{
		alert("Please provide the answer to your secret question.");
		Answer.focus();
		return false;
	}
	if (trims(FirstName.value) == "")
	{
		alert("Please provide the first name.");
		FirstName.focus();
		return false;
	}
	if (trims(LastName.value) == "")
	{
		alert("Please provide the last name.");
		LastName.focus();
		return false;
	}
	day = new String(Day.value);
	month = new String(Month.value);
	year = new String(Year.value);
	if (!(isDate(month, day, year)))
	{
		alert("Your specified date of birth is not valid.");
		Day.focus();
		return false;
	}
	if (trims(City.value) == "")
	{
		alert("Please provide city name.");
		City.focus();
		return false;
	}
	if (!VerifyZip(Zip))
	{
		return false;
	}
	return true;
}	// End of function


	function numericsWithDecimalOnly()
		{

			if(window.event.keyCode >= 48 && window.event.keyCode <= 57 || window.event.keyCode ==46)
			{
			}
			else
			{
				window.event.returnValue = false;	
			}
	
		}	
		
		/*
=================================================================================
	Function Name : isInteger
	Synopsis	  : Returns a boolean value indicating that passed variable
					is a integer or not..
	Created On    : 24-FEB-2004
	Author		  : YAS
	
=================================================================================
*/
		
		function isInteger(number)
		{
			var validChars = '0123456789';
			var chr;
 		   for (i = 0; i < number.length ; i++) 
			{ 
				chr = number.charAt(i);
				if (validChars.indexOf(chr) == -1) 
				{
					return false;
				}
			}
		   return true;
   		}


		function IsNumeric(sText)
		{
			var ValidChars = '0123456789.';
			var IsNumber=true;
			var Char;

			if(trims(sText)==".") 
			{
				return false
			}
		   for (i = 0; i < sText.length && IsNumber == true; i++) 
			{ 
				Char = sText.charAt(i);
				if (ValidChars.indexOf(Char) == -1) 
				{
					IsNumber = false;
				}
			}
		   return IsNumber;
   
		}


	 function numericsOnly()
	{
		if(window.event.keyCode >= 48 && window.event.keyCode <= 57)
		{
		}
		else
		{
			window.event.returnValue = false;	
		}
	
	}		
	
	
function cancelConfirm()
		{
		
			//----------------------Transelated Version------------------(Malik)//
		switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				bConfirmed = window.confirm("Are you sure you want to cancel the changes?")
				break;   
			case "fr":       
				//code here for lang
				//bConfirmed = window.confirm("Êtes-vous sûr vous voulez-vous décommander les changements?")
				break;
			default: 
				bConfirmed = window.confirm("Are you sure you want to cancel the changes?")
			}
		//----------------------End Transelated Version------------------(Malik)//
				if (bConfirmed == true)
				{
					return true;
				}
				else 
				{
					return false;
				}
		}	
		
		
		
		function exitConfirm()
		{
	
			//----------------------Transelated Version------------------(Malik)//
			switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				bConfirmed = window.confirm("Are you sure you want to exit?")
				break;   
			case "fr":       
				//code here for lang
				bConfirmed = window.confirm("Êtes-vous sûr vous voulez-vous sortir ?")
				break;
			default: 
				bConfirmed = window.confirm("Are you sure you want to exit?")
			}
			//----------------------End Transelated Version------------------(Malik)//
			
				if (bConfirmed == true)
				{
					return true;
				}
				else 
				{
					return false;
				}
		}	
	
	function deleteConfirm()
	{
			//----------------------Transelated Version------------------(Malik)//
			switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				return  window.confirm("You have selected to remove item(s). This action is irreversible. Are you sure you want to continue?")
				break;   
			case "fr":       
				//code here for lang
				return  window.confirm("Vous avez choisi pour enlever l'item(s). Cette action est irréversible. Êtes-vous sûr vous voulez-vous continuer ?")
				break;
			default: 
				return  window.confirm("You have selected to remove item(s). This action is irreversible. Are you sure you want to continue?")
			}
			//----------------------End Transelated Version------------------(Malik)//
			
				/*if (bConfirmed == true)
				{
					return true;
				}
				else 
				{
					return false;
				}*/
	}


	// Removes leading and trailing spaces from the passed string. Added By Sheraz
	function trim(inputString) {
		var retValue = inputString;
		var ch = retValue.substring(0, 1);
			
			while (ch == " ") { // Check for spaces at the beginning of the string
				retValue = retValue.substring(1, retValue.length);
				ch = retValue.substring(0, 1);
			}
			ch = retValue.substring(retValue.length-1, retValue.length);
			while (ch == " ") { // Check for spaces at the end of the string
				retValue = retValue.substring(0, retValue.length-1);
				ch = retValue.substring(retValue.length-1, retValue.length);
			}
   
		return retValue; // Return the trimmed string back to the user
	}

	
	

function checkDecimals(fieldValue,fieldName) {
decallowed = 2;  // how many decimals are allowed?
	if (isNaN(fieldValue) ) {
	alert("Please provide a valid "+RomoveColen(fieldName.innerText)+".");
	return false;
}
if (fieldValue.indexOf('.') == -1) fieldValue += ".";
dectext = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);

if (dectext.length > decallowed)
{
//----------------------Transelated Version------------------(Malik)//
			switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert ("Please enter a number with up to " + decallowed + " decimal places.  Please try again.");
				break;   
			case "fr":       
				//code here for lang 
				alert ("Veuillez écrire un nombre avec jusqu \u0027 a "+ decallowed + " positions décimales.  Svp essai encore.");
				break;
			default: 
				alert ("Please enter a number with up to " + decallowed + " decimal places.  Please try again.");
			}
//----------------------End Transelated Version------------------(Malik)//
			return false;
}
	if(fieldValue<0)
	{
		alert("Please provide a positive "+RomoveColen(fieldName.innerText)+".");
		return false;
	}
	return true;
}



function checkDecimals3(fieldValue,fieldName) {

decallowed = 3;  // how many decimals are allowed?
if (isNaN(fieldValue) ) {
//----------------------Transelated Version------------------(Malik)//
			switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert("Please provide a valid "+RomoveColen(fieldName.innerText)+".");
				break;   
			case "fr":       
				//code here for lang
				alert("Please provide a valid "+RomoveColen(fieldName.innerText)+".");
				break;
			default: 
				alert("Please provide a valid "+RomoveColen(fieldName.innerText)+".");
			}
			//----------------------End Transelated Version------------------(Malik)//

return false;
}
else {
if (fieldValue.indexOf('.') == -1) fieldValue += ".";
dectext = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);

if (dectext.length > decallowed)
{
//----------------------Transelated Version------------------(Malik)//
			switch (GetCookie("UserLanguage")){   
			case "en-us":       
				//code here for english lang
				alert ("Please enter a number with up to " + decallowed + " decimal places.  Please try again.");
				break;   
			case "fr":       
				//code here for lang
				alert ("Veuillez écrire un nombre avec jusqu \u0027 a" + decallowed + " positions décimales.  Svp essai encore.");
				break;
			default: 
				alert ("Please enter a number with up to " + decallowed + " decimal places.  Please try again.");
			}
			//----------------------End Transelated Version------------------(Malik)//

return false;
      }
else {
		return true;
      }
   }
}


	function IsValidStartEndDateRange(date1, date2){
	
		var startdate = new Date(date1.value);
		var enddate = new Date(date2.value);
		var thisdate = new Date; 
		var thisalert = "End Date cannot be less than Start Date.";
		var check;
		if (startdate=='NaN' && trims(date2.value) !="" ){
				alert("Please Provide Start Date.");
				date1.focus();
				return false;
		}
		else if(enddate<startdate){
				alert(thisalert);
				date2.focus();
				date2.select();
				return false;
		}
		return true;
	}
	
	
	function validateField(field,Message)
	{
		var valid = "1234567890-_qwertyuiopasdfghjklzxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM /"
		var ok = "yes";
		var temp;
		val=parseInt(field.value)

		for (var i=0; i<field.value.length; i++) 
		{
			temp = "" + field.value.substring(i, i+1);
			if (valid.indexOf(temp) == "-1") ok = "no";
		}

		
		if (ok == "no") 
		{
			alert("Please enter a valid " + Message  + ".");
			field.focus();
			field.select();
		}
		
	return ok	
	}
	
		function wrapQuery(qStr)
		{
			if(qStr != ""){
				for (var i = 0; i < qStr.length; i++)
				{
					if (qStr.indexOf("#", 0) >= 0){
						qStr = qStr.replace("#","[(1)]");
					}
					else if (qStr.indexOf("&", 0) >= 0){
						qStr = qStr.replace("&","[(2)]");
					}
				}
			}
			return qStr;
		}
		
		function unWrapQuery(qStr)
		{
			if(qStr != ""){
				for (var i = 0; i < qStr.length; i++)
				{
					if (qStr.indexOf("[(1)]", 0) >= 0){
						qStr = qStr.replace("[(1)]","#");
					}
					else if (qStr.indexOf("[(2)]", 0) >= 0){
						qStr = qStr.replace("[(2)]","&");
					}
				}
			}
			return qStr;
		}
		
		function wrapFieldValues()
		{
			for(i=0; i<=document.forms[0].length -1; i++){
				var obj;
				obj = document.forms[0].elements[i]
				
				if(obj.type=='text'){ 
					obj.value = wrapQuery(obj.value);
				}
				else if(obj.type=='select-one'){ 
					obj.options[obj.selectedIndex].text = wrapQuery(obj.options[obj.selectedIndex].text);
				}
			}
			return false;
		}
		
		function unWrapFieldValues()
		{
			for(i=0; i<=document.forms[0].length -1; i++){
				var obj;
				obj = document.forms[0].elements[i]
				
				if(obj.type=='text'){ 
					obj.value = unWrapQuery(obj.value);
				}
				else if(obj.type=='select-one'){ 
					obj.options[obj.selectedIndex].text = unWrapQuery(obj.options[obj.selectedIndex].text);
				}
			}
			return false;
		}
		
		
		function PopulateRelationalDropDown(Source_Obj,Distination_Obj,Data_txt,TargetSpanID){
	
		var l_MainArrayData 
		var l_STR
		l_STR = ""		
		l_MainArrayData = Data_txt.value.split("[(-/+)]")
		for (i=0;i<l_MainArrayData.length;i++){
			if ((Source_Obj.value) == l_MainArrayData[i].slice(0,l_MainArrayData[i].indexOf("[(+)]")) || (Source_Obj.value == -1) )
				if (l_MainArrayData[i].slice(l_MainArrayData[i].indexOf("[(-)]")+5,l_MainArrayData[i].length) != "")
					l_STR = l_STR + "<option value='" + l_MainArrayData[i].slice(l_MainArrayData[i].indexOf("[(+)]")+5,l_MainArrayData[i].indexOf("[(-)]"))  + " '>" + l_MainArrayData[i].slice(l_MainArrayData[i].indexOf("[(-)]")+5,l_MainArrayData[i].length) + "</option>"		
	    }
		
		var l_Options
		if (l_STR == "")
			l_Options = "<option value=-2>----------- None -----------</option>"	
		else
			l_Options = "<option value=-1>-------- Choose One --------</option>" + l_STR

		if (document.all(TargetSpanID))
			eval(TargetSpanID + '.innerHTML') = "<select name='cdoDefCategories' id='cdoDefCategories' class='MidDropDownList' >" + l_Options  + "</select>"
 			// DefectCategory.innerHTML = "<select name='cdoDefCategories' id='cdoDefCategories' class='MidDropDownList' >" + l_Options  + "</select>"
		}		
		
