var aSpanishMonths = new Array('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre');
var GMT_OFFSET = -7;

function printDateTime()
{
	var oTmp = FIND('datetimespan');

	if(oTmp)
		oTmp.innerHTML = getDateTime();

	setTimeout(printDateTime, 30000);
}

function getDateTime()
{
	var oDate = new Date();
	//oDate.setTime(oDate.getTime() + (GMT_OFFSET * 60 * 60000));
	var iHour = oDate.getHours();//oDate.getUTCHours();
	var iMinutes = oDate.getMinutes();//oDate.getUTCMinutes();
	var sAMPM = 'am';

	if(!iHour)
		iHour = 12;
	else if(iHour >= 12)
	{
		sAMPM = 'pm';

		if(iHour > 12)
			iHour -= 12;
	}

	if(iMinutes < 10)
		iMinutes = '0' + iMinutes
	
	return	aSpanishMonths[oDate.getUTCMonth()].substr(0, 3) + ' ' +
			oDate.getUTCDate() + ' ' +
			iHour + ':' + iMinutes + ' ' +
			sAMPM;
}

//FLASH FUNCTIONS
var bo_ns_id = 0;

function startIeFix()
{  
	if(isIE())
	{    
		document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');  
	}
}

function endIeFix()
{  
	if(isIE())
	{    
		document.write('</div>');    
		var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
		var theCode = theObject.innerHTML;    
		theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"));
		document.write(theCode);  
	}
}

function isIE()
{	// only for Win IE 6+  
	// But not in Windows 98, Me, NT 4.0, 2000  
	var strBrwsr = navigator.userAgent.toLowerCase();  
	if(strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0)
	{    
		if(parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6)
		{      
			return false;    
		}    

		if(	strBrwsr.indexOf("win98") > -1 ||       
			strBrwsr.indexOf("win 9x 4.90") > -1 ||       
			strBrwsr.indexOf("winnt4.0") > -1 ||       
			strBrwsr.indexOf("windows nt 5.0") > -1)    
		{      
			return false;    
		}    
		
		return true;  
	}
	else
	{    
		return false;  
	}
}

//POPUP
function popUp(URL, width, height, scrollbars)
{
	if(scrollbars == undefined)
		scrollbars = '1';

	window.open(URL, '', 'toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=' + scrollbars + ',width=' + width + ',height=' + height);

	return false;
}

function showPhoto(sImageID)
{
	popUp('photo.php?id=' + sImageID, 900, 800);
}

function showVideo(sVideoID)
{
	popUp('video.php?id=' + sVideoID, 900, 800);
}

var mainMarqueeStopped = false;

function startMainMarquee()
{
	FIND('mainMarquee').start();
	mainMarqueeStopped = false;
}

function stopMainMarquee()
{
	FIND('mainMarquee').stop();
	mainMarqueeStopped = true;
}

//HOME PAGE
function homePage()
{
	var aURL = new Array();
	var aURLAux = new Array();
	var sHomePage = '';

	aURL = document.URL.split("/");

	if(aURL.length >= 3)
	{
		aURLAux = aURL[2].split("?");

		if(aURLAux.length >= 1)
			sHomePage = aURL[0] + '//' + aURLAux[0];
	}

	if(!sHomePage)
		sHomePage = 'http://www.kbnt17.com';

	if(!hp.isHomePage(sHomePage))
	{
		document.write(
				'<table id="tuhomepage">' +
				'<tr>' +
				'<td width="5"></td>' +
				'<td valign="middle">' +
				'<img src="img/loguito-uni.jpg" border="0"/>' +
				'</td>' +
				'<td valign="middle">' +
				'<a href="javascript:void(null)" ' +
				'onClick="this.style.behavior=\'url(#default#homepage)\';' +
				'this.setHomePage(\'' + sHomePage + '\');">' +
				'Haz KBNT 17 tu homepage' +
				'</a>' +
				'</td>' +
				'</table>');
	}
}

//COOKIE FUNCTIONS
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires;
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return '';
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


function setSearchEngine(BASE_URL,form)
{
	if(form.sitesearch[0].checked)
		form.action=BASE_URL + "search.php"
	else
		form.action=BASE_URL + "result.php"	
	return true;
}

/************************AJAX.JS*************************/
function createRequest()
{
	var aXmlHttp = null;

	if(window.XMLHttpRequest) //Mozilla, Safari,...
	{
		aXmlHttp = new XMLHttpRequest();

		if(aXmlHttp.overrideMimeType)
			aXmlHttp.overrideMimeType('text/xml'); //https://bugzilla.mozilla.org/show_bug.cgi?id=311724
	}
	else if(window.ActiveXObject) //IE
	{
		var aXmlObjects = null;
		aXmlObjects = new Array();

		aXmlObjects[0] = "Msxml2.XMLHTTP";
		aXmlObjects[1] = "Microsoft.XMLHTTP";

		var i = null;

		for(i = 0; i < aXmlObjects.length; i++)
		{
			try
			{
				aXmlHttp = new ActiveXObject(aXmlObjects[i]);
				break;
			}
			catch(e)
			{
			}
		}
	}

	if(!aXmlHttp)
	{
		throw "This navigator does not support asynchronous calls"; 
	}
	else
	{
		return aXmlHttp;
	}
}

function sendRequest(aXmlHttp, sURL, aHandler, bNoCached, bSynchronous)
{
	if(!aXmlHttp)
		return;

	if(!(aXmlHttp.readyState === 4 || aXmlHttp.readyState === 0))
		aXmlHttp.abort();

	if(bNoCached == null)
		bNoCached = false;

	if(bSynchronous == null)
		bSynchronous = false;

	if(bNoCached)
		sURL = getNoCachedURL(sURL);

	aXmlHttp.open('GET', sURL, !bSynchronous);

	if(aHandler)
		aXmlHttp.onreadystatechange = function() { aHandler(aXmlHttp); };
	aXmlHttp.send(null);
}

function makeRequest(sURL, aHandler, bNoCached, bSynchronous)
{
	sendRequest(createRequest(), sURL, aHandler, bNoCached, bSynchronous);
}

function getNoCachedURL(sURL)
{
	return sURL + (sURL.indexOf("?") != -1 ? "&" : "?") + "__=" + encodeURIComponent(getUniqueValue());
}

function getUniqueValue()
{
	return new Date().getTime() + parseInt(Math.random() * 100);
}

function isCompleted(aXmlHttp)
{
	return aXmlHttp.readyState == 4 || aXmlHttp.readyState == "complete";
}

function getResponse(aXmlHttp)
{
	if(aXmlHttp.status == 200)
		return unescape(aXmlHttp.responseText);
	else
		return '';
}
/****************************ajax-dynamic-content.js************************************/
/************************************************************************************************************
Ajax dynamic content
Copyright (C) 2006  DTHMLGoodies.com, Alf Magne Kalleland

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
written by Alf Magne Kalleland.

Alf Magne Kalleland, 2006
Owner of DHTMLgoodies.com


************************************************************************************************************/	

var enableCache = true;
var jsCache = new Array();

var dynamicContent_ajaxObjects = new Array();

function ajax_showContent(divId,ajaxIndex,url)
{
	var targetObj = document.getElementById(divId);
	targetObj.innerHTML = dynamicContent_ajaxObjects[ajaxIndex].response;
	if(enableCache){
		jsCache[url] = 	dynamicContent_ajaxObjects[ajaxIndex].response;
	}
	dynamicContent_ajaxObjects[ajaxIndex] = false;
	
	ajax_parseJs(targetObj)
}

function ajax_loadContent(divId,url)
{
	if(enableCache && jsCache[url]){
		document.getElementById(divId).innerHTML = jsCache[url];
		return;
	}
	
	var ajaxIndex = dynamicContent_ajaxObjects.length;
	document.getElementById(divId).innerHTML = 'Loading content - please wait';
	dynamicContent_ajaxObjects[ajaxIndex] = new sack();
	dynamicContent_ajaxObjects[ajaxIndex].requestFile = url;	// Specifying which file to get
	dynamicContent_ajaxObjects[ajaxIndex].onCompletion = function(){ ajax_showContent(divId,ajaxIndex,url); };	// Specify function that will be executed after file has been found
	dynamicContent_ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function	
	
	
}

function ajax_parseJs(obj)
{
	var scriptTags = obj.getElementsByTagName('SCRIPT');
	var string = '';
	var jsCode = '';
	for(var no=0;no<scriptTags.length;no++){	
		if(scriptTags[no].src){
	        var head = document.getElementsByTagName("head")[0];
	        var scriptObj = document.createElement("script");
	
	        scriptObj.setAttribute("type", "text/javascript");
	        scriptObj.setAttribute("src", scriptTags[no].src);  	
		}else{
			if(navigator.userAgent.indexOf('Opera')>=0){
				jsCode = jsCode + scriptTags[no].text + '\n';
			}
			else
				jsCode = jsCode + scriptTags[no].innerHTML;	
		}
		
	}

	if(jsCode)ajax_installScript(jsCode);
}


function ajax_installScript(script)
{		
    if (!script)
        return;		
    if (window.execScript){        	
    	window.execScript(script)
    }else if(window.jQuery && jQuery.browser.safari){ // safari detection in jQuery
        window.setTimeout(script,0);
    }else{        	
        window.setTimeout( script, 0 );
    } 
}	
	
/************************************buttons.js********************************************/	
function right_button() {
	if(document.getElementById("feedbackdiv"))
	document.getElementById("feedbackdiv").innerHTML = '<div id="menudeladerecha"><a href="/feedback.php"><img src="../img/feedback-bot1.png" border="0"/></a></div>';
	if(document.getElementById("feedbackdivtop"))
	document.getElementById("feedbackdivtop").innerHTML = '';
}

function brand_button() {
	if(document.getElementById("feedbackdivtop"))
	document.getElementById("feedbackdivtop").innerHTML = '<div align="center" style="padding-bottom: 10px; padding-top: 10px;"><a href="/feedback.php"><img src="../img/feedback-bot2.png" border="0" /></a></div>';
	if(document.getElementById("feedbackdiv"))
	document.getElementById("feedbackdiv").innerHTML = '';
}

/* 12/01/2010 - by andres for left buttons. */

function left_button() {
	if(document.getElementById("socialnetdiv"))
	document.getElementById("socialnetdiv").innerHTML = '<div id="menudelaizquierda"><img src="img/menuIzquierda.gif" border="0" usemap="#menuizquierda" /></div>';
	if(document.getElementById("socialnetdivtop"))
	document.getElementById("socialnetdivtop").innerHTML = '';
}

function bottom_button() {
	if(document.getElementById("socialnetdivtop"))
	document.getElementById("socialnetdivtop").innerHTML = '<div align="center" style="padding-bottom: 10px; padding-top: 10px;"><img src="img/menuIzquierda_brand.gif" border="0" usemap="#leftbottom_buttom" /></div>';
	if(document.getElementById("socialnetdiv"))
	document.getElementById("socialnetdiv").innerHTML = '';
}

/* booth buttons */

function left_complete_button() {
	if(document.getElementById("socialnetdiv"))
	document.getElementById("socialnetdiv").innerHTML = '<div id="menudelaizquierda"><img src="img/menuIzquierda_complete.gif" border="0" usemap="#menuizquierda" /></div>';
	if(document.getElementById("socialnetdivtop"))
	document.getElementById("socialnetdivtop").innerHTML = '';
}

function bottom_complete_button() {
	if(document.getElementById("socialnetdivtop"))
	document.getElementById("socialnetdivtop").innerHTML = '<div align="center" style="padding-bottom: 10px; padding-top: 10px;"><img src="img/menuIzquierda_brand_complete.gif" border="0" usemap="#leftbottom_buttom" /></div>';
	if(document.getElementById("socialnetdiv"))
	document.getElementById("socialnetdiv").innerHTML = '';
}


/* ---- */

function print_jsDiv() {
	var sReturn;

	sReturn = false;
	if(screen.width > 1024)
		 sReturn = true;

	if(navigator.appName == 'Netscape') {
		if(window.innerWidth > 1024)
			 sReturn = true;
		else
			 sReturn = false;
    }
 
	else if(navigator.appName == 'Microsoft Internet Explorer'){
		if(document.body.offsetWidth > 1024)
			 sReturn = true;
		else
			 sReturn = false;
    }


	return sReturn;
}

function Resize() {

	if(navigator.appName == 'Netscape') {
		if(window.innerWidth > 1024) {
			if(document.getElementById("feedbackdiv"))
				right_button();
			if(document.getElementById("socialnetdiv"))
				left_button();
		}
		else {
			if(document.getElementById("feedbackdivtop"))	
				brand_button();
			if(document.getElementById("socialnetdivtop"))
				bottom_button();
		}
    }
 
	else if(navigator.appName == 'Microsoft Internet Explorer'){
		if(document.body.offsetWidth > 1024) {
			if(document.getElementById("feedbackdiv"))
				right_button();
			if(document.getElementById("socialnetdiv"))
				left_button();
		}
		else {
			if(document.getElementById("feedbackdivtop"))
				brand_button();
			if(document.getElementById("socialnetdivtop"))
				bottom_button();
		}
    }
   
} // Rezise.

