// JavaScript Document
// Declaración de variables y objetos

// Texto en movimiento en una ventana
var txt="Agenda, Gestión de visitas, Alarmas, Pacientes, Facultativos, Clínicas, Quirófanos, Intervenciones, Recepción,Salas de espera, Presupuestos, Cobros, Recibos, Mutuas, Baremos, Pedidos de material, Laboratorios, Medicamentos, Episodios médicos, Actuaciones, Historias médicas, Exploraciones, Diagnósticos, Tratamientos, Intervenciones, Antecedentes, Recetas, Pruebas, Documentación, Multimedia, Imágenes, Comparativas, Administración, Estadísticas, Informes, Proveedores, Materiales, Caja, Saldos pacientes, ";

function scroll()
{
  //document.frm.textomov.value = txt;
  //txt = txt.substring(1,txt.length) + txt.charAt(0);
  //window.setTimeout("scroll()",150);
}

//Funcio per mostrar l'Iframe despres de mostrar la pagina principal
function showIframe(){
	document.getElementById("pag_principal_iframe").style.display = "";
	document.getElementById("pag_principal").style.display = "none";
}

// Funció per controlar els parametres que arriben del flash i per mostrar les diferents pàgines
// Si viene flash grande = 0
// Si viene flash pequeño = 1
function changePage(args,type)
{
	
	//var rootPath = "http://ofimedic.belgen.dev/";
	var rootPath = "http://www.ofimedic.com/";
	
	//alert(args,type)

	switch (args)
		{ 
		// MENU CONOZCALO
		case "que_es" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/que_es.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?que_es";
			}
			break;
		case "general" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/general.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?general";
			}
			break;
		case "operatius" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="beneficis/operatius.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?operatius";
			}
			break;
		case "economics" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="beneficis/economics.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?economics";
			}
			break;
		case "accedir" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/requeriments.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?requeriments";
			}
			break;		
		case "credits" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="altres/credits.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?credits";
			}
			break;
		
		// MENU PRODUCTO		
		case "net" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="servei/net.htm";
			}
			else
			{
				document.location.href = rootPath + "servei/net.htm";
			}
			break;
		case "view_demo" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="ajudav40/default.htm";
			}
			else
			{
				document.location.href = rootPath + "ajudav40/default.htm";
			}
			//fullScreen('http://www.ofimedic.com/demo/demo.html','demo','860','580');
			break;
		case "premium" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="servei/premium.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?premium";
			}
			break;
		case "tarifes" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="servei/tarifes.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?tarifes";
			}
			break;
		case "banco_santander" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="news/banco_santander.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?banco_santander";
			}
			break;
		case "personalitzada" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/informacio.asp";
			}
			else
			{
				document.location.href = rootPath + "default.htm?informacio";
			}
			break;
			
		// MENU OTRAS SOLUCIONES
		case "web" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="servei/web.htm";
			}
			else
			{
				document.location.href = rootPath + "servei/web.htm";
			}
			break;
		case "sistemas" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="servei/sistemes.htm";
			}
			else
			{
				document.location.href = rootPath + "servei/sistemes.htm";
			}
			break;
			
		// MENU CLIENTES
		case "consisteix" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="clients/consisteix.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?consisteix";
			}
			break;
		case "acces_clients" : 
			location.href="http://www.ofimedic.com/SSI"
			break;
		
		// OTRAS DIRECCIONES
		case "el_necesito" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/el_necessito.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?el_necesito";
			}
			break;
		case "gestion_total" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/versio_4_0.htm";				
			}
			else
			{
				document.location.href = rootPath + "default.htm?versio_4_0";
			}
			break;
		case "per_que" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/per_que.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?per_que";
			}
			break;
		case "demostracio" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/demostracio.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?demostracio";
			}
			break;
		case "informacio" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/informacio.asp";
			}
			else
			{
				document.location.href = rootPath + "default.htm?informacio";
			}
			break;
		case "1151" : 
			document.getElementById("texte").src="producte/envia_informacio.asp";
			break;
		case "recepcio" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/recepcio.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?recepcio";
			}
			break;
		case "doctors" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/doctors.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?123";
			}
			break;
		case "administradors" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/administradors.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?administradors";
			}
			break;
		case "comptabilitat" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/comptabilitat.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?comptabilitat";
			}
			break;			
		case "dades_actuals" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/dades_actuals.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?1dades_actuals";
			}
			break;
		case "requeriments" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/requeriments.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?requeriments";
			}
			break;
		case "formacio" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="producte/formacio.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?formacio";
			}
			break;
		case "consultes" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="servei/consultes.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?consultes";
			}
			break;
		case "231_b" : 
			//document.getElementById("texte").src="servei/tarifes.htm";
			//document.getElementById("texte").src="servei/premium.htm";
			var newWindow = window.open(rootPath + 'default.htm?premium', 'newwindow', 'scrollbars=yes,toolbar=yes,status=yes,location=yes,menubar=yes,resizable=yes,width=' + screen.width + ',height=' + screen.height);
			newWindow.name = 'newwindow';      //Nombre de la ventana. Si llamamos siempre con el mismo nombre no se abrirá más de una ventana
			newWindow.focus();		
			break;
		case "241_2" :
			var newWindow = window.open(rootPath + 'default.htm?preus', 'newwindow', 'scrollbars=yes,toolbar=yes,status=yes,location=yes,menubar=yes,resizable=yes,width=' + screen.width + ',height=' + screen.height);
			newWindow.name = 'newwindow';      //Nombre de la ventana. Si llamamos siempre con el mismo nombre no se abrirá más de una ventana
			newWindow.focus();
			break;		
		case "claves" : 
			document.getElementById("texte").src="clients/claves.htm";
			break;
		case "news" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="news/news.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?news";
			}
			break;
		case "nota" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="notalegal/notalegal_ifr.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?nota";
			}
			break;
		case "principal" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="principal.htm";
			}
			else
			{
				document.location.href = rootPath + "principal.htm";
			}
			break;
		case "trial" : 
			document.location.href = rootPath + "servei/trial.asp";
			break;
		case "premium_service" : 
			//document.location.href = rootPath + "altres/premium.htm";
			fullScreen('../altres/premium.htm','popup','750','550');
			break;
		case "requeriments_tecnics" : 
			fullScreen('../altres/requeriments.htm','popup','750','550');
			break;
		case "buy" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="news/buy_step1.asp";
			}
			else
			{
				document.location.href = rootPath + "servei/buy_step1.asp";
			}
		case "demand" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="servei/buy_net_step1.asp";
			}
			else
			{
				document.location.href = rootPath + "servei/buy_net_step1.asp";
			}
			break;
		case "demand_web" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="servei/web_form1.asp#web_form";
			}
			else
			{
				document.location.href = rootPath + "servei/web_form1.asp#web_form";
			}
			break;
		case "demand_sistemas" :
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="servei/sistemas_pers.asp#form_sistemes";
			}
			else
			{
				document.location.href = rootPath + "servei/sistemas_pers.asp#form_sistemes";
			}
			break;
		case "nosession" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="altres/nosession.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?nosession";
			}
			break;
		case "contactar" : 
			if (type == "0")
			{
				showIframe();
				document.getElementById("texte").src="contactar/contactar.htm";
			}
			else
			{
				document.location.href = rootPath + "default.htm?contactar";
			}
			break;
		case "politica_privacitat" : 
			fullScreen('../altres/politica_privacitat.htm','popup','750','550');
			break;
		case "manual_instalacion" :
			fullScreen('../pdf/ManualInstalacion.v.3.1.3.pdf','pdf','750','550');
			break;
		case "legal_conditions" : 
			fullScreen('../altres/condicions.htm','popup','800','550');
			break;
		 default : 
			//alert("Opcion no valida"); 
		} 
}

