function ShowProgress_ORIGINAL(barref)
	{
	strAppVersion = navigator.appVersion;
	//alert(strAppVersion);
		if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
		{
			winstyle = "dialogWidth=385px; dialogHeight:140px; center:yes";
			//alert(barref + '&b=IE');
			window.showModelessDialog(barref + '&b=IE',null,winstyle);
		}
		else
		{
			window.open(barref + '&b=NN','','width=375,height=115', true);
		}
	return true;
	}

function ShowProgress(barref)
	{
	document.getElementById('divPROGRESS').style.display = 'block';
	document.getElementById('frPROGRESS').src = barref;
	return true;
	}

/***********************************************
* KEY DOCUMENTS SUBMIT
***********************************************/
function validate_KEY_FILES()
	{
	// Per il FILE UPLOAD nei KEY DOCUMENTS
	if((document.getElementById('txtFILE').value == '') || (document.getElementById('txtFILE_desc').value == '') || (document.getElementById('cmbFOLDER').value == ''))
		{
		alert('File NAME, DESCRIPTION and KEY FOLDER\nvalues are MANDATORY!');
		return false;
		}
	else
		{
		var objHTML = document.getElementById('cmbFOLDER');
		if(objHTML.options[objHTML.selectedIndex].value == '')
			{
			alert('No value selected in Folder Combo!');
			return false;
			}
		else
			return ShowProgress(sTEMP);
		}
	}

function validate_KEY_FOLDERS(sVALUE)
	{
	if(sVALUE == 'ADD')
		{
		// Add new Folder
		if((document.getElementById('txtFOLDER').value == '') || (document.getElementById('txtFOLDER_SORT').value == ''))
			{
			alert('Folder NAME and ORDER values are MANDATORY!');
			return false;
			}
		}

	if(sVALUE == 'REMOVE')
		{
		// Remove Folder
		var objHTML = document.getElementById('cmbFOLDER2');
		//debugger;
		if(objHTML.options[objHTML.selectedIndex].value == '')
			{
			alert('No value selected in Folder Combo!');
			return false;
			}
		}
	}

/***********************************************
* MY PROFILE/REQUEST ACCESS
***********************************************/
function validate_MyProfile(sVALUE)
	{
	//alert(sVALUE);
	var arNAME = new Array();
	var arLABEL = new Array();	
	var objHTML;

	// MANDATORY FIELDS
	arNAME[0] = "txtNAME";
	arNAME[1] = "txtSURNAME";
	arNAME[2] = "txtMAIL";
	arNAME[3] = "txtPHONE";
	arNAME[4] = "cmbREGION";
	arNAME[5] = "cmbCOUNTRY";
	arLABEL[0] = "NAME";
	arLABEL[1] = "SURNAME";
	arLABEL[2] = "E-MAIL";
	arLABEL[3] = "PHONE";
	arLABEL[4] = "REGION";
	arLABEL[5] = "COUNTRY";
	
	if(sVALUE == "REQUEST_ACCESS")
		{
		arNAME[6] = "txtREQUEST_REASON";
		arLABEL[6] = "REQUEST REASON";
		}

	for (var i = 0; i < (arNAME.length); i++)
		{
		objHTML = document.getElementById(arNAME[i]);
		if (objHTML.value=='')
			{
			alert(arLABEL[i] + '\nfield is MANDATORY!');
			if(arNAME[i].indexOf('txt') != -1)
				objHTML.focus();
			return false;
			}
		}

	// Devo far aparire la UPLOAD PROGRESS BAR?
	if (document.getElementById('txtIMG_USER').value != '')
		{
		return ShowProgress(sTEMP);
		}
	else
		return true;
	}

/***********************************************
* BRAC TEMPLATE 
***********************************************/
function refresh_BRAC(intStep)
	{
	switch (intStep)
		{
		case 7:
			setTimeout("$('#divRATE input[@type=radio]').rating('','#txtMY_RATING')", 10);
			break;
		}
	}

function validate_BRAC(intStep)
	{
	switch (intStep)
		{
		case 7:
			
			if((document.getElementById('txtRATE').value=='Cancel Rating')||(document.getElementById('txtRATE').value==''))
			{		
				alert('You have not rated');
				return false;
			}
			else
			{
			return true;
			}
			break;		
		return true;
		}
	}

/***********************************************
* COCH TEMPLATE JS REFRESH
***********************************************/
function refresh_COCH(intStep)
	{
//	alert('refresh_COCH: ' + intStep);
	switch (intStep)
		{
		case 1:
			setTimeout("getData('cmbTEAM_FROM', 'cmbTEAM', 'txtTEAM_ID')", 10);
			setTimeout("addROW('', '', 'txtROWS_ID', 'txtROWS_DESC', 'tblGEO_BRAND')", 20);
			break;
		case 2:
			setTimeout("getData('cmbMKT_OBJ_FROM', 'cmbMKT_OBJ', 'txtMKTOBJ_ID')", 10);
			setTimeout("addROW('', '', 'txtROWS_ID', 'txtROWS_DESC', 'tblSOCIO_DEMO')", 20);
			break;
		case 3:
			setTimeout("addROW('', '', 'txtFILES_ID', 'txtFILES_DESC', 'tblFILE_LIST')", 10);
			setTimeout("addROW('', '', 'txtVIDEOS_ID', 'txtVIDEOS_DESC', 'tblVIDEO_LIST')", 20);
		//	setTimeout("initON2()", 30);
		//	setTimeout("getFileSize()", 40);			
		//	setTimeout("createFCK()", 30);
			break;
		case 4:
			break;
		case 5:
			break;
		case 6:
			break;
		case 7:
			setTimeout("$('#divRATE input[@type=radio]').rating('','#txtMY_RATING')", 10);
			break;
		}
	}

/***********************************************
* COCH TEMPLATE SUBMIT
***********************************************/
function validate_COCH(intStep)
	{
	//alert('refresh_COCH: ' + intStep);
	// Validazione SUBMIT Template CHANNEL: intSTEP = STEP di cui fare la VALIDATE (1/2/3/4)
	var arNAME = new Array();
	var arLABEL = new Array();	
	var objHTML;

	switch (intStep)
		{
		case 1:
			arNAME[0] = "txtCASE_NAME";
			//arNAME[1] = "txtCASE_DESC";
			arNAME[1] = "txtGEO_BRAND";
			arLABEL[0] = "CASE TITLE";
			//arLABEL[1] = "CASE DESCRIPTION";
			arLABEL[1] = "GEO/BRAND";
			for (var i = 0; i < (arNAME.length); i++)
				{
				objHTML = document.getElementById(arNAME[i]);
				if (objHTML.value=='')
					{
					alert(arLABEL[i] + '\nfield is MANDATORY!');
				//	objHTML.focus();
					return false;
					}
				}

			// Se ci sono ALLEGATI devo mostrare la PROGRESS BAR!
			if (document.getElementById('txtFILE_PREVIEW').value != '')
				{
				return ShowProgress(sTEMP);
				}
			else
				return true;
			break;

		case 2:
			arNAME[0] = "txtMKTOBJ_ID";
			arLABEL[0] = "MARKETING OBJECTIVES";
			for (var i = 0; i < (arNAME.length); i++)
				{
				objHTML = document.getElementById(arNAME[i]);
				if (objHTML.value=='')
					{
					alert(arLABEL[i] + '\nfield is MANDATORY!');
				//	objHTML.focus();
					return false;
					}
				}

		//	document.getElementById('divCASE').className = 'FILTER_25';
			return true;
			break;

		case 3:
		//	document.getElementById('divCASE').className = 'FILTER_25';
			//alert(sTEMP);
			// Se ci sono ALLEGATI devo mostrare la PROGRESS BAR!
		//	if ((document.getElementById('txtFILE_PREVIEW').value!='') || (document.getElementById('txtFILE_1').value!=''))
			if (document.getElementById('txtFILE_1').value != '')
				{
				return ShowProgress(sTEMP);
				}
			else
				return true;
			break;

		case 4:
		//	document.getElementById('divCASE').className = 'FILTER_25';
			return true;
			break;
		
		case 5:
			// FINAL REVIEW
		//	document.getElementById('divCASE').className = 'FILTER_25';
			return true;
			break;
		case 6:
			// APPROVE/REJECT: quale dei 2?
			objHTML = document.getElementById('txtREJECT');
			if ((objHTML.value=='') && (document.getElementById('txtFLAG').value=='N'))
				{
				alert('Reject reason\nfield is MANDATORY!');
				objHTML.focus();
				return false;
				}
			objHTML = document.getElementById('txtAPPROVE');
			if ((objHTML.value=='') && (document.getElementById('txtFLAG').value=='Y'))
				{
				alert('Approve reason\nfield is MANDATORY!');
				objHTML.focus();
				return false;
				}
		//	document.getElementById('divCASE').className = 'FILTER_25';
			return true;
			break;
			
		case 7:
		
			if((document.getElementById('txtRATE').value=='Cancel Rating')||(document.getElementById('txtRATE').value==''))
			{	
				alert('You have not rated');	
				return false;
			}
			else
			{
			return true;
			}
			break;	
		}
	}

