// JavaScript Document


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;
}
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];}}
}

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_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];}
}


function slideBarraTopo() {

    //Set the opacity of all images to 0
    $('#barra-topo a').css({ opacity: 0.0 });

    //Get the first image and display it (set it to full opacity)
    $('#barra-topo a:first').css({ opacity: 1.0 });

    //Set the caption background to semi-transparent
    $('#barra-topo .caption').css({ opacity: 0.7 });

    //Resize the width of the caption according to the image width
    $('#barra-topo .caption').css({ width: $('#barra-topo a').find('img').css('width') });

    //Get the caption of the first image from REL attribute and display it
    //$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
    //.animate({ opacity: 0.7 }, 400);

    //Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
    setInterval('barra_topo()', 6000);

}

function slideBarraTopo2() {

    //Set the opacity of all images to 0
    $('#barra-topo2 a').css({ opacity: 0.0 });

    //Get the first image and display it (set it to full opacity)
    $('#barra-topo2 a:first').css({ opacity: 1.0 });

    //Set the caption background to semi-transparent
    $('#barra-topo2 .caption').css({ opacity: 0.7 });

    //Resize the width of the caption according to the image width
    $('#barra-topo2 .caption').css({ width: $('#barra-topo2 a').find('img').css('width') });

    //Get the caption of the first image from REL attribute and display it
    //$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
    //.animate({ opacity: 0.7 }, 400);

    //Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
    setInterval('barra_topo2()', 6000);

}

function slidePremio() {

    //Set the opacity of all images to 0
    $('#premio a').css({ opacity: 0.0 });

    //Get the first image and display it (set it to full opacity)
    $('#premio a:first').css({ opacity: 1.0 });

    //Set the caption background to semi-transparent
    $('#premio .caption').css({ opacity: 0.7 });

    //Resize the width of the caption according to the image width
    $('#premio .caption').css({ width: $('#premio a').find('img').css('width') });

    //Get the caption of the first image from REL attribute and display it
    //$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
    //.animate({ opacity: 0.7 }, 400);

    //Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
    setInterval('func_premio()', 6000);

}


function func_premio() {

    //if no IMGs have the show class, grab the first image
    var current = ($('#premio a.show') ? $('#premio a.show') : $('#premio a:first'));

    //Get next image, if it reached the end of the slideshow, rotate it back to the first image
    var next = ((current.next().length) ? ((current.next().hasClass('caption')) ? $('#premio a:first') : current.next()) : $('#premio a:first'));

    //Get next image caption
    var caption = next.find('img').attr('rel');

    //Set the fade in effect for the next image, show class has higher z-index
    next.css({ opacity: 0.0 })
	.addClass('show')
	.animate({ opacity: 1.0 }, 1000);

    //Hide the current image
    current.animate({ opacity: 0.0 }, 1000)
	.removeClass('show');

    //Set the opacity to 0 and height to 1px
    $('#premio .caption').animate({ opacity: 0.0 }, { queue: false, duration: 0 }).animate({ height: '1px' }, { queue: true, duration: 300 });

    //Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
    $('#premio .caption').animate({ opacity: 0.7 }, 100).animate({ height: '100px' }, 500);

    //Display the content
    $('#premio .content').html(caption);

}



function barra_topo() {

    //if no IMGs have the show class, grab the first image
    var current = ($('#barra-topo a.show') ? $('#barra-topo a.show') : $('#barra-topo a:first'));

    //Get next image, if it reached the end of the slideshow, rotate it back to the first image
    var next = ((current.next().length) ? ((current.next().hasClass('caption')) ? $('#barra-topo a:first') : current.next()) : $('#barra-topo a:first'));

    //Get next image caption
    var caption = next.find('img').attr('rel');

    //Set the fade in effect for the next image, show class has higher z-index
    next.css({ opacity: 0.0 })
	.addClass('show')
	.animate({ opacity: 1.0 }, 1000);

    //Hide the current image
    current.animate({ opacity: 0.0 }, 1000)
	.removeClass('show');

    //Set the opacity to 0 and height to 1px
    $('#barra-topo .caption').animate({ opacity: 0.0 }, { queue: false, duration: 0 }).animate({ height: '1px' }, { queue: true, duration: 300 });

    //Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
    $('#barra-topo .caption').animate({ opacity: 0.7 }, 100).animate({ height: '100px' }, 500);

    //Display the content
    $('#barra-topo .content').html(caption);

}



