//Llista de paisos
function getcountrylist(aCombo) {
	aCombo.options.length = 0;
var pais = new Array(
new Array('Afghanistan','Afghanistan'),
new Array('Albania','Albania'),
new Array('Algeria','Algeria'),
new Array('American Samoa','American Samoa'),
new Array('Andorra','Andorra'),
new Array('Angola','Angola'),
new Array('Anguilla','Anguilla'),
new Array('Antarctica','Antarctica'),
new Array('Antigua and Barbuda','Antigua and Barbuda'),
new Array('Argentina','Argentina'),
new Array('Armenia','Armenia'),
new Array('Aruba','Aruba'),
new Array('Australia','Australia'),
new Array('Austria','Austria'),
new Array('Azerbaijan','Azerbaijan'),
new Array('Bahamas','Bahamas'),
new Array('Bahrain','Bahrain'),
new Array('Bangladesh','Bangladesh'),
new Array('Barbados','Barbados'),
new Array('Belarus','Belarus'),
new Array('Belgium','Belgium'),
new Array('Belize','Belize'),
new Array('Benin','Benin'),
new Array('Bermuda','Bermuda'),
new Array('Bhutan','Bhutan'),
new Array('Bolivia','Bolivia'),
new Array('Bosnia and Herzegovina','Bosnia and Herzegovina'),
new Array('Botswana','Botswana'),
new Array('Bouvet Island','Bouvet Island'),
new Array('Brazil','Brazil'),
new Array('British Indian Ocean Territory','British Indian Ocean Territory'),
new Array('Brunei Darussalam','Brunei Darussalam'),
new Array('Bulgaria','Bulgaria'),
new Array('Burkina Faso','Burkina Faso'),
new Array('Burundi','Burundi'),
new Array('Cambodia','Cambodia'),
new Array('Cameroon','Cameroon'),
new Array('Canada','Canada'),
new Array('Cape Verde','Cape Verde'),
new Array('Cayman Islands','Cayman Islands'),
new Array('Central African Republic','Central African Republic'),
new Array('Chad','Chad'),
new Array('Chile','Chile'),
new Array('China','China'),
new Array('Christmas Island','Christmas Island'),
new Array('Cocos (Keeling Islands)','Cocos (Keeling Islands)'),
new Array('Colombia','Colombia'),
new Array('Comoros','Comoros'),
new Array('Congo','Congo'),
new Array('Cook Islands','Cook Islands'),
new Array('Costa Rica','Costa Rica'),
new Array('Cote D Ivoire','Cote D Ivoire'),
new Array('Croatia (Hrvatska','Croatia (Hrvatska'),
new Array('Cuba','Cuba'),
new Array('Cyprus','Cyprus'),
new Array('Czech Republic','Czech Republic'),
new Array('Denmark','Denmark'),
new Array('Djibouti','Djibouti'),
new Array('Dominican Republic','Dominican Republic'),
new Array('Dominica','Dominica'),
new Array('East Timor','East Timor'),
new Array('Ecuador','Ecuador'),
new Array('Egypt','Egypt'),
new Array('El Salvador','El Salvador'),
new Array('Equatorial Guinea','Equatorial Guinea'),
new Array('Eritrea','Eritrea'),
new Array('Estonia','Estonia'),
new Array('Ethiopia','Ethiopia'),
new Array('Falkland Islands (Malvinas)','Falkland Islands (Malvinas)'),
new Array('Faroe Islands','Faroe Islands'),
new Array('Fiji','Fiji'),
new Array('Finland','Finland'),
new Array('France, Metropolitan','France, Metropolitan'),
new Array('France','France'),
new Array('French Guiana','French Guiana'),
new Array('French Polynesia','French Polynesia'),
new Array('French Southern Territories','French Southern Territories'),
new Array('Gabon','Gabon'),
new Array('Gambia','Gambia'),
new Array('Georgia','Georgia'),
new Array('Germany','Germany'),
new Array('Ghana','Ghana'),
new Array('Gibraltar','Gibraltar'),
new Array('Greece','Greece'),
new Array('Greenland','Greenland'),
new Array('Grenada','Grenada'),
new Array('Guadeloupe','Guadeloupe'),
new Array('Guam','Guam'),
new Array('Guatemala','Guatemala'),
new Array('Guinea-Bissau','Guinea-Bissau'),
new Array('Guinea','Guinea'),
new Array('Guyana','Guyana'),
new Array('Haiti','Haiti'),
new Array('Heard and McDonald Islands','Heard and McDonald Islands'),
new Array('Honduras','Honduras'),
new Array('Hong Kong','Hong Kong'),
new Array('Hungary','Hungary'),
new Array('Iceland','Iceland'),
new Array('India','India'),
new Array('Indonesia','Indonesia'),
new Array('Iran','Iran'),
new Array('Iraq','Iraq'),
new Array('Ireland','Ireland'),
new Array('Israel','Israel'),
new Array('Italy','Italy'),
new Array('Jamaica','Jamaica'),
new Array('Japan','Japan'),
new Array('Jordan','Jordan'),
new Array('Kazakhstan','Kazakhstan'),
new Array('Kenya','Kenya'),
new Array('Kiribati','Kiribati'),
new Array('Korea (North)','Korea (North)'),
new Array('Korea (South)','Korea (South)'),
new Array('Kuwait','Kuwait'),
new Array('Kyrgyzstan','Kyrgyzstan'),
new Array('Laos','Laos'),
new Array('Latvia','Latvia'),
new Array('Lebanon','Lebanon'),
new Array('Lesotho','Lesotho'),
new Array('Liberia','Liberia'),
new Array('Libya','Libya'),
new Array('Liechtenstein','Liechtenstein'),
new Array('Lithuania','Lithuania'),
new Array('Luxembourg','Luxembourg'),
new Array('Macau','Macau'),
new Array('Macedonia','Macedonia'),
new Array('Madagascar','Madagascar'),
new Array('Malawi','Malawi'),
new Array('Malaysia','Malaysia'),
new Array('Maldives','Maldives'),
new Array('Mali','Mali'),
new Array('Malta','Malta'),
new Array('Marshall Islands','Marshall Islands'),
new Array('Martinique','Martinique'),
new Array('Mauritania','Mauritania'),
new Array('Mauritius','Mauritius'),
new Array('Mayotte','Mayotte'),
new Array('Mexico','Mexico'),
new Array('Micronesia','Micronesia'),
new Array('Moldova','Moldova'),
new Array('Monaco','Monaco'),
new Array('Mongolia','Mongolia'),
new Array('Montserrat','Montserrat'),
new Array('Morocco','Morocco'),
new Array('Mozambique','Mozambique'),
new Array('Myanmar','Myanmar'),
new Array('Namibia','Namibia'),
new Array('Nauru','Nauru'),
new Array('Nepal','Nepal'),
new Array('Netherlands Antilles','Netherlands Antilles'),
new Array('Netherlands','Netherlands'),
new Array('New Caledonia','New Caledonia'),
new Array('New Zealand','New Zealand'),
new Array('Nicaragua','Nicaragua'),
new Array('Nigeria','Nigeria'),
new Array('Niger','Niger'),
new Array('Niue','Niue'),
new Array('Norfolk Island','Norfolk Island'),
new Array('Northern Mariana Islands','Northern Mariana Islands'),
new Array('Norway','Norway'),
new Array('Oman','Oman'),
new Array('Pakistan','Pakistan'),
new Array('Palau','Palau'),
new Array('Panama','Panama'),
new Array('Papua New Guinea','Papua New Guinea'),
new Array('Paraguay','Paraguay'),
new Array('Peru','Peru'),
new Array('Philippines','Philippines'),
new Array('Pitcairn','Pitcairn'),
new Array('Poland','Poland'),
new Array('Portugal','Portugal'),
new Array('Puerto Rico','Puerto Rico'),
new Array('Qatar','Qatar'),
new Array('Reunion','Reunion'),
new Array('Romania','Romania'),
new Array('Russian Federation','Russian Federation'),
new Array('Rwanda','Rwanda'),
new Array('S. Georgia and S. Sandwich Isls.','S. Georgia and S. Sandwich Isls.'),
new Array('Saint Kitts and Nevis','Saint Kitts and Nevis'),
new Array('Saint Lucia','Saint Lucia'),
new Array('Saint Vincent and The Grenadines','Saint Vincent and The Grenadines'),
new Array('Samoa','Samoa'),
new Array('San Marino','San Marino'),
new Array('Sao Tome and Principe','Sao Tome and Principe'),
new Array('Saudi Arabia','Saudi Arabia'),
new Array('Senegal','Senegal'),
new Array('Seychelles','Seychelles'),
new Array('Sierra Leone','Sierra Leone'),
new Array('Singapore','Singapore'),
new Array('Slovak Republic','Slovak Republic'),
new Array('Slovenia','Slovenia'),
new Array('Solomon Islands','Solomon Islands'),
new Array('Somalia','Somalia'),
new Array('South Africa','South Africa'),
new Array('Spain','Spain'),
new Array('Sri Lanka','Sri Lanka'),
new Array('St. Helena','St. Helena'),
new Array('St. Pierre and Miquelon','St. Pierre and Miquelon'),
new Array('Sudan','Sudan'),
new Array('Suriname','Suriname'),
new Array('Svalbard and Jan Mayen Islands','Svalbard and Jan Mayen Islands'),
new Array('Swaziland','Swaziland'),
new Array('Sweden','Sweden'),
new Array('Switzerland','Switzerland'),
new Array('Syria','Syria'),
new Array('Taiwan','Taiwan'),
new Array('Tajikistan','Tajikistan'),
new Array('Tanzania','Tanzania'),
new Array('Thailand','Thailand'),
new Array('Togo','Togo'),
new Array('Tokelau','Tokelau'),
new Array('Tonga','Tonga'),
new Array('Trinidad and Tobago','Trinidad and Tobago'),
new Array('Tunisia','Tunisia'),
new Array('Turkey','Turkey'),
new Array('Turkmenistan','Turkmenistan'),
new Array('Turks and Caicos Islands','Turks and Caicos Islands'),
new Array('Tuvalu','Tuvalu'),
new Array('US Minor Outlying Islands','US Minor Outlying Islands'),
new Array('Uganda','Uganda'),
new Array('Ukraine','Ukraine'),
new Array('United Arab Emirates','United Arab Emirates'),
new Array('United Kingdom','United Kingdom'),
new Array('United States','United States'),
new Array('Uruguay','Uruguay'),
new Array('Uzbekistan','Uzbekistan'),
new Array('Vanuatu','Vanuatu'),
new Array('Vatican City State','Vatican City State'),
new Array('Venezuela','Venezuela'),
new Array('Viet Nam','Viet Nam'),
new Array('Virgin Islands (British)','Virgin Islands (British)'),
new Array('Virgin Islands (US)','Virgin Islands (US)'),
new Array('Wallis and Futuna Islands','Wallis and Futuna Islands'),
new Array('Western Sahara','Western Sahara'),
new Array('Yemen','Yemen'),
new Array('Yugoslavia','Yugoslavia'),
new Array('Zaire','Zaire'),
new Array('Zambia','Zambia'),
new Array('Zimbabwe','Zimbabwe')
);
		  
	for (var i = 0, n = 0; i < pais.length; i++) {
		aCombo.options[n++] = new Option(
			pais[i][1],
			pais[i][0]
		);
	}
	aCombo.selectedIndex = 194;
}

