﻿// JScript File

function msgAlert()
{
    if(document.getElementById("ctl00_hidPostAlert").value!="")
    {
        alert(document.getElementById("ctl00_hidPostAlert").value);
        document.getElementById("ctl00_hidPostAlert").value="";
    }
}

function MainMenu(MenuId)
{
    if(MenuId=="")
    {
        alert("Will be accessible shortly");
    }
    else
    {
        document.getElementById("ctl00_cphMain_hidMainMenu").value=MenuId;
        document.getElementById("ctl00_cphMain_hidSubMenu").value="";
        document.getElementById("ctl00_cphMain_hidOthers").value="";
        document.getElementById("ctl00_cphMenu_ucMenu_btnmenuTrigger").click();
    }                
}   

function submenu(MenuId,subMenuId)
{
    document.getElementById("ctl00_cphMain_hidMainMenu").value=MenuId;
    document.getElementById("ctl00_cphMain_hidSubMenu").value=subMenuId;
    document.getElementById("ctl00_cphMain_hidOthers").value="";
    document.getElementById("ctl00_cphMenu_ucMenu_btnmenuTrigger").click();
}   
     
function otherMenu()
{
    document.getElementById("ctl00_cphMain_hidMainMenu").value="";
    document.getElementById("ctl00_cphMain_hidOthers").value="Others";
}

function otherSubMenu()
{    
    document.getElementById("ctl00_cphMain_hidOthers").value="Others";
}

function myHomeShortCut()
{
    document.getElementById("ctl00_cphMain_hidMainMenu").value="";            
    document.getElementById("ctl00_cphMain_hidSubMenu").value="";
    document.getElementById("ctl00_cphMain_hidOthers").value="";
    document.getElementById("ctl00_cphMenu_ucMenu_btnmenuTrigger").click();
    return false;
}
        
function AddNew_PriActivity(CtlActivity)
{    
    document.getElementById(CtlActivity).value = document.getElementById(CtlActivity).value.trim();    
    if(document.getElementById(CtlActivity)!= null)
    {
        if(!validateNotEmpty(document.getElementById(CtlActivity).value))        
	    {
	        alert('Please enter "Principal Activity"');		        
	        document.getElementById(CtlActivity).focus();
	        return false;
	    }
	    if(!validatePrincipleActivity(document.getElementById(CtlActivity).value))
	    {
		    alert('Please enter valid "Principal Activity"')
		    document.getElementById(CtlActivity).focus();
		    return false;
	    }
	    var value=document.getElementById(CtlActivity).value;				
        var len=value.length;
        var Alpha = /^[a-zA-Z]+$/;			
        if(!Alpha.test(value.charAt(0)))
        {
            alert('Please enter valid "Principal Activity"')
		    document.getElementById(CtlActivity).focus();
		    return false;
        }  	        
        if(!Alpha.test(value.charAt(len-1)))
        {
            alert('Please enter valid "Principal Activity"')
		    document.getElementById(CtlActivity).focus();
		    return false;
        }         
        if(len<2) 
	    {
		    alert('Please check "Principal Activity"..\nsingle characters input in "Principal Activity" is not allowed');				
		    document.getElementById(CtlActivity).focus();
		    return false;							
	    }
	    for(i=0;i<len-1;i++)
        {
            var Alpha = /^[,]+$/;
            if((Alpha.test(value.charAt(i))) && (Alpha.test(value.charAt(i+1))))
            {
                alert('Please enter valid "Principal Activity"')
		        document.getElementById(CtlActivity).focus();
		        return false;
            }  
        }
	    var jointxtval;
	    var firstsplit;
	    var txtval=document.getElementById(CtlActivity).value;
	    var allvalue=Array();
	    var j=0;    																		
        if(txtval!="")
        {
            txtsplit=txtval.split(" "); 
                                   
            for(i=0;i<txtsplit.length;i++)
            {           
                splitvalue=txtsplit[i];
                if(splitvalue!="")
                {
                    firstsplit=splitvalue.split("");
                    if(firstsplit!="")
                    {
                        firstsplitval=firstsplit[0];
                        firstsplitval=firstsplitval.toUpperCase( );
                        firstsplit[0]=firstsplitval;
                        jointxtval=firstsplit.join("");
                        allvalue[j]=jointxtval;
                        j=j+1;                    
                    }
                }            
            }
	        allvaluejoin=allvalue.join(" ");
	        document.getElementById(CtlActivity).value=allvaluejoin;
	    }	    
    }  
}

