function Focus() {
document.forms[0].elements[0].focus();
}


/* ==================================================================================================== */
/* FUNCTION detectCssUserAgent                                                                          */
/* ==================================================================================================== */
function detectCssUserAgent()
{
	var userAgent = navigator.userAgent.toLowerCase();
	var arrBrowser = new Array("opera","msie","safari","webkit","firefox","netscape","mozilla","gecko");
	var arrOSystem = new Array("win","mac","linux","x11");
	var browser, version, oSystem = "";

	for (var iBrowser=0; iBrowser<arrBrowser.length; iBrowser++)
	{
		var objRegExp = new RegExp(arrBrowser[iBrowser] + ".\\d{1,}(.\\d{1,})*");
		if (objRegExp.test(userAgent))
		{
			browser = arrBrowser[iBrowser];
			version = (objRegExp.exec(userAgent)[0].replace(/[\.]/g,"_")).replace(/[\s\/]/g,"-");
			
			if ((browser == "firefox") || (browser == "netscape") || (browser == "mozilla"))
			{
				browser = "gecko";
			}

			if (browser == "safari")
			{
				browser = "webkit";
			}
			
			break;
		}
	}

	for (var iOSystem=0; iOSystem<arrOSystem.length; iOSystem++)
	{
		if (userAgent.indexOf(arrOSystem[iOSystem]) > -1)
		{
			oSystem = arrOSystem[iOSystem];
			if (oSystem == "x11")
			{
				oSystem = "linux";
			}
			break;
		}
	}

	var tagHtml = document.getElementsByTagName("html")[0];
	tagHtml.className += oSystem + " " + browser + " " + version;
}

/* ==================================================================================================== */
/* CALL detectCssUserAgent                                                                              */
/* ==================================================================================================== */

detectCssUserAgent();


function ShowContentProduto(str,action,id_cat,buscaprodutos,id_subcat,preco,preco2,orderbyajax)
{
//alert(str);
//alert(action);
//alert(id_cat);
//alert(orderbyajax);

	
if (str=="")
  {
  document.getElementById("hiddencontentproduto"+str).innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("hiddencontentproduto"+str).innerHTML=xmlhttp.responseText;
	
	
    }
  }
xmlhttp.open("POST","conf/resultproduto.php?limiteproduto="+str+"&action="+action+"&id_cat="+id_cat+"&buscaprodutos="+buscaprodutos+"&id_subcat="+id_subcat+"&preco="+preco+"&preco2="+preco2+"&orderbyajax="+orderbyajax,true);
xmlhttp.send();
}


function DisableInput() {
var IEcadcnpj = document.getElementById('cadcnpj');
var IEiecheck = document.getElementById('iecheck').checked;
if(IEiecheck == true){
var IEie = document.getElementById('ie').disabled=true;
}
if(IEiecheck == false){
var IEie = document.getElementById('ie').disabled=false;
}
}

function CheckPf() {
var CheckPF = document.getElementById('pf').checked;	
if(CheckPF == true){
document.getElementById('BodyFormCadPf').style.visibility = 'visible';
document.getElementById('FormCadEnd').style.visibility = 'visible';
}else{
document.getElementById('BodyFormCadPf').style.visibility = 'hidden'; 	
}

}


function CheckPj() {
var CheckPJ = document.getElementById('pj').checked;	
if(CheckPJ == true){
document.getElementById('BodyFormCadPj').style.visibility = 'visible'; 
document.getElementById('FormCadEnd').style.visibility = 'visible'; 
}else{
document.getElementById('BodyFormCadPj').style.visibility = 'hidden'; 	
}
}

function DocPgShow() {
document.getElementById('DivDocPg').style.visibility = 'visible'; 
document.getElementById('DivDocPg').style.width = '360px';
document.getElementById('DivDocPg').style.height = '210px';
document.getElementById('DivDocPg').style.background = '#F4E8E8';
document.getElementById('DivDocPg').style.border = 'solid 2px #C496BD';
document.getElementById('DivDocPg').style.padding = '5px';
}

function DocPgShowOut() {
document.getElementById('DivDocPg').style.visibility = 'hidden'; 
}


function GravaFormaPgto(id,forma) {
var response = '';
$.ajax({ type: "GET",   
         url: "modulos/finalizacompra/updatepgto.php?id="+id+"&forma="+forma,   
         async: false,
         success : function(text)
         {
             response = text;
         }
});
}




