function $obj(obj){ return document.getElementById(obj.id); }
function $id(id){ return document.getElementById(id); }
function $tag(tag){ return document.getElementsByTagName(tag); }
function meds(w,h){
	wi = w;
	he = h;
	cim = (screen.height-he)/2;
	dir = (screen.width-wi)/2;
}

function form_envio(){

nom = document.getElementById("remetente_nom").value;
	if (nom == ""){
		alert("por favor digite o seu nome")
		return false;
	}

cemail = document.getElementById("remetente_ema").value
	if (cemail == "" ){
		alert("por favor digite o seu email")
		return false;
	}

strMail = cemail;
var re = new RegExp;
re = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var arr = re.exec(strMail);
	if (arr == null){
		alert("Por favor, digite o seu email corretamente")	
		return false;
	}

/*

ctel = document.getElementById("remetente_tel").value
	if (ctel == "" ){
		alert("Por favor, digite o seu telefone")
		return false;
	}

*/

return true;
}




function pro_cor(obj,v){
li = $(obj)
alvo = li.getElementsByTagName("a")[0];// nome do produto

alvo = li.getElementsByTagName("a")[2];//link do produto
alvo.className = "prod_link"+v;
//alvo.className == "prod_link" ? alvo.className = "prod_linkb" : alvo.className = "prod_link";
}

function link_externo(){
	
if(document.getElementsByTagName("a"))
{
    if(document.getElementsByTagName)
	{
        var anchors = document.getElementsByTagName('a');
        	
			for(var i=0; i<anchors.length; i++)
			{
            	var anchor = anchors[i];
            		if(anchor.getAttribute("href") && anchor.getAttribute('rel')=='externo')
					{ // <-- É necessário inserir rel="externo" no link
                	anchor.target = '_blank';
                	var title = anchor.title + ' (este link abre uma nova janela)'; // <-- Insere este texto no final do Title do link
                	anchor.title = title;
            		}
        	}
    }

}
}

// exemplo para corrigir falhas ao suporte do css no IE
// verifica comportamento para executar alterações visuais no IE   
function contato_cores_trocar(){


if($id("produtos")){

ul = $id("produtos");
lis = ul.getElementsByTagName("li");
	for(i=0;i<lis.length;i++){
		

		lis[i].onmouseover = function(){ pro_cor(this,"b"); }
		lis[i].onmouseout = function(){ pro_cor(this,""); }
		/*
		lis[i].onfocus = function(){ pro_cor(this,"b"); }
		lis[i].onblur = function(){ pro_cor(this,""); }
*/

	}

	}

	// || document.getElementById("maisvendidos")
	if(document.getElementById("maisprocurados")){
	tooltip.init ();	
	}
	
	

/*
	var busca_url = location.href;
		if(document.getElementById("produtos") && busca_url.lastIndexOf("busca=")!=-1){
			links_pro = document.getElementById("produtos").getElementsByTagName("a");
			for(i=0;i<links_pro.length;i++){
						var muda_url = new String(links_pro[i]);
						muda_url.lastIndexOf("view.asp")!=-1 ? curl = "&busca=s" : curl = "?busca=s";
					links_pro[i].href += curl;
			}
		}
*/
	
	
	if(document.all){
	if(document.getElementById("cadastro")){

	ipts = document.getElementById("cadastro").getElementsByTagName("input");

	for(i=0;i<ipts.length;i++)
	{
		if(!/reset/.test(ipts[i].type) && !/submit/.test(ipts[i].type) && !/hidden/.test(ipts[i].type)){
			ipts[i].onfocus = function(){ this.className="border_red"; }
			ipts[i].onblur = function(){ this.className=""; }
		}
	}

	}
	
}
	
	
	}



function vertel(e){
    var tecla=(window.event)?event.keyCode:e.which;
	
    if((tecla > 47 && tecla < 58) || (tecla == 13) || (tecla == 32) || (tecla == 40) || (tecla == 41)|| (tecla == 45)|| (tecla == 0) || (tecla == 101)) return true;
    else{
    if (tecla != 8) return false;
    else return true;
    }

	}


