var urls = new Array();
urls[0] = new Array('Corporativa','corporativa.htm')
urls[1] = new Array('Links','links.htm')
urls[2] = new Array('Ofertas','ofertas.htm')
urls[3] = new Array('Flota','flota.htm')
urls[4] = new Array('Preguntas más Frecuentes','faq.htm')
urls[5] = new Array('Empleo','empleo.htm')
urls[6] = new Array('Comentarios/Sugerencias','comentarios.asp')
urls[7] = new Array('Oficinas/Delegaciones','oficinas.htm')
urls[8] = new Array('Transporte de Mercancías','carga.asp')
urls[9] = new Array('Horarios y Tarifas','lineas.asp')
urls[10] = new Array('Seguridad y Calidad','seguridad.htm')
urls[11] = new Array('Noticias','noticias.htm')
urls[12] = new Array('< Inicio','default.asp')
urls[13] = new Array('Medio Ambiente','medioambiente.htm')
urls[14] = new Array('Atención Comercial','atencionComercial.htm')
urls[15] = new Array('Reservas On·Line','https://www.iscomar.com/reservas/reserva_online0.asp')
urls[16] = new Array('agencias','https://www.iscomar.com/Agencias/ag_id0.asp')
urls[17] = new Array('Català','cat/default.asp')
urls[18] = new Array('English','eng/default.asp')
urls[19] = new Array('Français','fra/default.asp')

function irA(url){
	for(i=0;i<urls.length;i++){
		if(urls[i][0].match(url)){
			document.location = urls[i][1]
			return;
		}
	}
	alert('unknown destination')
}

var header = '' 
		+'<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="100%" HEIGHT="105" id="default" ALIGN="">'
 			+'<PARAM NAME=movie VALUE="header.swf">'
 			+'<PARAM NAME=menu VALUE=false>'
 			+'<PARAM NAME=quality VALUE=high>'
 			+'<PARAM NAME=scale VALUE=noscale>'
 			+'<PARAM NAME=salign VALUE=LT>'
 			+'<PARAM NAME=bgcolor VALUE=#003865>'
  		+'<EMBED src="header.swf" menu=false quality=high scale=noscale salign=LT bgcolor=#003865  WIDTH="100%" HEIGHT="105" NAME="default" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>'
		+'</OBJECT>';
		
var footer = ''

		+'<table border=0 cellpadding=0 cellspacing=0 width=700><td class=copyr>'
			+'Páginas optimizadas para una resolución de 800x600 pixels.<br>'
			+'&copy;Iscomar, 2002<br><br>'
			+'<a href="javascript:wopen(\'legal.htm\',400,400);" class="legal">Información Legal</a></span><br>'
			+'</td></table>'
		
function rollover(imgName,st){
	document.images[imgName].src = "images/bt_" + imgName + '_' + st + '.gif'
}

function oWIN(img){
	nw = window.open('foto.htm?foto=' + img,'nw','width=10,height=10,resizable=yes')
}

function openPresupuesto(){
	nw = window.open('presupuesto.asp','nw','width=540,height=400,scrollBars=2')
}


//Funciones para el envio de email

function testForm(formulario){
	errorMsg = ''
	for(i=0;i<obligar.length;i++){
		obliga = obligar[i].split('|')
		if((obliga.length == 3)&&(eval('formulario.' + obliga[0]).value != "")){
			val = eval('formulario.' + obliga[0]).value		
			if((val/val) != 1){
				errorMsg += 'El campo ' + obliga[1] + ' debe ser numérico\r'
			}
		}
		if(eval('formulario.' + obliga[0]).value == ""){
			errorMsg += 'Debe rellenar el campo ' + obliga[1] + '\r'
		}
	}
	if(errorMsg.length > 0){
		alert(errorMsg)
		return false;
	}else{
		return true;
	}
}

function sendMail(){
	formulario = document.forms[0]
	if(testForm(formulario)){
		formulario.fromPage.value = document.location
		formulario.messageOK.value = eMail_mensaje
		formulario.toMail.value = eMail_toMail
		formulario.subject.value = eMail_subject
		for(i=4;i<formulario.length;i++){
			if(i>0 && formulario[i].name != formulario[i-1].name)
			formulario.fields.value += formulario[i].name + ','
		}
		mailWIN = null
		window.open('about:','mailWIN','width=300,height=100,top=100,left=100')
		formulario.action = 'sendMail.asp'
		formulario.target = 'mailWIN'
		formulario.method = "post"
		formulario.submit()
	}
}