function barra_topo2() {

    //if no IMGs have the show class, grab the first image
    var current = ($('#barra-topo2 a.show') ? $('#barra-topo2 a.show') : $('#barra-topo2 a:first'));

    //Get next image, if it reached the end of the slideshow, rotate it back to the first image
    var next = ((current.next().length) ? ((current.next().hasClass('caption')) ? $('#barra-topo2 a:first') : current.next()) : $('#barra-topo2 a:first'));

    //Get next image caption
    var caption = next.find('img').attr('rel');

    //Set the fade in effect for the next image, show class has higher z-index
    next.css({ opacity: 0.0 })
	.addClass('show')
	.animate({ opacity: 1.0 }, 1000);

    //Hide the current image
    current.animate({ opacity: 0.0 }, 1000)
	.removeClass('show');

    //Set the opacity to 0 and height to 1px
    $('#barra-topo2 .caption').animate({ opacity: 0.0 }, { queue: false, duration: 0 }).animate({ height: '1px' }, { queue: true, duration: 300 });

    //Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
    $('#barra-topo2 .caption').animate({ opacity: 0.7 }, 100).animate({ height: '100px' }, 500);

    //Display the content
    $('#barra-topo2 .content').html(caption);

}



function slideShow() {

    //Set the opacity of all images to 0
    $('#gallery a').css({ opacity: 0.0 });

    //Get the first image and display it (set it to full opacity)
    $('#gallery a:first').css({ opacity: 1.0 });

    //Set the caption background to semi-transparent
    $('#gallery .caption').css({ opacity: 0.7 });

    //Resize the width of the caption according to the image width
    $('#gallery .caption').css({ width: $('#gallery a').find('img').css('width') });

    //Get the caption of the first image from REL attribute and display it
    //$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
	//.animate({ opacity: 0.7 }, 400);

    //Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
    setInterval('gallery()', 6000);

}

function gallery() {

    //if no IMGs have the show class, grab the first image
    var current = ($('#gallery a.show') ? $('#gallery a.show') : $('#gallery a:first'));

    //Get next image, if it reached the end of the slideshow, rotate it back to the first image
    var next = ((current.next().length) ? ((current.next().hasClass('caption')) ? $('#gallery a:first') : current.next()) : $('#gallery a:first'));

    //Get next image caption
    var caption = next.find('img').attr('rel');

    //Set the fade in effect for the next image, show class has higher z-index
    next.css({ opacity: 0.0 })
	.addClass('show')
	.animate({ opacity: 1.0 }, 1000);

    //Hide the current image
    current.animate({ opacity: 0.0 }, 1000)
	.removeClass('show');

    //Set the opacity to 0 and height to 1px
    $('#gallery .caption').animate({ opacity: 0.0 }, { queue: false, duration: 0 }).animate({ height: '1px' }, { queue: true, duration: 300 });

    //Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
    $('#gallery .caption').animate({ opacity: 0.7 }, 100).animate({ height: '100px' }, 500);

    //Display the content
    $('#gallery .content').html(caption);


}




///flash

//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2008 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
	var version;
	var axo;
	var e;
	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}
	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";
			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";
			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}
// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];
        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}
function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }
  document.write(str);
}
function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    
    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblclick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}




 function MascaraCNPJ(cnpj) {
       if (mascaraInteiro(cnpj) == false) {
            event.returnValue = false;
        }       
        return formataCampo(cnpj, '00.000.000/0000-00', event); 
     }