function showDesc(x) {
	if (isMicrosoft(4))
		document.all[x].style.visibility="visible";	
	else if(isMozilla(1))
		document.layers[x].visibility="show";
	else if(isNetscape(1))
		document.getElementById(x).style.visibility="visible";

}

function hideDesc(x) {
	if (isMicrosoft(4))
		document.all[x].style.visibility="hidden";	
	else if(isMozilla(1))
		document.layers[x].visibility="hidden";
	else if(isNetscape(1))
		document.getElementById(x).style.visibility="hidden";
}

function moveTo(obj, x, y) {
        if (document.getElementById) {
        document.getElementById('menuDiv').style.left = x;
        document.getElementById('menuDiv').style.top = y;
        }
}

var slide;
var idslide;
var slideobj;

function init(){
		//document.getElementById('menuDiv1').style.left=275;
		//document.getElementById('menuDiv2').style.left=275;
		//document.getElementById('menuDiv3').style.left=275;
}

function slideRight(object){
		var obj;
		
        if(document.getElementById){
			
			obj = document.getElementById(object);
			if (!obj.style.left) obj.style.left = 275;
			if(parseInt(obj.style.left) < 432){
				obj.style.left = parseInt(obj.style.left) + 4 + "px";
				if (slideobj==object) clearTimeout(idslide);
				idslide=setTimeout(function () {slideRight(object) },20);
				slideobj=object;
			}
			
			if(parseInt(obj.style.left) < 432 && parseInt(obj.style.left) > 429 ){
							obj.style.left = 433 + "px";
			}				
        }
}

