/**
 * Popup code
 */
function openpopup(url, width, height) {
	
	window.open(url, 'popup', 'scrollbars=yes, directories=0, location=0, menubar=0, status=0, toolbar=0, width='+width +', height=' + height); 	
		
	return false;
}

function openpopup2(url, width, height) {
	
	window.open(url, 'popup2', 'scrollbars=yes, directories=0, location=0, menubar=0, status=0, toolbar=0, width='+width +', height=' + height); 	
		
	return false;
}

function closepopup(id, text, champsCache, valSpan) {
	window.opener.document.getElementById(champsCache).value = id;
	window.opener.document.getElementById(valSpan).innerHTML = text;
	window.close();
}

function popupPic(url, fileName) { 
   window.open(url+"?"+fileName, "", "resizable=1,HEIGHT=200,WIDTH=200"); 
} 


function vider(id, text) {
	document.getElementById(id).value = "";
	document.getElementById(text).innerHTML = "";
}

function hidediv(element) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(element).style.visibility = 'hidden';
		document.getElementById(element).style.display = 'none';
	} else {
		if (document.layers) { // Netscape 4
		document.element.visibility = 'hidden';
		document.element.display = 'none';
		} else { // IE 4
			document.all.element.style.visibility = 'hidden';
			document.all.element.style.diplay = 'none';
		}
	}	
}

function showdiv(element) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(element).style.visibility = 'visible';
		document.getElementById(element).style.display = 'block';
	} else {
		if (document.layers) { // Netscape 4
			document.element.visibility = 'visible';
			document.element.display = 'block';
		} else { // IE 4
			document.all.element.style.visibility = 'visible';
			document.all.element.style.diplay = 'block';
		}
	}
}

function truncateBlanks(chaine){
	if(chaine!=""){
		while (chaine.indexOf(" ",0)==0){
			chaine = chaine.substring(1,chaine.length);
		}
		if(chaine!=""){
			while (chaine.lastIndexOf(" ",chaine.length)==(chaine.length)-1){
				chaine = chaine.substring(0,(chaine.length) - 1);
			}
		}
		
	}
	return chaine;
}

function validateSize(chaine){
	var message="";
	if(chaine.length == 0 || chaine.length>50){
		return false;
	}
	return true;
}
function validateChar(chaine){
	var carVal = new Array("&","'","%","?","!","£","¨","¤",":",",",";","/","\\","§","*","#","\"","<",">","|","`","°","²");
	var idx = carVal.length;
	for (i=0;i<idx;i++){
		var car = carVal[i];
		if(chaine.indexOf(car,0)!=-1){
			return false;
			
		}
	}
	return true;
}

function validateCharNE(chaine){
	var carVal = new Array("&");
	var idx = carVal.length;
	for (i=0;i<idx;i++){
		var car = carVal[i];
		if(chaine.indexOf(car,0)!=-1){
			return false;
			
		}
	}
	return true;
}

