/**
* Project : VectorLibrary
* Package : Joomla!
* Version : 1.0
* Author  : 2007, 2008 Vector Online Communications BV, Michel Groenescheij
*/

// trims string
function trim(str) {
  
   return str.replace(/^\s*|\s*$/g,"");
   
}//function


// retrieve left part of string
//
function Left(str, n){
  
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
	    
}//function


// retrieve right part of string
//
function Right(str, n){
  
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }

}//function


// checks if HTML element is without content
//
function WithoutContent(ss) {

	if ((ss.value.length > 0) || (ss.readonly) || (ss.disabled)) { 
		return false; 
	}
	return true;

}//function


// checks if HTML elements are ALL without content
//
function NoneWithContent(ss) {

	for (var i = 0; i < ss.length; i++) {
		if (ss[i].value.length > 0) { 
		 	return false; 
		}
	}
	return true;

}//function


// checks if HTML checkbox elements are ALL unchecked
//
function NoneWithCheck(ss) {

	for (var i = 0; i < ss.length; i++) {
		if(ss[i].checked) { 
			return false; 
		}
	}
	return true;

}//function


// checks if HTML element is without content
//
function WithoutCheck(ss) {

	if (ss.checked) { 
		return false; 
	}
	return true;

}//function


// checks if HTML option element are without selection values
//
function WithoutSelectionValue(ss) {

	for (var i = 0; i < ss.length; i++) {
		if (ss[i].selected) {
			if(ss[i].value.length) { 
				return false; 
			}
		}
	}
	return true;

}//function
