// JavaScript Document
/************* GENERAL STUFF ****************/
function ShowId(id)
{
	var obj = document.getElementById(id);
	if (obj)
	{
		obj.style.display="";
	}
}
//-----------------------------------------------
function HideId(id)
{
	var obj = document.getElementById(id);
	if (obj)
	{
		obj.style.display="none";
	}
}
//-----------------------------------------------
function ToogleId(id)
{
	var obj = document.getElementById(id);
	if (obj)
	{
		if (obj.style.display=="") obj.style.display="none";
		else obj.style.display="";
	}
}
//-----------------------------------------------
function VisibleId(id)
{
	var obj = document.getElementById(id);
	if (obj)
	{
		obj.style.visibility="visible";
	}
}
//-----------------------------------------------
function InvisibleId(id)
{
	var obj = document.getElementById(id);
	if (obj)
	{
		obj.style.visibility="hidden";
	}
}
//-----------------------------------------------
function get_butao(id, text, url, style){
	var html = '';
	html += '<div onclick="'+url+'" class="'+style+'" id="'+id+'"><table cellpadding="0" cellspacing="0"><tr><td class="texto">'+text+'</td><td class="fim"></td></tr></table></div>';
	return(html);
}
function draw_butao3(id, text, url){
	return(draw_butao(id, text, url, 'butao-red'));
}
function draw_butao(id, text, url, style){
	var html = '';
	html += '<div onclick="'+url+'" class="'+style+'" id="'+id+'"><table cellpadding="0" cellspacing="0"><tr><td class="texto">'+text+'</td><td class="fim"></td></tr></table></div>';
	document.write(html);
}

function draw_nonC_butao(id, text, style){
	var html = '';
	html += '<div class="'+style+'" id="'+id+'"><table cellpadding="0" cellspacing="0"><tr><td class="texto">'+text+'</td><td class="fim"></td></tr></table></div>';
	document.write(html);
}

/************* LOGIN BAR STUFF ****************/
function draw_loginbar(loggedin)
{
	document.write(get_loginbar(loggedin));
}
/****************************************************************************************************/

function draw_topmenu(indice_menu, indice_submenu)
{
	document.write(get_topmenu(indice_menu, indice_submenu));
	ShowSubMenu(indice_menu);
}
/****************************************************************************************************/

function draw_bottom()
{
	var html = '';
	html += '<div style="display:block; z-index:100;">';
	html += '		<table cellpadding="0" cellspacing="0" border="0" style="width:100%">';
	html += '			<tr valign="top">';
	html += '				<td width="100" align="left">';
	html += '					<form name="formLang" method="post">';
	html += '						<input type="hidden" name="l" value="'+jslang+'" />';
	html += '					</form>';
//	html += '					<span class="flag2_selected">';
	html += '					<span onclick="javascript:toogleFlags();" class="flag2_selected">';
	html += '					'+echo_lang(jslang);
	html += '					&nbsp;</span>';
	html += '				</td>';
	html += '				<td><div id="flagsContainer" style="position:absolute;background:#333333;display:none;margin:0px; width:400px; border:0px solid #FF0000; text-align:left; overflow:hidden;">';
	html += '					'+echo_flags(jslang);
	html += '					</div>';
	html += '				</td>';
	
	if (jslang=="de")
		html += '				<td style="width:105px; height:15px; text-align:left; padding-left:20px;">&nbsp;<span class="copyrightTextWHITE">by <strong>Start</strong>Control.com</span></td>';
	else
		html += '				<td style="width:245px; height:15px; text-align:left; padding-left:20px;">&nbsp;<span class="copyrightTextWHITE">by <strong>Start</strong>Control.com</span></td>';
	html += '				<td style="text-align:right" ><span class="copyrightTextWHITE">copyright &copy; <?php echo date("y");?> Multiplicar Neg&oacute;cios Remote Access ';
	html += '				 | <a href="https://secure.corporate.beanywhere.com/site/company_terms.php" class="copyrightTextORANGE">'+jsGLOBAL_PRIVACY+'</a> ';
	html += '				 | <a href="https://secure.corporate.beanywhere.com/site/company_terms.php" class="copyrightTextORANGE">'+jsGLOBAL_TERMS_OF_SERVICE+'</a>';
	html += '				 | <a href="https://secure.corporate.beanywhere.com/site/contact_us.php" class="copyrightTextORANGE">'+jsGLOBAL_CONTACT_US+'</a></span>&nbsp;</td>';
	html += '			</tr>';
	html += '		</table>';
	html += '<br/></div>';
	document.write(html);
}
// JavaScript Document
function validateEmail(e) {
	var reg1 = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
	var reg2 = /^[a-zA-Z0-9\_\-\.]+\@(\[?)[a-zA-Z0-9\_\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;

	if (e.match(reg1) || !e.match(reg2)) {
		return false;
	}
	
	return true;
}
