﻿var maxBailes=9;
maxBailes=maxBailes+1;

function getUserNav() {
userNav=0;
 try { 
    var agt=navigator.userAgent.toLowerCase(); 
	  	 if (agt.indexOf('gecko') != -1) {userNav = 1;} // Firefox
	  	 if (agt.indexOf('msie' ) != -1) {userNav = 2;} // IExplorer
	  	 if (userNav==0) { throw "Not Found"; } // Browser not found (Opera & more)
 } catch(e) { alert('shade effects disabled!!'); } /* swallow any browser incompatibility errors */
return userNav;
}

function gup( name ){
  	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  var regexS = "[\\?&]"+name+"=([^&#]*)";
	  var regex = new RegExp( regexS );
	  var results = regex.exec( window.location.href );
	  if( results == null )    return null;  else    return results[1];
} // http://www.netlobo.com/url_query_string_javascript.html

function isHiliteBall() {
    if (userNavIs == 1) {
      if (document.getElementById('hilighter').sheet.cssRules.length > 0 ) return true;  else  return false;
    } else {
      if ( document.styleSheets["hilighter"].rules.length  > 0 ) return true;  else  return false;
    }
}	

// Navigator test
var userNavIs = getUserNav(); // alert(userNavIs)

function hiliteBall(itemid) {
	if (itemid == null) return;
if ( isHiliteBall() ) loliteBall()
else {
  for (i=0; i<maxBailes; i++) {
  	if (i == itemid) hiliteitem = 'visible'; else hiliteitem = 'hidden';
	// if (i == itemid) hiliteitem = '#E4CAFF'; else hiliteitem = '#f4f4f4';
    if (userNavIs == 1) {
        document.getElementById('hilighter').sheet.insertRule('.it'+i+' { visibility: '+hiliteitem+'; }', 0);
		// document.getElementById('hilighter').sheet.insertRule('.it'+i+' { BACKGROUND: '+hiliteitem+'; }', 0);
		// alert( document.getElementById('hilighter').sheet.cssRules.length )
    } else {
        document.styleSheets["hilighter"].addRule('.it'+i, 'visibility: '+hiliteitem, 0);
		// document.styleSheets["hilighter"].addRule('.it'+i, 'BACKGROUND: '+hiliteitem, 0);  
		// alert( document.styleSheets["hilighter"].rules.item(0).style.visibility )
		// alert( document.styleSheets["hilighter"].rules.length )
    }
  }
}
} // http://www.javascriptkit.com/domref/stylesheet.shtml

function loliteBall() {
  // for (i=1; i<9; i++) {
    if (userNavIs == 1) {
        while (document.getElementById('hilighter').sheet.cssRules.length > 0 ) document.getElementById('hilighter').sheet.deleteRule(0);
    } else {
        while ( document.styleSheets["hilighter"].rules.length  > 0 ) document.styleSheets["hilighter"].removeRule(0);
    }
  // }
}	

function hidePastActivities() {
	var dayLimits = ['0709', '0716', '0723', '0730', 
									'0806', '0813',
									'0917', '0924', '0929']
		
	for (i=0; i<dayLimits.length; i++) {
		var fecha=new Date();
    var diames=fecha.getDate();
    var mes=fecha.getMonth() +1 ;
    var token = ''+(mes<10?'0':'')+mes+(diames<10?'0':'')+diames+''
    // alert(token)
    // token='0704'
		if (token<dayLimits[i])
			break;	
		else
			document.getElementById(dayLimits[i]).style.display = "none"
	}
}