//Funciones del listado

function raster(txt){
	temp = ''
	texto = txt.split("ISCOMAR");
	for(r=0;r<texto.length;r++){
		if(r > 0){ temp += "<b>ISCOMAR</b>"}
		temp += texto[r]
	}
	return temp;
} 

// abre ventana
function wopen(url,w,h,name){
	nw = window.open(url,name,'width=' + w + ',height=' + h + ',scrollBars=2')
}
function parpadeo(cod){
		
	if (cod == '1') {
			document.all.presu.style.textDecoration = "none";
			document.all.presu.style.color = "red";
			setTimeout('parpadeo(0)', 1000);
			} 
		else {
				document.all.presu.style.textDecoration = "underline";
				document.all.presu.style.color = "#5A5A5C";
				setTimeout('parpadeo(1)', 1000);
		}
		
	}				
//xtra estilos
var st = '<style>'
	+ '.legal{font-family:Arial, Helvetica;font-size:9px;color:#06528E;font-weight:normal}'
	+ 'A:link.legal{font-family:Verdana;color:#ADCFEF;font-weight:normal;font-size:9px;text-decoration:underline;}'
	+ 'A:visited.legal{color:#ADCFEF;font-weight:normal;font-size:9px;text-decoration:underline;}'
	+ 'A:hover.legal{color:#FBF709;text-decoration:underline;font-weight:normal;font-size:9px}'
	+ '</style>'
document.write(st)

function menuIzquierda(idioma){
	switch(idioma){
		case "esp":
			txtTransporte = "Transporte de Mercancías"
			txtLinks = "Links"
			txtEmpleo = "Bolsa de empleo"
			txtAtencion = "Atención Comercial"
			txtContacto = "Contáctanos"
			txtInfoLegal = "Información legal"
			txtCreditos = "Créditos"
			txtPresu = "Presupuesto Carga"
			break;
		case "cat":
			txtTransporte = "Transport de Mercaderies"
			txtLinks = "Links"
			txtEmpleo = "Borsa de treball"
			txtAtencion = "Atenció Comercial"
			txtContacto = "Contacti´ns"
			txtInfoLegal = "Informació legal"
			txtCreditos = "Crèdits"
			txtPresu = "Pressupost Càrrega"	
			break;
		case "eng":
			txtTransporte = "Goods Carriage"
			txtLinks = "Links"
			txtEmpleo = "Job"
			txtAtencion = "Commercial Attention"
			txtContacto = "Contact"
			txtInfoLegal = "Legal Information"
			txtCreditos = "Credits"
			txtPresu = "Freight Budget"		
			break;
		case "fra":
			txtTransporte = "Transport de Merchandises"
			txtLinks = "Links"
			txtEmpleo = "Emploi"
			txtAtencion = "Attention Commerciale"
			txtContacto = "Contact"
			txtInfoLegal = "Information Légale"
			txtCreditos = "Crédits"
			txtPresu = "Budget Frêt"		
			break;
		default:
			txtTransporte = "Transporte de Mercancías"
			txtLinks = "Links"
			txtEmpleo = "Bolsa de empleo"
			txtAtencion = "Atención Comercial"
			txtContacto = "Contáctanos"
			txtInfoLegal = "Información legal"
			txtCreditos = "Créditos"
			txtPresu = "Presupuesto Carga"	
			break;
	}
	txt ='<A HREF="transporte.asp" CLASS="menusub">'+txtTransporte.toUpperCase()+'</A> · '
		+'<A HREF="presupuesto.asp"  name="presu"    CLASS="menusub" target="_blank" style="text-decoration:underline;">'+txtPresu+'</A> · '
		+'<A HREF="atencioncomercial.asp" CLASS="menusub">'+txtAtencion+'</A> · '
		+'<A HREF="empleo.asp" CLASS="menusub">'+txtEmpleo+'</A> · '		
		+'<A HREF="links.asp" CLASS="menusub" >'+txtLinks+'</A> · '
		+'<A HREF="contacto.asp" CLASS="menusub">'+txtContacto+'</A><br>'
		+'<SPAN CLASS=legal_in><br>&copy; 2006 Iscomar · <A href="#" CLASS="legal_in" onClick="iPracticaIL(\''+idioma+'\')">'+txtInfoLegal+'</A></SPAN> · <a href="#" class="legal_in" onClick="iPracticaCR(\''+idioma+'\')">'+txtCreditos+'</a><br><br><br>'
		+'<Script>parpadeo(1);</script>'
	return txt;
	
}