// Codi automatic de les layers
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// Funció per mostrar la imatge-->
var nom_old2
nom_old2 = ""
// Funcio per a ocultar la foto-->
function ocultaFoto(nom)
{
	document.texte.document.getElementById(nom).style.display="none"
}
// Funcio per a mostrar la imatge gran-->
function mostraFoto(nom)
{
		//alert(nom);
		//document.getElementById(nom).style.display=""
		if (nom_old2 != '') document.texte.document.getElementById(nom_old2).style.display="none"
		if (nom != '') document.texte.document.getElementById(nom).style.display=""
		nom_old2 = nom
}

<!-- Begin
function fullScreen(pag,tit,w,h) {
	var newWindow = window.open(pag, tit, 'scrollbars=yes,toolbar=no,status=no,resizable=no,width=' + w + ',height=' + h);
	newWindow.name = tit;      //Nombre de la ventana. Si llamamos siempre con el mismo nombre no se abrirá más de una ventana
	newWindow.focus();		
}
//  End -->

// Funcio per saber quina pàgina hem de mostrar quan venim de la demo amb la finestra tancada
function leerGET()
{ 
  var cadGET = location.search.substr(1,location.search.length); 
  //alert(cadGET); 
   return cadGET;
 
}
var origen = "";
var promo = "";
function doleerGET()
{
	var get = leerGET();
	var getS = get.split("&");
	var num = getS.length;
	if (num > 0) origen = getS[0];
	if (num > 1) promo = getS[1];


	//Esta línea sirve para incrementar el contador de el e-mail
	//document.getElementById("contador_mail").src="/contador/carga_contador_mail.asp?Origen=" + origen + "&Promo=" + promo;

	//alert(origen)


	//Esta línea sirve para incrementar el contador de el e-mail
	//document.getElementById("contador_mail").src="/contador/carga_contador_mail.asp?Origen=" + origen + "&Promo=" + promo;
	if (origen == "principal"){
		changePage('principal','0');
	}
	else if (origen == "que_es"){
		changePage('que_es','0');
	}
	else if (origen == "general"){
		changePage('general','0');
	}
	else if (origen == "operatius"){
		changePage('operatius','0');
	}
	else if (origen == "economics"){
		changePage('economics','0');
	}
	else if (origen == "accedir"){
		changePage('accedir','0');
	}
	else if (origen == "credits"){
		changePage('credits','0');
	}
	else if (origen == "net"){
		changePage('net','0');
	}
	else if (origen == "web"){
		changePage('web','0');
	}
	else if (origen == "premium"){
		changePage('premium','0');
	}
	else if (origen == "tarifes"){
		changePage('tarifes','0');
	}
	else if (origen == "banco_santander"){
		changePage('banco_santander','0');
	}
	else if (origen == "view_demo"){
		changePage('view_demo','0');
	}
	else if (origen == "personalitzada"){
		changePage('personalitzada','0');
	}
	else if (origen == "clients"){
		changePage('clients','0');
	}
	else if (origen == "acces_clients"){
		changePage('acces_clients','0');
	}
	else if (origen == "el_necesito"){
		changePage('el_necesito','0');
	}
	else if (origen == "per_que"){
		changePage('per_que','0');
	}
	else if (origen == "demostracio"){
		changePage('demostracio','0');
	}
	else if (origen == "informacio"){
		changePage('informacio','0');
	}
	else if (origen == "news"){
		changePage('news','0');
	}
	else if (origen == "nota"){
		changePage('nota','0');
	}
	else if (origen == "nosession"){
		changePage('nosession','0');
	}
	else if (origen == "claves"){
		changePage('claves','0');
	}
	else if (origen == "requeriments"){
		changePage('requeriments','0');
	}
	else if (origen == "dades_actuals"){
		changePage('dades_actuals','0');
	}
	else if (origen == "formacio"){
		changePage('formacio','0');
	}
	else if (origen == "consultes"){
		changePage('consultes','0');
	}	
	else if (origen == "recepcio"){
		changePage('recepcio','0');
	}
	else if (origen == "doctors"){
		changePage('doctors','0');
	}
	else if (origen == "administradors"){
		changePage('administradors','0');
	}
	else if (origen == "comptabilitat"){
		changePage('comptabilitat','0');
	}
	else if (origen == "demand"){
		changePage('demand','1');
	}
	else if (origen == "demand_web"){
		changePage('demand_web','1');
	}
	else if (origen == "promo_conozcalo"){
		changePage('que_es','0');
	}
	else if (origen == "promo_producto"){
		changePage('web','1');
	}
	else if (origen == "promo_trial"){
		changePage('personalitzada','1');
	}
	else if (origen == "promo_clients"){
		changePage('consisteix','0');
	}
	else if (origen == "promo_solicitelo"){
		changePage('demand_web','1');
	}
	else if (origen == "demand_sistemas"){
		changePage('demand_sistemas','1');
	}
	else if (origen == "contactar"){
		changePage('contactar','0');
	}
	else
	{
		//El ELSE indica que vengo de dirección manual o que el parametro es incorrecto
		//alert("vengo de direccion manual");
		changePage(origen,'0');
	}
}

