var $=function(){var a=[];for(var i=0,b;b=arguments[i];i++){if(typeof(b)=='string'){b=document.getElementById(b);}if(arguments.length===1){return b;}a.push(b);}return a;};

function showHide(divName, tot){
	
	var div;
	if(!tot){
		div = $(divName);
		if(div)
			div.style.display = ( div.style.display=="none" ) ? '' : 'none';
	}else{
		for(var i=1; i<=tot; i++){
			div = $(divName+'_'+i);
			if(div)
				div.style.display = ( div.style.display=="none" ) ? '' : 'none';
		}
	}
}

function random_pix_loaded(){
	var random_pix = $('random_img');
	alert(random_pix);
	alert(random_pix.offsetWidth);
	alert(random_pix.offsetHeight);
}

function checkForm(inputToCheck){
	var tmp;
	var ok = true;
	for(var i in inputToCheck){
		tmp = $(inputToCheck[i]);
		if(tmp){
			if(tmp.value==""){
				ok = false;
				tmp.className = 'inp inpRed';
			}else{
				tmp.className = 'inp';
			}
		}else{
			alert("Id manquant: "+inputToCheck[i]);
		}
	}
	return ok;
}
function getURL(link){
	window.location.href = link;
}
function parent_getURL(link){
	window.parent.location.href = link;
}
//
// Dimension_detect
function dimension_detect(){
	var d={
		'viewW':0, //viewPort Width
		'viewH':0, //viewPort Height
		'docH':0,  //document Height
		'docW':0,  //document Width
		'left':0,  //content Left Position according to the document flow
		'top':0    //content top position according to the document flow
	};
	if(document.body.scrollHeight>document.body.offsetHeight){
		d.docW=document.body.scrollWidth;
		d.docH=document.body.scrollHeight;
	}else{
		d.docW=document.body.offsetWidth;
		d.docH=document.body.offsetHeight;
	}
	if(self.innerWidth){
		d.viewW=self.innerWidth;
		d.viewH=self.innerHeight;
		d.left=window.pageXOffset;
		d.top=window.pageYOffset;
	}else{
		var ie=(document.compatMode&&document.compatMode!='BackCompat')?document.documentElement:document.body;
		d.viewW=ie.clientWidth;
		d.viewH=ie.clientHeight;
		d.left=ie.scrollLeft;
		d.top=ie.scrollTop;
	}
	return d;
};

function album_over(id_album){
	var el 	= $('album_infos_'+id_album);
	var el2 = $('album_thumb_'+id_album);	
	if(el)
		el.className = "album_infos underline";
		
	if(el2)
		el2.className = "album_thumb rose_border";
	
}
function album_out(id_album){
	var el 	= $('album_infos_'+id_album);
	var el2 = $('album_thumb_'+id_album);
	
	if(el)
		el.className = "album_infos";
		
	if(el2)
		el2.className = "album_thumb";
}
function thumb_over(id_pix){
	var pix = $('thumb_'+id_pix);
	if(pix){
		pix.style.borderColor = "#CE2166";
	}
}
function thumb_out(id_pix){
	var pix = $('thumb_'+id_pix);
	if(pix){
		pix.style.borderColor = "#fff";
	}
}


//
// Mp3 Players Funcions
function player_playNext(nextSong){
	var nextFlash = document.getElementById(nextSong);
	if(nextFlash){
		nextFlash.replay();
	}
	
}