function UpperNotFirst(str){
	txt2 = str.substring(1)
	txt3 = String(str).substring(0,1)
	
	return txt3.toUpperCase() + txt2.toLowerCase()
}

function menuFunc(pres,idioma,tipo){
	switch(idioma){
		case "esp":
			txtInfoPractica = "Información práctica"
			txtImprimir = "Imprimir"
			txtEnviar = "Enviar a un amigo"
			txtPresupuesto = "Presupuestos"
			break;
		case "cat":
			txtInfoPractica = "Informació pràctica"
			txtImprimir = "Imprimir"
			txtEnviar = "Enviar a un amic"
			txtPresupuesto = "Pressupostos"
			break;
		case "eng":
			txtInfoPractica = "Practical information"
			txtImprimir = "Print"
			txtEnviar = "Send to a friend"
			txtPresupuesto = "Budgets"
			break;
		case "fra":
			txtInfoPractica = "Information practique"
			txtImprimir = "Imprimer"
			txtEnviar = "Envoyer à un ami"
			txtPresupuesto = "Devis"
			break;
		default:
			txtInfoPractica = "Información práctica"
			txtImprimir = "Imprimir"
			txtEnviar = "Enviar a un amigo"
			txtPresupuesto = "Presupuestos"
			break;
	}
	
	str ='<table cellpadding=2 cellspacing=2>'
		+'<tr bgcolor="#CDDAE2" Height="18" style="border-left:#CDDAE2;color:#5A5A5C;cursor:hand;">'
		if(tipo==1){str +='	<td style="padding:0px 7px 0px 7px" onClick="iPracticaCarga()">'+txtInfoPractica+'</td>'}else{str +=' <td style="padding:0px 7px 0px 7px" onClick="iPractica()">'+txtInfoPractica+'</td>'}
		str +='	<td style="padding:0px 7px 0px 7px" onClick="printPageH()">'+txtImprimir+'</td>'
		+'	<td style="padding:0px 7px 0px 7px" onClick="tellaFriend()">'+txtEnviar+'</td>'
		if(pres==1){str += '<td style="padding:0px 7px 0px 7px" onClick="openPresupuesto()">'+txtPresupuesto+'</td>'}
		str +='</tr>'
		+'</table>'	
	return str;
}

function printPageH(){
	nw = window.open('blank.htm','nm','width=10,height=10,resizable=yes')
	h = '<head>'
	+'<style>'
	+'TD{font-family:Verdana;font-size:10px;}'
	+'A:link{font-family:Verdana;color:#000000;}'
	+'A:hover{color:#FCC917;text-decoration:none}'
	+'.textN{color:black;}'
	+'.textB{color:white;}'
	+'.textN2{color:black;font-size:10px;}'
	+'.textG{color:#58595B;font-size:10px;}'
	+'.textIDA{font-family:Arial, Helvetica;font-size:9px;color:#06528E;text-transform:uppercase}'
	+'#content{ width:100%;padding: 0px 0px 0px 40px;}'
	+'</style>'
	+'</head>'
	+'<BODY bgcolor="#ffffff" marginwidth=0 marginheight=0 leftmargin=0 topmargin=0>'
	+'<center><img src="images/logo_print.jpg"><br></center><br><br>'
	nw.document.write(h + document.f1.tvalue.value + '</body>')
	nw.location.reload()
	nw.print();
	setTimeout("nw.close();",6000);
}

function tellaFriend(){
	nw = window.open('blank.htm','nm','width=400,height=350')
	document.f1.submit();
}			

function iPractica(){
	wopen('iPractica.asp',400,400,'win1')
}

function iPracticaCarga(){
	wopen('iPracticacarga.asp',400,400,'win2')
}

function iPracticaIL(idioma){
	wopen('legal.htm',400,400,'win3')
}

function iPracticaCR(idioma){
	wopen('creditos.htm',400,400,'win4')
}

function getPath(idioma){
	switch(idioma){
		case "esp":
			antURL = ""
			break;
		case "cat":
			antURL = "cat/"
			break;
		case "eng":
			antURL = "eng/"
			break;
		case "fra":
			antURL = "fra/"
			break;
	}
	return antURL;
}
