
function Cmn_ChangeImage(imgName, imgSource)
{
	//alert('imgSource :' + imgSource);
	//alert('imgName :' + imgName);
	document[imgName].src = eval(imgSource + '.src')
}

var ie4 = false;

if(document.all) {
      ie4 = true;
}

function getObject(id) {
      if (ie4) {
							
              return document.all[id];
      } else {
              return document.getElementById(id);
      }
}
                        
function toggle(link, divId) {
                  
       var lText = link.innerHTML;
       var d = getObject(divId);
       if (lText == 'More (+)') {
               link.innerHTML = 'Hide (&#8722;)';
               d.style.display = 'block';
       } else {
               link.innerHTML = 'More (+)';
               d.style.display = 'none';
       }
}


//added by Manoj Budakoti on April 12,2005

function funShowProduct(objCurrentSel,strObjName)
{

	var strPagePath;
	var strProductPath;
	var intSelValue;
	
	intSelValue = objCurrentSel.value;	
	strProductPath = browseUrl //'<%=BROWSEURL%>';
	
	strPagePath = strProductPath + 'Brw_ProductLineCategory.asp?CategoryId='+intSelValue+'&Area='+strObjName;
	
	if (intSelValue != "0")
	{
		window.location.href = strPagePath; 	
	}
}


/*
Function: CheckTextFieldLength
Description:

Parameter:				TYPE		DATATYPE		DESCRIPTION
	WhichField:		   Array		Object			This Array contains controls that needs to be checked.
	DisplayName:	   Array		String			This Array contains screen names of all controls that are passed in WhichField.
	MinLength:	  Normal Variable	Integer			This variable contains MINIMUM length limit.
	MaxLength:	  Normal Variable	Integer			This variable contains MAXIMUM length limit.

Result: CASE	DESCRIPTION
		TRUE	ATLEAST one control is not empty and those controls which are
				not empty contains characters within LIMITS.
				
		FALSE	When All Controls are empty or some control voilates length LIMITS.
*/
function CheckTextFieldLength(WhichField,DisplayName,MinLength,MaxLength,GroupEmpty)
{
	//This checks all controls available in WhichField Array and determines whether it
	var i,strTemp
	var flag
	flag=0
	//Checking each field whether it clears all rules
	//alert(WhichField.length)
	for(i=0;i<WhichField.length;i++)
	{
		strTemp=trimSpaces(WhichField[i])
		//checking if field's length is >= minLength and <= max length
		if(strTemp.length>=MinLength && strTemp.length<=MaxLength)
		{
			flag++;
		}
		else
		{	
			//checking field's length is empty or not
			if(strTemp.length==0)
			{
				continue;
			}
			else
			{
				//set the flag value to -1 if The field contains less than minlength characters 
				//and more than maxlength characters and break the loop.
				flag = -1
				break;
			}
		}
	}
	if(GroupEmpty==true)
	{
		 if(flag==0)
		{
			//All Fields are Empty
			WhichField[flag].focus()
			alert('You must specify atleast one field for "Where did you hear about us?"')
			return false;
		}
		
	}
	
	if(flag>0)
	{
		//Field is OK
		return true;
	}
	else if(flag<0)
	{
		//Show the alert message when the chracters are not between minimum length and maximum length.
		WhichField[i].focus()
		alert('Character length should be greater than 4 and less than 1024')
		return false;
	}
	
}