function limpaBusca(){
	if(document.getElementById("str_search").value=="Localize produtos"){
		document.getElementById("str_search").value = "";
	}
	
}
function preencheBusca(){
	if(document.getElementById("str_search").value==""){
		document.getElementById("str_search").value = "Localize produtos";
	}
	
}
function vldBusca(){
		if(document.getElementById("str_search").value.length<3){
		alert("A palavra deve ter no minimo 3 caracteres!");
		return false;
	}
	else{
		return true;	
	}	
	}
//ROLL OVER CAMPOS


// source de validaçõe

function formataCampo(campo, Mascara, evento) {
         var boleanoMascara;                 
         var Digitato = evento.keyCode;        
         exp = /\-|\.|\/|\(|\)| /g;
         campoSoNumeros = campo.value.toString().replace( exp, "" );            
         var posicaoCampo = 0;            
         var NovoValorCampo="";        
         var TamanhoMascara = campoSoNumeros.length;                
         if (Digitato != 8) { // backspace                 
         for(i=0; i<= TamanhoMascara; i++) {                         
            boleanoMascara  = ((Mascara.charAt(i) == "-") || (Mascara.charAt(i) == ".") || (Mascara.charAt(i) == "/")) 
            boleanoMascara  = boleanoMascara || ((Mascara.charAt(i) == "(")
                  || (Mascara.charAt(i) == ")") || (Mascara.charAt(i) == " "))
            if (boleanoMascara) {
                NovoValorCampo += Mascara.charAt(i);
                TamanhoMascara++;
            }
            else {
                NovoValorCampo += campoSoNumeros.charAt(posicaoCampo);
                posicaoCampo++;
            }
        }
        campo.value = NovoValorCampo;
        return true;
    } else {
    return true;
} 
}


//valida numero inteiro com mascara
function mascaraInteiro() {
    if (event.keyCode < 48 || event.keyCode > 57) {
        event.returnValue = false;
        return false;
    }
    return true;
   }
		
		
		
		function isNumeric(iCampo,iNomeCampo) {
	while(iCampo.value.indexOf('.') != -1) {iCampo.value = iCampo.value.replace('.','')}
	while(iCampo.value.indexOf(' ') != -1) {iCampo.value = iCampo.value.replace(' ','')}
	while(iCampo.value.indexOf('-') != -1) {iCampo.value = iCampo.value.replace('-','')}
	if (isNaN(iCampo.value) == true) {
		alert('Utilize apenas numeros para ' + iNomeCampo);
		/* iCampo.focus(); iCampo.select(); */ return false;
	}
}

function isNumerico(iCampo,iNomeCampo) {
	if (isNaN(iCampo.value) == true) {
		alert('Utilize apenas numeros para ' + iNomeCampo);
		/* iCampo.focus(); iCampo.select(); */ return false;
	}
}

function isEmail(iCampo,iNomeCampo) {
	var str = iCampo.value;
		//alert(str);
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	if ( (!r1.test(str) && r2.test(str)) ) {
		return true;
	} else {
		/* iCampo.focus(); iCampo.select(); */
		//alert(iNomeCampo+" invalido.");
		return false;
	}
	return true;
}

function EhIgual(campo) { /* Verifica se todos os valores são iguais */
	var i = 0
	var j = 1
	var igual = true;
	/* Todos os caracteres devem ser diferentes */
	while (i < campo.length-1 && igual == true) {
		while (j < campo.length && igual == true) {
			if (campo.charAt(i) != campo.charAt(j)) {
				igual = false;
			}
			else j++;
		}
		i++;
	}
	return igual;
}

function isVazio(iCampo,iNomeCampo) {
	if (iCampo.value == false) {
		alert(iNomeCampo + ' e obrigatorio.');
		iCampo.focus();
		return false;
	}
	return true;
}

