//-------------------------------------------------------------
//  Nom Document : mousezoom 
//  Auteur       : kazma
//  Objet        : zoom a la sourie   http://www.javascriptfr.com/
//  Création     : 12.10.2008
//-------------------------------------------------------------
//  Mise à Jour  : 19.10.2008
//  Objet        : neant
//-------------------------------------------------------------
//-(*)------------------
var couleur_de_fond="blue"
var factalle
var opab=10
var tour=1
var dde=document.documentElement
var prech=1
var imag = new Image();
var cc
function precharge(ii){
if(prech==1){
imag.src = ii;
prech=2
cc=ii
dde.lastChild.appendChild(document.createElement('div')).setAttribute("id",'preco');
document.getElementById('preco').appendChild(document.createElement('img')).setAttribute("id",'preci');
precco=document.getElementById('preco');
precdi=document.getElementById('preci');
precco.style.width = 100+"%";
precco.style.height =dde.scrollHeight+"px";
precdi.src="Animation.gif";
precdi.style.position='absolute';
precdi.style.height=100+"px";
precdi.style.left=(dde.clientWidth-precdi.offsetWidth)/2+"px";
if(navigator.vendor!=null && navigator.vendor.substring(0,3)=="Goo" || navigator.vendor!=null && (navigator.vendor.substring(0,3)=="App")){
precdi.style.top=(dde.clientHeight-precdi.offsetHeight)/2+dde.lastChild.scrollTop+"px";
}
else{
precdi.style.top=(dde.clientHeight-precdi.offsetHeight)/2+dde.scrollTop+"px";
}
imag.onload=function(){
document.getElementById('preco').parentNode.removeChild(document.getElementById('preco'));
resize(cc)}
} 
if(imag.complete==true){
prech=1
return false
}
setTimeout("precharge()",1);
} 

function quit(){
document.getElementById('divco').parentNode.removeChild(document.getElementById('divco'));
document.getElementById('divim').parentNode.removeChild(document.getElementById('divim'));
document.onmousemove = null;
tour=1;
opab=10;
} 
function sscro(){
if(document.getElementById('divco')!=null){
if(navigator.vendor!=null && navigator.vendor.substring(0,3)=="Goo" || navigator.vendor!=null && (navigator.vendor.substring(0,3)=="App")){
document.getElementById('divco').style.height =dde.clientHeight+dde.lastChild.scrollTop+"px";
} 
else{
document.getElementById('divco').style.height =dde.clientHeight+dde.scrollTop+"px";
}
}
}
function tarto(s){
if(navigator.appName.substring(0,3)=="Net"){
setY = s.clientY+dde.scrollTop;
}
if(navigator.appName.substring(0,3)!="Net"){
setY=event.y+dde.scrollTop;
return false;
}
}

function disableselect(e){
return false;
}
function enableselecte(e){
return true;
}

function mousezoom(){
if(tour==2){
document.onmousedown=enableselecte;
return false;
}
if(tour==3){
py=setY;
tour=1;
adi=document.getElementById('divim');
oper=adi.offsetWidth/adi.offsetHeight;
}
if(adi.offsetWidth<=(30)){
adi.style.height=50+'px';
adi.style.width=factalle*ydi.offsetHeight+'px';
adi.style.left=((dde.clientWidth-adi.offsetWidth)/2)+dde.scrollLeft+'px';
adi.style.top=((dde.clientHeight-adi.offsetHeight)/2)+dde.scrollTop+'px';
return false;
}
adi.style.width=oper*(adi.offsetHeight-(setY-py)*2)+'px';
adi.style.height=(adi.offsetHeight-(setY-py)*2)+'px';
adi.style.left=((dde.clientWidth-adi.offsetWidth)/2)+'px';
if(navigator.vendor!=null && navigator.vendor.substring(0,3)=="Goo" || navigator.vendor!=null && (navigator.vendor.substring(0,3)=="App")){
adi.style.top=((dde.clientHeight-adi.offsetHeight)/2)+dde.lastChild.scrollTop+"px";
}
else{
adi.style.top=((dde.clientHeight-adi.offsetHeight)/2)+dde.scrollTop+'px';
}
dde.onmousedown=disableselect;
py=setY;
setTimeout("mousezoom()",1);
}