function Resizecomplete() {

	if(navigator.appName == 'Netscape') {
		if(window.innerWidth > 1024) {
			if(document.getElementById("feedbackdiv"))
				right_button();
			if(document.getElementById("socialnetdiv"))
				left_complete_button();
		}
		else {
			if(document.getElementById("feedbackdivtop"))
				brand_button();
			if(document.getElementById("socialnetdivtop"))
				bottom_complete_button();
		}
    }
 
	else if(navigator.appName == 'Microsoft Internet Explorer'){
		if(document.body.offsetWidth > 1024) {
			if(document.getElementById("feedbackdiv"))
				right_button();
			if(document.getElementById("socialnetdiv"))
				left_complete_button();
		}
		else {
			if(document.getElementById("feedbackdivtop"))
				brand_button();
			if(document.getElementById("socialnetdivtop"))
				bottom_complete_button();
		}
    }
   
} // Rezise.

/**************************************checkform.js**************************************/

/*
   This script validates form fields for proper values.
   Here's how to use it:

	  Call it from OnSubmit in the form tag with the following: OnSubmit="return checkForm(this.name);"
	  To validate a field include a hidden tag with the same name but append "_validate"
	   	to it then put the type of field it is as the value (see lit of types below).
		You may also add a custom error message for the field by appending
		the error message with a "-" then the message.
		
		Examples:
		With a custom message: 		<input type="hidden" name="FIRST_NAME_validate" value="text-Custom error message goes here.">
		Without a custome message 	<input type="hidden" name="FIRST_NAME_validate" value="text">
				
		The current field types are as follows:
		
		text - regular text field, check for the existance of a value- nothing else
		month - checks for an integer between 1 and 12 (no decimals)
		year - checks for integer (no decimals)
	  	dropdown - checks that the first item is not selected
		checkbox - checks for at least one choice (note: all fields must be named the same)
		radio - checks for a selection
		email - checks for proper email syntax
		email_null - checks for proper email syntax, but allows null value
		numeric[(a)|(a,b)] - checks that the value is an integer number
				- (a): checks that the value is lesser than 'a'
				- (a,b): checks that the value is between 'a' and 'b'
		zipcode - checks that the value is a valid US zip code
	
	For testing purposes, include a hidden field in your form named "sitesys_test" and
	it will stop the form from submitting.
	
	Modifications History
	**********************
	06/07/2001 - Created 
	06/11/2001 - Added new function to focus on first field that needs fixing
	06/12/2001 - Dash no longer needed when no custom error message is specified
	06/18/2001 - Added email_null type to check for proper email syntax only if a value is provided
	11/05/2001 - Fix Month and Year routine
	09/25/2002 - Add longYear validation
	11/11/2004 - Fix Year to use this year not a hard coded value
	02/11/2007 - Added numeric and zipcode validation
*/

// set global params
var focusfield = '';
var bletSubmitGo = true
var today = new Date();
//
function checkForm(formname) {
//to avoid the ENTER without ckick;	
if (bletSubmitGo==false){return false}


	// create some default parameters for the error message if one is needed
	var final_msg = ""; 
	var intro = "Hubo un problema con tu respuesta.         \n\n"; // create intro 
	var ending = "\nPor favor, haz los cambios necesarios y prueba nuevamente.     " // create ending
	
	// define default messages 
	var err_text = "     - Incomplete Form"
	var err_month = "     - Invalid Month"
	var err_day = "     - Invalid Day"
	var err_year = "     - Invalid Year"
	var err_longYear = "     - Invalid Year"
	var err_dropdown = "     - Incomplete Form"
	var err_checkbox = "     - No checkbox selected"
	var err_email = "     - Invalid Email"
	var err_numeric = "     - Invalid number"
	var err_zipcode = "     - Invalid zipcode"
	
	var f = eval("document." + formname + ".elements"); // define the scope to save time
	var vArray = new Array(); // Create an Array to hold fields to be validated
		
	//Check for fields that need to be validated
	for (i=0; i<f.length; i++) {
		if(f[i].name.indexOf('_validate') != -1) {
			if (vArray.length == 0) {
				vCurrent = 0;
			} else {
				vCurrent = vCurrent + 1;
			}
			vArray[vCurrent]  = f[i].name;
		}
		// check for a hidden test to stop form from submitting
		if(f[i].name == 'sitesys_test') {
			var testing = true;
		}
	}

	// Now that we have the validated fields, start checking values
	for (i=0; i<vArray.length; i++) {
		var fposition = vArray[i].indexOf('_validate'); // find the position of "_validate"
		var fname = vArray[i].substring(0, fposition); // extract field name
		var validate = eval("document." + formname + "." + vArray[i] + ".value"); // define scope
		var dash = validate.indexOf('-'); // find the position of the "-"

		if(dash == -1) {
			var type = validate; // if there is no dash set error_msg to blank/default
			var err_msg = '';
		} else {
			var type = validate.substring(0,dash); // get field type

			//Only for numeric check
			var tmp = "numeric";
			if(type.substring(0, tmp.length) == tmp) {
				var n_beg = -65535;
				var n_end = 65535;

				var tmp_1 = type.indexOf('(');
				var tmp_2 = type.indexOf(')');

				if(tmp_1 != -1 && tmp_2 != -1 && tmp_1 < tmp_2)
				{
					var aux_1 = type.substring(tmp_1 + 1, tmp_2);
					var aux_2 = aux_1.split(',');

					type = "numeric";

					if(aux_2.length == 1)
					{
						if(isNumeric(aux_2[0]))
							n_end = aux_2[0];
					}
					else if(aux_2.length == 2)
					{
						if(isNumeric(aux_2[0]) && isNumeric(aux_2[1]))
						{
							n_beg = aux_2[0];
							n_end = aux_2[1];
						}
					}
					
				}
			}
			//End Only for numeric check

			var err_msg = validate.substring(dash + 1, validate.length); // get custom error message if any
			var aTempLength = err_msg.split('<br>')
			for (iTempLength=0;iTempLength<aTempLength.length;iTempLength++){
				err_msg = err_msg.replace('<br>','\n')
			}
			aTempLength = err_msg.split('<b>')
			for (iTempLength=0;iTempLength<aTempLength.length;iTempLength++){
				err_msg = err_msg.replace('<b>','')
			}
			aTempLength = err_msg.split('</b>')
			for (iTempLength=0;iTempLength<aTempLength.length;iTempLength++){
				err_msg = err_msg.replace('</b>','')
			}
			
		}	

		var field = eval("document." + formname + "." + fname); // define field scope
		 
		// validate text fields
		if(type == 'text') {
			if(!field.value) {
				if (err_msg == "") {
					final_msg = final_msg + err_text + "\n";
				} else {
					final_msg = final_msg + err_msg + "\n";
				}	
			setFocus(field); // run focus function
			}	
		}
		// end text validation
		
		// validate month 
		if(type == 'month') {
			if ((!field.value) || (!isFinite(field.value)) || (field.value.indexOf('.') != -1) || (field.value > 12) || (field.value < 1) || (field.value == '  ') || (field.value == ' ')) {
				if (err_msg == "") {
					final_msg = final_msg + err_month + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}				
			setFocus(field); // run focus function
			}
		}		
		// end month validation
		
		// validate day 
		if(type == 'day') {
			if ((!field.value) || (!isFinite(field.value)) || (field.value.indexOf('.') != -1) || (field.value > 31) || (field.value < 1) || (field.value == '  ') || (field.value == ' ')) {
				if (err_msg == "") {
					final_msg = final_msg + err_day + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}				
			setFocus(field); // run focus function
			}
		}		
		// end month validation

		// validate year
		if(type == 'year') {
			if ((!field.value) || (!isFinite(field.value)) || (field.value.indexOf('.') != -1) || (field.value == '  ') || (field.value == ' ')) {
				if (err_msg == "") {
						final_msg = final_msg + err_year + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}				
			setFocus(field); // run focus function	
			}
		}		
		// end year validation

		// validate longYear
		if(type == 'longYear') {
			//alert(field.value.length)
			iTemp = Val(field.value)
			sTemp = iTemp  + "A"
			//alert(sTemp.length)
			if ((sTemp.length != 5) || (!isFinite(iTemp)) || (sTemp.indexOf('.') != -1) || (iTemp < 1900) || (iTemp > today.getFullYear()) ){
				if (err_msg == "") {
						final_msg = final_msg + err_longYear + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}				
			setFocus(field); // run focus function	
			}
		}		
		// end longYear validation
		
		
		// validate dropdown
		if(type == 'dropdown') {
			if(field[0].selected) {
				if (err_msg == "") {
						final_msg = final_msg + err_dropdown + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}
			setFocus('nofocus'); // run focus function								
			}
		}
		// end dropdown validation
		
		// validate checkbox 
		if(type == 'checkbox'){
			var cempty = true;
			for (c=0;c<field.length;c++) {
				if(field[c].checked) {
					cempty = false;
				}
			}
			if(cempty) {
				if (err_msg == "") {
					final_msg = final_msg + err_checkbox + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}
			setFocus('nofocus'); // run focus function											
			}
		}
		// end checkbox validation
		
		// validate radio
		if(type == 'radio'){
			var rempty = true;
			for (r=0;r<field.length;r++) {
				if(field[r].checked) {
					rempty = false;
				}
			}
			if(rempty) {
				if (err_msg == "") {
					final_msg = final_msg + err_radio + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}
			setFocus('nofocus'); // run focus function											
			}
		}
		// end radio validation
		
		// validate email
		if (type == 'email') {
			var bademail = false
	
			if (!field.value) { 
				bademail = true; 
				} else {
			
				var emailStr = field.value;
				var emailPat=/^(.+)@(.+)$/;
				var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
				var validChars="\[^\\s" + specialChars + "\]";
				var quotedUser="(\"[^\"]*\")";
				var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
				var atom=validChars + '+';
				var word="(" + atom + "|" + quotedUser + ")";
				var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
				var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
				var matchArray=emailStr.match(emailPat);
				
				if (matchArray==null) { 
					bademail = true; 
				} else {
				
						var user=matchArray[1];
						var domain=matchArray[2];
						
						if (user.match(userPat)==null)  { bademail = true; }
						
						var IPArray=domain.match(ipDomainPat);
						if (IPArray!=null) {
						    // this is an IP address
							  for (var i=1;i<=4;i++) {
							    if (IPArray[i]>255) {
									 bademail = true;
							    }
						    }
						}
				
				
						var domainArray=domain.match(domainPat);
						if (domainArray==null)  { bademail = true; }
						
						var atomPat=new RegExp(atom,"g");
						var domArr=domain.match(atomPat);
						var len=domArr.length;
						if (domArr[domArr.length-1].length<2 || 
						    domArr[domArr.length-1].length>3) {
							bademail = true;
						}
						
						if (len<2) {
							bademail = true;
						}
				}	
			}
				
			if(bademail) {
				if (err_msg == "") {
					final_msg = final_msg + err_email + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}
			setFocus(field); // run focus function											
			}
		}
		//end email validation

				// validate email
		if (type == 'email_null') {
			var bademail = false
	
			if (!field.value) { 
				bademail = false; 
				} else {
			
				var emailStr = field.value;
				var emailPat=/^(.+)@(.+)$/;
				var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
				var validChars="\[^\\s" + specialChars + "\]";
				var quotedUser="(\"[^\"]*\")";
				var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
				var atom=validChars + '+';
				var word="(" + atom + "|" + quotedUser + ")";
				var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
				var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
				var matchArray=emailStr.match(emailPat);
				
				if (matchArray==null) { 
					bademail = true; 
				} else {
				
						var user=matchArray[1];
						var domain=matchArray[2];
						
						if (user.match(userPat)==null)  { bademail = true; }
						
						var IPArray=domain.match(ipDomainPat);
						if (IPArray!=null) {
						    // this is an IP address
							  for (var i=1;i<=4;i++) {
							    if (IPArray[i]>255) {
									 bademail = true;
							    }
						    }
						}
				
				
						var domainArray=domain.match(domainPat);
						if (domainArray==null)  { bademail = true; }
						
						var atomPat=new RegExp(atom,"g");
						var domArr=domain.match(atomPat);
						var len=domArr.length;
						if (domArr[domArr.length-1].length<2 || 
						    domArr[domArr.length-1].length>3) {
							bademail = true;
						}
						
						if (len<2) {
							bademail = true;
						}
				}	
			}
				
			if(bademail) {
				if (err_msg == "") {
					final_msg = final_msg + err_email + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}
			setFocus(field); // run focus function											
			}
		}
		//end email validation
				
		//validate number
		if(type == 'numeric') {
			if(	!isNumeric(field.value)	||
				(isNumeric(field.value) && 
				 (parseInt(field.value) < n_beg || parseInt(field.value) > n_end)))
			{
				if (err_msg == "") {
						final_msg = final_msg + err_numeric + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}
			setFocus(field); // run focus function	
			}
		}
		//end validate number

		//validate zipcode
		if(type == 'zipcode') {
			if(!(isNumeric(field.value)	&& trim(field.value).length == 5))
			{
				if (err_msg == "") {
						final_msg = final_msg + err_zipcode + "\n";
					} else {
						final_msg = final_msg + err_msg + "\n";
				}
			setFocus(field); // run focus function	
			}
		}
		//end validate zipcode

		// add new	
		// end new

	}

	// stop the submission if there are errors and notify the user
	if (final_msg != "") {
		alert(intro + final_msg + ending); // give the user the error
		if(focusfield != "false") {
			var focus_on = eval("document." + formname + "." + focusfield); // define scope
			focus_on.focus(); // focus on first field that needs to be fixed
		 }

		focusfield = ''; // clear out the focus field for next run
		return false; 

	}
	

	
	// check and see if we are testing, if so, then stop the form from submitting
	if(testing) { return false; }
		
	
}

