function textFieldFocus(id,value) {
    if (document.getElementById(id).value == value){
        document.getElementById(id).className = 'textFilled';
        document.getElementById(id).value = '';
    }
}
function textFieldBlur(id,value) {
    if (document.getElementById(id).value == ''){
        document.getElementById(id).className = 'textDefault';
        document.getElementById(id).value = value;
    }
}

function emptySearchValue() {
    if (document.getElementById('search').value == 'Busqueda'){
        document.getElementById('search').value = ''
    }
}

function getHeight(x,y) { 
    /* function(x,y) Asigna a X el height de Y */
    divh = document.getElementById(y).offsetHeight;
    document.getElementById(y).style.height = divh +"px";
}

function amPm(val,div){
	if(val < 12){
		document.getElementById('ampm'+div).innerHTML = 'AM';
	} else {
		document.getElementById('ampm'+div).innerHTML = 'PM';
	}
}

function colHeight() { 
    divh1 = document.getElementById('col1_content').offsetHeight;
    divh2 = document.getElementById('col2_content').offsetHeight;
    divh3 = document.getElementById('col3_content').offsetHeight;
	
    var height = Math.max(divh1,divh2,divh3);
	
    document.getElementById('col1_content').style.height = height +"px";
    document.getElementById('col2_content').style.height = height +"px";
    document.getElementById('col3_content').style.height = height +"px";
    document.getElementById('col4_content').style.height = height-10 +"px";
}

function contentImgs(seg,id,pictPath)
{
    var xmlHttp;
    try
    {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange=function()
    {
        if(xmlHttp.readyState==4)
        {
            document.getElementById('spotImg').src="/images_data/thumb/phpThumb.php?src="+pictPath;
            document.getElementById('spotDescripcion').innerHTML = xmlHttp.responseText; 
        }
    }
    xmlHttp.open("GET","/images_data/thumb/phpThumb.php?src="+pictPath,true);
    xmlHttp.open("GET","/"+seg+"/foto/"+id,true); /* Run query in controller 'seg', function 'foto' */
    xmlHttp.send(null);
}


function eval_terms(){
  if(document.forma.terms.checked)
     document.forma.btnSubmit.disabled=false;
  else
     document.forma.btnSubmit.disabled=true;
 }

var checkeadas = 0;
function nomasdetres(cbObj){
    if (cbObj.checked){
        if (checkeadas < 3){
            checkeadas++;
        } else {
            cbObj.checked = false;
            alert('Puede seleccionar hasta 3 causas');
        }
    } else {
        checkeadas--;
    }
}