function slideLeft(object){
        if(document.getElementById){
			obj = document.getElementById(object);
			if(parseInt(obj.style.left) > 275){
				obj.style.left = parseInt(obj.style.left) - 4 + "px";
				if (slideobj==object) clearTimeout(idslide);
				idslide=setTimeout(function () {slideLeft(object) },20);
				slideobj=object;
			}
	}
}

var FadeDown=100;
var FadeUp=100;
var FadeTrans=4000;
var FadeIE=2;

function AlphaDown(obj){
		if (obj.filters){
			if (obj.filters.alpha.opacity>=FadeIE){
				obj.filters.alpha.opacity-=FadeIE;
				setTimeout(function () { AlphaDown(obj) },FadeDown);
			}else{
				setTimeout(function () { AlphaUp(obj) },FadeTrans+Math.random()*1000);
			}
		}else{
			if (obj.style.MozOpacity>=0.02){
				obj.style.MozOpacity-=0.02;
				setTimeout(function () { AlphaDown(obj) },FadeDown);
			}else{
				setTimeout(function () { AlphaUp(obj) },FadeTrans+Math.random()*1000);
			}
		}
}

function AlphaUp(obj){
		if (obj.filters){
			if (obj.filters.alpha.opacity<100){
				obj.filters.alpha.opacity+=FadeIE;
				setTimeout(function () { AlphaUp(obj) },FadeUp);
			}else{
				setTimeout(function () { AlphaDown(obj) },FadeTrans+Math.random()*5000);
			}
		}else{
			if (obj.style.MozOpacity<1.0){
				obj.style.MozOpacity=1.0;
				setTimeout(function () { AlphaUp(obj) },FadeUp);
			}else{
				setTimeout(function () { AlphaDown(obj) },FadeTrans+Math.random()*5000);
			}
		}
}

