﻿// Archivo JScript
$(document).ready(function()
{
    _OnResize();
})

/*Reajustar el tamaño de los controles al tamaño de la pantalla.*/
function _OnResize ()
{
    try{
    // el contenedor principal es topcontainer.
    var FixedHeight = $("#head").height() + $("#PanelPieMaster").height()+15;
    var newHeight = $(window).height()-FixedHeight;
    
    
    $("#container").css ( 'height', newHeight );
    $("#visorCarreraContainer").css ( 'height', newHeight );
    
    $("#tabsSecc").css ('height', newHeight-70 );
    
    $("#PanelGaleria").css ('height', newHeight-120 );
    $("#PanelPresentacion").css ('height', newHeight-120 );
    $("#PanelResultados").css ('height', newHeight-120 );
    $("#PanelInstrucciones").css ('height', newHeight-120 );
    }
    catch ( E)
    {
    alert ( E );
    }
    
    
    
}


var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function IsDateEs ( dtStr )
{//basado en http://www.smartwebby.com/dhtml/

    var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	
	if (pos1==-1 || pos2==-1){ return false;}
	
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	
    try{
    	month=parseInt(strMonth, 10)
	    day=parseInt(strDay, 10)
	    year=parseInt(strYear, 10)
    
        if (strMonth.length<1 || month<1 || month>12)
        {
            return false;
        }
	    if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month])
	    {
		    return false
	    }
	    if (strYear.length != 4 || year==0 || year<minYear || year>maxYear)
	    {
		    return false
	    }

        return true;
    }
    catch (E)
    {
        return false;
    }
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

