﻿// JScript File

//Redirection

        function RedirectPage(url)
        {
            //alert('Redirection');
            window.location.href=url;
            //self.close();
            return false;
        }
        
        
        //Trim Functions
        
        function trimAll( strValue ) 
        {
            /************************************************
            DESCRIPTION: Removes leading and trailing spaces.

            PARAMETERS: Source string from which spaces will
              be removed;

            RETURNS: Source string with whitespaces removed.
            *************************************************/ 
             var objRegExp = /^(\s*)$/;

                //check for all spaces
                if(objRegExp.test(strValue)) {
                   strValue = strValue.replace(objRegExp, '');
                   if( strValue.length == 0)
                      return strValue;
                }
                
               //check for leading & trailing spaces
               objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
               if(objRegExp.test(strValue)) {
                   //remove leading and trailing whitespace characters
                   strValue = strValue.replace(objRegExp, '$2');
                }
              return strValue;
        }
        
         //Get Cookie Value
        
        // this fixes an issue with the old method, ambiguous values 
        // with this test document.cookie.indexOf( name + "=" );
        function Get_Cookie( check_name ) 
        {
	        // first we'll split this cookie up into name/value pairs
	        // note: document.cookie only returns name=value, not the other components
	        var a_all_cookies = document.cookie.split( ';' );
	        var a_temp_cookie = '';
	        var cookie_name = '';
	        var cookie_value = '';
	        var b_cookie_found = false; // set boolean t/f default f
        	
	        for ( i = 0; i < a_all_cookies.length; i++ )
	        {
		        // now we'll split apart each name=value pair
		        a_temp_cookie = a_all_cookies[i].split( '=' );
        		
        		
		        // and trim left/right whitespace while we're at it
		        cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
        	
		        // if the extracted name matches passed check_name
		        if ( cookie_name == check_name )
		        {
			        b_cookie_found = true;
			        // we need to handle case where cookie has no value but exists (no = sign, that is):
			        if ( a_temp_cookie.length > 1 )
			        {
				        cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			        }
			        // note that in cases where cookie is initialized but no value, null is returned
			        return cookie_value;
			        break;
		        }
		        a_temp_cookie = null;
		        cookie_name = '';
	        }
	        if ( !b_cookie_found )
	        {
		        return null;
	        }
        }	
        
        // Set Default Button
        
        //client side js
        function clickButton(e, buttonid)
        { 
        //alert(buttonid);
              var bt = document.getElementById(buttonid); 
              if (typeof bt == 'object'){ 
                    if(navigator.appName.indexOf("Netscape")>(-1)){ 
                          if (e.keyCode == 13){ 
                                bt.click(); 
                                return false; 
                          } 
                    } 
                    if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
                          if (event.keyCode == 13){ 
                                bt.click(); 
                                return false; 
                          } 
                    } 
              } 
        } 

    function MM_openBrWindowView(theURL,winName,feature) { //v2.0
var topval=screen.availHeight/3;
var laftval=screen .availWidth/4;
var features=feature+',top='+topval+',left='+laftval
//alert(features);
  window.open(theURL,winName,features);
}  


function IsBlank(strID){    
    var oField = document.getElementById(strID);
    if(oField!=null){
        var strValue = oField.value.trim();
        oField.value=strValue;  
          
        if(strValue.length <= 0){ 
            return true;    
        }else{
            return false;
        }  
    } 
    return false;     
}

function htmlCharReplace(val)
{
    val = val.replace('<', "&lt;");
    val = val.replace('>', "&gt;");
    
    return val;    
    
}

        
       

	
        
        
        	