function isNetscape(v) {
  return isBrowser("Netscape", v);
}

function isMicrosoft(v) {
  return isBrowser("Microsoft", v);
}

function isMozilla(v) {
  return isBrowser("Mozilla	", v);
}

function isBrowser(b,v) {
  browserOk = false;
  versionOk = false;

  browserOk = (navigator.appName.indexOf(b) != -1);
  if (v == 0) versionOk = true;
  else  versionOk = (v <= parseInt(navigator.appVersion));
  return browserOk && versionOk;
  }

function imprimir(url) {
  open('print.php?nid='+url,'DisplayWindow','width=800,height=450,scrollbars=yes,toolbar=yes');
}

function showexport(object) {
	var exportOptions = document.getElementById(object);
	if (exportOptions.style.display == 'inline') {
		exportOptions.style.display = 'none';
	} else {
		exportOptions.style.display = 'inline';
	}
}

function changelink(text1,text2){
		document.getElementById('pLink').innerHTML = "<a class=\"text\" href=\"javascript:showexport('pCase'); showexport('pImage'); showexport('pResumen'); changelink('"+text2+"','"+text1+"');\">"+text2+"</a>";
}

function ImagesIterator(obj,num){
		
		if (typeof( window['imgIterator'] ) == "undefined" ) return;
		
		if (num == 0){
			obj.src=imgIterator[ 0 ];
			setTimeout(function () { ImagesIterator(obj,num+1) },5000);
			return;
		}
	
		if ( num == imgIterator.length * 2 ){
			obj.src=imgIterator[ 0 ];
			ImageIteratorUp(obj, 0);
			return;
		}
		
		if (num % 2 == 1)
		{
			//IMPARS
			ImageIteratorDown(obj,num);
			return;
		}
		else
		{
			//PARS
			ImageIteratorUp(obj,num);
			return;
		}
}

function ImageIteratorDown(obj,num){
		if (obj.filters){
			if (obj.filters.alpha.opacity>=FadeIE){
				obj.filters.alpha.opacity-=FadeIE;
				setTimeout(function () { ImageIteratorDown(obj,num) },30);
			}else{	
		        if ( num + 1 < imgIterator.length * 2 )
				    obj.src=imgIterator[ ( num + 1 )  / 2 ];
                    
                setTimeout(function () { ImagesIterator(obj,num+1) },10);
			}
		}else{
			if (obj.style.MozOpacity>=0.1){
				obj.style.MozOpacity-=0.1;
				setTimeout(function () { ImageIteratorDown(obj,num) },FadeDown);
			}else{
                
                if ( num + 1 < imgIterator.length * 2 )
				    obj.src=imgIterator[ ( num + 1 )  / 2 ];
        
				setTimeout(function () { ImagesIterator(obj,num+1) },10);
			}
		}
}

