//Var defined for Check Box and Radio Buttons functions
//imageSrc = '../system/images/tickets/unchecked.gif';
//imageSrcClick = '../system/images/tickets/checked.gif';
//radioReplaceID1 = Radio Button ID clicked
//radioReplaceID2 = Radio Button ID non-clicked
//hiddenName = Input hidden Name (ID)

function onClickRadioBtnBIT(radioReplaceID1, radioReplaceID2, hiddenName){
	//Cut str to compare only the name of image
	var posDash = document.getElementById(radioReplaceID1).src.lastIndexOf('/');
	var srcImg = document.getElementById(radioReplaceID1).src.substring((posDash + 1), document.getElementById(radioReplaceID1).src.length);
	posDash = imageSrc.lastIndexOf('/');
	chkImageSrc = imageSrc.substring((posDash + 1), imageSrc.length);
	//Compare image names
	if (srcImg == chkImageSrc){
		document.getElementById(radioReplaceID1).src = imageSrcClick;
		document.getElementById(radioReplaceID2).src = imageSrc;
		//State invert
		document.getElementById(hiddenName).value = (document.getElementById(hiddenName).value * (-1)) + 1;
	}
}

function onClickRadioBtn(radioReplaceID1, radioReplaceID2, hiddenName, value){
   //Cut str to compare only the name of image
	var posDash = document.getElementById(radioReplaceID1).src.lastIndexOf('/');
   var srcImg = document.getElementById(radioReplaceID1).src.substring((posDash + 1), document.getElementById(radioReplaceID1).src.length);
   posDash = imageSrc.lastIndexOf('/');
   chkImageSrc = imageSrc.substring((posDash + 1), imageSrc.length);
   //Compare image names
   if (srcImg == chkImageSrc){
   	document.getElementById(radioReplaceID1).src = imageSrcClick;
      document.getElementById(radioReplaceID2).src = imageSrc;
    	//State invert
      document.getElementById(hiddenName).value = value
	}
}
function Left(str, n)
        /***
                IN: str - the string we are LEFTing
                    n - the number of characters we want to return

                RETVAL: n characters from the left side of the string
        ***/
        {
                if (n <= 0)     // Invalid bound, return blank string
                        return "";
                else if (n > String(str).length)   // Invalid bound, return
                        return str;                // entire string
                else // Valid bound, return appropriate substring
                        return String(str).substring(0,n);
        }
// Removes leading whitespaces

function LTrim( value ) {
        var re = /\s*((\S+\s*)*)/;
        return value.replace(re, "$1");
        
}
 
// Removes ending whitespaces
function RTrim( value ) {
        var re = /((\s*\S+)*)\s*/;
        return value.replace(re, "$1");
        
}
 
// Removes leading and ending whitespaces
function Trim( value ) {
        return LTrim(RTrim(value));
}