function isCPF(iCampo,iNomeCampo){
	if (isNumeric(iCampo,iNomeCampo)==false) {return false;};
	if (EhIgual(iCampo.value)==true) { 
		/* iCampo.focus(); */
		alert(iNomeCampo + ' é invalido.');
		return false; 
	}
	x=0; 
	soma=0; 
	dig1=0; 
	dig2=0; 
	texto=""; 
	iCampo1="";
	len = iCampo.value.length; 
	x = len -1;
	for (var i=0; i <= len - 3; i++) {
		y = iCampo.value.substring(i,i+1); 
		soma = soma + ( y * x);
		x = x - 1; 
		texto = texto + y;
	}
	dig1 = 11 - (soma % 11);
	if (dig1 == 10) dig1=0 ; 
	if (dig1 == 11) dig1=0 ;
	iCampo1 = iCampo.value.substring(0,len - 2) + dig1 ;
	x = 11; soma=0;
	for (var i=0; i <= len - 2; i++) {
		soma = soma + (iCampo1.substring(i,i+1) * x); 
		x = x - 1;
	}
	dig2= 11 - (soma % 11);
	if (dig2 == 10) dig2=0; 
	if (dig2 == 11) dig2=0;
	if ((dig1 + "" + dig2) == iCampo.value.substring(len,len-2)) {
		return true;
	}
	/* iCampo.focus(); */
	alert(iNomeCampo + ' e invalido.');
	return false; 
}

function isCNPJ(iCampo, iNomeCampo) {
	if (EhIgual(iCampo.value)==true) { 
		iCampo.focus();
		alert(iNomeCampo + ' e invalido.');
		return false; 
	}
	dac1 = 0; 
	dac2 = 0; 
	dac = ""; 
	dact = ""; 
	sum = 0;
	iCampo1="";
	dac = iCampo.value.substring(iCampo.value.length-2, iCampo.value.length);
	iCampo1 = iCampo.value.substring(0,iCampo.value.length-2);
	for (i=iCampo1.length-1, j=2; i >= 0 ; i--, j++) {	
		j = (j == 10) ? 2 : j; 
		sum += (iCampo1.substring(i, i+1) * j); 
	}
	dac1 = ((sum * 10) % 11); 
	dac1 = (dac1 == 10) ? 0 : dac1; 
	sum = 0;
	for (i=iCampo1.length-1, j=3; i >= 0 ; i--, j++){	
		j = (j == 10) ? 2 : j; 
		sum += (iCampo1.substring(i, i+1) * j); 
	}
	sum  += (dac1 * 2); 
	dac2 = ((sum * 10) % 11); 
	dac2 = (dac2 == 10) ? 0 : dac2; 
	dact = dac1+""+dac2;
	if (dact == dac) {
		return true;
	} else {	
		iCampo.focus();
		alert(iNomeCampo + ' e invalido.');
		return false; 
	}
}

function isData(strData,dataObj,alertData) {
	var exprData = new RegExp("(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/(19|20)[0-9]{2}", "gi");

	ret = exprData.exec(strData);

	if(strData == '' || ret == null){
		alert(alertData); /* dataObj.focus() */ ;return false;
	} else {
		arrData = strData.split('/');
		testData = new Date(arrData[2], arrData[1]-1, arrData[0], 0, 0, 0, 0);

		if((testData.getDate()==arrData[0])&&
			 ((testData.getMonth())==(arrData[1]-1))&&
				(testData.getFullYear()==arrData[2])){
		} else {
			alert(alertData); /* dataObj.focus();dataObj.select(); */ return false;
		}
	}
}
function prc_campo(campo, qtd, valor) {
    if (valor.length == qtd) {
        document.getElementById(campo).focus();
    }


}

var isNav4, isNav, isIE;
if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
    isNav = (navigator.appName == "Netscape") ? true : false;
    isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
}
if (navigator.appName == "Netscape") {
    isNav4 = (parseInt(navigator.appVersion.charAt(0)) == 4);
}
function onlynum(e) {
    var keyNumber = (isIE) ? event.keyCode : e.which;
    if (((keyNumber < 48) || (keyNumber > 57)) && (keyNumber != 13) && (keyNumber != "0") &&

(keyNumber != 8) && (keyNumber != 44)) {
        if (isIE) event.keyCode = 0;
        return false;
    }
}
	  