function ImageIteratorUp(obj,num){
		if (obj.filters){
			if (obj.filters.alpha.opacity<100){
				obj.filters.alpha.opacity+=FadeIE;
				setTimeout(function () { ImageIteratorUp(obj,num) },30);
			}else{

				setTimeout(function () { ImagesIterator(obj,num+1) },5000);
			}
		}else{
			if (obj.style.MozOpacity<1.0){
				obj.style.MozOpacity=1;
				setTimeout(function () { ImageIteratorUp(obj,num) },FadeUp);
			}else{
				setTimeout(function () { ImagesIterator(obj,num+1) },1000);
			}
		}
}

var bgcolor = "#FFFFFF"; // background color, must be valid browser hex color (not color names)
var fcolor = "#000000";  // foreground or font color
var steps = 64; // number of steps to fade
var show = 1000; // milliseconds to display message
var sleep = 1000; // milliseconds to pause inbetween messages
var loop = true; // true = continue to display messages, false = stop at last message

// Do Not Edit Below This Line
var colors = new Array(steps);
getFadeColors(bgcolor,fcolor,colors);
var color = 0;
var step = 1;

// fade: magic fader function
function fade(text) {

// insert fader color into message
var text_out = "<font color='"+colors[color]+"'><strong>"+text+"</strong></font>";

// actually write message to document
if (document.all) fader.innerHTML = text_out; // document.all = IE only
if (document.layers) { document.fader.document.write(text_out); document.fader.document.close(); } // document.layers = Netscape only

// select next fader color
color += step; 

// completely faded in?
if (color >= colors.length-1) {
step = -1; // traverse colors array backward to fade out

// stop at last message if loop=false
if (!loop && text >= texts.length-1) return; // loop should be defined in user script, e.g.: var loop=true;
}

// completely faded out?
if (color == 0) {
step = 1; // traverse colors array forward to fade in again

}

// subtle timing logic...
setTimeout("fade('"+text+"')", (color == colors.length-2 && step == -1) ? show : ((color == 1 && step == 1) ? sleep : 50)); // sleep and show should be defined in user script, e.g.: var sleep=30; var show=500;
}
// getFadeColors: fills Colors (predefined Array)
// with color hex strings fading from ColorA to ColorB

// note: Colors.length equals the number of steps to fade
function getFadeColors(ColorA, ColorB, Colors) {
len = Colors.length; 

// strip '#' signs if present 
if (ColorA.charAt(0)=='#') ColorA = ColorA.substring(1);
if (ColorB.charAt(0)=='#') ColorB = ColorB.substring(1);

// substract rgb compents from hex string 
var r = HexToInt(ColorA.substring(0,2));
var g = HexToInt(ColorA.substring(2,4));
var b = HexToInt(ColorA.substring(4,6));
var r2 = HexToInt(ColorB.substring(0,2));
var g2 = HexToInt(ColorB.substring(2,4));
var b2 = HexToInt(ColorB.substring(4,6));

// calculate size of step for each color component
var rStep = Math.round((r2 - r) / len);
var gStep = Math.round((g2 - g) / len);
var bStep = Math.round((b2 - b) / len);

// fill Colors array with fader colors
for (i = 0; i < len-1; i++) {
Colors[i] = "#" + IntToHex(r) + IntToHex(g) + IntToHex(b);
r += rStep;
g += gStep;
b += bStep;
}
Colors[len-1] = ColorB; // make sure we finish exactly at ColorB
}

// IntToHex: converts integers between 0-255 into a two digit hex string.
function IntToHex(n) {
var result = n.toString(16);
if (result.length==1) result = "0"+result;
return result;
}

// HexToInt: converts two digit hex strings into integer.
function HexToInt(hex) {
return parseInt(hex, 16);
}

function fadetext(text) {
	fade('<span style="font-size: 28px; font-family: Arial, Helvetica, sans-serif;">&quot;</span>'+text+'<span style="font-size: 28px; font-family: Arial, Helvetica, sans-serif;">&quot;</span>');
}

function submitenter(myfield,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	
	if (keycode == 13){ myfield.form.submit(); return false; }
	else return true;
}

