function btnH(whatImage, putOrTake) {

	if(putOrTake == '1') {
		whatImage.src = btnHeader.src;

	} else {
		whatImage.src = 'img/1x1.gif';

	}

}

function m1(menuElement, cL) {

	if(cL == 1) {
		menuElement.style.backgroundColor='#43A831';
	} else if(cL == 2) { 
		menuElement.style.backgroundColor='#2894FF';
	} else {
		menuElement.style.backgroundColor='#F2F200';
	}

	menuElement.style.cursor='hand'; 
	menuElement.style.cursor='pointer'; 	

	if(cL != 3) {
		menuElement.style.color='#FFFFFF';
	}
	
}

function m2(menuElement) {
	
	menuElement.style.backgroundColor=''; 
	menuElement.style.color='#000000';
	
}

function m3(menuLink) {

	location.href = menuLink;

}

function openWin(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function openGallery(galId) {
	openWin('gallery/?gid=' + galId, '', 'width=600,height=420')
}

function getFile(fileId) {
	window.open('/app/getfile/?fid=' + fileId);
}

function getRandomNum(Min, Max) {
	var r;
	r = (Math.floor(Math.random() * ((Max+1) - Min)) + Min)
	return r;
}

function writeStaticBanner(fileName, urlLink, sizeX, sizeY, bolNewWindow, bolBorder) {

	if(urlLink != '') {
		document.write('<a href="' + urlLink + '"');
		if(bolNewWindow) {
			document.write(' target="_blank"');
		}
		document.write('>');
	}
		
	document.write('<img src="');
	document.write('../stor/banners/' + fileName + '" ');
	document.write('width="' + sizeX + '" ');
	document.write('height="' + sizeY + '" ');

	if(bolBorder) {
		document.write('border="0" class="1px-border">');
	} else {
		document.write('border="0">');
	}
			
	if(urlLink != '') {
		document.write('</a>');
	}

}

function writeFlashBanner(fileName, sizeX, sizeY, bolBorder) {

	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + sizeX + '" height="' + sizeY + '"')

	if(bolBorder) {
		document.write(' class="1px-border">')
	} else {
		document.write('>')	
	}			
	
	document.write('<param name="movie" value="../stor/banners/' + fileName + '">')
	document.write('<param name="quality" value="high">')
	document.write('<param name="wmode" value="transparent">')
	document.write('<embed src="../stor/banners/' + fileName + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + sizeX + '" height="' + sizeY + '" wmode="transparent"')
			
			
	if(bolBorder) {
		document.write(' class="1px-border"></embed>')
	} else {
		document.write('></embed>')
	}
						
	document.write('</object>')

}

function writeFlashBannerNotWMode(fileName, sizeX, sizeY, bolBorder) {

	if(fileName == 'newhorizons.swf' && 1==2) {
		document.write('<IFRAME frameborder="0" SCROLLING="no" src="http://www.gcnewhorizons.net/bdl.htm" width="468" height="60">');
		document.write('</IFRAME>');
		return true;
	}

	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + sizeX + '" height="' + sizeY + '"')

	if(bolBorder) {
		document.write(' class="1px-border">')
	} else {
		document.write('>')	
	}			
	
	document.write('<param name="movie" value="../stor/banners/' + fileName + '">')
	document.write('<param name="quality" value="high">')
	document.write('<embed src="../stor/banners/' + fileName + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + sizeX + '" height="' + sizeY + '"')
			
			
	if(bolBorder) {
		document.write(' class="1px-border"></embed>')
	} else {
		document.write('></embed>')
	}
						
	document.write('</object>')

}

function objBanner(isFlash, fileName, urlLink, sizeX, sizeY, bolNewWindow, bolBorder) {
	this.isFlash = isFlash;
	this.fileName = fileName;
	this.urlLink = urlLink;
	this.sizeX = sizeX;
	this.sizeY = sizeY;
	this.bolNewWindow = bolNewWindow;
	this.bolBorder = bolBorder;
}

function pollVote(a, b) {
	openWin('pollsys/results.aspx?voteid=' + a + '&survey=' + b,'','scrollbars=yes, width=530,height=360');
}

function saveArticle(aid, title) { 
	
	if (window.external) {
		external.AddFavorite('http://www.diariolibre.com/app/article.aspx?id=' + aid, 'Diario Libre - ' + title)
	} else {
		alert('Para guardar la noticia, haga click en el menú de favoritos de su navegador.');
	}

}

function TopSrch_Now(SrchString) {

	var s;
	s = SrchString;

	if(s.replace(/\s/gi, "").length < 3) {
		alert('El texto de b\úsqueda es demasiado corto.');
	} else {

		location.href = 'search.aspx?m=1&s=' + escape(s);
	}

	return false;

}
