function ylib_Browser(){
	d=document;
	this.agt=navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.dom=(d.getElementById)?1:0;
	this.ns=(d.layers);
	this.ns4up=(this.ns && this.major >=4);
	this.ns6=(this.dom&&navigator.appName=="Netscape");
	this.op=(window.opera? 1:0);
	this.ie=(d.all);
	this.ie4=(d.all&&!this.dom)?1:0;
	this.ie4up=(this.ie && this.major >= 4);
	this.ie5=(d.all&&this.dom);
	this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	this.mac=(this.agt.indexOf("mac")!=-1);
};

var oBw = new ylib_Browser();

function funcLink(url){
	window.location = url;
}

function funcLinkDecisionCanjePremio(url){
	if (confirm( "Esta Seguro de Canjear este Premio?" ))
		window.location = url;
//	else		
}

function funcLinkDecisionAumentarAnioo(url){
	if (confirm( "Esta Seguro de Aumentar el Anio para la Galeria?" ))
		window.location = url;
//	else		
}

function funcRedondear(num, decimal) {
	return Math.round(num * Math.pow(10, decimal)) / Math.pow(10, decimal);
}

/*function funcRedondearInput(num, decimal) {
	alert (num);
	var valor = Math.round(num * Math.pow(10, decimal)) / Math.pow(10, decimal);
	if (num != ''){
		if (isNaN(valor))
			num = '';
		else
			num = valor;
	}
	alert (num);
}*/
function DisplayElement ( elt, displayValue )
{
	//if (ComposeVals.ExpandoToCcBcc){
		if ( typeof elt == "string" )
			elt = document.getElementById( elt );
			if ( elt == null ) return;
			if ( oBw && oBw.ns6 ) {
				// OTW table formatting will be lost:
				if ( displayValue == "block" && elt.tagName == "TR" )
					displayValue = "table-row";
				else if ( displayValue == "inline" && elt.tagName == "TR" )
					displayValue = "table-cell";
		}
		elt.style.display = displayValue;
		//alert(elt.style.display);
	//}
}

function TrimLeft( str ) {
	var resultStr = "";
	var i = len = 0;

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str == null)	
		return null;

	// Make sure the argument is a string
	str += "";

	if (str.length == 0) 
		resultStr = "";
	else {	
  		// Loop through string starting at the beginning as long as there
  		// are spaces.
//	  	len = str.length - 1;
		len = str.length;
		
  		while ((i <= len) && (str.charAt(i) == " "))
			i++;

   	// When the loop is done, we're sitting at the first non-space char,
 		// so return that char plus the remaining chars of the string.
  		resultStr = str.substring(i, len);
  	}

  	return resultStr;
}

function TrimRight( str ) {
	var resultStr = "";
	var i = 0;

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str == null)	
		return null;

	// Make sure the argument is a string
	str += "";
	
	if (str.length == 0) 
		resultStr = "";
	else {
  		// Loop through string starting at the end as long as there
  		// are spaces.
  		i = str.length - 1;
  		while ((i >= 0) && (str.charAt(i) == " "))
 			i--;
 			
 		// When the loop is done, we're sitting at the last non-space char,
 		// so return that char plus all previous chars of the string.
  		resultStr = str.substring(0, i + 1);
  	}
  	
  	return resultStr;  	
}

function Trim( str ) {
	var resultStr = "";
	
	resultStr = TrimLeft(str);
	resultStr = TrimRight(resultStr);
	
	return resultStr;
}

function TrimObject( object ) {
	var resultStr = "";
	
	resultStr = TrimLeft(object.value);
	resultStr = TrimRight(resultStr);
	
	object.value = resultStr;
}