function vldParceiros(){
	if(document.getElementById("str_Empresa").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o nome da empresa.</p>');
		return false;
	}
	else if(document.getElementById("str_Nome").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione seu nome.</p>');
		return false;
	}
	else if(window.document.getElementById("str_Email").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione seu e-mail.</p>');
		return false;
	}
	else if(isEmail(window.document.getElementById("str_Email"), "E-mail")==false) {
			  Sexy.alert('<h1>Alerta</h1><br/><p>Digite um e-mail v&aacute;lido!</p>');
			  return false;
    } 
	else if(document.getElementById("str_DDDFone").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o ddd do telefone.</p>');
		return false;
	}
	else if(document.getElementById("str_Fone").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o telefone.</p>');
		return false;
	}
	else if(document.getElementById("str_DDDCel").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o ddd do celular.</p>');
		return false;
	}
	else if(document.getElementById("str_Cel").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o celular.</p>');
		return false;
	}
	else if(document.getElementById("str_Assunto").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o assunto.</p>');
		return false;
	}
	else if(document.getElementById("str_Mensagem").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione a mensagem.</p>');
		return false;
	}
	else{
		return true;	
	}
}

function vldContato(){
	
	if(window.document.getElementById("int_Departamento").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Selecione um departamento.</p>');
		return false;
	}
	else if(window.document.getElementById("str_Nome").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione seu nome.</p>');
		return false;
	}
	else if(window.document.getElementById("str_Email").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione seu e-mail.</p>');
		return false;
	}
	else if(isEmail(window.document.getElementById("str_Email"), "E-mail")==false) {
			  Sexy.alert('<h1>Alerta</h1><br/><p>Digite um e-mail v&aacute;lido!</p>');
			  return false;
    } 
	else if(window.document.getElementById("str_DDDFone").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o ddd do telefone.</p>');
		return false;
	}
	else if(window.document.getElementById("str_Fone").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o telefone.</p>');
		return false;
	}
	/*else if(window.document.getElementById("str_DDDCel").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o ddd do celular.</p>');
		return false;
	}
	else if(window.document.getElementById("str_Cel").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o celular.</p>');
		return false;
	}*/
	else if(window.document.getElementById("str_Assunto").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o assunto.</p>');
		return false;
	}
	else if(window.document.getElementById("str_Mensagem").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione a mensagem.</p>');
		return false;
	}
	else{
		return true;	
	}
	
}


function vldAgendamento(){
	
	if(document.getElementById("str_Nome").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione seu nome.</p>');
		return false;
	}
	else if(window.document.getElementById("str_Email").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione seu e-mail.</p>');
		return false;
	}
	else if(isEmail(window.document.getElementById("str_Email"), "E-mail")==false) {
			  Sexy.alert('<h1>Alerta</h1><br/><p>Digite um e-mail v&aacute;lido!</p>');
			  return false;
    } 
	else if(document.getElementById("str_DDDFone").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o ddd do telefone.</p>');
		return false;
	}
	else if(document.getElementById("str_Fone").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o telefone.</p>');
		return false;
	}
	/*else if(document.getElementById("str_DDDCel").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o ddd do celular.</p>');
		return false;
	}
	else if(document.getElementById("str_Cel").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o celular.</p>');
		return false;
	}*/
	else if(document.getElementById("str_Assunto").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o assunto.</p>');
		return false;
	}
	else if(document.getElementById("str_Mensagem").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione a mensagem.</p>');
		return false;
	}
	else{
		return true;	
	}	
}


