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 setActiveStyleSheet(title) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			a.disabled = true;
		if(a.getAttribute("title") == title) a.disabled = false;
		}
	}
	document.cookie = 'estiloCSS=' + title; //aquí ponemos la cookie
}
/*//y aquí verificamos si la cookie existe 
var galleta = document.cookie;
galleta = galleta.split(';');
estiloCSS = '';
for(m=0; m<galleta.length; m++){
	if(galleta[m].split('=')[0] == 'estiloCSS'){
		estiloCSS = galleta[m].split('=')[1];
		break;
	}
}*/

//en caso de existir la cookie llama a la función que cambia la hoja de estilos

/*if(estiloCSS != ''){
	setActiveStyleSheet(estiloCSS)
}*/

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;
}