function iframe_box(){ document.write("<iframe name=\"box\" id=\"box\" height=\"0\" width=\"0\" frameborder=\"0\"></iframe>"); }
	
	
function pro_ordem(){
alvo = $id("tip");

var ende = location.href;
n_ende = ende
if(ende.lastIndexOf("tip=")!=-1){
//lastIndexOf procura a última ocorrência de uma string ou inteiro
// -1 é a resposta caso a string não seja encontrada
n_ende = ende.substring(0, ende.lastIndexOf("&tip=") ); // pego a url e retiro a var tip
}

if(ende.lastIndexOf("busca=")!=-1){
	intermediario = "&";
}
else
{
	intermediario = "?";
}
//alert(ende.lastIndexOf("&tip="));
document.location = n_ende + intermediario +"tip=" + alvo.value;
}


function bigimg(id_produto, state){
//pega_img = $id("imggrande");pega_img.getElementsByTagName("img")[0].src = "library/produtos/22_p.jpg"


mostraIMG(id_produto);

var offsetTrail = $id(id_produto);
var offsetLeft = 0;
var offsetTop = 0;
	
	while (offsetTrail) {
	offsetLeft += offsetTrail.offsetLeft;
	offsetTop += offsetTrail.offsetTop;
	offsetTrail = offsetTrail.offsetParent;
	}

		if (navigator.userAgent.indexOf("Mac") != -1 && 
		typeof document.body.leftMargin != "undefined") {
		offsetLeft += document.body.leftMargin;
		offsetTop += document.body.topMargin;
		}
// alert(offsetTop);
// return {left:offsetLeft, top:offsetTop};
//alert("esquerda:" + getPosicaoElemento("ELEMENTO").left)
//alert("topo:" + getPosicaoElemento("ELEMENTO").top
document.getElementById("imggrande").style.visibility = state;
document.getElementById("imggrande").style.top = (offsetTop - 310) + "px";

}


function recomendar_link(){
var rec = new Array("opcoes","listadeprodutos");

for (nrec = 0; nrec < rec.length; nrec++){

class_rec = rec[nrec];


	if(document.getElementById(class_rec)){/*"listadeprodutos"*/

		rl = document.getElementById(class_rec).getElementsByTagName("a");
	 
		 for(arl = 0; arl < rl.length; arl++){
		 	
				 if(rl[arl].className=="recomendar")
								{
			            
								rl[arl].onclick = function() { 
								
								
									recomendar_link_popup(this.href);
									return false;
									
								}	
								
								}
			 
		 }
		 
	}
	
	
	
	

}	
	

}


function ffbusca() {
			  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function"))  {
			    window.sidebar.addSearchEngine("http://solutionshop.com.br/solutionshop.src","http://solutionshop.com.br/favicon.gif","www.solutionshop.com.br","Notebooks");
			  }
			  else {
			    alert("Você precisa usar o navegador Firefox para utilizar esse recurso.\nPara conhecer o Firefox acesse http://br.mozdev.org/firefox ou\nenvie-nos um email através da seção contato.");
			  }
			}


function recomendar_link_popup(ende){
	meds(555,527);
	window.open(ende+"&popup","nomedopopup","scrollbars=yes,width="+wi+", height="+he+", top="+cim+", left="+dir)
}


function revisao(){
	meds(550,325);
	window.open("tools-revisao-de-notebooks.asp","revisao","scrollbars=yes,width="+wi+", height="+he+", top="+cim+", left="+dir +", outerWidth="+wi)
}

function galeria(id,qtd,nome){
meds(690,470);
window.open("library/galeria/galeria.asp?folder="+id+"&qtd="+qtd+"&name="+nome,"galeria_ss","width="+wi+", height="+he+", top="+cim+", left="+dir)
}


function notaba(){

if(document.getElementById("bresadcrumb")){
as = document.getElementById("breadcrumb").a;
	for(a=0;a<as.length;a++){
		as[a].tabindex = "-1";
	}
}

}

function limpa(campo){ if (campo.defaultValue==campo.value) { campo.value = ""} }


//----  js-qtip.js

var qTipTag = new Array("a"); // Array com as tags que nos implementaremos o Tool-tip
var qTipX = -30; // qTip's X offset//
var qTipY = 25; //qTip's Y offset//

tooltip = {
  name : "qTip",
  offsetX : qTipX,
  offsetY : qTipY,
  tip : null
}

