function CambiarImagen(imagen)
{
  document.getElementById("imgPrincipal").src = imagen;
}

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function replaceAll( text, busca, reemplaza ){
    while (text.toString().indexOf(busca) != -1){
        text = text.toString().replace(busca,reemplaza);
    }
    return text;
}

function replaceAmp(text)
{	
	return replaceAll(text,'&','~');
}

function isInteger(s) {
  return (s.toString().search(/^-?[0-9]+$/) == 0);
}

function datosMail(str)
{
	var tags = new Array("Content-Type:",
		"MIME-Version:",
		"Content-Transfer-Encoding:",
		"Return-path:",
		"Subject:",
		"From:",
		"Envelope-to:",
		"To:",
		"bcc:",
		"cc:");
		
	for(i=0; i< tags.length; i++)
	{
		if (str.indexOf(tags[i]) != "-1")
			return false;
	}
	return true;
}

String.prototype.capitalize = function(){
   return this.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } );
  };
  
 function inputFocus(obj, str)
 {
	if (obj.value == str)
		obj.value = '';
 }
 
 function inputBlur(obj, str)
 {
	if (obj.value == '')
		obj.value = str;
 }
 
function ajaxRequest(src, objID, action)
{	
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			if(typeof action == 'function')
				action(xmlhttp.responseText);
			else
				document.getElementById(objID).innerHTML = xmlhttp.responseText;
		}
	}
	
	xmlhttp.open("GET",src,true);
	xmlhttp.send();
}
 
 

