
function show(component){
	$(component).show();
}
function toggle(component){
	$(component).toggle();
}
function hide(component){
	$(component).hide();
}
function fadeIn(component){
	$(component).fadeIn("slow");
}
function fadeOut(component){
	$(component).fadeOut("slow");
}
function isResponseError(request){
	var errorStr = '[error]';
	var errorIndex = request.responseText.indexOf(errorStr);
	if(errorIndex != -1) return true;
	return false;
}
function getResponseError(request){
	var errorStr = '[error]';
	return request.responseText.slice(request.responseText.indexOf(errorStr) + errorStr.length);
}
function isResponseStatusError(request){
	if( (request.status < 200) || (request.status > 299) )
		return true;
	return false;
}
function showAjaxLoader(){
	$("#ajaxLoader").show();
}
function hideAjaxLoader(){
	$("#ajaxLoader").hide();
}
function showPanel(panel,msg){
	$(panel).html(msg);
	$(panel).show();
}
function hidePanel(panel){
	$(panel).hide();
}
function sleep(milliseconds) {
	  var start = new Date().getTime();
	  for (var i = 0; i < 1e7; i++) {
	    if ((new Date().getTime() - start) > milliseconds){
	      break;
	    }
	  }
	}
function showDate(id){
	$(function() {
		 $(id).datepicker({dateFormat: 'yy-mm-dd'});
		
	});
}
function showMenuDivContent(urlparam){

	jQuery.ajax(
	{
		type:'POST',
		dataType:'html',
		success:function(data, textStatus){jQuery('#big_content').html(data);},
//		beforeSend:function(XMLHttpRequest){jQuery('#status_toogle').html('Chargement ...');},
		complete: alert("url"+urlparam),
		url:urlparam
	});
}

function showDate(id){
	$(function() {
		 $(id).datepicker({dateFormat: 'yy-mm-dd'});
		
	});
}

function ShowClassStudent(id){
	jQuery("#c2005").hide();
	var divs = new Array();
	divs[0] = "c2005";
	divs[1] = "c2006";
	divs[2] = "c2007";
	divs[3] = "c2008";

	for(i =0;i<=divs.length;i++){
		if(id !=divs[i]){	
			jQuery("#"+divs[i]).fadeOut('slow');
		}
	}
	jQuery("#"+id).fadeIn('slow');
}

function playDiv(id){
	 fadeOut(current);
	 sleep(500);
	 fadeIn(id);	 
	 current = id;
}
function PutMeActive(id){
	var subM = new Array('#c_77','#c_78','#c_79','#c_80');
	for(i =0;i<=subM.length;i++){
		if(id == subM[i]){
			jQuery(id).css({'font-weight':'bold'});
		}else{
			
			jQuery(subM[i]).css({'font-weight':'normal'});
		}
	}
}
function ValidDataRealGeneric(request,resultDiv,errorDiv){
	jQuery('#'+errorDiv).hide();
	if(request.status == 200){
		var errorStr = '[error]';
		var errorIndex = request.responseText.indexOf(errorStr);
		if(errorIndex == -1){
			jQuery('#'+resultDiv).html(request.responseText);
			
			//jQuery("#error_div").html('open');
		}
		else{
			var error = request.responseText.slice(errorIndex + errorStr.length);
			jQuery('#'+errorDiv).html(error);
			jQuery('#'+errorDiv).show();
		}
		
	}else{
		jQuery('#'+errorDiv).html("Problème de connexion!");
		jQuery('#'+errorDiv).show();
	}
}


function multiClass(eltId) {
	arrLinkId = new Array('_0','_1','_2','_3');
	intNbLinkElt = new Number(arrLinkId.length);
	arrClassLink = new Array('current','ghost');
	strContent = new String()
	for (i=0; i<intNbLinkElt; i++) {
		strContent = "menu"+arrLinkId[i];
		if ( arrLinkId[i] == eltId ) {
			document.getElementById(arrLinkId[i]).className = arrClassLink[0];
			document.getElementById(strContent).className = 'on content';
		} else {
			document.getElementById(arrLinkId[i]).className = arrClassLink[1];
			document.getElementById(strContent).className = 'off content';
		}
	}	
}
