function $(id) {
 if(document.getElementById) {
     if (typeof document.getElementById(id) == "object")
     return (document.getElementById(id));
     else return (void(0));
 }
 else if(document.all) {
     if (typeof document.all[id] == "object")
     return (document.all[id]);
     else return (void(0));
 }
 else if(document.layers) {
   if (typeof document[id] == "object")
     return (document[id]);
     else return (void(0));
 }
}

function afficher() {
	for(var i=0; i<afficher.arguments.length; i++){
		var id = afficher.arguments[i];
		$(id).style.display='block';
	}
}

function masquer() {
	for(var i=0; i<masquer.arguments.length; i++){
		var id = masquer.arguments[i];
		$(id).style.display='none';
	}
}

function recup_reso(wh) {	
	var wh; var reso;
	if (wh == 'w') reso = (window.screen.availWidth ? window.screen.availWidth : (screen.width ? screen.width : 1016));
	else if (wh == 'h') reso = (window.screen.availHeight ? window.screen.availHeight : (screen.height ? screen.height : 714));
	return reso;
}

function popup(URL,title,W,H) {
	var URL; var title; var W; var H; var left; var top; var scrollbar; var menubar; var full=false;
	var isIE = (navigator.appName.indexOf("Microsoft Internet Explorer")!=-1 && navigator.platform.indexOf("Win")!=-1);
	if(!W && !H) {
			W = recup_reso('w');
			H = recup_reso('h');
			left='0'; top='0';
			scrollbar='no'; menubar='no'; full=true;
	}else if (W && H){ 
			left = (recup_reso('w')>W) ? (recup_reso('w')-W)/2 : 0;
			top = (recup_reso('h')>H) ? (recup_reso('h')-H)/2 : 0;
			scrollbar='yes'; menubar='yes';
	}				
	var attr='width='+W+',height='+H+',left='+left+'top='+top+',scrollbar='+scrollbar+',menubar='+menubar; 
	attr+='titlebar=no,toolbar=no,location=no,directories=no,statut=no,resizable=yes';
	var win = window.open(URL,title,attr);
	if (full && isIE){ win.moveTo(0,0); win.resizeTo(screen.width,screen.height); }
	win.focus();
}

function adobe_popup() {
	var URL='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash'; var title='adobe';
	var W='760'; var H='570';
	popup(URL,title,W,H);
}

function full_screen() {
		var URL="nomad.php?fv_full=1"; var title="nomad";
		popup(URL,title);
}

function h_browser() {
	var h;
	if (typeof(window.innerHeight) == 'number') h = window.innerHeight;
	else if (document.documentElement && document.documentElement.clientHeight)
					h = document.documentElement.clientHeight;
	else if (document.body) h = document.body.clientHeight;
	h_browser = (false == isNaN(h)) ? h : "580"	;
	return h_browser;
}

function vcenter(div_id,h_div,marge) {
	var h = h_browser();
	var marge = Math.round((h-h_div)*(50/100));
	$(div_id).style.marginTop = marge+"px";
}

function addFooter() {
		var divNode = document.createElement("div");
		divNode.setAttribute("id","footer");
		var pNode = document.createElement("p");
		var footer = "Communication Design et Création de sites Web";
		pNode.appendChild(document.createTextNode(footer));		
		divNode.appendChild(pNode);		
		$("doc").appendChild(divNode);
}

function getStyle(el,styleProp) {
	var object = $(el);
	if (window.getComputedStyle)
		var valeur = window.getComputedStyle(object,null).getPropertyValue(styleProp);
	else if (object.currentStyle)
		var valeur = eval('object.currentStyle.' + styleProp);
	return valeur;
}

function favoris() {
  if ( navigator.appName != 'Microsoft Internet Explorer' ){
    window.sidebar.addPanel("No[mad]","http://www.no-mad-online.com","");
  }else{
    window.external.AddFavorite("http://www.no-mad-online.com", "No[mad]");
  }
}