//funcio que ens crea el menu dintre de la SSI
function creaMenuSSI()
{
	//número d'Opcions que es mostraran al menu
	var numeroOpcions = 6;
	
	//format de les opciones inactives
	var claseOpcionsOff = "menu_off";
	//format de les opciones actives
	var claseOpcionsOn = "menu_on";
	
	//nombres que mostraran las opciones de menú
	var nomOpcions = new Array();
	nomOpcions[0] = "Novedades";
	nomOpcions[1] = "Consultas";
	nomOpcions[2] = "Incidencias";
	nomOpcions[3] = "Ayuda";
	nomOpcions[4] = "&Aacute;rea de descargas";
	
	//páginas que se mostraran al pulsar las opciones
	var nomLinks = new Array();
	nomLinks[0] = "IncInicio.aspx"
	nomLinks[1] = "IncConsul.aspx"
	nomLinks[2] = "IncList.aspx"
	nomLinks[3] = "IncAyuda.aspx" /*"Help/default.htm"*/
	nomLinks[4] = "IncDesc.aspx"
	
	
	document.write("<table cellpadding='0' cellspacing='2' border='0' align='center' width='100%'>")
	document.write("<tr>")
	
	for (i = 0; i < numeroOpcions - 1; i++)
	{
		document.write("<td width='20%' class='" + claseOpcionsOff + "' onMouseOver=this.className='" + claseOpcionsOn + "' onMouseOut=this.className='" + claseOpcionsOff + "' onclick=document.location.href='" + nomLinks[i] + "' style='height:30px;'>" + nomOpcions[i] + "</td>")
	}
	
	document.write("</tr>")
	document.write("</table>")
}

//FUNCIO PER A FER EL IFRAME VARIABLE

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:

//IMPORTANTE EL NOMBRE DEL IFRAME

var iframeids=["soporte"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller