// JavaScript Document
// Prototype add-on declarations 
// ----------------------------- 
String.prototype.left               = String_left; // Get n leftmost chars 
String.prototype.right              = String_right; // Get n rightmost chars 


// Prototype add-on definitions 
// ---------------------------- 


/** 
 * x > 0 : return x leftmost chars in string 
 * x = 0 : return null string 
 * x < 0 : return all chars EXCEPT the x leftmost chars 
 * 
 * @param x char count for operation 
 * @return see description 
 */ 
function String_left(x) 
{ 
        if ( x == 0 ) 
                return ""; 


        if ( x < 0 ) 
                return this.substring(-x); 
        else 
                return this.substring(0, x); 



} 


/** 
 * x > 0 : return x rightmost chars in string 
 * x = 0 : return null string 
 * x < 0 : return all chars EXCEPT the x rightmost chars 
 * 
 * @param x char count for operation 
 * @return see description 
 */ 
function String_right(x) 
{ 
        if ( x == 0 ) 
                return ""; 

        if ( x < 0 ) 
                return this.substring(0, this.length - -x); 
        else 
                return this.substring(this.length - x); 



}