// JavaScript Document
function submit_value(pais,regiao,tipo,marca,ano,file)
{
	window.location=file+"?pais="+pais+"&regiao="+regiao+"&tipo="+tipo+"&marca="+marca+"&ano="+ano;
}

function disable_pais()
{
	document.procura.cbxPais.disabled=true;
}

function disable_regiao()
{
    document.procura.cbxRegiao.disabled=true;
}

function disable_tipo()
{
    document.procura.cbxTipo.disabled=true;
}

function disable_marca()
{
    document.procura.cbxMarca.disabled=true;
}

function disable_ano()
{
    document.procura.cbxAno.disabled=true;
}

function page_scroll(pais,regiao,tipo,marca,ano,page)
{		
	window.location="search.php?pais="+pais+"&regiao="+regiao+"&tipo="+tipo+"&marca="+marca+"&ano="+ano+"&page="+page;
}

function addpopup(marca)
{
  alert ('Encomenda de '+marca+' adicionada à sua lista.');
} 

function mylist()
{
 window.location='mylist.php';
} 

function addmylist(id,nome,qtfee,efee,iva)
{
 window.location='mylist.php?id='+id+'&marca='+nome+'&qtfee='+qtfee+'&efee='+efee+'&iva='+iva+'&inserir=1';
}

var selected="";

function teste_cbox(id,cond)
{
 if(cond)
 {   
  selected=selected+id+"&";
 } 
 else
 {
  selected=selected.replace(id+"&","");
 } 
}

function clear_all()
{
 window.location="mylist.php?clear=-1";
}

function clear_sel()
{
 tab=selected.split('&');
 index=selected.indexOf("&",0);
 
 for(count=0;index!=-1;count++)
 {
  index=selected.indexOf("&",index+1);
 }

 newurl="";
 for(j=0;j<count;j++)
 {
  newurl=newurl+"cl"+j+"="+tab[j];
  if(j<(count-1))
   newurl=newurl+"&";
 }
 
 if(count!=0)
  window.location.href="mylist.php?"+newurl;
}

function MM_openBrWindow2(theURL,winName,features, myWidth, myHeight, isCenter) 
{ //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  jaadd=window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}