/***********************************************
* CONTROLLO CINQUINA CASE TEMPLATE - STEP 1
***********************************************/
function checkGEO()
	{
	var arNAME = new Array();
	var arLABEL = new Array();
	var arID = new Array();
	var arDESC = new Array();
	var objHTML;

	arNAME[0] = "cmbREGION";
	arNAME[1] = "cmbCOUNTRY";
	arNAME[2] = "cmbBUSINESS";
	arNAME[3] = "cmbCATEGORY";
	arNAME[4] = "cmbBRAND";
	arLABEL[0] = "Region";
	arLABEL[1] = "Country";
	arLABEL[2] = "Business Division";
	arLABEL[3] = "Category";
	arLABEL[4] = "Brand";

	for (var i = 0; i < (arNAME.length); i++)
		{
		objHTML = document.getElementById(arNAME[i]);
		if (objHTML.value=='')
			{
			alert(arLABEL[i] + ' must be specified!');
			if (objHTML.disabled == false)
				objHTML.focus();
			return false;
			}
		else
			{
				arID[i] = objHTML.options[objHTML.selectedIndex].value;
				arDESC[i] = objHTML.options[objHTML.selectedIndex].text;
				if((document.getElementById('btnGEO_DEL').style.visibility == "hidden")&&(i == (arNAME.length-1)))				
				document.getElementById('btnGEO_DEL').style.visibility = "visible";
			}
		}

	var strID = arID[0] + '|' + arID[1] + '|' + arID[2] + '|' + arID[3] + '|' + arID[4];
	var strDESC = arDESC[0] + '|' + arDESC[1] + '|' + arDESC[2] + '|' + arDESC[3] + '|' + arDESC[4];
	addROW(strID, strDESC, 'txtROWS_ID', 'txtROWS_DESC', 'tblGEO_BRAND');
	}

/***********************************************
* CONTROLLO COMBO SOCIO/DEMO - STEP 2
***********************************************/

/***********************************************
function checkSOCIODEMO()
	{
	var arID = new Array();
	var arDESC = new Array();
	var arNAME = new Array();
	var arLABEL = new Array();	
	var objHTML;

	arNAME[0] = "cmbGENDER";
	arNAME[1] = "cmbSOCIOECONOMIC";
	arNAME[2] = "cmbAGE";
	arNAME[3] = "cmbSITE";
	arLABEL[0] = "Gender";
	arLABEL[1] = "Socio Economic";
	arLABEL[2] = "Age";
	arLABEL[3] = "Site";

	for (var i = 0; i < (arNAME.length); i++)
		{
		objHTML = document.getElementById(arNAME[i]);
		if (objHTML.value=='')
			{
			alert(arLABEL[i] + ' must be specified!');
			if (objHTML.disabled == false)
				objHTML.focus();
			return false;
			}
		else
			{
			arID[i] = objHTML.options[objHTML.selectedIndex].value;
			arDESC[i] = objHTML.options[objHTML.selectedIndex].text;
			}
		}

	var strID = arID[0] + '|' + arID[1] + '|' + arID[2] + '|' + arID[3];
	var strDESC = arDESC[0] + '|' + arDESC[1] + '|' + arDESC[2] + '|' + arDESC[3];
	addROW(strID, strDESC, 'txtROWS_ID', 'txtROWS_DESC', 'tblSOCIO_DEMO');
	}
	
***********************************************/
	
/***********************************************
* CONTROLLO COMBO TARGET AUDIENCE - SOCIO DEMOGRAPHIC - STEP 2
***********************************************/
/***********************************************
function checkTASD()
	{
	var arID = new Array();
	var arDESC = new Array();
	var arNAME = new Array();
	var arLABEL = new Array();	
	var objHTML;

	arNAME[0] = "cmbGENDER";
	arNAME[1] = "cmbCLASS";
	arNAME[2] = "cmbAGE";
	arNAME[3] = "cmbLIFESTAGE";
	arNAME[4] = "cmbSITE";
	arNAME[5] = "cmbDIST_CH";
	arLABEL[0] = "Gender";
	arLABEL[1] = "Class";
	arLABEL[2] = "Age";
	arLABEL[3] = "Lifestage";
	arLABEL[4] = "Site";
	arLABEL[5] = "Dist. Channel";

	for (var i = 0; i < (arNAME.length); i++)
		{
		objHTML = document.getElementById(arNAME[i]);
		if (objHTML.value=='')
			{
			alert(arLABEL[i] + ' must be specified!');
			if (objHTML.disabled == false)
				objHTML.focus();
			return false;
			}
		else
			{
			arID[i] = objHTML.options[objHTML.selectedIndex].value;
			arDESC[i] = objHTML.options[objHTML.selectedIndex].text;
			if((document.getElementById('btnTASD_DEL').style.visibility == "hidden")&&(i == (arNAME.length-1)))				
			document.getElementById('btnTASD_DEL').style.visibility = "visible";
			}
		}

	var strID = arID[0] + '|' + arID[1] + '|' + arID[2] + '|' + arID[3] + '|' + arID[4] + '|' + arID[5];
	var strDESC = arDESC[0] + '|' + arDESC[1] + '|' + arDESC[2] + '|' + arDESC[3] + '|' + arDESC[4] + '|' + arDESC[5];
	addROW(strID, strDESC, 'txtROWS_ID', 'txtROWS_DESC', 'tblTASD');
	}
	
	
	***********************************************/
/***********************************************
* NEW SCRIPTS FOR IMA TEMPLATE 
***********************************************/

/***********************************************
* IMA TEMPLATE REFRESH
***********************************************/
function refresh_IMA(intStep)
	{

	switch (intStep)
		{
		case 1:
			setTimeout("getDataTL('cmbTEAMTL_FROM', 'cmbTEAMTL', 'txtTEAMTL_ID')", 10);
			setTimeout("getData('cmbTEAM_FROM', 'cmbTEAM', 'txtTEAM_ID')", 20);
			setTimeout("addROW('', '', 'txtROWS_ID', 'txtROWS_DESC', 'tblGEO_BRAND')", 30);
			setTimeout("window.scrollTo(0,0);", 40);
			break;
		case 2:
			//alert('one')
			//setTimeout("addROW('', '', 'txtROWS_ID', 'txtROWS_DESC', 'tblTASD')", 10);
			//alert('two')
			setTimeout("window.scrollTo(0,0);", 20);
			//alert('three')
			break;
		case 3:
			//setTimeout("addROW('', '', 'txtFILES_ID', 'txtFILES_DESC', 'tblFILE_LIST')", 10);
			//setTimeout("addROW('', '', 'txtVIDEOS_ID', 'txtVIDEOS_DESC', 'tblVIDEO_LIST')", 20);
			setTimeout("window.scrollTo(0,0);", 30);
			//alert('three')
			break;
		case 4:
			setTimeout("window.scrollTo(0,0);", 10);
			break;
		case 5:
			setTimeout("window.scrollTo(0,0);", 10);
			break;
		case 6:			
			setTimeout("window.scrollTo(0,0);", 10);
			break;
		case 7:
			setTimeout("$('#divRATE input[@type=radio]').rating('','#txtMY_RATING')", 10);
			setTimeout("window.scrollTo(0,0);", 20);
			break;
		case 8:
			//setTimeout("window.scrollTo(0,0);", 10);
			break;			
		}
	}

/***********************************************
* IMA TEMPLATE SUBMIT
***********************************************/
//IMA1.3_01 - Deepa - 20-Aug-08 - start of code change Purpose: To validate FCKeditor textboxes


