var browser 		= navigator.userAgent.toLowerCase();
var isIE 				= ((browser.indexOf( "msie" ) != -1) && (browser.indexOf( "opera" ) == -1) && (browser.indexOf( "webtv" ) == -1));

function clientWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return myWidth;
}

function clientHeight() {
  var myHeight = 0;
  if(typeof( window.innerWidth ) == 'number'){
    myHeight = top.window.innerHeight; //Non-IE
  }else if( document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
    myHeight = top.document.documentElement.clientHeight; //IE 6+ in standards compliant mode
  }else if(document.body && ( document.body.clientWidth || document.body.clientHeight)) {
    myHeight = top.document.body.clientHeight; //IE 4 compatible
  }
  return myHeight;
}

//var swidth = clientWidth()-16;
function resizeBck(){
  var nwidth = clientWidth();
  var nheight = clientHeight();
	if(nwidth>0 && nheight>0){
		document.getElementById('background').style.width = nwidth+'px';
		document.getElementById('background').style.height = nheight+'px';
		document.getElementById('texts').style.height = nheight+'px';
		document.getElementById('menu').style.height = nheight+'px';
	}
	
}
window.onresize = function(){ resizeBck() };

var idRef = 0;
function switchReferences(){
  document.getElementById('references').href = "references.php?id="+refsIds[idRef];
  document.getElementById('references').innerHTML = refsSoc[idRef];
  idRef++;
  if(idRef>=refsSoc.length) idRef = 0;
  window.setTimeout("switchReferences()", 3000);
}

function sh(elem,act){
  if(act=='block' || act=='none')
		document.getElementById(elem).style.display = act;
  else if(act=='visible' || act=='hidden')
		document.getElementById(elem).style.visibility = act;
}

function closeAll(){
  //for(i in allDivs) document.getElementById(allDivs[i]).style.visibility='hidden';
}

/* INTEGRATION FLASH */
function flash(url, alttext, w, h, classe){
	if(!isIE){
			document.write('<object style="width: '+w+'px; height: '+h+'px" type="application/x-shockwave-flash" data="'+url+'" class="'+classe+'">');
	}else{
			document.write('<object style="width: '+w+'px; height: '+h+'px" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" class="'+classe+'"');
			document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0">');
			document.write('  <param name="movie" value="'+url+'">');
	}
	document.write('<param name="loop" value="true">');
	document.write('<param name="menu" value="false">');
  document.write('<param name="wmode" value="transparent">');
  document.write('<param name="width" value="'+w+'">');
  document.write('<param name="height" value="'+h+'">');
	document.write('<p>'+alttext+'</p>');
	document.write('</object>');
}