function vldNewsletter(){
	if(document.getElementById("str_NewsL").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione um e-mail</p>');
		return false;
	}
	else if(isEmail(document.getElementById("str_NewsL"), "E-mail")==false) {
			  Sexy.alert('<h1>Alerta</h1><br/><p>Digite um e-mail v&aacute;lido!</p>');
			  return false;
            } 
	else{
		return true;	
	}
}





	 
function RetiraAcentos(Campo) {
   var Acentos = "àáâãäèéêëìíîïòóôõöùúûüÀÁÂÃÄÈÉÊËÌÍÎÒÓÔÕÖÙÚÛÜçÇñÑ,;/?:><]}[{ºª=+)(*&¨%$#@!‡§œ›™–•ŽŒ‹Š‰ˆƒ€¼»º¹¶µ´³¯®­¬«ª©¨¤£¢¡ ";
   var Traducao ="";
   var Posic, Carac;
   var TempLog = "";
   for (var i=0; i < Campo.length; i++)
   {
   Carac = Campo.charAt (i);
   Posic  = Acentos.indexOf (Carac);
   if (Posic > -1)
	  TempLog += Traducao.charAt (Posic);
   else
      TempLog += Campo.charAt (i);
   }
   	  TempLog = TempLog.toLowerCase();
      return (TempLog);
}


function vldTrabalhe(){
	if(document.getElementById("str_Arquivo").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Anexo necess&aacute;rio.</p>');
		return false;
	}
	else if(document.getElementById("str_Nome").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione seu nome.</p>');
		return false;
	}
	else if(window.document.getElementById("str_Email").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione seu e-mail.</p>');
		return false;
	}
	else if(isEmail(window.document.getElementById("str_Email"), "E-mail")==false) {
			  Sexy.alert('<h1>Alerta</h1><br/><p>Digite um e-mail v&aacute;lido!</p>');
			  return false;
    } 
	else if(document.getElementById("str_DDDFone").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o ddd do telefone.</p>');
		return false;
	}
	else if(document.getElementById("str_Fone").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o telefone.</p>');
		return false;
	}
	/*else if(document.getElementById("str_DDDCel").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o ddd do celular.</p>');
		return false;
	}
	else if(document.getElementById("str_Cel").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o celular.</p>');
		return false;
	}*/
	else if(document.getElementById("str_Assunto").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o assunto.</p>');
		return false;
	}
	else if(document.getElementById("str_Mensagem").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione a mensagem.</p>');
		return false;
	}
	else{
		return true;	
	}		
}


function vldDuvidaResposta(){
	//alert(document.getElementById("RadioGroup1_0").checked);
	if(document.getElementById("RadioGroup1_0").checked==false && document.getElementById("RadioGroup1_1").checked == false){
		Sexy.alert('<h1>Alerta</h1><br/><p>Responda se j&aacute; &eacute; cliente.</p>');
		return false;
	}
	if(document.getElementById("str_Nome").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione seu nome.</p>');
		return false;
	}
	else if(document.getElementById("str_DDDFone").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione o ddd do telefone.</p>');
		return false;
	}
	else if(document.getElementById("str_Conhece").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Responda como nos conheceu.</p>');
		return false;
	}	
	else if(document.getElementById("str_Mensagem").value==""){
		Sexy.alert('<h1>Alerta</h1><br/><p>Adicione a mensagem.</p>');
		return false;
	}
	else{
		return true;	
	}	
	
}




function popmysql(){
	//pega a resolução do visitante
var w = screen.width;
var h = screen.height;

//divide a resolução por 2, obtendo o centro do monitor
var meio_w = w/2;
var meio_h = h/2;

//diminui o valor da metade da resolução pelo tamanho da janela, fazendo com q ela fique centralizada
var altura2 = 430/2;
var largura2 = 600/2;
var meio1 = meio_h-altura2;
var meio2 = meio_w-largura2;

	
window.open('http://plasticasuprema.mysuite.com.br/clientvivo.php?param=sochat_chatdep&inf=&sl=srm&redirect=http://plasticasuprema.mysuite.com.br/empresas/srm/atendimento.php', 'minhaJanela2', 'status = 1, height = 430, width = 600, resizable = 0, scrollbars=1, top='+meio1+',left='+meio2);
}