function setFocus(field) {
	if(focusfield == '') {
		if (field == 'nofocus') {
			focusfield = "false";
		} else {
			focusfield = field.name;
		} 
	}	
}

		function Val(sString){
			bFlag = true;
			sResult = "";
			for (i=0; i<=sString.length-1; i++){
				if (bFlag){
					sTemp = sString.substring(i,i+1);
					if (sTemp >= "0" && sTemp <= "9"){
						sResult = sResult + sTemp;
					}
					else {
						bFlag = false;
					}
				}
			}
			return sResult*1
		}

function isNumeric(sString)
{
	bFlag = false;
	var iTmp;

	sString = trim(sString);

	for (i=0; i<=sString.length-1; i++) {
		iTmp = parseInt(sString.substring(i,i+1));
		if(!(iTmp >= 0 && iTmp <= 9)) {
			break;
		}

		if(i == sString.length - 1)
			bFlag = true;
	}
	return bFlag;
}

function trim(sThisValue) {
		sThis = rtrim(sThisValue)
		sThis = ltrim(sThis)
      return sThis
}

function ltrim(sThisL) {
      return sThisL.replace(/^\s*/,'')
}
function rtrim(sThisR) {
      return sThisR.replace(/\s*$/,'')
}


/*****************************************equalcolumns.js**************************************************/
//** Dynamic Drive Equal Columns Height script v1.01 (Nov 2nd, 06)
//** http://www.dynamicdrive.com/style/blog/entry/css-equal-columns-height-script/

var ddequalcolumns=new Object()
//Input IDs (id attr) of columns to equalize. Script will check if each corresponding column actually exists:
ddequalcolumns.columnswatch=["rightcolumn", "contentwrapper", "leftcolumn"]

ddequalcolumns.setHeights=function(reset){
var tallest=0
var resetit=(typeof reset=="string")? true : false
for (var i=0; i<this.columnswatch.length; i++){
if (document.getElementById(this.columnswatch[i])!=null){
if (resetit)
document.getElementById(this.columnswatch[i]).style.height="auto"
if (document.getElementById(this.columnswatch[i]).offsetHeight>tallest)
tallest=document.getElementById(this.columnswatch[i]).offsetHeight
}
}
if (tallest>0){
for (var i=0; i<this.columnswatch.length; i++){
if (document.getElementById(this.columnswatch[i])!=null)
document.getElementById(this.columnswatch[i]).style.height=tallest+"px"
}
}
}

ddequalcolumns.resetHeights=function(){
this.setHeights("reset")
}

ddequalcolumns.dotask=function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
}

ddequalcolumns.dotask(window, function(){ddequalcolumns.setHeights()}, "load")
//ddequalcolumns.dotask(window, function(){if (typeof ddequalcolumns.timer!="undefined") clearTimeout(ddequalcolumns.timer); ddequalcolumns.timer=setTimeout("ddequalcolumns.resetHeights()", 200)}, "resize")

/*****************************************************m_menu.js*******************************************************/
//Menu Manager functions
var aMM_Menu = new Array();

//Other definitions
Object.prototype.clone = MM_clone;

function MenuManager(sID)
{
	//Menu Properties
	this.id = sID;
	this.classMain = '';
	this.classPad = '';
	this.buttons = new Array();

	//Methods
	this.addButton = addButton;
	this.show = show;
	this.setSelectedLink = setSelectedLink;
	this.getButtonID = getButtonID;
}

function addButton(oMenuButton)
{
	this.buttons[this.buttons.length] = oMenuButton;
}

function show()
{
	var sHTMLCode =
		'<table cellspacing="0" ' +
		'cellpadding="0" border="0" ' +
		'class="' + this.classMain + '">';
	var sHTMLMouseOver;
	var sHTMLMouseOut;
	var sHTMLBorderLeft;
	var sHTMLBorderRight;
	var oTmp = null;

	for(var i = 0; i < this.buttons.length; i++)
	{
		sHTMLMouseOver = '';
		sHTMLMouseOut = '';
		sHTMLBorderLeft = '';
		sHTMLBorderRight = '';

		this.buttons[i].setSelected();

		if(this.buttons[i].hasSubMenu())
		{
			if(navigator.appVersion.match(/(Safari)/g) != null){ // es safari el navegador
				y = 20;
			}else{
				y = 30;
			}
			
			sHTMLMouseOver = 
				'MM_showMenu(aMM_Menu[' +
				aMM_Menu.length + '], 0, ' + 
				 + y + 
				', null, ' +
				'\'' + this.buttons[i].getMainID(this.id, i) + '\');';

			sHTMLMouseOut =
				'MM_startTimeout();';

			oTmp = this.buttons[i].submenu.createMenu(this.id);

			aMM_Menu[aMM_Menu.length] = oTmp;
		}

		sHTMLMouseOver += 
			' onMouseOver="' + sHTMLMouseOver +
			'MM_setClass(\'' + this.id + '\', '
			+ i + ', \'' +
			this.buttons[i].classLeftHL + '\', \'' +
			this.buttons[i].classMainHL + '\', \'' +
			this.buttons[i].classRightHL + '\', \'' +
			this.buttons[i].classFontHL + '\');" ';

		sHTMLMouseOut += 
			' onMouseOut="' + sHTMLMouseOut +
			'MM_setClass(\'' + this.id + '\', '
			+ i + ', \'' +
			this.buttons[i].classLeft + '\', \'' +
			this.buttons[i].classMain + '\', \'' +
			this.buttons[i].classRight + '\', \'' +
			this.buttons[i].classFont + '\');" ';

		if(this.buttons[i].classLeft)
			sHTMLBorderLeft =
				'<td class="' + this.buttons[i].classLeft + '" ' +
				'id="menu_' + this.id + '_left_id_' + i + '"' +
				sHTMLMouseOver +
				sHTMLMouseOut +
				'>&nbsp;</td>';

		if(this.buttons[i].classRight)
			sHTMLBorderRight =
				'<td class="' + this.buttons[i].classRight + '" ' +
				'id="menu_' + this.id + '_right_id_' + i + '"' +
				sHTMLMouseOver +
				sHTMLMouseOut +
				'>&nbsp;</td>';

		if(this.classPad && i < this.buttons.length - 1)
			sHTMLBorderRight +=
				'<td class="' + this.classPad + '"></td>';

		sHTMLCode +=
			sHTMLBorderLeft +
			'<td class="' + this.buttons[i].classMain + '" ' +
			'id="menu_' + this.id + '_main_id_' + i + '"' +
			sHTMLMouseOver +
			sHTMLMouseOut +
			'>' +
			this.buttons[i].getLink(this.id, i) +
			'</td>' +
			sHTMLBorderRight;
	}

	if(oTmp)
		oTmp.writeMenus();
	
	sHTMLCode += '</table>';

	//alert(sHTMLCode);
	document.write(sHTMLCode);
}

function setSelectedLink()
{
	var bSelected = false;

	for(var i = 0; i < this.buttons.length; i++)
	{
		if(	MM_getPageName(this.buttons[i].link) ==
			MM_getPageName(window.location.href) &&
			!this.buttons[i].blank)
			bSelected = true;
		else
		{
			if(this.buttons[i].hasSubMenu())
				for(var j = 0; j < this.buttons[i].submenu.items.length; j++)
					if(	MM_getPageName(this.buttons[i].submenu.items[j].link) ==
						MM_getPageName(window.location.href) &&
						!this.buttons[i].submenu.items[j].blank)
					{
						bSelected = true;
						break;
					}

		}

		if(bSelected)
		{
			this.buttons[i].selected = true;
			break;
		}
	}
}

function getButtonID(oButton, sType)
{
	var sID = -1;

	for(var i = 0; i < this.buttons.length; i++)
		if(oButton == this.buttons[i])
		{
			sID = i;
			break;
		}

	if(sType && sID != -1)
		sID = 'menu_' + this.id + '_' + sType + '_id_' + sID;

	return sID;
}
//Menu Button functions
function MenuButton(sLabel, sLink)
{
	//Properties
	this.label = sLabel;
	this.link = sLink;
	this.classLeft = '';
	this.classMain = '';
	this.classRight = '';
	this.classFont = '';
	this.classLeftHL = '';
	this.classMainHL = '';
	this.classRightHL = '';
	this.classFontHL = '';
	this.blank = false;
	this.js = false;
	this.submenu = null;
	this.selected = false;

	//Methods
	this.addSubMenu = addSubMenu;
	this.createSubMenu = createSubMenu;
	this.getLink = getLink;
	this.getMainID = getMainID;
	this.hasSubMenu = hasSubMenu;
	this.setSelected = setSelected;
}

function addSubMenu(oSubMenu)
{
	this.submenu = oSubMenu;
}

function createSubMenu()
{
	this.addSubMenu(new SubMenu());

	return this.submenu;
}

function getLink(sMenuID, sButtonID)
{
	var sLink = 
		'<font class="' + this.classFont + '" ' +
		'id="menu_' + sMenuID + '_font_id_' + sButtonID + '"' +
		'>' +
		(this.label ? this.label : '') +
		'</font>';

	if(this.link)
		sLink =
			'<a href="' + 
			(this.js ? 'javascript:' : '') +
			this.link + 
			(this.blank ? ' \" target="_blank"' : '') +
			'">' + sLink + '</a>';

	return sLink;	
}

function getMainID(sMenuID, sButtonID)
{
	var sMainID = '';

	if(this.classLeft)
		sMainID = 'menu_' + sMenuID + '_left_id_' + sButtonID;
	else
		sMainID = 'menu_' + sMenuID + '_main_id_' + sButtonID;

	return sMainID;
}

function hasSubMenu()
{
	return this.submenu && this.submenu.items.length > 0;
}

function setSelected()
{
	if(this.selected)
	{
		if(this.classLeftHL)
			this.classLeft = this.classLeftHL;
		if(this.classMainHL)
			this.classMain = this.classMainHL;
		if(this.classRightHL)
			this.classRight = this.classRightHL;
		if(this.classFontHL)
			this.classFont = this.classFontHL;
	}
}

//Class Submenu
function SubMenu()
{
	//Properties
	this.width = 0;
	this.height = 0;
	this.font = '';
	this.fontsize = 12;
	this.fontcolor = '';
	this.fontcolorhl = '';
	this.bgcolor = '';
	this.bgcolorhl = '';
	this.itempadding = 0;
	this.itemspacing = 0;
	this.timeout = 0;
	this.submenuxoffset = 0;
	this.submenuyoffset = 0;
	this.bgopaque = false;
	this.vertical = true;
	this.weight = 'normal';
	this.items = new Array();

	//Methods
	this.addSubMenuLink = addSubMenuLink;
	this.addItem = addItem;
	this.removeAllItems = removeAllItems;
	this.createMenu = createMenu;
}

function addSubMenuLink(oSubMenuLink)
{
	this.items[this.items.length] = oSubMenuLink;
}

function addItem(sLabel, sLink, bBlank, bJS)
{
	this.addSubMenuLink(new SubMenuLink(sLabel, sLink, bBlank, bJS));
}

function createMenu(sID)
{
	var oMenu = new Menu(
			sID,
			this.width,
			this.height,
			this.font,
			this.fontsize,
			this.fontcolor,
			this.fontcolorhl,
			this.bgcolor,
			this.bgcolorhl,
			'left',
			'middle',	
			this.itempadding,
			this.itemspacing,
			this.timeout,
			this.submenuxoffset,
			this.submenuyoffset,
			true,
			this.bgopaque,
			this.vertical,
			0,
			false,
			false,
			this.weight);

	oMenu.hideOnMouseOut = true;
	oMenu.menuBorder = 1;

	for(var i = 0; i < this.items.length; i++)
		oMenu.addMenuItem(this.items[i].getLabel(), this.items[i].getSubMenuLink());

	return oMenu;
}

function removeAllItems()
{
	this.items = new Array();
}

//Class SubMenuLink
function SubMenuLink(sLabel, sLink, bBlank, bJS)
{
	//Properties
	this.label = sLabel;
	this.link = sLink;
	this.blank = bBlank;
	this.js = bJS;

	//Methods
	this.getLabel = getLabel;
	this.getSubMenuLink = getSubMenuLink;
}

function getLabel()
{
	return this.label.replace(/ /g, '&nbsp;');
}

function getSubMenuLink()
{
	var sLink = '';

	if(this.link)
	{
		if(this.blank)
			sLink = 'window.open(\'' + this.link + '\')';
		else if(this.js)
			sLink = this.link;
		else
			sLink = 'location=\'' + this.link + '\'';
	}

	return sLink;
}
//Static functions
function MM_getPageName(sPageAll)
{
	var sPage = sPageAll ? sPageAll : '';

	//if(sPage.lastIndexOf('?') != -1)
	//	sPage = sPage.substr(0, sPage.lastIndexOf('?'));

	sPage = sPage.substr(sPage.lastIndexOf('/') + 1);

	if(!sPage)
		sPage = 'index.php';

	return sPage;
}

