// JavaScript Document
var c_interval;
var flash_actual;
var contacto = 0;
var trabaja = 0;
var h = 0;
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

function open_window(url,w,h) {
	LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
	TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
	finestra = window.open(url,'','width='+w+', height='+h+', scrollbars=yes, mainbar=no, statusbar=no, left='+LeftPosition+', top='+TopPosition+'');	
}

function check_form() {
	if (document.form_contacto.nombre.value!='' && document.form_contacto.empresa.value!='' && document.form_contacto.direccion.value!='' && document.form_contacto.poblacion.value!='' && document.form_contacto.provincia.value!='' && document.form_contacto.telefono.value!='' && document.form_contacto.correu_e.value!='') {
		document.form_contacto.submit();
	} else {
		alert('Todos los campos son obligatorios.');
	}
}

function check_form_rma() {
	if (document.form_rma.nombre.value!='' && document.form_rma.empresa.value!='' && document.form_rma.telefono.value!='' && document.form_rma.correu_e.value!='' && document.form_rma.factura.value!='' && document.form_rma.consulta.value!='' ) {
		document.form_rma.submit();
	} else {
		alert('Todos los campos son obligatorios.');
	}
}

function menu_changer(menu,opt) {
	if (opt==1) {
		document.getElementById(menu).style.background = "url('img/pastilla_orange_97.jpg')";
	}
	
	if (opt==2) {
		document.getElementById(menu).style.background = "url('img/pastilla_gris_97.jpg')";
	}
	
	if (opt==3) {
		document.getElementById(menu).style.background = "url('img/pastilla_orange_107.jpg')";
	}
	
	if (opt==4) {
		document.getElementById(menu).style.background = "url('img/pastilla_gris_107.jpg')";
	}
}

function change_div_photo(menu,opt) {
	if (opt==1) {
		document.getElementById(menu).style.background = "url('img/"+menu+"_orange.jpg')";
	}
	
	if (opt==2) {
		document.getElementById(menu).style.background = "url('img/"+menu+"_gris.jpg')";
	}
}

function change_sec_photo(menu,opt) {
	if (opt==1) {
		document.getElementById(menu).style.background = "url('img/"+menu+"_over.jpg')";
	}
	
	if (opt==2) {
		document.getElementById(menu).style.background = "url('img/"+menu+".jpg')";
	}
}

function ampliar_foto(id,opt) {
	LeftPosition = (screen.width) ? (screen.width - 900) / 2 : 0;
	TopPosition = (screen.height) ? (screen.height - 700) / 2 : 0;
	window.open ('ampliacio.asp?id='+id+'&opt='+opt,'','width=900,height=700,scrollbars=no,mainbar=no,toolbar=no,left='+LeftPosition+',top='+TopPosition+'');
}

function init_scroll() {
	obj = document.getElementById('news_slide');
	h = obj.scrollHeight;
	obj.style.top = 0;
	moure();
}

function moure()
{
	if ( parseInt( document.getElementById('news_slide').style.top ) > -( h/2 ) )
	{
		s = parseInt( document.getElementById('news_slide').style.top );
		s -= 1;
		//s = s+'px';
		document.getElementById('news_slide').style.top = s + 'px';
	}
	else
	{
		document.getElementById('news_slide').style.top = 0;
	}
	c_interval = setTimeout("moure()",50);
}

function go_url(url) {
	window.location.href = url;	
}

function stop_scroller() {
	clearInterval(c_interval);
}

function ma_over (obj) {
	document.getElementById(obj).cursor.style='hand';
}

function introtext(text,textb)
{
	LeftPosition = (screen.width) ? (screen.width - 505) / 2 : 0;
	TopPosition = (screen.height) ? (screen.height - 453) / 2 : 0;
	editor = window.open('intro.asp?text='+text+'&textb='+textb+'','','width=505,height=453,scrollbars=no,mainbar=no,statusbar=no,left='+LeftPosition+',top='+TopPosition+'');
}