function AddNew_OrgType(CtlOrgType)
{    
    document.getElementById(CtlOrgType).value = document.getElementById(CtlOrgType).value.trim();
    
    if(document.getElementById(CtlOrgType)!= null)
    {
        if(!validateNotEmpty(document.getElementById(CtlOrgType).value))
	    {
	        alert('Please enter "Organization Type"');	
	        document.getElementById(CtlOrgType).focus();
	        return false;	
	    }
        if(!validateAlpha(document.getElementById(CtlOrgType).value))
	    {
		    alert('Please enter valid "Organization Type"')
		    document.getElementById(CtlOrgType).focus();
		    return false;
	    }
        var value=document.getElementById(CtlOrgType).value;				
        var len=value.length;
        if(len<2) 
	    {
		    alert('Please check "Organization Type"...\nsingle characters input in "Organization Type" is not allowed');				
		    document.getElementById(CtlOrgType).focus();
		    return false;							
	    }    	
	    var jointxtval;
	    var firstsplit;
	    var txtval=document.getElementById(CtlOrgType).value;
	    var allvalue=Array();
	    var j=0;    																		
        if(txtval!="")
        {
            txtsplit=txtval.split(" "); 
                                   
            for(i=0;i<txtsplit.length;i++)
            {           
                splitvalue=txtsplit[i];
                if(splitvalue!="")
                {
                    firstsplit=splitvalue.split("");
                    if(firstsplit!="")
                    {
                        firstsplitval=firstsplit[0];
                        firstsplitval=firstsplitval.toUpperCase( );
                        firstsplit[0]=firstsplitval;
                        jointxtval=firstsplit.join("");
                        allvalue[j]=jointxtval;
                        j=j+1;                    
                    }
                }            
            }
	        allvaluejoin=allvalue.join(" ");
	        document.getElementById(CtlOrgType).value=allvaluejoin;
	    }	
    }  
}

function AddNew_FuncArea(CtlFuncArea)
{
    document.getElementById(CtlFuncArea).value = document.getElementById(CtlFuncArea).value.trim();
    
    if(document.getElementById(CtlFuncArea)!= null)
    {   
        if(!validateNotEmpty(document.getElementById(CtlFuncArea).value))
	    {
	        alert('Please enter "Functional Areas"');	
	        document.getElementById(CtlFuncArea).focus();
	        return false;	
	    }
        if(!validateAlpha(document.getElementById(CtlFuncArea).value))
	    {
		    alert('Please enter valid "Functional Areas"');
		    document.getElementById(CtlFuncArea).focus();
		    return false;
	    }
        var value=document.getElementById(CtlFuncArea).value;				
        var len=value.length;
        if(len<2) 
	    {
		    alert('Please check "Functional Areas"...\nsingle characters input in "Functional Areas" is not allowed');				
		    document.getElementById(CtlFuncArea).focus();
		    return false;							
	    }    	
	    var jointxtval;
	    var firstsplit;
	    var txtval=document.getElementById(CtlFuncArea).value;
	    var allvalue=Array();
	    var j=0;    																		
        if(txtval!="")
        {
            txtsplit=txtval.split(" "); 
                                   
            for(i=0;i<txtsplit.length;i++)
            {           
                splitvalue=txtsplit[i];
                if(splitvalue!="")
                {
                    firstsplit=splitvalue.split("");
                    if(firstsplit!="")
                    {
                        firstsplitval=firstsplit[0];
                        firstsplitval=firstsplitval.toUpperCase( );
                        firstsplit[0]=firstsplitval;
                        jointxtval=firstsplit.join("");
                        allvalue[j]=jointxtval;
                        j=j+1;                    
                    }
                }            
            }
	        allvaluejoin=allvalue.join(" ");
	        document.getElementById(CtlFuncArea).value=allvaluejoin;
	    }	   
    }	  
}

