function showhidepalette(action) {
		document.getElementById('palette').style.display = action;
}

function blend100(img) { document.images[img].className='blend100'; }
function blend50(img,imgencours) { 
	if (img!=imgencours) {
		document.images[img].className='blend50';
	}
}

function blend100ivig(img) { 
	if (document.getElementById('txt_'+img).className!='blend0') {
		document.getElementById('ico_'+img).className='blend100';
		document.getElementById('txt_'+img).className='blend100';
	}
}
function blend50ivig(img) { 
	if (document.getElementById('txt_'+img).className!='blend0') {
		document.getElementById('ico_'+img).className='blend50';
		document.getElementById('txt_'+img).className='blend50';	
	}	
}
function blend0ivig(img) { 
	document.getElementById('ico_'+img).className='blend0';
	document.getElementById('txt_'+img).className='blend0';	
}

function chgcl(btn,classe) { 
	document.getElementById(btn).className=classe;
}

function load_ib(page) { 
	parent.if_ibank.location.href= 'ibank.php?' +  page;
}


function addfilter(filtre) { 
	valeur =document.getElementById(filtre).value
	if (valeur=="-1") {
		load_ib(filtre + '=' + valeur + '&nostat=1');
	} else {
		load_ib(filtre + '=' + valeur);
	}
}


function chgnbv(btnnbv) { 
	load_ib('selnbv=' + btnnbv + '&nostat=1');
}

function chglot(lot) { 
		load_ib('sellot=' + lot + '&nostat=1');
}

function clickpdf() { 
//	parent.location.href= 'pdf.php';
	window.open("pdf.php", "_blank");
}

function clickdownbask() { 
	parent.if_ibank.location.href= 'downbasket.php';
	//parent.location.href= 'MultiPowUpload/SimpleDownload.php';
}


function clickbasket() { 
	parent.if_ibank.location.href= 'basket.php';
	
}
function clickback() { 
	load_ib('nostat=1');
}

function chginfo(idx,leg,pg) { 
	document.getElementById('i_idx').innerHTML = idx;
	document.getElementById('i_leg').innerHTML = leg;
	document.getElementById('i_pg').innerHTML = pg + "&nbsp;&nbsp;";
}

var xpopup=10;
var ypopup=10;
function popupvig(idx,imp) {
	xpopup=xpopup+20;
	ypopup=ypopup+20;
wpopup = window.open("popupvig.php?idx="+idx+"&imp="+imp, "_blank", 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,copyhistory=0,top='+xpopup+',left='+ypopup+',width=750,height=570'  );

}

function printphoto() { 
	window.print();
	window.close();
}

function download(idx,typ) {
	parent.location.href= 'dw.php?fic=' + idx + '&typ='+ typ + '&typdown=1';
}
function downloadbasket(idx,typ) {
	//window.alert(idx + "," + typ);
	window.open('dw.php?fic='+idx+'&typ='+typ + '&typdown=0');
}


function addbasketpopup(idx) { 
	addbasket(idx)
	window.opener.blend0ivig('addb' + idx);
}


function razbasket() { 
	l_basket="";
	addbasket2(l_basket,0);
	parent.if_ibank.location.href= 'basket.php';
}

function addbasket(idx) { 
	l_basket=l_basket+idx+"|";
	blend0ivig('addb' + idx);
	ok = addbasket2(l_basket,idx);
	if (ok==0 || ok=="0") { 
		window.alert("Connexion invalid.\n please contact the webmaster");
	} else {
		//window.alert("photo " + idx + " add to your basket");	
	}
}



function addbasket2(lbasket,idx) {
	fichier="maj_sessionbasket.php?lbasket="+lbasket+"&idx="+idx;
	if(window.XMLHttpRequest) // FIREFOX
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // IE
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else
	return(false);
	xhr_object.open("GET", fichier, false);
	xhr_object.send(null);
	if(xhr_object.readyState == 4 && xhr_object.status == 200) return(xhr_object.responseText);
	else return(0);
}