function MM_setClass(sMenuID, sButtonID, sClassLeft, sClassMain, sClassRight, sClassFont)
{
	MM_changeClass('menu_' + sMenuID + '_left_id_' + sButtonID, sClassLeft);
	MM_changeClass('menu_' + sMenuID + '_main_id_' + sButtonID, sClassMain);
	MM_changeClass('menu_' + sMenuID + '_right_id_' + sButtonID, sClassRight);
	MM_changeClass('menu_' + sMenuID + '_font_id_' + sButtonID, sClassFont);
}

function MM_changeClass(sID, sClass)
{
	var oTmp = FIND(sID);

	if(oTmp && sClass)
		oTmp.className = sClass;
}

function MM_clone()
{
	var objectClone = new this.constructor();

	for(var property in this)
		if(typeof this[property] == 'object' && this[property])
			objectClone[property] = this[property].clone();
		else
			objectClone[property] = this[property];
	
	return objectClone;
}


/*********************************menu.js***************************************/
var COOKIE_OPENADS = 'banneropenclose';
var DIV_OPENADS = 'banneropenclose';
var bIsClosed = false;//readCookie(COOKIE_OPENADS) == '1';
var sBannerToPad = '';

var aMenu = new MenuManager('main');

if(!sBaseHref)
	sBaseHref = '';

aMenu.classMain = 'tblUp';
aMenu.classPad = 'tblUpSep';

var aMenuButton = new MenuButton();

aMenuButton.classLeft = 'btnUpLeft';
aMenuButton.classLeftHL = 'btnUpLeftHL';
aMenuButton.classMain = 'btnUpMain';
aMenuButton.classMainHL = 'btnUpMainHL';
aMenuButton.classRight = 'btnUpRight';
aMenuButton.classRightHL = 'btnUpRightHL';

var aSubMenu = new SubMenu();

aSubMenu.font = 'Arial';
aSubMenu.width = 150;
aSubMenu.weight = 'bold';
aSubMenu.fontsize = 11;
aSubMenu.fontcolor = '#FFFFFF';
aSubMenu.fontcolorhl = '#1F6BA5';
aSubMenu.bgcolor = '#1F6BA5';
aSubMenu.bgcolorhl = '#D4E6FA';
aSubMenu.timeout = 1000;
aSubMenu.itempadding = 3;


//PORTADA
var aBtnPortada = aMenuButton.clone();
aBtnPortada.label = 'PORTADA';
aBtnPortada.link = sBaseHref + 'index.php';
aMenu.addButton(aBtnPortada);

//NOTICIAS
var aBtnNoticias = aMenuButton.clone();
aBtnNoticias.label = 'NOTICIAS';
aBtnNoticias.link = sBaseHref + 'noticias.php?cat=noticias';
aMenu.addButton(aBtnNoticias);

//CLIMA
var aBtnClima = aMenuButton.clone();
aBtnClima.label = 'CLIMA';
aBtnClima.link = sBaseHref + 'clima.php';
aMenu.addButton(aBtnClima);

//DEPORTES
var aBtnDeportes = aMenuButton.clone();
aBtnDeportes.label = 'DEPORTES';
aBtnDeportes.link = sBaseHref + 'noticias.php?cat=deportes';
aMenu.addButton(aBtnDeportes);

//ESPECTACULOS
//var aBtnEspectaculos = aMenuButton.clone();
//aBtnEspectaculos.label = 'ESPECT&Aacute;CULOS';
//aBtnEspectaculos.link = sBaseHref + 'notcat.php?cat=espect%E1culos';
//aMenu.addButton(aBtnEspectaculos);

/*var aBtnTVD = aMenuButton.clone();
aBtnTVD.classLeft = 'btnUpLeft2';
aBtnTVD.classLeftHL = 'btnUpLeftHL2';
aBtnTVD.classMain = 'btnUpMain2';
aBtnTVD.classMainHL = 'btnUpMainHL2';
aBtnTVD.classRight = 'btnUpRight2';
aBtnTVD.classRightHL = 'btnUpRightHL2';

aBtnTVD.label = 'TV DIGITAL';
aBtnTVD.link = sBaseHref + 'tvdigitalnew.php';
aMenu.addButton(aBtnTVD);*/


//TELEFUTURA
var aBtnPrograma = aMenuButton.clone();
aBtnPrograma.label = 'TELEFUTURA';
aBtnPrograma.link = sBaseHref + 'telefutura.php';
aMenu.addButton(aBtnPrograma);

//PROGRAMA SEMANAL
var aBtnPrograma = aMenuButton.clone();
aBtnPrograma.label = 'PROGRAMA SEMANAL';
aBtnPrograma.link = sBaseHref + 'quepasahoy.php';
aMenu.addButton(aBtnPrograma);

//PROMOCIONES
var aBtnPromociones = aMenuButton.clone();
aBtnPromociones.label = 'PROMOCIONES';
aBtnPromociones.link = sBaseHref + 'promociones.php';
aMenu.addButton(aBtnPromociones);

//SERVICIOS
var aBtnServicios = aMenuButton.clone();

var aMnuServicios = aSubMenu.clone();
aMnuServicios.addItem('REPORTE DE TRÁFICO', 'http://www.dot.ca.gov/dist11/d11tmc/sdmap/showmap.html', true);
aMnuServicios.addItem('HOROSCOPO', sBaseHref + 'horoscopo.php');
aMnuServicios.addItem('LOTERIA', sBaseHref + 'loteria.php');
aBtnServicios.addSubMenu(aMnuServicios);

aBtnServicios.label = 'SERVICIOS';
aMenu.addButton(aBtnServicios);

//COMUNIDAD
var aBtnComunidad = aMenuButton.clone();
var aMnuComunidad = aSubMenu.clone();
aMnuComunidad.addItem('CALENDARIO', sBaseHref + 'calendario.php?id=5');
aMnuComunidad.addItem('EVENTOS BICENTENARIO', sBaseHref + 'calendario.php?id=7');
aMnuComunidad.addItem('PRÁCTICAS', sBaseHref + 'empleos.php');
aMnuComunidad.addItem('EMPLEO', sBaseHref + 'jobs.php');
aMnuComunidad.addItem('DIRECTORIO COMUNITARIO', sBaseHref + 'dcomunitario.php');
aBtnComunidad.addSubMenu(aMnuComunidad);
aBtnComunidad.label = 'COMUNIDAD';
aMenu.addButton(aBtnComunidad);

//CONTACTO
var aBtnContacto = aMenuButton.clone();
aBtnContacto.label = 'CONTACTO';
aBtnContacto.link = sBaseHref + 'contacto.php';
aMenu.addButton(aBtnContacto);

//CIERRA AD
var aBtnAd = aMenuButton.clone();
aBtnAd.label = getOpenAdsLabel();
aBtnAd.link = 'openCloseAds();';
aBtnAd.js = true;
aBtnAd.classLeft = 'btnAdLeft';
aBtnAd.classLeftHL = 'btnAdLeft';
aBtnAd.classMain = 'btnAdMain';
aBtnAd.classMainHL = 'btnAdMain';
aBtnAd.classRight = 'btnAdRight';
aBtnAd.classRightHL = 'btnAdRight';
//aMenu.addButton(aBtnAd);

//COPA CONFEDERACIONES
/*
var aBtnCopaConf = aMenuButton.clone();
aBtnCopaConf.label = 'COPA<br/>DE ORO';
aBtnCopaConf.link = sBaseHref + 'channel_new.php?id=106';
aMenu.addButton(aBtnCopaConf);
var sButtonAdID = aMenu.getButtonID(aBtnAd, 'font');
*/

var aMenuSec = new MenuManager('sec');

aMenuSec.classMain = 'tblDown';
//aMenuSec.classMain = 'tblDownPatched';
var aSecButton = new MenuButton();

aSecButton.classLeft = 'btnDownLeft';
aSecButton.classMain = 'btnDownMain';
aSecButton.classRight = 'btnDownRight';

var aSecButton_res = new MenuButton();

aSecButton_res.classLeft = 'btnDownLeft_res';
aSecButton_res.classMain = 'btnDownMain_res';
aSecButton_res.classRight = 'btnDownRight_res';


var aBtnPM = aSecButton.clone();
aBtnPM.label = 'PAGA MENOS';
//aBtnPM.link = sBaseHref + 'redireccionar.html';
aBtnPM.link = sBaseHref + 'pagamenos.php';
aMenuSec.addButton(aBtnPM);


//SHOWS
//INMIGRACION
var aBtnINM = aSecButton.clone();
aBtnINM.label = 'INMIGRACION';
aBtnINM.classFont = 'fntDown17'
//aBtnINM.classFont = 'fntDownDisabled'
aBtnINM.link = sBaseHref + 'inmigracion.php';
aMenuSec.addButton(aBtnINM);



//DESPIERTA SAN DIEGO
var aBtnDSD = aSecButton.clone();
aBtnDSD.classFont = 'fntDownShows'
aBtnDSD.label = 'DESPIERTA SAN DIEGO';
aBtnDSD.link = sBaseHref + 'shows.php?id=15';
aMenuSec.addButton(aBtnDSD);

var aBtnN17 = aBtnDSD.clone();
aBtnN17.label = 'NOTICIAS 17';
aBtnN17.link = sBaseHref + 'shows.php?id=noticias17';
//aMenuSec.addButton(aBtnN17);

//AGENDA

var aBtnAgenda = aSecButton.clone();
aBtnAgenda.classFont = 'fntDownShows'
aBtnAgenda.label = 'AGENDA WASHINGTON';
aBtnAgenda.link = sBaseHref + 'agenda-washington.php?id=66';
aMenuSec.addButton(aBtnAgenda);


//TU NOTICIAS
var aBtnTuNoticias = aSecButton.clone();
aBtnTuNoticias.classFont = 'fntDownTuNoticias'
//aBtnTuNoticias.classFont = 'fntDownDisabled'
aBtnTuNoticias.label = 'TU NOTICIA';
aBtnTuNoticias.link = sBaseHref + 'tunoticia/website/';
//aMenuSec.addButton(aBtnTuNoticias);

//17 CONTIGO
var aBtn17 = aSecButton_res.clone();
aBtn17.classFont = 'fntDown17'
aBtn17.label = 'UNIVISION CONTIGO';
aBtn17.link = sBaseHref + 'el17contigo.php';
aMenuSec.addButton(aBtn17);

//BLOGS
var aBtnBlog = aSecButton.clone();
//aBtnBlog.classFont = 'fntDownDisabled'
aBtnBlog.classFont = 'fntDownBlogs'
aBtnBlog.label = 'CHISMEBLOG';
aBtnBlog.link = sBaseHref + 'blog/chismeblog/';
//aMenuSec.addButton(aBtnBlog);


var aBtnComunicarte = aBtnBlog.clone();
aBtnComunicarte.label = 'CONECTARTE';
aBtnComunicarte.link = sBaseHref + 'blog/conectarte/';
aMenuSec.addButton(aBtnComunicarte);


var aBtnTodon = aBtnBlog.clone();
aBtnTodon.label = 'TODO NOVELAS';
aBtnTodon.link = sBaseHref + 'todonovelas.php';
aMenuSec.addButton(aBtnTodon);

var aBtnModa = aBtnBlog.clone();
aBtnModa.label = 'FOTOS';
aBtnModa.link = sBaseHref + 'galeria-de-fotos.php';
aMenuSec.addButton(aBtnModa);


var aBtnM2O = aSecButton_res.clone();
aBtnM2O.label = 'CLUB CONTIGO';
aBtnM2O.classFont = 'fntDown17';
aBtnM2O.target='_blank';
aBtnM2O.link = 'http://clubcontigo.univisionsandiego.com';
aMenuSec.addButton(aBtnM2O);


//SELECT LINK
aMenu.setSelectedLink();

function preloadImages()
{
	MM_preloadImages('img/bot-arriba-izq.jpg', 'img/bot-arriba-medio.jpg', 'img/bot-arriba-der.jpg');
}

function getOpenAdsLabel()
{
	var sLabel;

	if(bIsClosed)
		sLabel = 'ABRE AD +';
	else
		sLabel = 'CIERRA AD -';

	return sLabel;
}

function printOpenClose(bOpen)
{
	try {
		if(bOpen)
		{
			FIND(DIV_OPENADS).style.visibility = 'visible';
			FIND(DIV_OPENADS).style.height = '106px';
			FIND(sButtonAdID).innerHTML = getOpenAdsLabel();
		}
		else
		{
			FIND(DIV_OPENADS).style.visibility = 'hidden';
			FIND(DIV_OPENADS).style.height = '0px';
			FIND(sButtonAdID).innerHTML = getOpenAdsLabel();
		}
	} catch(e) {
	}
}

function openCloseAds()
{
	bIsClosed = !bIsClosed;

	printOpenClose(!bIsClosed);

	createCookie(COOKIE_OPENADS, bIsClosed ? '1' : '0', 1);
}


