
function resize_content(){

height = 0;
height = height + document.getElementById('header').offsetHeight;
height = height + document.getElementById('prof_list').offsetHeight;
height = height + document.getElementById('footer').offsetHeight;

document.getElementById('content_page').style.height = height+'px';
}

function popup(id, str, parOnly, cntry, GUA, gclid)
  {
    /****PROVISIONALMENT****/
    url = "../profilebig/index.php?"+ str +"&id="+ id +"&parOnly="+ parOnly +"&cntry="+ cntry +"&GUA="+ GUA +"&gclid="+ gclid;
    opcions = "toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=1";
    
    var nav = whatnav();
    
    if (nav == "ns")
    {
      amplada = 950;
      alsada = 600;
    }
    else
    {
      amplada = 950;
      alsada = 600;
    }
   
    var w=screen.width;
    var h=screen.height;
    w=(w/2)-(amplada/2);
    h=(h/2)-(alsada/2);
    
    opcions = opcions + ",width=" + amplada;
    opcions = opcions + ",height=" + alsada ;
    opcions = opcions + ",left=" + w;
    opcions = opcions + ",top=" + h;
    
    var x=window.open(url,'ProfessionalProfile',opcions);
    x.focus();
  }

/* trossos
function popuppay(urlfirst, urlsecond, urlthird, urlfinal)
{  
var amplada = screen.width -10;
var alsada = screen.height -20;
var posX = 0;
var posY = 0;

var urlsecondmodify= escape(urlsecond);
var urlfinalmodify= escape(urlfinal);
var url = urlfirst + urlsecondmodify + urlthird + urlfinalmodify;



opcions = "toolbar=0,location=0,directories=0,maximized=yes,status=0,menubar=0,resizable=0,scrollbars=yes";
opcions = opcions + ",width=" + amplada;
opcions = opcions + ",height=" + alsada;
opcions = opcions + ",left=" + posX;
opcions = opcions + ",top=" + posY;

window.open(url,'Professional',opcions);
}
*/

function popuppay(url, language, parameterOnly, country, rurl, nick, photo, GUA, paypage, gclid)
{  
  if (parameterOnly != "")
  {
    url = url + "," + parameterOnly + "&lng=" + language + "&cntry=" + country + "&gclid=" + gclid;
  }
  else
  {
    url = url + "&lng=" + language + "&cntry=" + country + "&gclid=" + gclid;
  }
  
  if (country.toUpperCase() == "ES")
  {
    url = url + "&dp=0&dt=1";
  }
  else
  {
    url = url + "&dp=0&dt=2";
  }
  
  url = url + "&GUA=" + GUA;
  
  if (paypage == 1)
  {
    var amplada = screen.width - 10;
    var alsada = screen.height - 20;
    var posX = 0;
    var posY = 0;
    
    opcions = "toolbar=yes,location=yes,directories=yes,maximized=yes,status=yes,menubar=yes,resizable=yes,scrollbars=yes";
    opcions = opcions + ",width=" + amplada;
    opcions = opcions + ",height=" + alsada;
    opcions = opcions + ",left=" + posX;
    opcions = opcions + ",top=" + posY;
    
    var x = window.open(url,'_blank',opcions);
    x.focus();
  }
  else
  {
    top.location = url;
  }
}


/*
function popuppro(id, str, profile)
{
	url = "../profilepro"+profile+"/index.php?"+ str +"&item_id="+ id;
	opcions = "toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=0";
	if (profile == 1)
	{
		amplada = 510;
		alsada = 560;
		posX = 600;
	}
	else 
	{
		amplada = 770;
		alsada = 490;
		posX = 250;
	}

	
	opcions = opcions + ",width=" + amplada;
	opcions = opcions + ",height=" + alsada;
	
	opcions = opcions + ",left=" + posX;
	posY = 150;
	opcions = opcions + ",top=" + posY;
	window.open(url,'Professional',opcions);
}
*/
function check_height(level, view_menu, number_tabs, number_listcat, ncols, item_type)
{
  if (view_menu == 2)
  {
    if ((level == 1) || (level == 2))
    {
      //CALCULEM L'ALSADA DEL LLISTAT VERTICAL DE CATEGORIES
      var i = 0;
      var tag = "";
      var contfills = 0;
      var alsada = 0;
      var fills = document.getElementById('vertical_menu').childNodes.length;
      
      while (i < fills)
      {
        tag = document.getElementById('vertical_menu').childNodes[i].nodeName;
        
        if (tag == "DIV")
        {
          contfills++;
        }
        
        if (contfills == number_listcat)
      	{
          i = fills;
      	}
        else
        {
          i++;
        }
      }
      
      alsada = contfills * 27;
      
      document.getElementById('vertical_menu').style.height = alsada + 'px';
      
      
      //CALCULEM L'ALSADA DEL LLISTAT PER TABS DE SUBCATEGORIES
      if (level == 2)
      {
        var num_lineas = 1;
        var menu_width = 0;
        var cont_width = 0;
        i = 0;
        tag = "";
        contfills = 0;
        fills = document.getElementById('tabs_menu').childNodes.length;
        
        if (item_type == 2)
        {
          menu_width = 490;
        }
        else
        {
          menu_width = 142 * ncols; // item = 152, but 142 why (- 10px of margins)
        }
        
        document.getElementById('tabs_menu').style.width = menu_width + 'px';
        
        while (i < fills)
        {
          tag = document.getElementById('tabs_menu').childNodes[i].nodeName;
          
          if (tag == "DIV")
          {
            cont_width = cont_width + parseInt(document.getElementById('tabs_menu').childNodes[i].clientWidth) + 5; // 5px of margins
            
            if (cont_width > menu_width)
            {		
              cont_width = parseInt(document.getElementById('tabs_menu').childNodes[i].clientWidth) + 5; // 5px of margins
              num_lineas++;
            }
          }
          
          i++;
        }
        
        alsada = num_lineas * 27;
        
        document.getElementById('tabs_menu').style.height = alsada + 'px';
      }
    }
  }
}

  function whatnav()
	{    
		if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4))
	    {
			return("ie");
	    }
	    else
	    {
	      if(navigator.appName == "Netscape")
	      {
	       return("ns")
	      }
	    }
	}

