function centralDo(item) {
   var arr = document.getElementById('td_CentralMenu').getElementsByTagName('A');
   var obj = document.getElementById('div_' + item).getElementsByTagName('A')[0];
   var att; 
   var i;
   
   // Menu
   for (i=0;i<arr.length;i++) {
      objOut(arr[i], true);
      arr[i].removeAttribute('over_locked');
   }
   objOver(obj);
   obj.setAttribute('over_locked', 'S');
   
   //Contents
   arr = document.getElementById('div_CentralContent').getElementsByTagName('DIV');
   for (i=0;i<arr.length;i++) {
      if ((att = arr[i].getAttribute('content_id'))!=null) {
         arr[i].style.display = (att == item) ? 'block' : 'none';
      }
   }
   
   return false;
}


function centralLoad() {
   var frm = document.getElementById('frm_RequestGeneric');

	frm.action = 'sal_centralLoad.asp';
	return (popShow('frm_RequestGeneric'));
}
function loginLoad(sGoTo) {
   document.getElementById('hidGoTo').value = sGoTo;
   return popShow('frm_RequestLogin');
}

function popShow(form) {
	var oFade0 = new FadeEffect('div_Pop', 60, 40);
   var oFade1 = new FadeEffect('div_PopContentHolder', 100, 40);
   var path = document.getElementById('spa_StylePath').getAttribute('path');


   if (form != null) {   
      document.getElementById(form).target = 'fra_Submit';
      document.getElementById(form).submit();
      document.getElementById('div_PopContent').innerHTML = '<img src="' + path + 'animations/aniCarregando.gif">';
   }         
   document.getElementById('div_Pop').style.height = Number(document.body.scrollHeight).toString() + 'px';
   document.getElementById('div_PopContentHolder').style.top = Number(document.body.scrollTop + 90).toString() + 'px';
   
   oFade0.fadeIn();
   oFade1.fadeIn();
	
	return false;
}

function popLoad(contents) {
   document.getElementById('div_PopContent').innerHTML = contents;
   return false;
}

function popHide() {
	var oFade0 = new FadeEffect('div_Pop', 60, 10);
   var oFade1 = new FadeEffect('div_PopContentHolder', 100, 10);
   
   oFade1.fadeOut();
   oFade0.fadeOut();
   return false;
}

function produtoImagem(obj, frm_name, mod, cor, type) {
   var frm = document.getElementById('frm_' + frm_name);

   if (frm == null) {
      return false;
   }

   objOut(obj);

   document.getElementById('hid_' + frm_name + 'Mode').value = mod;
   document.getElementById('hid_' + frm_name + 'Core').value = cor;
   document.getElementById('hid_' + frm_name + 'Tipo').value = type;
   frm.action = 'sal_produtoImagem.asp';

   popShow('frm_' + frm_name);
      
   return false;
}

function produtoZoomHide() {
   document.getElementById('flash_Zoom').style.display='none';
   popHide();
   return false;
}

function produtoZoom(obj, frm_name, mod, cor) {
   var frm = document.getElementById('frm_' + frm_name);
   var path = document.getElementById('spa_StylePath').getAttribute('path');
   var content;
   var so;

   if (frm == null) {
      return false;
   }
   
   objOut(obj);

   content= '<table border="0" cellpadding="0" cellspacing="0" class="produtoZoom">';
   content= content + '<tr><td align="right" style="padding: 4px;"><a href="#null" onClick="return produtoZoomHide();" onMouseOver="objOver(this);" onMouseOut="objOut(this);"><img src="' + path + 'buttons/butFechar.gif" border="0" alt="fechar"></a></td></tr>';
   content= content + '<tr><td>';
   content= content + '<div id="div_Flash" style="width: 660px; height: 570px"><span id="flash_Zoom"></span><img src="' + path + 'error/P/txtFlash.gif"></div>';
   content= content + '</td></tr>';
   content= content + '</table>';
   popLoad(content);
   popShow();
   
   so = new SWFObject(path + 'swf/salZoomProduto.swf?proCode=' + mod + '&proColor=' + cor, 'flash_Zoom', '660', '570', '8', '#FFFFFF');
	so.addParam('scale', 'noscale');
	so.write('div_Flash');   

   return false;   
}

function produtoImagemErro(obj) {
   var path = document.getElementById('spa_StylePath').getAttribute('path');
   
   obj.src = path + 'labels/lblImagemNaoEncontrada.gif';
   obj.width = '250';
   obj.height = '300';
}

function searchDo() {
   var frm = document.getElementById('frm_Busca');
   var obj;
	
	obj = new ValidateFormData(frm, 'P', '');
	if (!obj.validate()) {
	     alert (obj.sMsg);
	     return false;
	}
	frm.submit();
}

function newsDo() {
   var frm = document.getElementById('frm_News');
   var obj;
	
	obj = new ValidateFormData(frm, 'P', '');
	if (!obj.validate()) {
	     alert (obj.sMsg);
	     return false;
	}
	return popShow('frm_News');
}

function videoLoad(vide) {
	document.getElementById('hidVideo').value = vide;
	popShow('frm_RequestVideo');
	return false;
}

function videoShow(content, url, w, h) {
   var so;
   
   popLoad(content);
   
   // Now loads the flash
   so = new SWFObject(url, 'flash_Video', w, h, '8', '#000000');
   so.addParam('menu', 'false');
   so.addParam('quality', 'high');
   so.addParam('scale', 'noscale');
   so.addParam('wmode', 'transparent');
   so.addParam('salign', 'lt');
   so.addParam('bgcolor', '#000000');
   so.write('div_Video');
}

function videoHide() {
   popHide();
   document.getElementById('div_Video').innerHTML = '';
   return false;
}

function catalogoLoad(cata) {
   var frm = document.getElementById('frm_RequestCata');

   document.getElementById('hidCata').value = cata;
   document.getElementById('hidURL').value = window.location.href;
	frm.action = 'salCatalogo.asp';
	frm.target = '_self';
	frm.submit();
	
	return false;
}

function catalogoClose() {
   window.location.href=document.getElementById('spa_URL').innerHTML;
}

function pageVerifyJs() {
   var enabled = true; 
   var frm = document.getElementById('frm_RequestTest');

   // document DOM
   enabled = enabled && (document != null);
   enabled = enabled && (document.getElementById != null);
   enabled = enabled && (document.getElementsByTagName != null);
   enabled = enabled && (document.childNodes != null);
   enabled = enabled && (document.body != null);
   enabled = enabled && (document.body.focus != null);
   enabled = enabled && (document.body.getAttribute != null);
   enabled = enabled && (document.body.removeAttribute != null);
   enabled = enabled && (document.body.parentNode != null);
   enabled = enabled && (document.body.tagName != null);
   enabled = enabled && (document.body.style != null);
   
   // Window DOM
   enabled = enabled && (window.screen != null);
   enabled = enabled && (window.location != null);
   enabled = enabled && (window.location.reload != null);
   
   if (enabled) {
      document.getElementById('hidTest').value = '2';
   }
   // frm.submit();
}

function blockAlternate(obj) {
   var div = obj.parentNode.getElementsByTagName('DIV')[0];
   div.style.display = (div.style.display == 'block') ? 'none' : 'block';
   return false;
}