tooltip.init = function () {
	
	
	var tipNameSpaceURI = "http://www.w3.org/1999/xhtml";
	if(!tipContainerID){ var tipContainerID = "qTip";}
	var tipContainer = document.getElementById(tipContainerID);

	

	if(!tipContainer) {
	  tipContainer = document.createElementNS ? document.createElementNS(tipNameSpaceURI, "div") : document.createElement("div");
		tipContainer.setAttribute("id", tipContainerID);
	  document.getElementsByTagName("body")[0].appendChild(tipContainer);
	
	}

	if (!document.getElementById) return;
	this.tip = document.getElementById (this.name);
	if (this.tip) document.onmousemove = function (evt) {tooltip.move (evt)};

	var a, sTitle;
	for (var j = 0; j < qTipTag.length; j ++) { // loop que vai implementar o tool-tip nas tags escolhidas
		
		
		var qid = new Array("produtos-mais-vendidos","produtos-mais-procurados","pro_rel");
	
for( nqid=0; nqid<qid.length; nqid++ ){	
		
		if(document.getElementById(qid[nqid])){
						anchors = document.getElementById(qid[nqid]).getElementsByTagName( qTipTag[j] ); // pegamos a tag escolhida
						
						for (var i = 0; i < anchors.length; i ++) { // atribuicao dos tool tips
							a = anchors[i];
							sTitle = a.getAttribute("title"); // pegamos o atributo title
							if(sTitle) { // se estiver setado
								a.setAttribute("tiptitle", sTitle);
								a.removeAttribute("title");
								a.onmouseover = function() {tooltip.show(this.getAttribute('tiptitle'))};
								a.onmouseout = function() {tooltip.hide()};
							}
						}// fim do for
		}
		
		
		
		
		}

		
	
	
	}
	
	
}

tooltip.move = function (evt) {
	var x=0, y=0;
	if (document.all) {// IE
		x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		x += window.event.clientX;
		y += window.event.clientY;
		
	} else {//Bons Navegadores
		x = evt.pageX;
		y = evt.pageY;
	}
	this.tip.style.left = (x + this.offsetX) + "px";
	this.tip.style.top = (y + this.offsetY) + "px";
}

tooltip.show = function (text) {
	if (!this.tip) return;
	this.tip.innerHTML = text;
	this.tip.style.display = "block";
}

tooltip.hide = function () {
	if (!this.tip) return;
	this.tip.innerHTML = "";
	this.tip.style.display = "none";
}


//-- js-flash.js

// js Flash detection and deployment - (c)2004 Adrian Rowbotham - www.ajrdesign.net
//set player version here
var MM_contentVersion = 6;
//set sub version here
var release = "6,0,67,0";
//check for flash player
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
/* -- 2. Deployment function -- */
function writeFlash(swf,flashVarString,w,h,bgcolor,menu,mode,q,id){
if ( MM_FlashCanPlay ) {
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
+'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+release+'" '
+'width="'+w+'" height="'+h+'" id="'+id+'" align="" tabindex="-1">'
+'<param name="movie" value="'+swf+'">'
+'<param name="menu" value="'+menu+'"> '
+'<param name="quality" value="'+q+'"> '
+'<param name="wmode" value="'+mode+'"> '
+'<param name="bgcolor" value="'+bgcolor+'"> '
+'<param name="flashvars" value="'+flashVarString+'"> '
+'<embed src="'+swf+'" flashvars="'+flashVarString+'" menu="'+menu+'" quality="'+q+'" wmode="'+mode+'" '
+' bgcolor="'+bgcolor+'" width="'+w+'" height="'+h+'" name="'+swf+'" '
+' align="" type="application/x-shockwave-flash" '
+' pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> ');
} else {
//behaviour for if there is no flash player
document.write('Você precisa instalar o plugin do Flash '+MM_contentVersion+' ou superior para ver corretamente esse site.');
document.write('<em><a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">');
document.write('Clique aqui para instalar o plugin.</a></em>');
//this can be replaced by anything you want
//e.g. document.location.replace("text.html");
}
}
/*
var flashvars = "";
arguments ==> (url,flashVarString,width,height,bgcolor,show menu,window mode,quality,id)
writeFlash('flash_para_estudos.swf',flashvars,800,390,'#FFFFFF',false,'window','high','sp');
*/

function classAlert(id){ $id(id).className = 'alert'; }
function classDesAlert(id){ $id(id).className = ''; }