function getObj(id) {
	if(document.all){
		return document.all(id);
	} else if (document.getElementById) {
		return document.getElementById(id);
	}
}

function newImage(strSrc) {
	i = new Image();
	i.src = strSrc;
	return i;
}

function loadImage(obj, img){
	obj.src = img.src;
}

function showHide(showL, nomeL, qtde){
	var mostraLay = nomeL + '' + showL;
	for (i = 1; i <=qtde; i++){
		document.getElementById(nomeL + '' + i).style.display = 'none';
	}
	document.getElementById(mostraLay).style.display = 'block';
}

function loadFlash(arquivo, w, h) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + w + '" height="' + h + '" align="middle">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="movie" value="' + arquivo + '" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="wmode" value="transparent" />\n');
	document.write('<param name="bgcolor" value="#f1f1f1" />\n');
	document.write('<embed src="' + arquivo + '" quality="high" wmode="transparent" bgcolor="#f1f1f1" width="' + w + '" height="' + h + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
	document.write('</object>\n');
}

function showHide(nomeL, showL, qtde){
	var mostraLay = nomeL + '' + showL;
	for (i = 1; i <=qtde; i++){
		document.getElementById(nomeL + '' + i).style.display = 'none';
	}
	document.getElementById(mostraLay).style.display = 'block';
}

/*Esconde e exibe forms Fale conosco e altera imagem seta*/
function showHideBlock(mostraLay,seta){
	if(document.getElementById(mostraLay).style.display == 'none'){
		document.getElementById(mostraLay).style.display = 'block';
		imagemseta("images/seta-abaixo.png",seta);
	}else{
		document.getElementById(mostraLay).style.display = 'none';
		imagemseta("images/seta-direita.png",seta);
	}
}

function imagemseta(dir,i){
	var seta="";
	if (i=="seta1") {
		seta = document.seta1;
	}
	if (i=="seta2") {
		seta = document.seta2;
	}
		seta.src=dir;
}

function image(dir)
{
	getObj('imagem').src = dir;
}

function insereTexto(est){
	if (est=="SP"){
		document.getElementById('titulo-unidade').innerHTML="S&Atilde;O PAULO (SP) Unit";
		document.getElementById('texto-unidade').innerHTML="AV. PAULISTA, 542 – 8&ordm; ANDAR<br /> S&Atilde;O PAULO - SP";
	}
	if (est=="PR"){
		document.getElementById('titulo-unidade').innerHTML="PONTA GROSSA (PR) Unit";
		document.getElementById('texto-unidade').innerHTML="AV. VISCONDE DE MAU&Aacute;, 4300<br /> PONTA GROSSA - PR";
	}
	if (est=="RS"){
		document.getElementById('titulo-unidade').innerHTML="SAPUCAIA DO SUL (RS) Unit";
		document.getElementById('texto-unidade').innerHTML="AV. LUCIO BITTENCOURT, 1680<br /> SAPUCAIA DO SUL - RS";
	}
}

function validaWebmail(form)
{
	form.userid.value = form.userid.value.replace('@kurashiki.com.br', '');
}

function validaExtensao(campo){
	ext = getExtensao(campo);
	if(ext != ".doc"){ 
		alert('O arquivo deve ser do tipo DOC.');
		return false;
	}
}

function getExtensao(s){
var ext="";
var pos;
	pos = s.lastIndexOf(".");
if(pos > 0){
	ext = s.substr(pos);
	ext = ext.toLowerCase();
}
	return ext;
}
