// JavaScript Document
// Copyright 2008 AySG
col_empresa = '#310f0f'; 
	 
col_permisos =  '#310f0f';  
col_distinitus =  '#310f0f'; 
col_enllasos =  '#310f0f';  
col_imatges =  '#310f0f';
col_maquines =  '#310f0f';  
col_contacte =  '#310f0f';  
col_serveis =  '#310f0f';  
/* Varios colores
 col_permisos =  '#7f898b';  
 col_distinitus =  '#41663b'; 
 col_enllasos =  '#e58356';  
 col_imatges =  '#21589b';
 col_maquines =  '#8c728b';  
 col_contacte =  '#4f545a';  
 col_serveis =  '#9c5158';  
*/
var ChildWin = null;
function abrirWin(url, tp, lft, w, h) {
if (ChildWin){ChildWin.close()};
//window.open(url, modus,'top=20,left=20,scrollbars=0,resizable=0,status=0,width='+w+',height='+h);
 ChildWin = window.open(url, "popup", 'top='+tp+',left='+lft+',titlebar=0,scrollbars=1,resizable=0,status=0,width='+w+',height='+h+'');

}
// Per mouseover
 function openWin( windowURL, windowName, windowFeatures ) { 
                return window.open( windowURL, windowName, windowFeatures ) ; 
} 



// Cameres no IE
function canvia_fr_src (pagina){
	if (!es_Explorer ()) {
		document.getElementById('fr_1').src = pagina;
		frames['FRAME_ME'].location.href = pagina;

	}
}



// Comprovacions
function es_Explorer (){
	    
		 if (navigator.userAgent.indexOf("MSIE")!=-1) return true;
		 else return false;
	 
}
function es_Windows (){
	
	 if (navigator.platform.indexOf("Win32")!=-1) return true;
	 else return false;
	 
}

// Cameres
function comprovar_cameres(){
	
	if (!es_Windows()){
		document.getElementById('cameres_div').style.visibility = 'hidden';
		return;
 	}
	
	horari_cameres();
	
}


function horari_cameres() {
  var literal = lit_Horari + hora_inici + ':00 a '+  hora_final +':00 HH:MM';
  document.getElementById('horari').innerText = literal; 
		// next line for Mozilla, notworking for IE (but OK for Safari)
		document.getElementById('horari').textContent = literal; 
		// end Mozilla
  
  
  LaHora = new Date();
  hora  = LaHora.getHours();
 
  if (hora >= hora_inici && hora <= hora_final) {
	  
	   
	  document.getElementById('cameres_div').style.visibility = 'visible';
	  document.getElementById('servei_no').style.visibility = 'hidden';
  }
  else  {
	   
      document.getElementById('cameres_div').style.visibility = 'hidden';
	  document.getElementById('servei_no').style.visibility = 'visible';
  };
 
}

	


// Fotos

var lastID = 0; 

var imatges_dir="img/fotos/";


function sh_foto(id) {
if (lastID > 0) {
	chng_border (lastID, "#FFFFFF", "#7B8955");
	document.getElementById(lastID).src = imatges_dir+lastID+'.jpg';
}

chng_border (id, "#7B8955", "#FFFFFF");
document.getElementById(id).src = imatges_dir+"thumb_selected.jpg";

document.getElementById('foto_G').style.backgroundcolor="#BDCB92";
document.getElementById('foto').src = imatges_dir+id+'.jpg';
lastID = id;

}



function chng_border (id, col_1, col_2){

document.getElementById(id).style.borderTopColor = col_1;
document.getElementById(id).style.borderRightColor = col_2;
document.getElementById(id).style.borderBottomColor = col_2;
document.getElementById(id).style.borderLeftColor = col_1;
	
}

// Canviar posicio

function chng_pos (id, xpos, ypos) {
	parent.FRAME_CAP.document.getElementById(id).style.top = xpos + "px";
	parent.FRAME_CAP.document.getElementById(id).style.left = ypos + "px";
	
	
}
// Canviar capçalera

function chng_cap_ant (imatge, logo_class) {
 
 chng_cap_bck(imatge);  
 parent.FRAME_CAP.document.getElementById('logo').className= logo_class;
 
	
}
function chng_cap(imatge, Cod_Color) {
 
 chng_cap_bck(imatge);  
 parent.FRAME_CAP.document.getElementById('cap').style.backgroundColor=Cod_Color ;
	
}
function chng_cap_cl(imatge, logo_img, logo_class) {
 
 chng_cap_bck(imatge);  
 parent.FRAME_CAP.document.getElementById('logo_img').src= logo_img;
 parent.FRAME_CAP.document.getElementById('logo').className= logo_class;
	
}

function chng_cap_bck(imatge) {         
  parent.FRAME_CAP.document.getElementById('cap').style.backgroundImage='url('+imatge+')';
 
  
}



// Expand-collapse


function expand_colapse(id) {
	var obj = document.getElementById(id);
	if ( obj.style.display != "none" ) {
		obj.style.display = 'none';
	}
	else {
		obj.style.display = '';
	}
}

//Video

function insertSimpleFlash(url,w,h) {
var str='';
str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">';
str+='<param name="movie" value="'+url+'" />';
str+='<param name="quality" value="high" />';
str+='<param name="wmode" value="opaque" />';
str+='<param name="loop" value="false" />';
str+='<param name="menu" value="false" />';
str+='<param value="exactfit" name="scale" />';
str+='<embed src="'+url+'" quality="high" wmode="opaque" scale="exactfit" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+ w +'" height="'+ h +'"></embed>';
str+='</object>';
document.write(str);
}
function insertSimpleFlash_Loop(url,w,h) {
var str='';
str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">';
str+='<param name="movie" value="'+url+'" />';
str+='<param name="quality" value="high" />';
str+='<param name="wmode" value="opaque" />';
str+='<param name="loop" value="true" />';
str+='<param name="menu" value="false" />';
str+='<param value="exactfit" name="scale" />';
str+='<embed src="'+url+'" quality="high" wmode="opaque" scale="exactfit" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+ w +'" height="'+ h +'"></embed>';
str+='</object>';
document.write(str);
}
// Portada