/********************************************mm_menu.js***********************************************/

/**
 * mm_menu 20MAR2002 Version 6.0
 * Andy Finnell, March 2002
 * Copyright (c) 2000-2002 Macromedia, Inc.
 *
 * based on menu.js
 * by gary smith, July 1997
 * Copyright (c) 1997-1999 Netscape Communications Corp.
 *
 * Netscape grants you a royalty free license to use or modify this
 * software provided that this copyright notice appears on all copies.
 * This software is provided "AS IS," without a warranty of any kind.
 */
function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh, halgn, valgn, pad, space, to, sx, sy, srel, opq, vert, idt, aw, ah, fw) 
{
	this.version = "020320 [Menu; mm_menu.js]";
	this.type = "Menu";
	this.menuWidth = mw;
	this.menuItemHeight = mh;
	this.fontSize = fs;
	this.fontWeight = fw;
	this.fontFamily = fnt;
	this.fontColor = fclr;
	this.fontColorHilite = fhclr;
	this.bgColor = "#555555";
	this.menuBorder = 1;
	this.menuBgOpaque=opq;
	this.menuItemBorder = 1;
	this.menuItemIndent = idt;
	this.menuItemBgColor = bg;
	this.menuItemVAlign = valgn;
	this.menuItemHAlign = halgn;
	this.menuItemPadding = pad;
	this.menuItemSpacing = space;
	this.menuLiteBgColor = "#ffffff";
	this.menuBorderBgColor = "#777777";
	this.menuHiliteBgColor = bgh;
	this.menuContainerBgColor = "#cccccc";
	this.childMenuIcon = "arrows.gif";
	this.submenuXOffset = sx;
	this.submenuYOffset = sy;
	this.submenuRelativeToItem = srel;
	this.vertical = vert;
	this.items = new Array();
	this.actions = new Array();
	this.childMenus = new Array();
	this.hideOnMouseOut = true;
	this.hideTimeout = to;
	this.addMenuItem = addMenuItem;
	this.writeMenus = writeMenus;
	this.MM_showMenu = MM_showMenu;
	this.onMenuItemOver = onMenuItemOver;
	this.onMenuItemAction = onMenuItemAction;
	this.hideMenu = hideMenu;
	this.hideChildMenu = hideChildMenu;
	if (!window.menus) window.menus = new Array();
	this.label = " " + label;
	window.menus[this.label] = this;
	window.menus[window.menus.length] = this;
	if (!window.activeMenus) window.activeMenus = new Array();
}

function addMenuItem(label, action) {
	this.items[this.items.length] = label;
	this.actions[this.actions.length] = action;
}

function FIND(item) {
	if( window.mmIsOpera ) return(document.getElementById(item));
	if (document.all) return(document.all[item]);
	if (document.getElementById) return(document.getElementById(item));
	return(false);
}

function writeMenus(container) {
	if (window.triedToWriteMenus) return;
	var agt = navigator.userAgent.toLowerCase();
	window.mmIsOpera = agt.indexOf("opera") != -1;
	if (!container && document.layers) {
		window.delayWriteMenus = this.writeMenus;
		var timer = setTimeout('delayWriteMenus()', 500);
		container = new Layer(100);
		clearTimeout(timer);
	} else if (document.all || document.hasChildNodes || window.mmIsOpera) {
		document.writeln('<span id="menuContainer"></span>');
		container = FIND("menuContainer");
	}

	window.mmHideMenuTimer = null;
	if (!container) return;	
	window.triedToWriteMenus = true; 
	container.isContainer = true;
	container.menus = new Array();
	for (var i=0; i<window.menus.length; i++) 
		container.menus[i] = window.menus[i];
	window.menus.length = 0;
	var countMenus = 0;
	var countItems = 0;
	var top = 0;
	var content = '';
	var lrs = false;
	var theStat = "";
	var tsc = 0;
	if (document.layers) lrs = true;
	for (var i=0; i<container.menus.length; i++, countMenus++) {
		var menu = container.menus[i];
		if (menu.bgImageUp || !menu.menuBgOpaque) {
			menu.menuBorder = 0;
			menu.menuItemBorder = 0;
		}
		if (lrs) {
			var menuLayer = new Layer(100, container);
			var lite = new Layer(100, menuLayer);
			lite.top = menu.menuBorder;
			lite.left = menu.menuBorder;
			var body = new Layer(100, lite);
			body.top = menu.menuBorder;
			body.left = menu.menuBorder;
		} else {
			content += ''+
			'<div id="menuLayer'+ countMenus +'" style="position:absolute;z-index:1;left:10px;top:'+ (i * 100) +'px;visibility:hidden;color:' +  menu.menuBorderBgColor + ';">\n'+
			'  <div id="menuLite'+ countMenus +'" style="position:absolute;z-index:1;left:'+ menu.menuBorder +'px;top:'+ menu.menuBorder +'px;visibility:hide;" onmouseout="mouseoutMenu();">\n'+
			'	 <div id="menuFg'+ countMenus +'" style="position:absolute;left:'+ menu.menuBorder +'px;top:'+ menu.menuBorder +'px;visibility:hide;">\n'+
			'';
		}
		var x=i;
		for (var i=0; i<menu.items.length; i++) {
			var item = menu.items[i];
			var childMenu = false;
			var defaultHeight = menu.fontSize+2*menu.menuItemPadding;
			if (item.label) {
				item = item.label;
				childMenu = true;
			}
			menu.menuItemHeight = menu.menuItemHeight || defaultHeight;
			var itemProps = '';
			if( menu.fontFamily != '' ) itemProps += 'font-family:' + menu.fontFamily +';';
			itemProps += 'font-weight:' + menu.fontWeight + ';fontSize:' + menu.fontSize + 'px;';
			if (menu.fontStyle) itemProps += 'font-style:' + menu.fontStyle + ';';
			if (document.all || window.mmIsOpera) 
				itemProps += 'font-size:' + menu.fontSize + 'px;" onmouseover="onMenuItemOver(null,this);" onclick="onMenuItemAction(null,this);';
			else if (!document.layers) {
				itemProps += 'font-size:' + menu.fontSize + 'px;';
			}
			var l;
			if (lrs) {
				var lw = menu.menuWidth;
				if( menu.menuItemHAlign == 'right' ) lw -= menu.menuItemPadding;
				l = new Layer(lw,body);
			}
			var itemLeft = 0;
			var itemTop = i*menu.menuItemHeight;
			if( !menu.vertical ) {
				itemLeft = i*menu.menuWidth;
				itemTop = 0;
			}
			var dTag = '<div id="menuItem'+ countItems +'" style="position:absolute;left:' + itemLeft + 'px;top:'+ itemTop +'px;'+ itemProps +'">';
			var dClose = '</div>'
			if (menu.bgImageUp) dTag = '<div id="menuItem'+ countItems +'" style="background:url('+menu.bgImageUp+');position:absolute;left:' + itemLeft + 'px;top:'+ itemTop +'px;'+ itemProps +'">';

			var left = 0, top = 0, right = 0, bottom = 0;
			left = 1 + menu.menuItemPadding + menu.menuItemIndent;
			right = left + menu.menuWidth - 2*menu.menuItemPadding - menu.menuItemIndent;
			if( menu.menuItemVAlign == 'top' ) top = menu.menuItemPadding;
			if( menu.menuItemVAlign == 'bottom' ) top = menu.menuItemHeight-menu.fontSize-1-menu.menuItemPadding;
			if( menu.menuItemVAlign == 'middle' ) top = ((menu.menuItemHeight/2)-(menu.fontSize/2)-1);
			bottom = menu.menuItemHeight - 2*menu.menuItemPadding;
			var textProps = 'position:absolute;left:' + left + 'px;top:' + top + 'px;';
			if (lrs) {
				textProps +=itemProps + 'right:' + right + ';bottom:' + bottom + ';';
				dTag = "";
				dClose = "";
			}
			
			if(document.all && !window.mmIsOpera) {
				item = '<div align="' + menu.menuItemHAlign + '">' + item + '</div>';
			} else if (lrs) {
				item = '<div style="text-align:' + menu.menuItemHAlign + ';">' + item + '</div>';
			} else {
				var hitem = null;
				if( menu.menuItemHAlign != 'left' ) {
					if(window.mmIsOpera) {
						var operaWidth = menu.menuItemHAlign == 'center' ? -(menu.menuWidth-2*menu.menuItemPadding) : (menu.menuWidth-6*menu.menuItemPadding);
						hitem = '<div id="menuItemHilite' + countItems + 'Shim" style="position:absolute;top:1px;left:' + menu.menuItemPadding + 'px;width:' + operaWidth + 'px;text-align:' 
							+ menu.menuItemHAlign + ';visibility:visible;">' + item + '</div>';
						item = '<div id="menuItemText' + countItems + 'Shim" style="position:absolute;top:1px;left:' + menu.menuItemPadding + 'px;width:' + operaWidth + 'px;text-align:' 
							+ menu.menuItemHAlign + ';visibility:visible;">' + item + '</div>';
					} else {
						hitem = '<div id="menuItemHilite' + countItems + 'Shim" style="position:absolute;top:1px;left:1px;right:-' + (left+menu.menuWidth-3*menu.menuItemPadding) + 'px;text-align:' 
							+ menu.menuItemHAlign + ';visibility:visible;">' + item + '</div>';
						item = '<div id="menuItemText' + countItems + 'Shim" style="position:absolute;top:1px;left:1px;right:-' + (left+menu.menuWidth-3*menu.menuItemPadding) + 'px;text-align:' 
							+ menu.menuItemHAlign + ';visibility:visible;">' + item + '</div>';
					}
				} else hitem = null;
			}
			if(document.all && !window.mmIsOpera) item = '<div id="menuItemShim' + countItems + '" style="position:absolute;left:0px;top:0px;">' + item + '</div>';
			var dText	= '<div id="menuItemText'+ countItems +'" style="' + textProps + 'color:'+ menu.fontColor +';">'+ item +'&nbsp</div>\n'
						+ '<div id="menuItemHilite'+ countItems +'" style="' + textProps + 'color:'+ menu.fontColorHilite +';visibility:hidden;">' 
						+ (hitem||item) +'&nbsp</div>';
			if (childMenu) content += ( dTag + dText + '<div id="childMenu'+ countItems +'" style="position:absolute;left:0px;top:3px;"><img src="'+ menu.childMenuIcon +'"></div>\n' + dClose);
			else content += ( dTag + dText + dClose);
			if (lrs) {
				l.document.open("text/html");
				l.document.writeln(content);
				l.document.close();	
				content = '';
				theStat += "-";
				tsc++;
				if (tsc > 50) {
					tsc = 0;
					theStat = "";
				}
				status = theStat;
			}
			countItems++;  
		}
		if (lrs) {
			var focusItem = new Layer(100, body);
			focusItem.visiblity="hidden";
			focusItem.document.open("text/html");
			focusItem.document.writeln("&nbsp;");
			focusItem.document.close();	
		} else {
		  content += '	  <div id="focusItem'+ countMenus +'" style="position:absolute;left:0px;top:0px;visibility:hide;" onclick="onMenuItemAction(null,this);">&nbsp;</div>\n';
		  content += '   </div>\n  </div>\n</div>\n';
		}
		i=x;
	}
	if (document.layers) {		
		container.clip.width = window.innerWidth;
		container.clip.height = window.innerHeight;
		container.onmouseout = mouseoutMenu;
		container.menuContainerBgColor = this.menuContainerBgColor;
		for (var i=0; i<container.document.layers.length; i++) {
			proto = container.menus[i];
			var menu = container.document.layers[i];
			container.menus[i].menuLayer = menu;
			container.menus[i].menuLayer.Menu = container.menus[i];
			container.menus[i].menuLayer.Menu.container = container;
			var body = menu.document.layers[0].document.layers[0];
			body.clip.width = proto.menuWidth || body.clip.width;
			body.clip.height = proto.menuHeight || body.clip.height;
			for (var n=0; n<body.document.layers.length-1; n++) {
				var l = body.document.layers[n];
				l.Menu = container.menus[i];
				l.menuHiliteBgColor = proto.menuHiliteBgColor;
				l.document.bgColor = proto.menuItemBgColor;
				l.saveColor = proto.menuItemBgColor;
				l.onmouseover = proto.onMenuItemOver;
				l.onclick = proto.onMenuItemAction;
				l.mmaction = container.menus[i].actions[n];
				l.focusItem = body.document.layers[body.document.layers.length-1];
				l.clip.width = proto.menuWidth || body.clip.width;
				l.clip.height = proto.menuItemHeight || l.clip.height;
				if (n>0) {
					if( l.Menu.vertical ) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder + proto.menuItemSpacing;
					else l.left = body.document.layers[n-1].left + body.document.layers[n-1].clip.width + proto.menuItemBorder + proto.menuItemSpacing;
				}
				l.hilite = l.document.layers[1];
				if (proto.bgImageUp) l.background.src = proto.bgImageUp;
				l.document.layers[1].isHilite = true;
				if (l.document.layers.length > 2) {
					l.childMenu = container.menus[i].items[n].menuLayer;
					l.document.layers[2].left = l.clip.width -13;
					l.document.layers[2].top = (l.clip.height / 2) -4;
					l.document.layers[2].clip.left += 3;
					l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
				}
			}
			if( proto.menuBgOpaque ) body.document.bgColor = proto.bgColor;
			if( proto.vertical ) {
				body.clip.width  = l.clip.width +proto.menuBorder;
				body.clip.height = l.top + l.clip.height +proto.menuBorder;
			} else {
				body.clip.height  = l.clip.height +proto.menuBorder;
				body.clip.width = l.left + l.clip.width  +proto.menuBorder;
				if( body.clip.width > window.innerWidth ) body.clip.width = window.innerWidth;
			}
			var focusItem = body.document.layers[n];
			focusItem.clip.width = body.clip.width;
			focusItem.Menu = l.Menu;
			focusItem.top = -30;
            focusItem.captureEvents(Event.MOUSEDOWN);
            focusItem.onmousedown = onMenuItemDown;
			if( proto.menuBgOpaque ) menu.document.bgColor = proto.menuBorderBgColor;
			var lite = menu.document.layers[0];
			if( proto.menuBgOpaque ) lite.document.bgColor = proto.menuLiteBgColor;
			lite.clip.width = body.clip.width +1;
			lite.clip.height = body.clip.height +1;
			menu.clip.width = body.clip.width + (proto.menuBorder * 3) ;
			menu.clip.height = body.clip.height + (proto.menuBorder * 3);
		}
	} else {
		if ((!document.all) && (container.hasChildNodes) && !window.mmIsOpera) {
			container.innerHTML=content;
		} else {
			container.document.open("text/html");
			container.document.writeln(content);
			container.document.close();	
		}
		if (!FIND("menuLayer0")) return;
		var menuCount = 0;
		for (var x=0; x<container.menus.length; x++) {
			var menuLayer = FIND("menuLayer" + x);
			container.menus[x].menuLayer = "menuLayer" + x;
			menuLayer.Menu = container.menus[x];
			menuLayer.Menu.container = "menuLayer" + x;
			menuLayer.style.zindex = 1;
		    var s = menuLayer.style;
			s.pixeltop = -300;
			s.pixelleft = -300;
			s.top = '-300px';
			s.left = '-300px';

			var menu = container.menus[x];
			menu.menuItemWidth = menu.menuWidth || menu.menuIEWidth || 140;
			if( menu.menuBgOpaque ) menuLayer.style.backgroundColor = menu.menuBorderBgColor;
			var top = 0;
			var left = 0;
			menu.menuItemLayers = new Array();
			for (var i=0; i<container.menus[x].items.length; i++) {
				var l = FIND("menuItem" + menuCount);
				l.Menu = container.menus[x];
				l.Menu.menuItemLayers[l.Menu.menuItemLayers.length] = l;
				if (l.addEventListener || window.mmIsOpera) {
					l.style.width = menu.menuItemWidth + 'px';
					l.style.height = menu.menuItemHeight + 'px';
					l.style.pixelWidth = menu.menuItemWidth;
					l.style.pixelHeight = menu.menuItemHeight;
					l.style.top = top + 'px';
					l.style.left = left + 'px';
					if(l.addEventListener) {
						l.addEventListener("mouseover", onMenuItemOver, false);
						l.addEventListener("click", onMenuItemAction, false);
						l.addEventListener("mouseout", mouseoutMenu, false);
					}
					if( menu.menuItemHAlign != 'left' ) {
						l.hiliteShim = FIND("menuItemHilite" + menuCount + "Shim");
						l.hiliteShim.style.visibility = "inherit";
						l.textShim = FIND("menuItemText" + menuCount + "Shim");
						l.hiliteShim.style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent;
						l.hiliteShim.style.width = l.hiliteShim.style.pixelWidth;
						l.textShim.style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent;
						l.textShim.style.width = l.textShim.style.pixelWidth;	
					}
				} else {
					l.style.pixelWidth = menu.menuItemWidth;
					l.style.pixelHeight = menu.menuItemHeight;
					l.style.pixelTop = top;
					l.style.pixelLeft = left;
					if( menu.menuItemHAlign != 'left' ) {
						var shim = FIND("menuItemShim" + menuCount);
						shim[0].style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent;
						shim[1].style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent;
						shim[0].style.width = shim[0].style.pixelWidth + 'px';
						shim[1].style.width = shim[1].style.pixelWidth + 'px';
					}
				}
				if( menu.vertical ) top = top + menu.menuItemHeight+menu.menuItemBorder+menu.menuItemSpacing;
				else left = left + menu.menuItemWidth+menu.menuItemBorder+menu.menuItemSpacing;
				l.style.fontSize = menu.fontSize + 'px';
				l.style.backgroundColor = menu.menuItemBgColor;
				l.style.visibility = "inherit";
				l.saveColor = menu.menuItemBgColor;
				l.menuHiliteBgColor = menu.menuHiliteBgColor;
				l.mmaction = container.menus[x].actions[i];
				l.hilite = FIND("menuItemHilite" + menuCount);
				l.focusItem = FIND("focusItem" + x);
				l.focusItem.style.pixelTop = -30;
				l.focusItem.style.top = '-30px';
				var childItem = FIND("childMenu" + menuCount);
				if (childItem) {
					l.childMenu = container.menus[x].items[i].menuLayer;
					childItem.style.pixelLeft = menu.menuItemWidth -11;
					childItem.style.left = childItem.style.pixelLeft + 'px';
					childItem.style.pixelTop = (menu.menuItemHeight /2) -4;
					childItem.style.top = childItem.style.pixelTop + 'px';
					l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
				}
				l.style.cursor = "pointer";
				menuCount++;
			}
			if( menu.vertical ) {
				menu.menuHeight = top-1-menu.menuItemSpacing;
				menu.menuWidth = menu.menuItemWidth;
			} else {
				menu.menuHeight = menu.menuItemHeight;
				menu.menuWidth = left-1-menu.menuItemSpacing;
			}

			var lite = FIND("menuLite" + x);
			var s = lite.style;
			s.pixelHeight = menu.menuHeight +(menu.menuBorder * 2);
			s.height = s.pixelHeight + 'px';
			s.pixelWidth = menu.menuWidth + (menu.menuBorder * 2);
			s.width = s.pixelWidth + 'px';
			if( menu.menuBgOpaque ) s.backgroundColor = menu.menuLiteBgColor;

			var body = FIND("menuFg" + x);
			s = body.style;
			s.pixelHeight = menu.menuHeight + menu.menuBorder;
			s.height = s.pixelHeight + 'px';
			s.pixelWidth = menu.menuWidth + menu.menuBorder;
			s.width = s.pixelWidth + 'px';
			if( menu.menuBgOpaque ) s.backgroundColor = menu.bgColor;

			s = menuLayer.style;
			s.pixelWidth  = menu.menuWidth + (menu.menuBorder * 4);
			s.width = s.pixelWidth + 'px';
			s.pixelHeight  = menu.menuHeight+(menu.menuBorder*4);
			s.height = s.pixelHeight + 'px';
		}
	}
	if (document.captureEvents) document.captureEvents(Event.MOUSEUP);
	if (document.addEventListener) document.addEventListener("mouseup", onMenuItemOver, false);
	if (document.layers && window.innerWidth) {
		window.onresize = NS4resize;
		window.NS4sIW = window.innerWidth;
		window.NS4sIH = window.innerHeight;
		setTimeout("NS4resize()",500);
	}
	document.onmouseup = mouseupMenu;
	window.mmWroteMenu = true;
	status = "";
}

function NS4resize() {
	if (NS4sIW != window.innerWidth || NS4sIH != window.innerHeight) window.location.reload();
}

function onMenuItemOver(e, l) {
	MM_clearTimeout();
	l = l || this;
	var a = window.ActiveMenuItem;
	if (document.layers) {
		if (a) {
			a.document.bgColor = a.saveColor;
			if (a.hilite) a.hilite.visibility = "hidden";
			if (a.Menu.bgImageOver) a.background.src = a.Menu.bgImageUp;
			a.focusItem.top = -100;
			a.clicked = false;
		}
		if (l.hilite) {
			l.document.bgColor = l.menuHiliteBgColor;
			l.zIndex = 1;
			l.hilite.visibility = "inherit";
			l.hilite.zIndex = 2;
			l.document.layers[1].zIndex = 1;
			l.focusItem.zIndex = this.zIndex +2;
		}
		if (l.Menu.bgImageOver) l.background.src = l.Menu.bgImageOver;
		l.focusItem.top = this.top;
		l.focusItem.left = this.left;
		l.focusItem.clip.width = l.clip.width;
		l.focusItem.clip.height = l.clip.height;
		l.Menu.hideChildMenu(l);
	} else if (l.style && l.Menu) {
		if (a) {
			a.style.backgroundColor = a.saveColor;
			if (a.hilite) a.hilite.style.visibility = "hidden";
			if (a.hiliteShim) a.hiliteShim.style.visibility = "inherit";
			if (a.Menu.bgImageUp) a.style.background = "url(" + a.Menu.bgImageUp +")";;
		} 
		l.style.backgroundColor = l.menuHiliteBgColor;
		l.zIndex = 1;
		if (l.Menu.bgImageOver) l.style.background = "url(" + l.Menu.bgImageOver +")";
		if (l.hilite) {
			l.hilite.style.visibility = "inherit";
			if( l.hiliteShim ) l.hiliteShim.style.visibility = "visible";
		}
		l.focusItem.style.pixelTop = l.style.pixelTop;
		l.focusItem.style.top = l.focusItem.style.pixelTop + 'px';
		l.focusItem.style.pixelLeft = l.style.pixelLeft;
		l.focusItem.style.left = l.focusItem.style.pixelLeft + 'px';
		l.focusItem.style.zIndex = l.zIndex +1;
		l.Menu.hideChildMenu(l);
	} else return;
	window.ActiveMenuItem = l;
}

function onMenuItemAction(e, l) {
	l = window.ActiveMenuItem;
	if (!l) return;
	hideActiveMenus();
	if (l.mmaction) eval("" + l.mmaction);
	window.ActiveMenuItem = 0;
}

function MM_clearTimeout() {
	if (mmHideMenuTimer) clearTimeout(mmHideMenuTimer);
	mmHideMenuTimer = null;
	mmDHFlag = false;
}

function MM_startTimeout() {
	if( window.ActiveMenu ) {
		mmStart = new Date();
		mmDHFlag = true;
		mmHideMenuTimer = setTimeout("mmDoHide()", window.ActiveMenu.Menu.hideTimeout);
	}
}

function mmDoHide() {
	if (!mmDHFlag || !window.ActiveMenu) return;
	var elapsed = new Date() - mmStart;
	var timeout = window.ActiveMenu.Menu.hideTimeout;
	if (elapsed < timeout) {
		mmHideMenuTimer = setTimeout("mmDoHide()", timeout+100-elapsed);
		return;
	}
	mmDHFlag = false;
	hideActiveMenus();
	window.ActiveMenuItem = 0;
}

function MM_showMenu(menu, x, y, child, imgname) {
	if (!window.mmWroteMenu) return;
	MM_clearTimeout();
	if (menu) {
		var obj = FIND(imgname) || document.images[imgname] || document.links[imgname] || document.anchors[imgname];
		x = moveXbySlicePos (x, obj);
		y = moveYbySlicePos (y, obj);
	}
	if (document.layers) {
		if (menu) {
			var l = menu.menuLayer || menu;
			l.top = l.left = 1;
			hideActiveMenus();
			if (this.visibility) l = this;
			window.ActiveMenu = l;
		} else {
			var l = child;
		}
		if (!l) return;
		for (var i=0; i<l.layers.length; i++) { 			   
			if (!l.layers[i].isHilite) l.layers[i].visibility = "inherit";
			if (l.layers[i].document.layers.length > 0) MM_showMenu(null, "relative", "relative", l.layers[i]);
		}
		if (l.parentLayer) {
			if (x != "relative") l.parentLayer.left = x || window.pageX || 0;
			if (l.parentLayer.left + l.clip.width > window.innerWidth) l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth);
			if (y != "relative") l.parentLayer.top = y || window.pageY || 0;
			if (l.parentLayer.isContainer) {
				l.Menu.xOffset = window.pageXOffset;
				l.Menu.yOffset = window.pageYOffset;
				l.parentLayer.clip.width = window.ActiveMenu.clip.width +2;
				l.parentLayer.clip.height = window.ActiveMenu.clip.height +2;
				if (l.parentLayer.menuContainerBgColor && l.Menu.menuBgOpaque ) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor;
			}
		}
		l.visibility = "inherit";
		if (l.Menu) l.Menu.container.visibility = "inherit";
	} else if (FIND("menuItem0")) {
		var l = menu.menuLayer || menu;	
		hideActiveMenus();
		if (typeof(l) == "string") l = FIND(l);
		window.ActiveMenu = l;
		var s = l.style;
		s.visibility = "inherit";
		if (x != "relative") {
			s.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0;
			s.left = s.pixelLeft + 'px';
		}
		if (y != "relative") {
			s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0;
			s.top = s.pixelTop + 'px';
		}
		l.Menu.xOffset = document.body.scrollLeft;
		l.Menu.yOffset = document.body.scrollTop;
	}
	if (menu) window.activeMenus[window.activeMenus.length] = l;
	MM_clearTimeout();
}

function onMenuItemDown(e, l) {
	var a = window.ActiveMenuItem;
	if (document.layers && a) {
		a.eX = e.pageX;
		a.eY = e.pageY;
		a.clicked = true;
    }
}

function mouseupMenu(e) {
	hideMenu(true, e);
	hideActiveMenus();
	return true;
}

function getExplorerVersion() {
	var ieVers = parseFloat(navigator.appVersion);
	if( navigator.appName != 'Microsoft Internet Explorer' ) return ieVers;
	var tempVers = navigator.appVersion;
	var i = tempVers.indexOf( 'MSIE ' );
	if( i >= 0 ) {
		tempVers = tempVers.substring( i+5 );
		ieVers = parseFloat( tempVers ); 
	}
	return ieVers;
}

function mouseoutMenu() {
	if ((navigator.appName == "Microsoft Internet Explorer") && (getExplorerVersion() < 4.5))
		return true;
	hideMenu(false, false);
	return true;
}

function hideMenu(mouseup, e) {
	var a = window.ActiveMenuItem;
	if (a && document.layers) {
		a.document.bgColor = a.saveColor;
		a.focusItem.top = -30;
		if (a.hilite) a.hilite.visibility = "hidden";
		if (mouseup && a.mmaction && a.clicked && window.ActiveMenu) {
 			if (a.eX <= e.pageX+15 && a.eX >= e.pageX-15 && a.eY <= e.pageY+10 && a.eY >= e.pageY-10) {
				setTimeout('window.ActiveMenu.Menu.onMenuItemAction();', 500);
			}
		}
		a.clicked = false;
		if (a.Menu.bgImageOver) a.background.src = a.Menu.bgImageUp;
	} else if (window.ActiveMenu && FIND("menuItem0")) {
		if (a) {
			a.style.backgroundColor = a.saveColor;
			if (a.hilite) a.hilite.style.visibility = "hidden";
			if (a.hiliteShim) a.hiliteShim.style.visibility = "inherit";
			if (a.Menu.bgImageUp) a.style.background = "url(" + a.Menu.bgImageUp +")";
		}
	}
	if (!mouseup && window.ActiveMenu) {
		if (window.ActiveMenu.Menu) {
			if (window.ActiveMenu.Menu.hideOnMouseOut) MM_startTimeout();
			return(true);
		}
	}
	return(true);
}

function hideChildMenu(hcmLayer) {
	MM_clearTimeout();
	var l = hcmLayer;
	for (var i=0; i < l.Menu.childMenus.length; i++) {
		var theLayer = l.Menu.childMenus[i];
		if (document.layers) theLayer.visibility = "hidden";
		else {
			theLayer = FIND(theLayer);
			theLayer.style.visibility = "hidden";
			if( theLayer.Menu.menuItemHAlign != 'left' ) {
				for(var j = 0; j < theLayer.Menu.menuItemLayers.length; j++) {
					var itemLayer = theLayer.Menu.menuItemLayers[j];
					if(itemLayer.textShim) itemLayer.textShim.style.visibility = "inherit";
				}
			}
		}
		theLayer.Menu.hideChildMenu(theLayer);
	}
	if (l.childMenu) {
		var childMenu = l.childMenu;
		if (document.layers) {
			l.Menu.MM_showMenu(null,null,null,childMenu.layers[0]);
			childMenu.zIndex = l.parentLayer.zIndex +1;
			childMenu.top = l.Menu.menuLayer.top + l.Menu.submenuYOffset;
			if( l.Menu.vertical ) {
				if( l.Menu.submenuRelativeToItem ) childMenu.top += l.top + l.parentLayer.top;
				childMenu.left = l.parentLayer.left + l.parentLayer.clip.width - (2*l.Menu.menuBorder) + l.Menu.menuLayer.left + l.Menu.submenuXOffset;
			} else {
				childMenu.top += l.top + l.parentLayer.top;	
				if( l.Menu.submenuRelativeToItem ) childMenu.left = l.Menu.menuLayer.left + l.left + l.clip.width + (2*l.Menu.menuBorder) + l.Menu.submenuXOffset;
				else childMenu.left = l.parentLayer.left + l.parentLayer.clip.width - (2*l.Menu.menuBorder) + l.Menu.menuLayer.left + l.Menu.submenuXOffset;
			}
			if( childMenu.left < l.Menu.container.clip.left ) l.Menu.container.clip.left = childMenu.left;
			var w = childMenu.clip.width+childMenu.left-l.Menu.container.clip.left;
			if (w > l.Menu.container.clip.width)  l.Menu.container.clip.width = w;
			var h = childMenu.clip.height+childMenu.top-l.Menu.container.clip.top;
			if (h > l.Menu.container.clip.height) l.Menu.container.clip.height = h;
			l.document.layers[1].zIndex = 0;
			childMenu.visibility = "inherit";
		} else if (FIND("menuItem0")) {
			childMenu = FIND(l.childMenu);
			var menuLayer = FIND(l.Menu.menuLayer);
			var s = childMenu.style;
			s.zIndex = menuLayer.style.zIndex+1;
			if (document.all || window.mmIsOpera) {
				s.pixelTop = menuLayer.style.pixelTop + l.Menu.submenuYOffset;
				if( l.Menu.vertical ) {
					if( l.Menu.submenuRelativeToItem ) s.pixelTop += l.style.pixelTop;
					s.pixelLeft = l.style.pixelWidth + menuLayer.style.pixelLeft + l.Menu.submenuXOffset;
					s.left = s.pixelLeft + 'px';
				} else {
					s.pixelTop += l.style.pixelTop;
					if( l.Menu.submenuRelativeToItem ) s.pixelLeft = menuLayer.style.pixelLeft + l.style.pixelLeft + l.style.pixelWidth + (2*l.Menu.menuBorder) + l.Menu.submenuXOffset;
					else s.pixelLeft = (menuLayer.style.pixelWidth-4*l.Menu.menuBorder) + menuLayer.style.pixelLeft + l.Menu.submenuXOffset;
					s.left = s.pixelLeft + 'px';
				}
			} else {
				var top = parseInt(menuLayer.style.top) + l.Menu.submenuYOffset;
				var left = 0;
				if( l.Menu.vertical ) {
					if( l.Menu.submenuRelativeToItem ) top += parseInt(l.style.top);
					left = (parseInt(menuLayer.style.width)-4*l.Menu.menuBorder) + parseInt(menuLayer.style.left) + l.Menu.submenuXOffset;
				} else {
					top += parseInt(l.style.top);
					if( l.Menu.submenuRelativeToItem ) left = parseInt(menuLayer.style.left) + parseInt(l.style.left) + parseInt(l.style.width) + (2*l.Menu.menuBorder) + l.Menu.submenuXOffset;
					else left = (parseInt(menuLayer.style.width)-4*l.Menu.menuBorder) + parseInt(menuLayer.style.left) + l.Menu.submenuXOffset;
				}
				s.top = top + 'px';
				s.left = left + 'px';
			}
			childMenu.style.visibility = "inherit";
		} else return;
		window.activeMenus[window.activeMenus.length] = childMenu;
	}
}

function hideActiveMenus() {
	if (!window.activeMenus) return;
	for (var i=0; i < window.activeMenus.length; i++) {
		if (!activeMenus[i]) continue;
		if (activeMenus[i].visibility && activeMenus[i].Menu && !window.mmIsOpera) {
			activeMenus[i].visibility = "hidden";
			activeMenus[i].Menu.container.visibility = "hidden";
			activeMenus[i].Menu.container.clip.left = 0;
		} else if (activeMenus[i].style) {
			var s = activeMenus[i].style;
			s.visibility = "hidden";
			s.left = '-200px';
			s.top = '-200px';
		}
	}
	if (window.ActiveMenuItem) hideMenu(false, false);
	window.activeMenus.length = 0;
}

function moveXbySlicePos (x, img) { 
	if (!document.layers) {
		var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
		var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
		var par = img;
		var lastOffset = 0;
		while(par){
			if( par.leftMargin && ! onWindows ) x += parseInt(par.leftMargin);
			if( (par.offsetLeft != lastOffset) && par.offsetLeft ) x += parseInt(par.offsetLeft);
			if( par.offsetLeft != 0 ) lastOffset = par.offsetLeft;
			par = macIE45 ? par.parentElement : par.offsetParent;
		}
	} else if (img.x) x += img.x;
	return x;
}

function moveYbySlicePos (y, img) {
	if(!document.layers) {
		var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
		var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
		var par = img;
		var lastOffset = 0;
		while(par){
			if( par.topMargin && !onWindows ) y += parseInt(par.topMargin);
			if( (par.offsetTop != lastOffset) && par.offsetTop ) y += parseInt(par.offsetTop);
			if( par.offsetTop != 0 ) lastOffset = par.offsetTop;
			par = macIE45 ? par.parentElement : par.offsetParent;
		}		
	} else if (img.y >= 0) y += img.y;
	return y;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) { x.src=x.oSrc; x.style.cursor = 'default'; }
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2]; x.style.cursor = 'pointer';}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

/******************************************modal-message.js*****************************************************/
/************************************************************************************************************
*	DHTML modal dialog box
*
*	Created:						August, 26th, 2006
*	@class Purpose of class:		Display a modal dialog box on the screen.
*			
*	Css files used by this script:	modal-message.css
*
*	Demos of this class:			demo-modal-message-1.html
*
* 	Update log:
*
************************************************************************************************************/


/**
* @constructor
*/

DHTML_modalMessage = function()
{
	var url;								// url of modal message
	var htmlOfModalMessage;					// html of modal message
	
	var divs_transparentDiv;				// Transparent div covering page content
	var divs_content;						// Modal message div.
	var iframe;								// Iframe used in ie
	var layoutCss;							// Name of css file;
	var width;								// Width of message box
	var height;								// Height of message box
	
	var existingBodyOverFlowStyle;			// Existing body overflow css
	var dynContentObj;						// Reference to dynamic content object
	var cssClassOfMessageBox;				// Alternative css class of message box - in case you want a different appearance on one of them
	var shadowDivVisible;					// Shadow div visible ? 
	var shadowOffset; 						// X and Y offset of shadow(pixels from content box)
	var MSIE;
		
	this.url = '';							// Default url is blank
	this.htmlOfModalMessage = '';			// Default message is blank
	this.layoutCss = 'modal-message.css';	// Default CSS file
	this.height = 200;						// Default height of modal message
	this.width = 400;						// Default width of modal message
	this.cssClassOfMessageBox = false;		// Default alternative css class for the message box
	this.shadowDivVisible = true;			// Shadow div is visible by default
	this.shadowOffset = 5;					// Default shadow offset.
	this.MSIE = false;
	if(navigator.userAgent.indexOf('MSIE')>=0) this.MSIE = true;
	

}

DHTML_modalMessage.prototype = {
	// {{{ setSource(urlOfSource)
    /**
     *	Set source of the modal dialog box
     * 	
     *
     * @public	
     */		
	setSource : function(urlOfSource)
	{
		this.url = urlOfSource;
		
	}	
	// }}}	
	,
	// {{{ setHtmlContent(newHtmlContent)
    /**
     *	Setting static HTML content for the modal dialog box.
     * 	
     *	@param String newHtmlContent = Static HTML content of box
     *
     * @public	
     */		
	setHtmlContent : function(newHtmlContent)
	{
		this.htmlOfModalMessage = newHtmlContent;
		
	}
	// }}}		
	,
	// {{{ setSize(width,height)
    /**
     *	Set the size of the modal dialog box
     * 	
     *	@param int width = width of box
     *	@param int height = height of box
     *
     * @public	
     */		
	setSize : function(width,height)
	{
		if(width)this.width = width;
		if(height)this.height = height;		
	}
	// }}}		
	,		
	// {{{ setCssClassMessageBox(newCssClass)
    /**
     *	Assign the message box to a new css class.(in case you wants a different appearance on one of them)
     * 	
     *	@param String newCssClass = Name of new css class (Pass false if you want to change back to default)
     *
     * @public	
     */		
	setCssClassMessageBox : function(newCssClass)
	{
		this.cssClassOfMessageBox = newCssClass;
		if(this.divs_content){
			if(this.cssClassOfMessageBox)
				this.divs_content.className=this.cssClassOfMessageBox;
			else
				this.divs_content.className='modalDialog_contentDiv';	
		}
					
	}
	// }}}		
	,	
	// {{{ setShadowOffset(newShadowOffset)
    /**
     *	Specify the size of shadow
     * 	
     *	@param Int newShadowOffset = Offset of shadow div(in pixels from message box - x and y)
     *
     * @public	
     */		
	setShadowOffset : function(newShadowOffset)
	{
		this.shadowOffset = newShadowOffset
					
	}
	// }}}		
	,	
	// {{{ display()
    /**
     *	Display the modal dialog box
     * 	
     *
     * @public	
     */		
	display : function()
	{
		if(!this.divs_transparentDiv){
			this.__createDivs();
		}	
		
		// Redisplaying divs
		this.divs_transparentDiv.style.display='block';
		this.divs_content.style.display='block';
		this.divs_shadow.style.display='block';		
		if(this.MSIE)this.iframe.style.display='block';	
		this.__resizeDivs();
		
		/* Call the __resizeDivs method twice in case the css file has changed. The first execution of this method may not catch these changes */
		window.refToThisModalBoxObj = this;		
		setTimeout('window.refToThisModalBoxObj.__resizeDivs()',150);
		
		this.__insertContent();	// Calling method which inserts content into the message div.
	}
	// }}}		
	,
	// {{{ ()
    /**
     *	Display the modal dialog box
     * 	
     *
     * @public	
     */		
	setShadowDivVisible : function(visible)
	{
		this.shadowDivVisible = visible;
	}
	// }}}	
	,
	// {{{ close()
    /**
     *	Close the modal dialog box
     * 	
     *
     * @public	
     */		
	close : function()
	{
		//document.documentElement.style.overflow = '';	// Setting the CSS overflow attribute of the <html> tag back to default.
		
		/* Hiding divs */
		this.divs_transparentDiv.style.display='none';
		this.divs_content.style.display='none';
		this.divs_shadow.style.display='none';
		if(this.MSIE)this.iframe.style.display='none';
		
	}	
	// }}}	
	,
	// {{{ __addEvent()
    /**
     *	Add event
     * 	
     *
     * @private	
     */		
	addEvent : function(whichObject,eventType,functionName,suffix)
	{ 
	  if(!suffix)suffix = '';
	  if(whichObject.attachEvent){ 
	    whichObject['e'+eventType+functionName+suffix] = functionName; 
	    whichObject[eventType+functionName+suffix] = function(){whichObject['e'+eventType+functionName+suffix]( window.event );} 
	    whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName+suffix] ); 
	  } else 
	    whichObject.addEventListener(eventType,functionName,false); 	    
	} 
	// }}}	
	,
	// {{{ __createDivs()
    /**
     *	Create the divs for the modal dialog box
     * 	
     *
     * @private	
     */		
	__createDivs : function()
	{
		// Creating transparent div
		this.divs_transparentDiv = document.createElement('DIV');
		this.divs_transparentDiv.className='modalDialog_transparentDivs';
		this.divs_transparentDiv.style.left = '0px';
		this.divs_transparentDiv.style.top = '0px';
		
		document.body.appendChild(this.divs_transparentDiv);
		// Creating content div
		this.divs_content = document.createElement('DIV');
		this.divs_content.className = 'modalDialog_contentDiv';
		this.divs_content.id = 'DHTMLSuite_modalBox_contentDiv';
		this.divs_content.style.zIndex = 100000;
		
		if(this.MSIE){
			this.iframe = document.createElement('<IFRAME src="about:blank" frameborder=0>');
			this.iframe.style.zIndex = 90000;
			this.iframe.style.position = 'absolute';
			document.body.appendChild(this.iframe);	
		}
			
		document.body.appendChild(this.divs_content);
		// Creating shadow div
		this.divs_shadow = document.createElement('DIV');
		this.divs_shadow.className = 'modalDialog_contentDiv_shadow';
		this.divs_shadow.style.zIndex = 95000;
		document.body.appendChild(this.divs_shadow);
		window.refToModMessage = this;
		this.addEvent(window,'scroll',function(e){ window.refToModMessage.__repositionTransparentDiv() });
		this.addEvent(window,'resize',function(e){ window.refToModMessage.__repositionTransparentDiv() });
		

	}
	// }}}
	,
	// {{{ __getBrowserSize()
    /**
     *	Get browser size
     * 	
     *
     * @private	
     */		
	__getBrowserSize : function()
	{
    	var bodyWidth = document.documentElement.clientWidth;
    	var bodyHeight = document.documentElement.clientHeight;
    	
		var bodyWidth, bodyHeight; 
		if (self.innerHeight){ // all except Explorer 
		 
		   bodyWidth = self.innerWidth; 
		   bodyHeight = self.innerHeight; 
		}  else if (document.documentElement && document.documentElement.clientHeight) {
		   // Explorer 6 Strict Mode 		 
		   bodyWidth = document.documentElement.clientWidth; 
		   bodyHeight = document.documentElement.clientHeight; 
		} else if (document.body) {// other Explorers 		 
		   bodyWidth = document.body.clientWidth; 
		   bodyHeight = document.body.clientHeight; 
		} 
		return [bodyWidth,bodyHeight];		
		
	}
	// }}}	
	,
	// {{{ __resizeDivs()
    /**
     *	Resize the message divs
     * 	
     *
     * @private	
     */	
    __resizeDivs : function()
    {
    	
    	var topOffset = Math.max(document.body.scrollTop,document.documentElement.scrollTop);

		if(this.cssClassOfMessageBox)
			this.divs_content.className=this.cssClassOfMessageBox;
		else
			this.divs_content.className='modalDialog_contentDiv';	
			    	
    	if(!this.divs_transparentDiv)return;
    	
    	// Preserve scroll position
    	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    	var sl = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
    	
    	window.scrollTo(sl,st);
    	setTimeout('window.scrollTo(' + sl + ',' + st + ');',10);

    	this.__repositionTransparentDiv();
    	

		var brSize = this.__getBrowserSize();
		var bodyWidth = brSize[0];
		var bodyHeight = brSize[1];
    	
    	// Setting width and height of content div
      	this.divs_content.style.width = this.width + 'px';
    	this.divs_content.style.height= this.height + 'px';  	
    	
    	// Creating temporary width variables since the actual width of the content div could be larger than this.width and this.height(i.e. padding and border)
    	var tmpWidth = this.divs_content.offsetWidth;	
    	var tmpHeight = this.divs_content.offsetHeight;
    	
    	
    	// Setting width and height of left transparent div
    	
    	

    	
    	
		
    	this.divs_content.style.left = Math.ceil((bodyWidth - tmpWidth) / 2) + 'px';;
    	this.divs_content.style.top = (Math.ceil((bodyHeight - tmpHeight) / 2) +  topOffset) + 'px';
    	
 		if(this.MSIE){
 			this.iframe.style.left = this.divs_content.style.left;
 			this.iframe.style.top = this.divs_content.style.top;
 			this.iframe.style.width = this.divs_content.style.width;
 			this.iframe.style.height = this.divs_content.style.height;
 		}
 		
    	this.divs_shadow.style.left = (this.divs_content.style.left.replace('px','')/1 + this.shadowOffset) + 'px';
    	this.divs_shadow.style.top = (this.divs_content.style.top.replace('px','')/1 + this.shadowOffset) + 'px';
    	this.divs_shadow.style.height = tmpHeight + 'px';
    	this.divs_shadow.style.width = tmpWidth + 'px';
    	
    	
    	
    	if(!this.shadowDivVisible)this.divs_shadow.style.display='none';	// Hiding shadow if it has been disabled
    	
    	
    }
    // }}}	
    ,
	// {{{ __insertContent()
    /**
     *	Insert content into the content div
     * 	
     *
     * @private	
     */	    
    __repositionTransparentDiv : function()
    {
    	this.divs_transparentDiv.style.top = Math.max(document.body.scrollTop,document.documentElement.scrollTop) + 'px';
    	this.divs_transparentDiv.style.left = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft) + 'px';
		var brSize = this.__getBrowserSize();
		var bodyWidth = brSize[0];
		var bodyHeight = brSize[1];
    	this.divs_transparentDiv.style.width = bodyWidth + 'px';
    	this.divs_transparentDiv.style.height = bodyHeight + 'px';		
		   	
    }
	// }}}	
	,
	// {{{ __insertContent()
    /**
     *	Insert content into the content div
     * 	
     *
     * @private	
     */	
    __insertContent : function()
    {
		if(this.url){	// url specified - load content dynamically
			ajax_loadContent('DHTMLSuite_modalBox_contentDiv',this.url);
		}else{	// no url set, put static content inside the message box
			this.divs_content.innerHTML = this.htmlOfModalMessage;	
		}
    }		
}


/***************************************retrocede.js*************************************************/
// JavaScript Document

function cdtime(container, targetdate){
if (!document.getElementById || !document.getElementById(container)) return
this.container=document.getElementById(container)
this.currentTime=new Date()
this.targetdate=new Date(targetdate)
this.timesup=false
this.updateTime()
}

cdtime.prototype.updateTime=function(){
var thisobj=this
this.currentTime.setSeconds(this.currentTime.getSeconds()+1)
setTimeout(function(){thisobj.updateTime()}, 1000) //update time every second
}

cdtime.prototype.displaycountdown=function(baseunit, functionref){
this.baseunit=baseunit
this.formatresults=functionref
this.showresults()
}

cdtime.prototype.showresults=function(){
var thisobj=this


var timediff=(this.targetdate-this.currentTime)/1000 //difference btw target date and current date, in seconds
if (timediff<0){ //if time is up
this.timesup=true
this.container.innerHTML=this.formatresults()
return
}
var oneMinute=60 //minute unit in seconds
var oneHour=60*60 //hour unit in seconds
var oneDay=60*60*24 //day unit in seconds
var dayfield=Math.floor(timediff/oneDay)
var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour)
var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute)
var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute))
if (this.baseunit=="hours"){ //if base unit is hours, set "hourfield" to be topmost level
hourfield=dayfield*24+hourfield
dayfield="n/a"
}
else if (this.baseunit=="minutes"){ //if base unit is minutes, set "minutefield" to be topmost level
minutefield=dayfield*24*60+hourfield*60+minutefield
dayfield=hourfield="n/a"
}
else if (this.baseunit=="seconds"){ //if base unit is seconds, set "secondfield" to be topmost level
var secondfield=timediff
dayfield=hourfield=minutefield="n/a"
}
this.container.innerHTML=this.formatresults(dayfield, hourfield, minutefield, secondfield)
setTimeout(function(){thisobj.showresults()}, 1000) //update results every second
}

/////CUSTOM FORMAT OUTPUT FUNCTIONS BELOW//////////////////////////////

//Create your own custom format function to pass into cdtime.displaycountdown()
//Use arguments[0] to access "Days" left
//Use arguments[1] to access "Hours" left
//Use arguments[2] to access "Minutes" left
//Use arguments[3] to access "Seconds" left

//The values of these arguments may change depending on the "baseunit" parameter of cdtime.displaycountdown()
//For example, if "baseunit" is set to "hours", arguments[0] becomes meaningless and contains "n/a"
//For example, if "baseunit" is set to "minutes", arguments[0] and arguments[1] become meaningless etc


function formatresults(){
if (this.timesup==false){//if target date/time not yet met
var displaystring="<span class='lcdstyle'>"+arguments[0]+" <sup>days</sup> "+arguments[1]+" <sup>hours</sup> "+arguments[2]+" <sup>minutes</sup> "+arguments[3]+" <sup>seconds</sup></span> "
}
else{ //else if target date/time met
var displaystring="La Televisión Digital ya llegó"
}
return displaystring
}
/*********************************************************textsizer.js***************************************************************/
// JavaScript Document

//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','tr');

//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large');//,'xx-large' );
var startSz = 2;

function ts( trgt,inc ) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > szs.length - 1) sz = szs.length - 1;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}

	if(ddequalcolumns)
		ddequalcolumns.resetHeights();
}


/*******************************xajax.js******************************************************/
// 08/04/2008, Added by Andres.

                       function makeRequest(method,url,parameters,div) {
						
						  http_request = false;

						  if (window.XMLHttpRequest) { // Mozilla, Safari,...
							 http_request = new XMLHttpRequest();
							 if (http_request.overrideMimeType) {
								http_request.overrideMimeType('text/xml');
							 }
						  } else if (window.ActiveXObject) { // IE
							 try {
								http_request = new ActiveXObject("Msxml2.XMLHTTP");
							 } catch (e) {
								try {
								   http_request = new ActiveXObject("Microsoft.XMLHTTP");
								} catch (e) {}
							 }
						  }
						  
						  if (!http_request) {
							 alert('No se puede crear instancia XMLHTTP');
							 return false;
						  }
						  //document.getElementById('loader').innerHTML="<img src='img/loader.gif' />";
						  document.getElementById(div).innerHTML = "";   

						  http_request.onreadystatechange = function(){
						  
							  if (http_request.readyState == 4) {
								  
								 if (http_request.status == 200) {

									//document.getElementById('loader').innerHTML="";
									result = http_request.responseText;
									document.getElementById(div).innerHTML = result;            

								 } else {
									alert('La pagina solicitada, no existe.');
								 }
							  }
						  } // function.

						  http_request.open(method, url, true);
						  http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
						  http_request.setRequestHeader("Content-length", parameters.length);
						  http_request.setRequestHeader("Connection", "close");
						  http_request.send(parameters);

					   } // makeRequest.
	 
					   function get(obj,method,action,div){

						  var i;
						  var poststr = '';

								  if(method=='GET'){
								  poststr=obj;
								  }
	   					          else{
									  longitud =  obj.length;          //setea la longitud del arreglo

									  for (i=0; i <longitud ; i++){
									
									  poststr = poststr + obj[i].name+"="+ encodeURI(obj[i].value) + "&";  
									  }
						           }
						//alert(poststr+": "+method+": "+action+": "+div);
						   makeRequest(method,action,poststr,div);
					   } // get.