function validate_IMA(intStep)
	{
	//debugger;		

	if (document.getElementById('txtSTEP_NEXT').value >= intStep)
  	{   
	var arNAME = new Array();
	var arLABEL = new Array();
	var arSIZE = new Array();		
	var arCONTROL = new Array();	
	var objHTML;
	var objHTMLCH;

	switch (intStep)
		{
		case 1:
			//alert(document.getElementById('cmbBRAND').value)
			
			arNAME[0] = "txtCASE_NAME";		
			
		
			arNAME[1] = "txtGEO_BRAND";
			arLABEL[0] = "PROJECT TITLE";		
			
			
			arLABEL[1] = "BRAND & REGIONAL SCOPE";
			for (var i = 0; i < (arNAME.length); i++)
				{
				objHTML = document.getElementById(arNAME[i]);
				if (trim(objHTML.value)=='')
					{
					if(document.getElementById('cmbBRAND').value!='')
			        {
        			
			            checkGEO();
			        }
			        else
			        {
					    alert(arLABEL[i] + '\nfield is MANDATORY!');
					    //objHTML.focus();
					    return false;
					}
					}
				}
				
			//Activity Description Validation added by Vergil on 18.8.2007
			//var oEditor = FCKeditorAPI.GetInstance('txtCASE_DESC') ;			
			//var FCKeditorText = oEditor.GetXHTML(true);			
			//if (FCKeditorText=='')
			//{
			//	alert('CASE DESCRIPTION\nfield is MANDATORY!');
			//	oEditor.Focus();
			//	oEditor ='';	
			//	return false;
			//}
			//else
			//{
			//	if ( document.getElementById('lenIMA_CASE_DESC').value < 0 ) // If Internet Explorer. 
			//	{					
			//		alert('Allowed text limit is only 255 characters for CASE DESCRIPTION field' );				
			//		oEditor.Focus();
			//		oEditor ='';	
			//		return false;
			//	} 					
		//	}
				
			//Timing Validation
			var monthFROM, monthTO, yearFROM, yearTO
			monthFROM = document.getElementById('cmbCASE_FROMMONTH').selectedIndex+1;
			monthTO = document.getElementById('cmbCASE_TOMONTH').selectedIndex+1;
			yearFROM = document.getElementById('cmbCASE_YEAR').options[document.getElementById('cmbCASE_YEAR').selectedIndex].text;
			yearTO = document.getElementById('cmbCASE_TOYEAR').options[document.getElementById('cmbCASE_TOYEAR').selectedIndex].text;
			
			if (yearTO<yearFROM)
			{
				alert('TIMIING is INVALID!');
				return false;
			}
			else if ((yearTO==yearFROM) && (monthTO<monthFROM))
			{
				alert('TIMIING is INVALID!');
				return false;
			}
			if ((document.getElementById('Projtype1').checked ==false)&&(document.getElementById('Projtype2').checked ==false)&&(document.getElementById('Projtype3').checked ==false))
			{
			    alert('Select the PROJECT TYPE!');
			    return false;
			}
			if ((document.getElementById('mda1').checked ==false) && (document.getElementById('mda2').checked ==false))
			{
			    alert('Please Select MARKET DEVELOPMENT ACTIVITY STATUS!');
			    return false;
			} 
			else if (document.getElementById('mda1').checked ==true)
			{
			    if(document.getElementById('mdadesc').value=='')
			    {
			        alert('Please Enter the TOOLKIT NAME !');
			        return false;
			    }
			}
			
			   if ((document.getElementById('txtFILE_PREVIEW1').value=='') &&(document.getElementById('hiddenThumbimage').value=='')) 
			    {
			 
			        alert('Please Enter the THUMBNAIL IMAGE !');
			     
			     
			   return false;
			   }
			   
			  
			   
			   
			   
			   
			        
			
			if ((document.getElementById('meas1').checked ==false) && (document.getElementById('meas2').checked ==false))
			{
			    alert('Please Select MARKETING EXCELLENCE AWARDS SUBMISSION STATUS!');
			    return false;
			} 
		    if (document.getElementById('meas2').checked ==true)
			{
	     	    var ddl = document.getElementById('cmbmeascat');
		        if (ddl.options[ddl.selectedIndex].value == '')
	    	    {
	    		    alert("Please Select the CATEGORY!");			
    	    	    return false;
			    }
			    }

	         if(document.getElementById('txtProjLead').value=='')
			    {
			        alert('Please Enter the PROJECT LEADER!');
			        return false;
			    }
			    
			    else
			    {
			    
			     var str=document.frmCASE.txtProjLead.value;
               var filter=/^.+@.+\..{2,3}$/;

            if (filter.test(str))
            {
                 testresults=true;
                 }
           else 
           {
                 alert("Invalid E-Mail Id in PROJECT LEADER!");
                    return false;
                  }
         		
			   
			    }
			    
			    
			    
			     var ddl1 = document.getElementById('cmb_PLFUNCTION');
		        if (ddl1.options[ddl1.selectedIndex].value == '')
	    	    {
	    		    alert("Please Enter the function of PROJECT LEADER!");			
    	    	    return false;
			    }
			    
			if(document.getElementById('txtIBCLead').value=='')
			    {
			        alert('Please Enter the IBC LEADER !');
			        return false;
			    }
			     else
			    {
			    
			     var str=document.frmCASE.txtIBCLead.value;
               var filter=/^.+@.+\..{2,3}$/;

            if (filter.test(str))
            {
                 testresults=true;
                 }
           else 
           {
                 alert("Invalid E-Mail Id in IBC LEADER!");
                    return false;
                  }
         		
			   
			    }
			   
			     
			     var ddl3 = document.getElementById('cmb_ILFUNCTION');
		        if (ddl3.options[ddl3.selectedIndex].value == '')
	    	    {
	    		    alert("Please Enter the function of IBC LEADER!");			
    	    	    return false;
			    }
			    if (document.getElementById('view').value >=0)
			    {
			    for (var j =0 ; j <=(document.getElementById('view').value); j++)
			    {
			    
			     if (document.getElementById('txtCoreTeam'+j+'').value=='')
			     {
			        alert("Please Enter the CORE TEAM !");			
    	    	    return false;
			     }
			     else
			     {
			     
			      var str=document.getElementById('txtCoreTeam'+j+'').value;
			      
               var filter=/^.+@.+\..{2,3}$/;

            if (filter.test(str))
            {
                 testresults=true;
                 }
           else 
           {
                 alert("Invalid E-Mail Id in CORE TEAM!");
                    return false;
                  }
         		
			     
			     }
			    
			    
			    
			     
			     var ddl4 = document.getElementById('cmb_CTFUNCTION'+j+'');
			     
			     if (ddl4.options[ddl4.selectedIndex].value == '')
			     {
			       alert("Please Enter the FUNCTION of CORE TEAM !");			
    	    	    return false;
			     }
			     
			    }
			    }
			    
			    
			    if(document.getElementById('txtSignoff').value=='')
			    {
			        alert('Please Enter the SIGN OFF !');
			        return false;
			    }
			     else
			    {
			    
			     var str=document.frmCASE.txtSignoff.value;
               var filter=/^.+@.+\..{2,3}$/;

            if (filter.test(str))
            {
                 testresults=true;
                 }
           else 
           {
                 alert("Invalid E-Mail Id in SIGN OFF!");
                    return false;
                  }
         		
			   
			    }
			   
			     if(document.getElementById('txtSignoffrole').value=='')
			    {
			        alert('Please Enter the Role of SIGN OFF !');
			        return false;			  
			    }
			    
			    
			 
 


		
			
			//alert('submitting..')
			
	
								//if (document.getElementById('txtFILE_PREVIEW').value != '')
			//	{
			//	return ShowProgress(sTEMP);
			//	}
			//else
				return true;			
			break;
			
		case 2:
		if((document.getElementById('txtTOTGTTP').value=='XX/YY')||(document.getElementById('txtTOTGTMSR').value=='€€')||(document.getElementById('txtTOTGTMSRP').value=='iTO%'))
			{
			alert('Please enter all the fields in TURNOVER !');
			document.getElementById('txtTOTGTTP').focus();
			return false;
			}
		if((document.getElementById('txtGMTGTTP').value=='XX/YY')||(document.getElementById('txtGMTGTMSR').value=='€€')||(document.getElementById('txtGMTGTMSRP').value=='€€'))
			{
			alert('Please enter all the fields in GM/PBI !');
			document.getElementById('txtGMTGTTP').focus();
			return false;
			}
		if((document.getElementById('txtVALSHTGTTP').value=='XX/YY')||(document.getElementById('txtVALSHTGTMSR').value=='%')||(document.getElementById('txtVALSHTGTMSRP').value=='%'))
			{
			alert('Please Enter all the fields in VALUE SHARE !');
			return false;
			}	
		if((document.getElementById('txtVOLSHTGTTP').value=='XX/YY')||(document.getElementById('txtVOLSHTGTMSR').value=='%')||(document.getElementById('txtVOLSHTGTMSRP').value=='%'))
			{
			alert('Please Enter all the fields in VOLUME SHARE !');
			return false;
			}
			
			
		if((document.getElementById('txtPNTGTTP').value=='XX/YY')||(document.getElementById('txtPNTGTMSR').value=='%')||(document.getElementById('txtPNTGTMSRP').value=='%'))
			{
			alert('Please Enter all the fields in PENETRATION !');
			return false;
			}	
		if((document.getElementById('txtFOPTGTTP').value=='XX/YY')||(document.getElementById('txtFOPTGTMSR').value=='%')||(document.getElementById('txtFOPTGTMSRP').value=='%'))
			{
			alert('Please Enter all the fields in REPEAT RATE/ LOYALTY !');
			return false;
			}
		if((document.getElementById('txtCNTGTTP').value=='XX/YY')||(document.getElementById('txtCNTGTMSR').value=='')||(document.getElementById('txtCNTGTMSRP').value==''))
			{
			alert('Please Enter all the fields in DISTRIBUTION QUALITY !');
			return false;
			}
		if((document.getElementById('txtRPITGTTP').value=='XX/YY')||(document.getElementById('txtRPITGTMSR').value=='')||(document.getElementById('txtRPITGTMSRP').value==''))
			{
			alert('Please Enter all the fields in RELATIVE PRICE INDEX !');
			return false;
			}
			
			if((document.getElementById('txtGMBSMSR').value>100)||(document.getElementById('txtGMBSMSR').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in GM/PBI for Base');
			return false;
			}
			if((document.getElementById('txtVALSHBSMSR').value>100)||(document.getElementById('txtVALSHBSMSR').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Value Share for Base');
			return false;
			}
			if((document.getElementById('txtVOLSHBSMSR').value>100)||(document.getElementById('txtVOLSHBSMSR').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Volume Share for Base');
			return false;
			}
			if((document.getElementById('txtVOLSHTGTMSR').value>100)||(document.getElementById('txtVOLSHTGTMSR').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Volume Share for Target');
			return false;
			}
			if((document.getElementById('txtVALSHTGTMSR').value>100)||(document.getElementById('txtVALSHTGTMSR').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Value Share for Target');
			return false;
			}
				if((document.getElementById('txtVOLSHTGTMSRP').value>100)||(document.getElementById('txtVOLSHTGTMSRP').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Volume Share for Actual');
			return false;
			}
			if((document.getElementById('txtVALSHTGTMSRP').value>100)||(document.getElementById('txtVALSHTGTMSRP').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Value Share for Actual');
			return false;
			}
			if((document.getElementById('txtPNBSMSR').value>100)||(document.getElementById('txtPNBSMSR').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Penetration for Base');
			return false;
			}
			if((document.getElementById('txtFOPBSMSR').value>100)||(document.getElementById('txtFOPBSMSR').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Repeat Rate/Loyalty for Base');
			return false;
			}
			if((document.getElementById('txtPNTGTMSR').value>100)||(document.getElementById('txtPNTGTMSR').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Penetration for Target');
			return false;
			}
			if((document.getElementById('txtFOPTGTMSR').value>100)||(document.getElementById('txtFOPTGTMSR').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Repeat Rate/Loyalty for Target');
			return false;
			}
			if((document.getElementById('txtPNTGTMSRP').value>100)||(document.getElementById('txtPNTGTMSRP').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Penetration for Actual');
			return false;
			}
			if((document.getElementById('txtFOPTGTMSRP').value>100)||(document.getElementById('txtFOPTGTMSRP').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Repeat Rate/Loyalty for Actual');
			return false;
			}
			if((document.getElementById('txtRPIBSMSR').value>100)||(document.getElementById('txtRPIBSMSR').value<0))
			{
			alert('Please Enter the Measure from 0 to 100 in Relative Price Index for Base');
			return false;
			}
			
			
		if(document.getElementById('txtTOBSTP').value=='XX/YY')
		{
		document.getElementById('txtTOBSTP').value=''
		}	
		
		if(document.getElementById('txtGMBSTP').value=='XX/YY')
		{
		document.getElementById('txtGMBSTP').value=''
		}
		
		if(document.getElementById('txtVALSHBSTP').value=='XX/YY')
		{
		document.getElementById('txtVALSHBSTP').value=''
		}
		if(document.getElementById('txtVOLSHBSTP').value=='XX/YY')
		{
		document.getElementById('txtVOLSHBSTP').value=''
		}
		if(document.getElementById('txtPNBSTP').value=='XX/YY')
		{
		document.getElementById('txtPNBSTP').value=''
		}
		if(document.getElementById('txtCNBSTP').value=='XX/YY')
		{
		document.getElementById('txtCNBSTP').value=''
		}
		if(document.getElementById('txtFOPBSTP').value=='XX/YY')
		{
		document.getElementById('txtFOPBSTP').value=''
		}
		if(document.getElementById('txtRPIBSTP').value=='XX/YY')
		{
		document.getElementById('txtRPIBSTP').value=''
		}
		

		if(document.getElementById('txtTOBSMSR').value=='€€')
		{
		document.getElementById('txtTOBSMSR').value=''
		}	
			if(document.getElementById('txtGMBSMSR').value=='€€')
		{
		document.getElementById('txtGMBSMSR').value=''
		}	
		if(document.getElementById('txtVALSHBSMSR').value=='%')
		{
		document.getElementById('txtVALSHBSMSR').value=''
		}	
		if(document.getElementById('txtVOLSHBSMSR').value=='%')
		{
		document.getElementById('txtVOLSHBSMSR').value=''
		}
		
		if(document.getElementById('txtPNBSMSR').value=='%')
		{
		document.getElementById('txtPNBSMSR').value=''
		}
		if(document.getElementById('txtFOPBSMSR').value=='%')
		{
		document.getElementById('txtFOPBSMSR').value=''
		}
		if(document.getElementById('txtRPIBSMSR').value=='%')
		{
		document.getElementById('txtRPIBSMSR').value=''
		}
			
			
			
			
	return true;
break;	
		case 3:

		
			//arNAME[0] = "txtCASE_BMO";		
			//arNAME[1] = "txtCASE_JTBD_1";
			//arNAME[2] = "txtCASE_DEMO";
		
		
			//arLABEL[0] = "CONTEXT ISSUE/OPPORTUNITY";	
			//arLABEL[1] = "JOBS TO BE DONE";
			//arLABEL[2] = "TARGET AUDIENCE";	
			
			
			
			//for (var i = 0; i < (arNAME.length); i++)
			//{		
				
			//	var oEditor = FCKeditorAPI.GetInstance(arNAME[i]) ;			
			//	var FCKeditorText = oEditor.GetXHTML(true);	
			//	if (FCKeditorText=='' || FCKeditorText == '<br />')
			//	{
				//	alert(arLABEL[i] + '\nfield is MANDATORY!');
				//	oEditor.Focus();
			//		return false;
			//	}
		//	}
		    var oEditor = FCKeditorAPI.GetInstance('txtCASE_BMO') ;			
			var FCKeditorText = oEditor.GetXHTML(true);			
				if (FCKeditorText=='' || FCKeditorText == '<br />')
				{
					alert( 'CONTEXT ISSUE/OPPORTUNITY field is MANDATORY!');
					oEditor.Focus();
					return false;
				}
					
			if(document.getElementById('txtCASE_JTBD_1').value=='')
			{
			alert('JOBS TO BE DONE field is MANDATORY!');
			return false;
			}	  
				
			var oEditor = FCKeditorAPI.GetInstance('txtCASE_DEMO') ;			
				var FCKeditorText = oEditor.GetXHTML(true);			
				if (FCKeditorText=='' || FCKeditorText == '<br />')
				{
					alert( 'TARGET AUDIENCE field is MANDATORY!');
					oEditor.Focus();
					return false;
				}
			
		
break;	
			
		case 4:



if((document.getElementById('Proposition').checked==false)&&(document.getElementById('Price').checked==false)&&(document.getElementById('Product').checked==false)&&(document.getElementById('Place').checked==false)&&(document.getElementById('Pack').checked==false)&&(document.getElementById('Promotion').checked==false))
{
alert('Please Check the 6Ps !');
return false;
}
if((document.getElementById('TV').checked==false)&&(document.getElementById('Digital').checked==false)&&(document.getElementById('OnPack').checked==false)&&(document.getElementById('Radio').checked==false)&&(document.getElementById('PR').checked==false)&&(document.getElementById('Sampling').checked==false)&&(document.getElementById('Print').checked==false)&&(document.getElementById('ResponseMktg').checked==false)&&(document.getElementById('Experience').checked==false)&&(document.getElementById('Cinema').checked==false)&&(document.getElementById('Partnership').checked==false)&&(document.getElementById('InStore').checked==false))
{
    alert('Please Check the CHANNELS & DISCIPLINES !');
    return false;
}


var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;			
				var FCKeditorText = oEditor.GetXHTML(true);			
				if (FCKeditorText=='' || FCKeditorText == '<br />')
				{
					alert( 'ACTIVITY DESCRIPTION field is MANDATORY!');
					oEditor.Focus();
					return false;
				}
				
			
			//	if(document.getElementById('txtVIDEO_1').value=='' && document.getElementById('txtFileCount').value <= 0)
			 //   {
			 //       alert('Please select a file !');
			  //      return false;
			  //  }
      //  if(document.getElementById('txtVIDEO_DESC_1').value=='' && document.getElementById('txtFileCount').value <= 0)
		//	    {
		//	        alert('Please Enter the file description !');
		//	        return false;
		//	    }
			    
			    
		//	    if(document.getElementById('txtVIDEOS_ID').value=='' && document.getElementById('txtFileCount').value <= 0)
			//    {
			 //       alert('Please Add the Video !');
			 //       return false;
			 //   }
break;

		case 5:
		var oEditor = FCKeditorAPI.GetInstance('txtCASE_BPE') ;	
		var FCKeditorText = oEditor.GetXHTML(true);	
		if (FCKeditorText=='' || FCKeditorText == '<br />')
				{
					alert( 'BRILLIANCE IN PLANNING & EXECUTION field is MANDATORY!');
					oEditor.Focus();
					return false;
				}
				
					var oEditor = FCKeditorAPI.GetInstance('txtCASE_SA') ;	
		var FCKeditorText = oEditor.GetXHTML(true);	
		if (FCKeditorText=='' || FCKeditorText == '<br />')
				{
					alert( 'SHARE & ADAPT field is MANDATORY!');
					oEditor.Focus();
					return false;
				}
				
				var oEditor = FCKeditorAPI.GetInstance('txtCASE_Learn1') ;	
		var FCKeditorText = oEditor.GetXHTML(true);	
		if (FCKeditorText=='' || FCKeditorText == '<br />')
				{
					alert( 'SHARE & ADAPT field is MANDATORY!');
					oEditor.Focus();
					return false;
				}
				
			break;	
				
				
		
		
           
		

		case 6:			
			
			if(document.getElementById('hidRole').value=='GKM')
			{
				if(document.getElementById('rdCAT_BP_FLAG2').checked)
				{
					objHTML = document.getElementById('txtCAT_BP_WHY');		
					if (objHTML.value=='') 
						{
						alert('Please detail what you would like the submitter to change.');
						objHTML.focus();
						return false;
						}
				}
				
				if(document.getElementById('rdCAT_BP_FLAG1').checked)
				{
					objHTML = document.getElementById('txtKM_HeadLine');
					if (objHTML.value=='') 
						{
							
							alert('Heading\nfield is MANDATORY!');
							objHTML.focus();
							return false;
						}
					objHTML = document.getElementById('txtKM_SubHead');
					if (objHTML.value=='') 
						{
						alert('Sub Heading\nfield is MANDATORY!');
						objHTML.focus();
						return false;
						}
					//objHTML = document.getElementById('txtFILE_PREVIEW');
					//if (objHTML.value=='') 
					//	{
					//	alert('Case Display Image\nfield is MANDATORY!');
					//	objHTML.focus();
					//	return false;
					//	}
				}
				if ( document.getElementById('lenSUB_HEADING')) // If Internet Explorer. 
				if ( document.getElementById('lenSUB_HEADING').value < 0 ) // If Internet Explorer. 
				{ 
					var oEditor = FCKeditorAPI.GetInstance('txtKM_SubHead');
					alert('Allowed text limit is only 255 characters for sub-heading field' );					
					oEditor.Focus();
					return false;
				}
				if ( document.getElementById('lenFCKeditor4')) // If Internet Explorer. 
				if ( document.getElementById('lenFCKeditor4').value < 0 ) // If Internet Explorer. 
				{ 
					var oEditor = FCKeditorAPI.GetInstance('FCKeditor4');
					alert('Allowed text limit is only 4000 characters for Related links field' );					
					oEditor.Focus();
					return false;
				}
				if(document.getElementById('rdBP_FLAG1').checked)
				{
					objHTML = document.getElementById('txtBP_WHY');					
					if (objHTML.value=='') 
					{
						alert('Please tell us why this case is Best practice.');
						objHTML.focus();
						return false;
					}
				}
				
				//if (document.getElementById('txtFILE_PREVIEW').value != '')
				//	{
				//	return ShowProgress(sTEMP);
				//	}
				//else
				//	return true;	
			}
			else
			{
				if(document.getElementById('rdBP_FLAG1'))	
				{
					if(document.getElementById('rdBP_FLAG1').checked)
					{
						objHTML = document.getElementById('txtBP_WHY');
						if (objHTML.value=='') 
						{
							alert('Please tell us why this case is Best practice.');
							objHTML.focus();
							return false;
						}
					}
				}
			}
									
				
		//return true;
		break;
		
		case 7:
		//IMA release 1.4 - Deepa - 29-Oct-08 - Start of code change Purpose: To remove pagination in Final review page when visited from portal 
		if (document.getElementById('txtFLAG').value=='ADD_RATE')
		{
			if((document.getElementById('txtRATE').value=='Cancel Rating')||(document.getElementById('txtRATE').value==''))
			{		
				alert('You have not rated');
				return false;
			}
			else
			{
				return true;
			}
		}
		else
		{
			if(trim(document.getElementById('txtCOMMENT').value)=='')
			{		
				alert('You have not entered any comments');
				return false;
			}
			else
			{
				return true;
			}
			
		}
		break;	
		//IMA release 1.4 - Deepa - 29-Oct-08 - End of code change Purpose: To remove pagination in Final review page when visited from portal 
			
		
		// This was added by Vergil purpose: To show alert messages for mandatory fields ends here
		case 8:
		alert('hi')
		    //return true;
		    break;
		}
	}
	else
	{
	// Previous step click
	var arNAME = new Array();
	var arLABEL = new Array();
	var arSIZE = new Array();		
	var arCONTROL = new Array();	
	var objHTML;
	var objHTMLCH;

	switch (intStep)
	{
		case 1:
			
			
			return true;			
			break;
			
		case 2:
								
//			arNAME[0] = "lenIMA_JTBD_1";
//			arNAME[1] = "lenIMA_JTBD_2";
//			arNAME[2] = "lenIMA_JTBD_3";
//			arNAME[3] = "lenCASE_MSR_OBJ_1";
//			arNAME[4] = "lenCASE_MSR_OBJ_2";			
//			arNAME[5] = "lenCASE_MSR_OBJ_3";
//			
//			arLABEL[0] = "JOBS TO BE DONE #1";
//			arLABEL[1] = "JOBS TO BE DONE #2";			
//			arLABEL[2] = "JOBS TO BE DONE #3";
//			arLABEL[3] = "MEASURABLE OBJECTIVE #1";
//			arLABEL[4] = "MEASURABLE OBJECTIVE #2";
//			arLABEL[5] = "MEASURABLE OBJECTIVE #3";
//			
//			arSIZE[0] = 100;
//			arSIZE[1] = 100;
//			arSIZE[2] = 100;
//			arSIZE[3] = 2000;
//			arSIZE[4] = 2000;
//			arSIZE[5] = 2000;
//		
//			arCONTROL[0] = "txtCASE_JTBD_1";
//			arCONTROL[1] = "txtCASE_JTBD_2";
//			arCONTROL[2] = "txtCASE_JTBD_3";
//			arCONTROL[3] = "txtCASE_MSR_OBJ_1";
//			arCONTROL[4] = "txtCASE_MSR_OBJ_2";
//			arCONTROL[5] = "txtCASE_MSR_OBJ_3";				
//			
//			for (var i = 0; i < (arNAME.length); i++)
//			{
//				if ( document.getElementById(arNAME[i]).value < 0 ) // If Internet Explorer. 
//				{ 
//				var oEditor = FCKeditorAPI.GetInstance(arCONTROL[i]) ;
//				alert('Allowed text limit is only '+arSIZE[i]+' characters for '+arLABEL[i]+' field' );				
//				oEditor.Focus();
//				return false;
//				} 				
//			}
//			
//			return true;
//			break;

		case 3:
						
								
////Purpose: Check the length of newly added editor fields. Date :Sep 29th Author : Deepa starts here
//			arNAME[0] = "lenCASE_BMO";
//			arNAME[1] = "lenIMA_JTBD_1";
//			arNAME[2] = "lenIMA_JTBD_2";
//			arNAME[3] = "lenIMA_JTBD_3";
//			arNAME[4] = "lenCASE_DEMO";
//			arNAME[5] = "lenCASE_CI";
//			arNAME[6] = "lenCASE_SI";
//			

//			
//			arLABEL[0] = "";
//			arLABEL[1] = "";			
//			arLABEL[2] = "";
//			arLABEL[3] = "";
//			arLABEL[4] = "";
//			arLABEL[5] = "";
//			arLABEL[6] = "";
//		


//			
//			arSIZE[0] = 3000;
//			arSIZE[1] = 100;
//			arSIZE[2] = 100;
//			arSIZE[3] = 100;
//			arSIZE[4] = 2000;
//			arSIZE[5] = 2000;
//			arSIZE[6] = 2000;
//		
//		
//			arCONTROL[0] = "txtCASE_BMO";
//			arCONTROL[1] = "txtCASE_JTBD_1";
//			arCONTROL[2] = "txtCASE_JTBD_2";
//			arCONTROL[3] = "txtCASE_JTBD_3";
//			arCONTROL[4] = "txtCASE_DEMO";	
//			arCONTROL[5] = "txtCASE_CI";
//			arCONTROL[6] = "txtCASE_SI";
//						
//			
//			
//			for (var i = 0; i < (arNAME.length); i++)
//			{
//				if ( document.getElementById(arNAME[i]).value < 0 ) // If Internet Explorer. 
//				{ 
//				var oEditor = FCKeditorAPI.GetInstance(arCONTROL[i]) ;
//				alert('Allowed text limit is only '+arSIZE[i]+' characters for '+arLABEL[i]+' field' );				
//				oEditor.Focus();
//				return false;
//				} 				
//			}
//			//Purpose: Check the length of newly added editor fields. Date :Sep 29th Author : Deepa ends here
//			
//			return true;
//			break;
			
		case 4:
						
						
//Count characters in FCKeditor fields
			arCONTROL[0] = "txtCASE_MSR_OBJ_ACH_1";
			arCONTROL[1] = "txtCASE_MSR_OBJ_ACH_2";
			arCONTROL[2] = "txtCASE_MSR_OBJ_ACH_3";	
			arCONTROL[3] = "txtIMA_S4_ANSWER01";
			arCONTROL[4] = "txtIMA_S4_ANSWER02";
			arCONTROL[5] = "txtIMA_S4_ANSWER03";		
			arCONTROL[6] = "txtIMA_S4_ANSWER04";			
			arNAME[0] = "lenCASE_MSR_OBJ_ACH_1";
			arNAME[1] = "lenCASE_MSR_OBJ_ACH_2";
			arNAME[2] = "lenCASE_MSR_OBJ_ACH_3";	
			arNAME[3] = "lenIMA_S4_ANSWER01";
			arNAME[4] = "lenIMA_S4_ANSWER02";
			arNAME[5] = "lenIMA_S4_ANSWER03";		
			arNAME[6] = "lenIMA_S4_ANSWER04";
			arLABEL[0] = "ACHIEVEMENT OF MEAS. OBJ. #1";
			arLABEL[1] = "ACHIEVEMENT OF MEAS. OBJ. #2";
			arLABEL[2] = "ACHIEVEMENT OF MEAS. OBJ. #3";
			arLABEL[3] = "Learnings. #1";
			arLABEL[4] = "Learnings. #2";
			arLABEL[5] = "Learnings. #3";
			arLABEL[6] = "Learnings. #4";
			arSIZE[0] = 3000;
			arSIZE[1] = 3000;
			arSIZE[2] = 3000;
			arSIZE[3] = 4000;	
			arSIZE[4] = 4000;	
			arSIZE[5] = 4000;		
			arSIZE[6] = 4000;
			
			for (var i = 0; i < (arNAME.length); i++)
			{
				if(document.getElementById(arNAME[i]))
				{				
					if ( document.getElementById(arNAME[i]).value < 0 ) // If Internet Explorer. 
					{ 
					var oEditor = FCKeditorAPI.GetInstance(arCONTROL[i]);
					alert('Allowed text limit is only '+arSIZE[i]+' characters for '+arLABEL[i]+' field' );					
					oEditor.Focus();
					return false;
					}
				} 				
			}
			return true;
			break;		
	case 5:
					
return true;
			break;
	case 6:
	if ( document.getElementById('lenSUB_HEADING')) // If Internet Explorer. 					
	if ( document.getElementById('lenSUB_HEADING').value < 0 ) // If Internet Explorer. 
			{ 
				var oEditor = FCKeditorAPI.GetInstance('txtKM_SubHead');
				alert('Allowed text limit is only 255 characters for sub-heading field' );					
				oEditor.Focus();
				return false;
			}						
			
			if ( document.getElementById('lenFCKeditor4')) // If Internet Explorer. 
			if ( document.getElementById('lenFCKeditor4').value < 0 ) // If Internet Explorer. 
			{ 
				var oEditor = FCKeditorAPI.GetInstance('FCKeditor4');
				alert('Allowed text limit is only 500 characters for Related links field' );					
				oEditor.Focus();
				return false;
			}
			return true;
			break;
	}
			
			return true;
		
	}
}
//IMA1.3_01 - Deepa - 20-Aug-08 - End of code change Purpose: To validate FCKeditor textboxes

/* Satya 18/11/2007 START*/
function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateEmail(txtMAIL){
	var emailID= document.getElementById(txtMAIL)
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter valid Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		//emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
/* Satya 18/11/2007 END*/

//IMA1.3_01 - Deepa - 20-Aug-08 - start of code change Purpose: To clear measurable objects content if the user not selecting an objective

function step2_MsrObj(sNAME, sVALUE ,sDIVHELPTEXT,sDIVEDITOR,sURL)
	{	
	// Enable/disable TEXT input based upon COMBO value
	if(sVALUE == '')
		{
		//$('#' + sNAME).attr('disabled', 'disabled');		
			var oEditor = FCKeditorAPI.GetInstance(sNAME);
			oEditor.EditorDocument.body.innerHTML="";
			document.getElementById(sDIVEDITOR).style.display="none";
		}
	else
		{
		//$('#' + sNAME).attr('disabled', '');			
			document.getElementById(sDIVEDITOR).style.display="block";
		}		
			sURL = sURL + "CMBID=" + sVALUE;			
			loadXMLDoc(sDIVHELPTEXT, sURL);
	}
//IMA1.3_01 - Deepa - 20-Aug-08 - end of code change Purpose: To clear measurable objects content if the user not selecting an objective
	
function step4_calcROI(intROI, sVALUE1, sVALUE2)
	{
	// ROI % calculation
	if(intROI == 1)
		$('#txtCASE_ROI_EXP').val(sVALUE1/sVALUE2);
	else
		$('#txtCASE_ROI_ACT').val(sVALUE1/sVALUE2);
	}

function trim(str)
   {
     s = str.replace(/^(\s)*/, '');
     s = s.replace(/(\s)*$/, '');
     return s;
   }
   
function step2_AvailMem(sDIV, sURL,sVALUE,sDELEMAILID)
   {
	sURL = sURL + "&STARTSWITH=" + sVALUE +"&DELEMAILID=" + sDELEMAILID;	 	
	loadXMLDoc(sDIV, sURL);
   }
   
function step2_SelMem(sDIV,sURL,sDELEMAILID)
	{
	//alert(sDELEMAILID);
	   
	if (sDELEMAILID=='TEAM_LEAD')
	{	
	sURL = sURL +"&MULTIMAILID=" + document.getElementById('txtTEAMTL_ID_MULTI').value;  
	sURL = sURL +"&DELEMAILID=Add All >>" ;	
	}
	else if (sDELEMAILID=='TEAM_MEMBERS')
	{
	sURL = sURL +"&MULTIMAILID=" + document.getElementById('txtTEAMMEM_ID_MULTI').value;  
	sURL = sURL +"&DELEMAILID=Add All >>" ;	
	}	 
	//alert(sURL );
	loadXMLDoc(sDIV, sURL);
	}

function clearFilter(sDIV,sURL)
{
//vergil
document.getElementById('txtAvailMem').value="Search E-mail";
document.getElementById('txtAvailTeamMem').value="Search E-mail";
loadXMLDoc(sDIV, sURL);
}
function validate_Business()
{
	objHTML = document.getElementById('cmbBUSINESS');
	if( (objHTML.value == '') || (objHTML.value == 'it is') )
	{
	alert('Please select a business division');
	return false;	
	}
	else
	{	

	return true;
	}
}


function validate_Cat()
{
	if (validate_Business())
	{		
		objHTML = document.getElementById('txtCATEGORY');
		objHTML1 = document.getElementById('cmbExtCATEGORY');		
		if ((objHTML.value=='')	&& (objHTML1.selectedIndex==0))
		{
			alert('Please enter a valid category or select a category to add!');
			return false;	
		}
		else if ((objHTML.value!='') && (objHTML1.selectedIndex!=0))
		{
			alert('Please either enter a category or select an existing one!');
			return false;	
		}
		else
		{	
			
			if (objHTML.value!='')				
			{
				document.getElementById('txtCat').value=objHTML.value;
				//alert(objHTML.value);
			}
			else
			{			
				document.getElementById('txtCat').value=objHTML1.options[objHTML1.selectedIndex].value;
			}
			return true;
		}
	}
}

function validate_Brand()
{
	if ( validate_selCat())
	{
		objHTML = document.getElementById('txtBRAND');
		objHTML1 = document.getElementById('cmbExtBRAND');	
		if ((objHTML.value=='')	&& (objHTML1.selectedIndex==0))
		{
			alert('Please enter a valid brand or select a brand to update');
			return false;	
		}
		else if ((objHTML.value!='') && (objHTML1.selectedIndex!=0))
		{
			alert('Please either enter a brand or select an existing one!');
			return false;	
		}
		else
		{
			if (objHTML.value!='')
			{
				document.getElementById('txtBr').value=objHTML.value;
			}
			else
			{			
				document.getElementById('txtBr').value=objHTML1.options[objHTML1.selectedIndex].value;
			}
			return true;
		}
	}
}

function validate_selCat()
{
	if (validate_Business())
	{
		objHTML = document.getElementById('cmbCATEGORY');
		if( (objHTML.value == '') || (objHTML.value == 'it is') )
		{
		alert('Please select a category');
		return false;	
		}
		else
		{
		return true;
		}
	}
}

function validate_selBrand()
{	
	if ( validate_selCat())
	{
		objHTML = document.getElementById('cmbBRAND');
		if( (objHTML.value == '') || (objHTML.value == 'it is') )
		{
		alert('Please select a brand');
		return false;	
		}
		else
		{
		return true;
		}
	}
}

function IsAvailable(txtfield,combofield)
{
	var strAvailable ='';
	objHTML = document.getElementById(txtfield);
	objHTML1 = document.getElementById(combofield);
	if (objHTML.value!='')
	{
		strAvailable ='NotExist';
	}
	else
	{			
		strAvailable ='Exist';
	}
	return (strAvailable);
}


//For Auto complete option... Testing...




    /**
    * Global vars
    */
    __AutoComplete = new Array();

    // Basic UA detection
    isIE = document.all ? true : false;
    isGecko = navigator.userAgent.toLowerCase().indexOf('gecko') != -1;
    isOpera = navigator.userAgent.toLowerCase().indexOf('opera') != -1;


    /**
    * Attachs the autocomplete object to a form element. Sets
    * onkeypress event on the form element.
    * 
    * @param string formElement Name of form element to attach to
    * @param array  data        Array of strings of which to use as the autocomplete data
    */
    function AutoComplete_Create (id, data)
    {
        __AutoComplete[id] = {'data':data,
                              'isVisible':false,
                              'element':document.getElementById(id),
                              'dropdown':null,
                              'highlighted':null};

        __AutoComplete[id]['element'].setAttribute('autocomplete', 'off');
        __AutoComplete[id]['element'].onkeydown  = function(e) {return AutoComplete_KeyDown(this.getAttribute('id'), e);}
        __AutoComplete[id]['element'].onkeyup    = function(e) {return AutoComplete_KeyUp(this.getAttribute('id'), e);}
        __AutoComplete[id]['element'].onkeypress = function(e) {if (!e) e = window.event; if (e.keyCode == 13 || isOpera) return false;}
        __AutoComplete[id]['element'].ondblclick = function() {AutoComplete_ShowDropdown(this.getAttribute('id'));}
        __AutoComplete[id]['element'].onclick    = function(e) {if (!e) e = window.event; e.cancelBubble = true; e.returnValue = false;}

        // Hides the dropdowns when document clicked
        var docClick = function()
        {
           for (id in __AutoComplete) {
               AutoComplete_HideDropdown(id);
           }
        }

        if (document.addEventListener) {
            document.addEventListener('click', docClick, false);
        } else if (document.attachEvent) {
            document.attachEvent('onclick', docClick, false);
        }


        // Max number of items shown at once
        if (arguments[2] != null) {
            __AutoComplete[id]['maxitems'] = arguments[2];
            __AutoComplete[id]['firstItemShowing'] = 0;
            __AutoComplete[id]['lastItemShowing']  = arguments[2] - 1;
        }
        
        AutoComplete_CreateDropdown(id);
        
        // Prevent select dropdowns showing thru
        if (isIE) {
            __AutoComplete[id]['iframe'] = document.createElement('iframe');
            __AutoComplete[id]['iframe'].id = id +'_iframe';
            __AutoComplete[id]['iframe'].style.position = 'absolute';
            __AutoComplete[id]['iframe'].style.top = '0';
            __AutoComplete[id]['iframe'].style.left = '0';
            __AutoComplete[id]['iframe'].style.width = '0px';
            __AutoComplete[id]['iframe'].style.height = '0px';
            __AutoComplete[id]['iframe'].style.zIndex = '98';
            __AutoComplete[id]['iframe'].style.visibility = 'hidden';
            
            __AutoComplete[id]['element'].parentNode.insertBefore(__AutoComplete[id]['iframe'], __AutoComplete[id]['element']);
        }
    }


    /**
    * Creates the dropdown layer
    * 
    * @param string id The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_CreateDropdown(id)
    {
        var left  = AutoComplete_GetLeft(__AutoComplete[id]['element']);
        var top   = AutoComplete_GetTop(__AutoComplete[id]['element']) + __AutoComplete[id]['element'].offsetHeight;
        var width = __AutoComplete[id]['element'].offsetWidth;
    
 
        __AutoComplete[id]['dropdown'] = document.createElement('div');
        __AutoComplete[id]['dropdown'].className = 'autocomplete'; // Don't use setAttribute()
    
        __AutoComplete[id]['element'].parentNode.insertBefore(__AutoComplete[id]['dropdown'], __AutoComplete[id]['element']);
        
        // Position it
        __AutoComplete[id]['dropdown'].style.left       = left + 'px';
        __AutoComplete[id]['dropdown'].style.top        = top + 'px';
        __AutoComplete[id]['dropdown'].style.width      = width + 'px';
        __AutoComplete[id]['dropdown'].style.zIndex     = '99';
        __AutoComplete[id]['dropdown'].style.visibility = 'hidden';
        __AutoComplete[id]['dropdown'].style.position = 'absolute';
    }
    
    
    /**
    * Gets left coord of given element
    * 
    * @param object element The element to get the left coord for
    */
    function AutoComplete_GetLeft(element)
    {
        var curNode = element;
        var left    = 0;

        do {
            left += curNode.offsetLeft;
            curNode = curNode.offsetParent;

        } while(curNode.tagName.toLowerCase() != 'div');

        return left;
    }
    
    
    /**
    * Gets top coord of given element
    * 
    * @param object element The element to get the top coord for
    */
    function AutoComplete_GetTop(element)
    {
        var curNode = element;
        var top    = 0;

        do {
            top += curNode.offsetTop;
            curNode = curNode.offsetParent;

        } while(curNode.tagName.toLowerCase() != 'div');

        return top;
    }

    
    /**
    * Shows the dropdown layer
    * 
    * @param string id The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_ShowDropdown(id)
    {
        AutoComplete_HideAll();

        var value = __AutoComplete[id]['element'].value;
        var toDisplay = new Array();
        var newDiv    = null;
        var text      = null;
        var numItems  = __AutoComplete[id]['dropdown'].childNodes.length;

        // please alllow to search if more than 3 Chars

        if (value.length <3) return;
        
        // Remove all child nodes from dropdown
        while (__AutoComplete[id]['dropdown'].childNodes.length > 0) {
            __AutoComplete[id]['dropdown'].removeChild(__AutoComplete[id]['dropdown'].childNodes[0]);
        }

        // Go thru data searching for matches
        for (i=0; i<__AutoComplete[id]['data'].length; ++i) {
            if (__AutoComplete[id]['data'][i].substr(0, value.length) == value) {
                toDisplay[toDisplay.length] = __AutoComplete[id]['data'][i];
            }
        }
        
        // No matches?
        if (toDisplay.length == 0) {
            AutoComplete_HideDropdown(id);
            return;
        }

        // Add data to the dropdown layer
        for (i=0; i<toDisplay.length; ++i) {
            newDiv = document.createElement('div');
            newDiv.className = 'autocomplete_item'; // Don't use setAttribute()
            newDiv.setAttribute('id', 'autocomplete_item_' + i);
            newDiv.setAttribute('index', i);
            newDiv.style.zIndex = '99';
            
             // Scrollbars are on display ?
            if (toDisplay.length > __AutoComplete[id]['maxitems'] && navigator.userAgent.indexOf('MSIE') == -1) {
                newDiv.style.width = __AutoComplete[id]['element'].offsetWidth - 22 + 'px';
            }

            newDiv.onmouseover = function() {AutoComplete_HighlightItem(__AutoComplete[id]['element'].getAttribute('id'), this.getAttribute('index'));};
            newDiv.onclick     = function() {AutoComplete_SetValue(__AutoComplete[id]['element'].getAttribute('id')); AutoComplete_HideDropdown(__AutoComplete[id]['element'].getAttribute('id'));}
            
            text   = document.createTextNode(toDisplay[i]);
            newDiv.appendChild(text);
            
            __AutoComplete[id]['dropdown'].appendChild(newDiv);
        }

        
        // Too many items?
        if (toDisplay.length > __AutoComplete[id]['maxitems']) {
            __AutoComplete[id]['dropdown'].style.height = (__AutoComplete[id]['maxitems'] * 15) + 2 + 'px';
        
        } else {
            __AutoComplete[id]['dropdown'].style.height = '';
        }

        
        /**
        * Set left/top in case of document movement/scroll/window resize etc
        */
        __AutoComplete[id]['dropdown'].style.position = 'absolute'  //testing.. 
        
        __AutoComplete[id]['dropdown'].style.left = AutoComplete_GetLeft(__AutoComplete[id]['element']);
        __AutoComplete[id]['dropdown'].style.top  = AutoComplete_GetTop(__AutoComplete[id]['element']) + __AutoComplete[id]['element'].offsetHeight;


        // Show the iframe for IE
        if (isIE) {
         
            __AutoComplete[id]['iframe'].style.top    = __AutoComplete[id]['dropdown'].style.top;
            __AutoComplete[id]['iframe'].style.left   = __AutoComplete[id]['dropdown'].style.left;
            __AutoComplete[id]['iframe'].style.width  = __AutoComplete[id]['dropdown'].offsetWidth;
            __AutoComplete[id]['iframe'].style.height = __AutoComplete[id]['dropdown'].offsetHeight;
            
            __AutoComplete[id]['iframe'].style.visibility = 'visible';

            
              
        }


        // Show dropdown
        if (!__AutoComplete[id]['isVisible']) {

            __AutoComplete[id]['dropdown'].style.visibility = 'visible';
            
            __AutoComplete[id]['isVisible'] = true;
        }

        
        // If now showing less items than before, reset the highlighted value
        if (__AutoComplete[id]['dropdown'].childNodes.length != numItems) {
            __AutoComplete[id]['highlighted'] = null;
        }
    }
    
    
    /**
    * Hides the dropdown layer
    * 
    * @param string id The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_HideDropdown(id)
    {
        if (__AutoComplete[id]['iframe']) {
            __AutoComplete[id]['iframe'].style.visibility = 'hidden';
        }


        __AutoComplete[id]['dropdown'].style.visibility = 'hidden';
        __AutoComplete[id]['highlighted'] = null;
        __AutoComplete[id]['isVisible']   = false;
    }
    
    
    /**
    * Hides all dropdowns
    */
    function AutoComplete_HideAll()
    {
        for (id in __AutoComplete) {
            AutoComplete_HideDropdown(id);
        }
    }
    
    
    /**
    * Highlights a specific item
    * 
    * @param string id    The form elements id. Used to identify the correct dropdown.
    * @param int    index The index of the element in the dropdown to highlight
    */
    function AutoComplete_HighlightItem(id, index)
    {
        if (__AutoComplete[id]['dropdown'].childNodes[index]) {
            for (var i=0; i<__AutoComplete[id]['dropdown'].childNodes.length; ++i) {
                if (__AutoComplete[id]['dropdown'].childNodes[i].className == 'autocomplete_item_highlighted') {
                    __AutoComplete[id]['dropdown'].childNodes[i].className = 'autocomplete_item';
                }
            }
            
            __AutoComplete[id]['dropdown'].childNodes[index].className = 'autocomplete_item_highlighted';
            __AutoComplete[id]['highlighted'] = index;
        }
    }


    /**
    * Highlights the menu item with the given index
    * 
    * @param string id    The form elements id. Used to identify the correct dropdown.
    * @param int    index The index of the element in the dropdown to highlight
    */
    function AutoComplete_Highlight(id, index)
    {
        // Out of bounds checking
        if (index == 1 && __AutoComplete[id]['highlighted'] == __AutoComplete[id]['dropdown'].childNodes.length - 1) {
            __AutoComplete[id]['dropdown'].childNodes[__AutoComplete[id]['highlighted']].className = 'autocomplete_item';
            __AutoComplete[id]['highlighted'] = null;
        
        } else if (index == -1 && __AutoComplete[id]['highlighted'] == 0) {
            __AutoComplete[id]['dropdown'].childNodes[0].className = 'autocomplete_item';
            __AutoComplete[id]['highlighted'] = __AutoComplete[id]['dropdown'].childNodes.length;
        }

        // Nothing highlighted at the moment
        if (__AutoComplete[id]['highlighted'] == null) {
            __AutoComplete[id]['dropdown'].childNodes[0].className = 'autocomplete_item_highlighted';
            __AutoComplete[id]['highlighted'] = 0;

        } else {
            if (__AutoComplete[id]['dropdown'].childNodes[__AutoComplete[id]['highlighted']]) {
                __AutoComplete[id]['dropdown'].childNodes[__AutoComplete[id]['highlighted']].className = 'autocomplete_item';
            }

            var newIndex = __AutoComplete[id]['highlighted'] + index;

            if (__AutoComplete[id]['dropdown'].childNodes[newIndex]) {
                __AutoComplete[id]['dropdown'].childNodes[newIndex].className = 'autocomplete_item_highlighted';
                
                __AutoComplete[id]['highlighted'] = newIndex;
            }
        }
    }


    /**
    * Sets the input to a given value
    * 
    * @param string id    The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_SetValue(id)
    {
        __AutoComplete[id]['element'].value = __AutoComplete[id]['dropdown'].childNodes[__AutoComplete[id]['highlighted']].innerHTML;
    }
    
    
    /**
    * Checks if the dropdown needs scrolling
    * 
    * @param string id    The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_ScrollCheck(id)
    {
        // Scroll down, or wrapping around from scroll up
        if (__AutoComplete[id]['highlighted'] > __AutoComplete[id]['lastItemShowing']) {
            __AutoComplete[id]['firstItemShowing'] = __AutoComplete[id]['highlighted'] - (__AutoComplete[id]['maxitems'] - 1);
            __AutoComplete[id]['lastItemShowing']  = __AutoComplete[id]['highlighted'];
        }
        
        // Scroll up, or wrapping around from scroll down
        if (__AutoComplete[id]['highlighted'] < __AutoComplete[id]['firstItemShowing']) {
            __AutoComplete[id]['firstItemShowing'] = __AutoComplete[id]['highlighted'];
            __AutoComplete[id]['lastItemShowing']  = __AutoComplete[id]['highlighted'] + (__AutoComplete[id]['maxitems'] - 1);
        }
        
        __AutoComplete[id]['dropdown'].scrollTop = __AutoComplete[id]['firstItemShowing'] * 15;
    }


    /**
    * Function which handles the keypress event
    * 
    * @param string id    The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_KeyDown(id)
    {
        // Mozilla
        if (arguments[1] != null) {
            event = arguments[1];
        }

        var keyCode = event.keyCode;

        switch (keyCode) {

            // Return/Enter
            case 13:
                if (__AutoComplete[id]['highlighted'] != null) {
                    AutoComplete_SetValue(id);
                    AutoComplete_HideDropdown(id);
                }
                
                event.returnValue = false;
                event.cancelBubble = true;
                break;

            // Escape
            case 27:
                AutoComplete_HideDropdown(id);
                event.returnValue = false;
                event.cancelBubble = true;
                break;
            
            // Up arrow
            case 38:
                if (!__AutoComplete[id]['isVisible']) {
                    AutoComplete_ShowDropdown(id);
                }
                
                AutoComplete_Highlight(id, -1);
                AutoComplete_ScrollCheck(id, -1);
                return false;
                break;
            
            // Tab
            case 9:
                if (__AutoComplete[id]['isVisible']) {
                    AutoComplete_HideDropdown(id);
                }
                return;
            
            // Down arrow
            case 40:
                if (!__AutoComplete[id]['isVisible']) {
                    AutoComplete_ShowDropdown(id);
                }
                
                AutoComplete_Highlight(id, 1);
                AutoComplete_ScrollCheck(id, 1);
                return false;
                break;
        }
    }


    /**
    * Function which handles the keyup event
    * 
    * @param string id    The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_KeyUp(id)
    {
        // Mozilla
        if (arguments[1] != null) {
            event = arguments[1];
        }

        var keyCode = event.keyCode;

        switch (keyCode) {
            case 13:
                event.returnValue = false;
                event.cancelBubble = true;
                break;

            case 27:
                AutoComplete_HideDropdown(id);
                event.returnValue = false;
                event.cancelBubble = true;
                break;
            
            case 38:
            case 40:
                return false;
                break;

            default:
                AutoComplete_ShowDropdown(id);
                break;
        }
    }
    
    /**
    * Returns whether the dropdown is visible
    * 
    * @param string id    The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_isVisible(id)
    {
        return __AutoComplete[id]['dropdown'].style.visibility == 'visible';
    }
    
    function CallMe()
    {
        //Mani.
    }