/*Recebe uma string como parametro e verifica se ela contém apenas números*/
function isNum (caractere) {
	regexp = /^[0-9]+$/;
	if (!regexp.test(caractere)) {
		return false;
	}
	else {
		return true;
	}
}

function changeFontSize(s) {
	if (s == 1) {
		resize = '11px';
		line_height = '15px';
	}
	if (s == 2) {
		resize = '15px';
		line_height = '18px';
	}
	if (s == 3) {
		resize = '16px';
		line_height = '22px';
	}
	o = document.getElementById("conteudo");
	pes = o.getElementsByTagName("p");
	lis = o.getElementsByTagName("li");
	as = o.getElementsByTagName("a");
	h2s = o.getElementsByTagName("h2");
	for (i=0; i < pes.length; i++) {
		pes[i].style.fontSize = resize;
		pes[i].style.lineHeight = line_height;
	}
	for (i=0; i < lis.length; i++) {
		lis[i].style.fontSize = resize;
		lis[i].style.lineHeight = line_height;
	}
	for (i=0; i < as.length; i++) {
		as[i].style.fontSize = resize;
	}
	for (i=0; i < h2s.length; i++) {
		h2s[i].style.fontSize = resize;
	}

}

function write_flash_topo(cache) {
	if (typeof(cache) != 'undefined') {
		cache = '?' + cache;
	} else {
		cache = '';
	}
	flashvar = '';
	flashvar += '<object width="910" height="198" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="flash_topo" align="middle">';
		flashvar += '<param name="allowScriptAccess" value="sameDomain" />';
		flashvar += '<param name="movie" value="/flashes/topo-dedic.swf'+cache+'" />';
		flashvar += '<param name="quality" value="high" />';
		flashvar += '<param name="bgcolor" value="#ffffff" />';
		flashvar += '<embed src="/flashes/topo-dedic.swf'+cache+'" width="910" height="198" quality="high" bgcolor="#ffffff" name="flash_topo" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="flash_topo" />';    
	flashvar += '</object>';
	document.write(flashvar);
}

function write_flash_pt(cache) {
	if (typeof(cache) != 'undefined') {
		cache = '?' + cache;
	} else {
		cache = '';
	}
	flashvar = '';
	flashvar += '<object width="170" height="81" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="flash_topo" align="middle">';
		flashvar += '<param name="allowScriptAccess" value="sameDomain" />';
		flashvar += '<param name="movie" value="/flashes/flash-pt.swf'+cache+'" />';
		flashvar += '<param name="quality" value="high" />';
		flashvar += '<param name="wmode" value="transparent" />';
		flashvar += '<embed src="/flashes/flash-pt.swf'+cache+'" width="170" height="81" quality="high" wmode="transparent" name="flash_pt" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="flash_topo" />';
	flashvar += '</object>';
	document.write(flashvar);
}

function write_flash_layer(cache) {
	mostraLayer();
	
	if (typeof(cache) != 'undefined') {
		cache = '?' + cache;
	} else {
		cache = '';
	}
	flashvar = '';
	
	flashvar += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="520" height="310">';
    	flashvar += '<param name="movie" value="/flashes/layer02.swf'+cache+'" />';
        flashvar += '<param name="quality" value="high" />';
		flashvar += '<param name="wmode" value="transparent" />';
        flashvar += '<embed src="/flashes/layer02.swf'+cache+'" quality="high" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="520" height="310"></embed>';
    flashvar += '</object>';
	document.write(flashvar);
}

function mostraFoto(caminho, largura, altura) {
	width = largura;
	height = altura;
	leftVal = (screen.width - width) / 2;
	topVal = (screen.height - height) / 3.5;
	window.open('/mostra_foto.asp?caminho=' + caminho,'mostra_foto_' + largura + '_' + altura,'width=' + width + ',height=' + height + ',scrollbars=no,top=' + topVal + ',left=' + leftVal)
}

function FechaBoxCuriosidades() {
	document.getElementById('box_curiosidades').style.display='none';
	document.getElementById('box_curiosidades_fechar').style.display='none';
}

function mostraLayer() {
	/*//ov = document.getElementById('overlay');
	//m = document.getElementById('msg');
	//m.innerHTML = msg + '<a class="fechar" href="javascript: fechaMsg()">' + fechar_msg + '</a>';
	//m.style.display = 'block';
	ov.style.display = 'block';
	arr_page_size = getPageSize();
	ov.style.height = arr_page_size[1] + 'px';*/
}

function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function mostraPopVideo() {
	width = 320;
	height = 258;
	leftVal = (screen.width - width) / 2;
	topVal = (screen.height - height) / 3.5;
	window.open('/videos/video.asp','mostra_foto','width=' + width + ',height=' + height + ',scrollbars=no,top=' + topVal + ',left=' + leftVal)
}

function mostraPopWebCallCenter() {
	width = 450;
	height = 450;
	leftVal = (screen.width - width) / 2;
	topVal = (screen.height - height) / 3.5;
	//window.open('http://atendimentoonline.dedic.com.br','web_call_center','width=' + width + ',height=' + height + ',scrollbars=no,top=' + topVal + ',left=' + leftVal)
	window.open('http://www.dedic.com.br/Collab/ui/Request.aspx?campaign=DDIC_CHAT&itr_type=collab&customer_name=my%20name&language=pt&gwused=GW  ','web_call_center','width=' + width + ',height=' + height + ',scrollbars=no,top=' + topVal + ',left=' + leftVal)
}

function mostraFlashCartaoFimAno2007() {
	sHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="630" height="328" title="Cart&atilde;o de fim de ano 2007">';
	sHTML += '<param name="movie" value="flashes/cartaofimano2007.swf" />';
	sHTML += '<param name="quality" value="high" />';
	sHTML += '<embed src="flashes/cartaofimano2007.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="630" height="328"></embed>';
	sHTML += '</object>';
	document.write(sHTML);
}