function AddNew_ServDomain(CtlServDomain)
{
    document.getElementById(CtlServDomain).value = document.getElementById(CtlServDomain).value.trim();
    
    if(document.getElementById(CtlServDomain)!= null)
    {  
        if(!validateNotEmpty(document.getElementById(CtlServDomain).value))
	    {
	        alert('Please enter "Domain"');	
	        document.getElementById(CtlServDomain).focus();
	        return false;	
	    }
        if(!validateService(document.getElementById(CtlServDomain).value))
	    {
		    alert('Please enter valid "Domain"')
		    document.getElementById(CtlServDomain).focus();
		    return false;
	    }
        var value=document.getElementById(CtlServDomain).value;				
        var len=value.length;        
        var Alpha = /^[a-zA-Z]+$/;			
        if(!Alpha.test(value.charAt(0)))
        {
            alert('Please enter valid "Domain"')
		    document.getElementById(CtlServDomain).focus();
		    return false;
        }  	
        if(!Alpha.test(value.charAt(len-1)))
        {
            alert('Please enter valid "Domain"')
		    document.getElementById(CtlServDomain).focus();
		    return false;
        }         
        if(len<2) 
	    {
		    alert('Please check "Domain"...\nsingle characters input in "Domain" is not allowed');				
		    document.getElementById(CtlServDomain).focus();
		    return false;							
	    }   
	    for(i=0;i<len-1;i++)
        {
            var Alpha = /^[,\/\&\-\']+$/;
            if((Alpha.test(value.charAt(i))) && (Alpha.test(value.charAt(i+1))))
            {
                alert('Please enter valid "Domain"')
		        document.getElementById(CtlServDomain).focus();
		        return false;
            }  
        } 	
	    var jointxtval;
	    var firstsplit;
	    var txtval=document.getElementById(CtlServDomain).value;
	    var allvalue=Array();
	    var j=0;    																		
        if(txtval!="")
        {
            txtsplit=txtval.split(" "); 
                                   
            for(i=0;i<txtsplit.length;i++)
            {           
                splitvalue=txtsplit[i];
                if(splitvalue!="")
                {
                    firstsplit=splitvalue.split("");
                    if(firstsplit!="")
                    {
                        firstsplitval=firstsplit[0];
                        firstsplitval=firstsplitval.toUpperCase( );
                        firstsplit[0]=firstsplitval;
                        jointxtval=firstsplit.join("");
                        allvalue[j]=jointxtval;
                        j=j+1;                    
                    }
                }            
            }
	        allvaluejoin=allvalue.join(" ");
	        document.getElementById(CtlServDomain).value=allvaluejoin;
	    }	   
    }		  
}

function AddNew_ServOffer(CtlServOffer)
{
    document.getElementById(CtlServOffer).value = document.getElementById(CtlServOffer).value.trim();
    
    if(document.getElementById(CtlServOffer)!= null)
    {       
        if(!validateNotEmpty(document.getElementById(CtlServOffer).value))
	    {
	        alert('Please enter "Services Offered"');	
	        document.getElementById(CtlServOffer).focus();
	        return false;	
	    }
        if(!validateService(document.getElementById(CtlServOffer).value))
	    {
		    alert('Please enter valid "Services Offered"')
		    document.getElementById(CtlServOffer).focus();
		    return false;
	    }
        var value=document.getElementById(CtlServOffer).value;				
        var len=value.length;           
        var Alpha = /^[a-zA-Z]+$/;			
        if(!Alpha.test(value.charAt(0)))
        {
            alert('Please enter valid "Services Offered"')
		    document.getElementById(CtlServOffer).focus();
		    return false;
        }  	
        if(!Alpha.test(value.charAt(len-1)))
        {
            alert('Please enter valid "Services Offered"')
		    document.getElementById(CtlServOffer).focus();
		    return false;
        }
        if(len<2) 
	    {
		    alert('Please check "Services Offered"...\nsingle characters input in "Services Offered" is not allowed');				
		    document.getElementById(CtlServOffer).focus();
		    return false;							
	    }
	    for(i=0;i<len-1;i++)
        {
            var Alpha = /^[,\/\&\-\']+$/;
            if((Alpha.test(value.charAt(i))) && (Alpha.test(value.charAt(i+1))))
            {
                alert('Please enter valid "Services Offered"')
		        document.getElementById(CtlServOffer).focus();
		        return false;
            }  
        }     	
	    var jointxtval;
	    var firstsplit;
	    var txtval=document.getElementById(CtlServOffer).value;
	    var allvalue=Array();
	    var j=0;    																		
        if(txtval!="")
        {
            txtsplit=txtval.split(" "); 
                                   
            for(i=0;i<txtsplit.length;i++)
            {           
                splitvalue=txtsplit[i];
                if(splitvalue!="")
                {
                    firstsplit=splitvalue.split("");
                    if(firstsplit!="")
                    {
                        firstsplitval=firstsplit[0];
                        firstsplitval=firstsplitval.toUpperCase( );
                        firstsplit[0]=firstsplitval;
                        jointxtval=firstsplit.join("");
                        allvalue[j]=jointxtval;
                        j=j+1;                    
                    }
                }            
            }
	        allvaluejoin=allvalue.join(" ");
	        document.getElementById(CtlServOffer).value=allvaluejoin;
	    }	   
    }		  
}

function UpperCase_Valid(CtlUprCase)
{    
    var jointxtval;
    var firstsplit;
    var txtval=document.getElementById(CtlUprCase).value.trim();
    var allvalue=Array();    																				
    var j=0;    																		
    if(txtval!="")
    {
        txtsplit=txtval.split(" ");                                
        for(i=0;i<txtsplit.length;i++)
        {           
            splitvalue=txtsplit[i];
            if(splitvalue!="")
            {
                firstsplit=splitvalue.split("");
                if(firstsplit!="")
                {
                    firstsplitval=firstsplit[0];
                    firstsplitval=firstsplitval.toUpperCase( );
                    firstsplit[0]=firstsplitval;
                    jointxtval=firstsplit.join("");
                    allvalue[j]=jointxtval;
                    j=j+1;                    
                }
            }            
        }
        allvaluejoin=allvalue.join(" ");
        document.getElementById(CtlUprCase).value=allvaluejoin;
    }  					 					 				
}

function LoginUserName(CtlLoginUser)
{                  
    if(event.keyCode == 32)
    {
        event.returnValue = false;
    }
}

function PassCheck(CtlUserid, CtlPassword, CtlConPassword)
{                  
    if(validateNotEmpty(document.getElementById(CtlPassword).value.trim()))
    {
        var pwd=document.getElementById(CtlPassword).value.trim();				
        var len=pwd.length;
        if(len<6 || len>8) 
        {
            alert('Please enter "Password" with minimum 6 characters and maximum 8 characters');
            document.getElementById(CtlPassword).value = "";
            document.getElementById(CtlConPassword).value = "";
            //document.getElementById(CtlPassword).focus();
            setTimeout('FocusControl(\'' + CtlPassword + '\')',1);
            elemFocused=true;
            return false;							
        }
        if((document.getElementById(CtlPassword).value.trim())==(document.getElementById(CtlUserid).value.trim()))
        {
            alert('"User ID" and "Password" should not be same');
            document.getElementById(CtlPassword).value = "";
            document.getElementById(CtlConPassword).value = "";
            //document.getElementById(CtlPassword).focus();
            setTimeout('FocusControl(\'' + CtlPassword + '\')',1);
            elemFocused=true;
            return false;
        }		  
    }
}

function ConPassCheck(CtlPassword, CtlConPassword)
{                  
    if(validateNotEmpty(document.getElementById(CtlConPassword).value.trim()))
    {
        var pwd=document.getElementById(CtlConPassword).value.trim();				
        var len=pwd.length;
        if(len<6 || len>8)
        {
            alert('Please enter "Confirm Password" with minimum 6 characters and maximum 8 characters');
            document.getElementById(CtlPassword).value = "";
            document.getElementById(CtlConPassword).value = "";
            //document.getElementById(CtlPassword).focus();
            setTimeout('FocusControl(\'' + CtlPassword + '\')',1);
            elemFocused=true;  
            return false;							
        }
        if((document.getElementById(CtlPassword).value.trim())!=(document.getElementById(CtlConPassword).value.trim()))
        {
            alert('"Password" and "Confirm Password" should be same');
            document.getElementById(CtlPassword).value = "";
            document.getElementById(CtlConPassword).value = "";
            //document.getElementById(CtlPassword).focus(); 
            setTimeout('FocusControl(\'' + CtlPassword + '\')',1);
            elemFocused=true;           
            return false;
        }	    
    }	
}

function CheckPhone(CtrlPhone, PhNo)
{
    if(validateNotEmpty(document.getElementById(CtrlPhone).value.trim()))
    {
        if(!validatePhoneNumber(document.getElementById(CtrlPhone).value.trim()))
        {            
            alert('Please enter valid "Phone Number' + PhNo + '"');
            //document.getElementById(CtrlPhone).focus();
            setTimeout('FocusControl(\'' + CtrlPhone + '\')',1);
            elemFocused=true; 
            return false;
        }
    }
}

function CheckContact(CtrlPhone, PhNo)
{
    if(validateNotEmpty(document.getElementById(CtrlPhone).value.trim()))
    {
        if(!validateContactNumber(document.getElementById(CtrlPhone).value.trim()))
        {            
            alert('Please enter valid "Contact Number' + PhNo + '"');
            //document.getElementById(CtrlPhone).focus();
            setTimeout('FocusControl(\'' + CtrlPhone + '\')',1);
            elemFocused=true; 
            return false;
        }
    }
}
function CheckFax(CtrlFax)
{
    if(validateNotEmpty(document.getElementById(CtrlFax).value.trim()))
    {
        if(!validateFaxNumber(document.getElementById(CtrlFax).value.trim()))
        {
            alert('Please enter valid "Fax Number"');
            //document.getElementById(CtrlFax).focus();
            setTimeout('FocusControl(\'' + CtrlFax + '\')',1);
            elemFocused=true; 
            return false;
        }
    }
}

function CheckMobile(CtrlMobile)
{
    if(validateNotEmpty(document.getElementById(CtrlMobile).value))
    {
        if(!validateMobileNumber(document.getElementById(CtrlMobile).value.trim()))
        {
            alert('Please enter valid "Mobile Number"');
            //document.getElementById(CtrlMobile).focus();
            setTimeout('FocusControl(\'' + CtrlMobile + '\')',1);
            elemFocused=true;  
            return false;
        }
    }
}

function CheckNumeric()
{       
    if(event.keyCode < 45 || event.keyCode > 57 || event.keyCode == 46 || event.keyCode == 47)
    {
        event.returnValue = false;
    }
}

function CheckNumericContact(e)

{       
    var intKey = (window.Event) ? e.which : e.keyCode;
    if(intKey < 45 || intKey > 57 || intKey == 46 || intKey == 47)
    {
        return false;
    }
}

function CheckEnterkey(e)
{       
    var intKey = (window.Event) ? e.which : e.keyCode;
    if (intKey == 13) 
    {
        return false;
    }
}
  
function Password()
{
    if(event.keyCode == 32)
    {
        event.returnValue = false;
    }
}

function Language_Upper(CtlLang)
{   
    var val=document.getElementById(CtlLang).value.trim()	
    document.getElementById(CtlLang).value = val.toUpperCase();
}

function URL_Valid(CtlURL)
{   
    var val=document.getElementById(CtlURL).value.trim()	
    document.getElementById(CtlURL).value = val.toLowerCase(); 

    if(validateNotEmpty(document.getElementById(CtlURL).value.trim()))
    {			
        if(!validateUrl(document.getElementById(CtlURL).value.trim()))
        {
            alert('Please enter valid "URL"');            
            //document.getElementById(CtlURL).focus(); 
            setTimeout('FocusControl(\'' + CtlURL + '\')',1);
            elemFocused=true;           
            return false;
        }
    }            
}

function setPinCode(PinCode,AreaName,clientId,gvClientId,lblAreaName)
{        
    document.getElementById(clientId).value=PinCode;
    if(AreaName!="")
    {
        if(document.getElementById(lblAreaName)!=null)
        {
            document.getElementById(lblAreaName).value=" - " + AreaName;
        }
    }
    else
    {
        if(document.getElementById(lblAreaName)!=null)
        {
            document.getElementById(lblAreaName).value="";
        }
    }
    document.getElementById(gvClientId).style.display="none";
    document.getElementById(clientId).focus();
    return false;
}

function checkPinCodeLength(txtPincodeId,ddlCountryId,ddlStateId,ddlFuncArea,lstServiceDomain,txtCityId,divResultId)
{
    document.getElementById(divResultId).style.display="none";
    if(document.getElementById(ddlCountryId)!=null)
    {
        if(document.getElementById(ddlCountryId).selectedIndex==0)
        {
           alert('Please select "Country" to search');
           document.getElementById(ddlCountryId).focus();
           return false;
        }
    }
    
    if(document.getElementById(ddlStateId)!=null)
    {
        if(document.getElementById(ddlStateId).selectedIndex==0)
        {
           alert('Please select "State/Province" to search');
           document.getElementById(ddlStateId).focus();
           return false;
        }
    }    
    
    /*
    if(document.getElementById(txtPincodeId).value=="*")
    {
        if(ddlFuncArea!="")
        {            
            if(document.getElementById(ddlFuncArea)!=null)
            {
                if(document.getElementById(ddlFuncArea).selectedIndex==0)
                {
                   alert('Please select "Functional Areas" to search');
                   document.getElementById(ddlFuncArea).focus();
                   return false;
                }
            }
            
            if(document.getElementById(lstServiceDomain)!=null)
            {            
                var flgServiceDomain=false;                
                for(i=0;i<document.getElementById(lstServiceDomain).options.length;i++)
                {
                    if(document.getElementById(lstServiceDomain).options[i].selected)
                    {                    
                       flgServiceDomain=true; 
                    }
                }
                if(!flgServiceDomain)
                {
                    alert('Please select "Functional Areas" and "Domain" to search');
                    document.getElementById(lstServiceDomain).focus();
                    return false;
                }
                else
                {
                    return true;
                }
            }            
        }    
        
        alert('Please enter valid "Postal Code" or "City/Town"');        
        document.getElementById(txtPincodeId).focus();
        return false;
    }    
    */
     
    document.getElementById(txtCityId).value=document.getElementById(txtCityId).value.trim();
    if(document.getElementById(txtCityId).value.trim()!="")
    {
        if(!validateAlpha(document.getElementById(txtCityId).value))
        {
            alert('Please enter valid "City/Town"');
            document.getElementById(txtCityId).focus();
            return false;
        } 
    }
    
    if(document.getElementById(txtPincodeId).value.length>=3 )
    {
        var val=document.getElementById(ddlCountryId);
        if(val[val.selectedIndex].text == "India")
        {
            if(validateNumeric(document.getElementById(txtPincodeId).value))
            {
                return true;                
            }
            else if(validateAlpha(document.getElementById(txtPincodeId).value))
            {
                return true;
            }
            else
            {
                alert('Please enter valid "Postal Code" or "Area Name"');
                document.getElementById(txtPincodeId).focus();
                return false;
            }
        }
        else
        {
            if(validatePincode(document.getElementById(txtPincodeId).value))
            {
                return true;                
            }
            else
            {
                alert('Please enter valid "Postal Code" or "Area Name"');
                document.getElementById(txtPincodeId).focus();
                return false;
            }
        }
    }
    /*
    else if(document.getElementById(txtPincodeId).value.trim()=='*')
    {
        return true;   
    }
    */
    else
    {
        alert('Please enter atleast first 3 digit for "Postal Code" or "Area Name"');
        document.getElementById(txtPincodeId).focus();
        return false;
    }
}

function openDocument(fileName)
{        
    document.getElementById("ctl00_cphMain_hidFileName").value=fileName;
    document.getElementById("ctl00_cphMain_btnFileDownload").click();
    return false;
}

function checkAllInputs()
{
    var allInput = document.getElementsByTagName("input");
    var allTextArea = document.getElementsByTagName("textarea");    
    var formValid = true;
    var firstInput = "";
    
    for(i = 0;i < allInput.length;i++)
    {
        if(allInput[i].getAttribute("type").toLowerCase() == "text")
        {
            var strValue = allInput[i].value;
            var strValid = true;            
            for(j = 0;j < strValue.length;j++)
            {
                if(strValue.charAt(j) == "'" || strValue.charAt(j) == '&' || strValue.charAt(j) == '>' || strValue.charAt(j) == '<' || strValue.charAt(j) == '#' || strValue.charAt(j) == '$')
                {                
                    strValid=false;
                    formValid=false;
                    if(firstInput=="")
                    {                        
                        firstInput=allInput[i].id;
                    }
                }
            }
            if(strValid)
            {
                allInput[i].style.backgroundColor="";
            }
            else
            {
                allInput[i].style.backgroundColor="Bisque";
            }
        }
    }
    
    for(i = 0;i < allTextArea.length;i++)
    {        
        var strValue = allTextArea[i].value;
        var strValid = true;
        for(j = 0;j < strValue.length;j++)
        {
            if(strValue.charAt(j) == "'" || strValue.charAt(j) == '&' || strValue.charAt(j) == '>' || strValue.charAt(j) == '<' || strValue.charAt(j) == '#' || strValue.charAt(j) == '$')
            {                
                strValid=false;
                formValid=false;
                if(firstInput=="")
                {                        
                    firstInput=allTextArea[i].id;
                }
            }
        }
        if(strValid)
        {
            allTextArea[i].style.backgroundColor="";
        }
        else
        {
            allTextArea[i].style.backgroundColor="Bisque";
        }
    }
    
    if(!formValid)
    {
        alert('For secure reason (\',&,<,>,#,$) these special characters are not allowed');
        document.getElementById(firstInput).focus();
    }
    return formValid;
}

function UploadKey(e)
{       
    var intKey = (window.Event) ? e.which : e.keyCode;
    if(intKey > 0)
    {
        return false;
    }
}

function Busrex_FireDefaultButton(event, target)
{
    if (event.keyCode == 13 && !(event.srcElement && (event.srcElement.tagName.toLowerCase() == "textarea"))) 
    {
        var defaultButton;
        if (__nonMSDOMBrowser) 
        {
            defaultButton = document.getElementById(target);
        }
        else 
        {
            defaultButton = document.all[target];
        }
        if (defaultButton && typeof(defaultButton.click) != "undefined") 
        {
            defaultButton.click();
            event.cancelBubble = true;
            if (event.stopPropagation) event.stopPropagation();
            return false;
        }
    }
    return true;
}

var elemFocused=false;
function FocusControl(id)
{    
    if(elemFocused)
    {
        document.getElementById(id).focus();
        elemFocused=false;
    }
    else
    {
        setTimeout('FocusControl(\''+ id + '\')',1);
    }
}

function vendorTabMouserOver(id,classname)
{
    document.getElementById(id).className=classname;
}

function vendorTabMouserOut(id,classname)
{
    document.getElementById(id).className=classname;
}

function changeTickerText(text,divId)
{    
    var divContainer = document.getElementById(divId);
    divContainer.innerHTML="<iframe id='tickeriframe' allowtransparency='true' contenteditable='false' frameborder='no'  scrolling='no' style='width: 100%; height: 100%;' ></iframe>";
    var tickeriframe = document.getElementById("tickeriframe");
    var doc = null;
    doc = tickeriframe.contentWindow.document;    
    doc.open();
    doc.write("<html><head><body>");
    doc.write("<style type='text/css'>body {margin-left: 0px;margin-top: 0px;width:100%;}");    
	doc.write("</style></head>");
    doc.write("<div style='height: 16px;vertical-align:top;font-size: 8pt;font-family: Verdana, Arial, Helvetica, sans-serif;'><marquee id='marText1'><b> "+text+"</b></marquee></div>");
    doc.write("</body></html>");
    doc.close();
}