function resize(remage){
if(tour==1){
dde.lastChild.appendChild(document.createElement('div')).setAttribute("id",'divco');
dde.lastChild.appendChild(document.createElement('img')).setAttribute("id",'divim');
ddco=document.getElementById('divco');
ydi=document.getElementById('divim');
ddco.style.position='absolute';
ddco.style.top=0+"px";
ddco.style.left=0+"px";
ddco.style.backgroundColor=couleur_de_fond;
ddco.style.width = 100+"%";
if(navigator.vendor!=null && navigator.vendor.substring(0,3)=="Goo" || navigator.vendor!=null && (navigator.vendor.substring(0,3)=="App")){
ddco.style.height=dde.lastChild.scrollHeight+"px";
}
else{
ddco.style.height=dde.scrollHeight+"px";
}
ydi.src=remage;
ydi.style.position='absolute';
ydi.style.cursor='pointer';
ydi.style.height=100+"px";
ydi.title="Cliquez pour quitter";
factalle=ydi.offsetWidth/ydi.offsetHeight;
tour=0;
}
opab+=6;
if(document.all && !window.opera){ 
ydi.style.filter = 'alpha(opacity=' + opab + ')';
ddco.style.filter = 'alpha(opacity=' + opab/4 + ')';
} 
else{ 
ydi.style.opacity = opab/100;
ddco.style.opacity = opab/100/4;
}
ydi.style.height=ydi.offsetHeight+10+"px";
ydi.style.width=factalle*(ydi.offsetHeight+10)+"px";
ydi.style.left=(dde.clientWidth-ydi.offsetWidth)/2+"px";
if(navigator.vendor!=null && navigator.vendor.substring(0,3)=="Goo" || navigator.vendor!=null && (navigator.vendor.substring(0,3)=="App")){
ydi.style.top=(dde.clientHeight-ydi.offsetHeight)/2+dde.lastChild.scrollTop+"px";
}
else{
ydi.style.top=(dde.clientHeight-ydi.offsetHeight)/2+dde.scrollTop+"px";
}

if(ydi.offsetHeight>=dde.clientHeight-20||ydi.offsetWidth>=dde.clientWidth-20){
tour=2;
ddco.appendChild(document.createElement('div')).setAttribute("id",'quit');
/*ddq=document.getElementById('quit');
ddq.appendChild(document.createTextNode("Q"));
ddq.style.fontSize=80+"px";
ddq.style.color="green";
ddq.style.cursor='pointer';
ddq.style.position='absolute';
ddq.style.top=5+'%';
ddq.style.left=5+'%';*/
if(navigator.appName.substring(0,5)=="Micro"){
	ydi.attachEvent('onclick', quit);
/*ydi.attachEvent('onmousedown', function(){tour=3;mousezoom()});
ydi.attachEvent("onmousemove",tarto);
ydi.attachEvent('onmouseup', function(){tour=2});
ddq.attachEvent("onmouseover",function(){ddq.style.color='red'});
ddq.attachEvent("onmouseout",function(){ddq.style.color='green'});
ddq.attachEvent("onclick",quit);*/
}
else{
	ydi.setAttribute('onclick', "quit()");
/*ydi.setAttribute("onmousedown","tour=3;mousezoom()");
ydi.setAttribute("onmousemove","tarto(event)");
ydi.setAttribute("onmouseup","tour=2");
ddq.setAttribute("onmouseover","ddq.style.color='red'");
ddq.setAttribute("onmouseout","ddq.style.color='green'");
ddq.setAttribute("onclick","quit()");*/
}
document.onscroll=sscro;
return false;
}
setTimeout("resize()",1);
}
