function kk_viewMerchantXml(url,comId,catId,from,frameset,contentId){
  var lparam="&catId="+catId+"&from="+from+"&frameset="+frameset;
  if(contentId!=""){lparam=lparam+'&contentId='+contentId;}
  kk_viewMerchant(url,comId,lparam);
}

function kk_afficheCommandeXml(pkey,merchantid){
  kk_afficheCommande('/shopbot/go.jsp?pkey='+pkey+'&catId=<%=request.getParameter("catId")%>&merchantId='+merchantid+'&from=shopbot');
}

function kk_viewMPopupXml(url,comId,catId,from,frameset,contentId,width,height) {
		var lparam="&catId="+catId+"&from="+from+"&frameset="+frameset;
		if(contentId!=""){lparam=lparam+'&contentId='+contentId;}
                url="/modules/go.jsp?merchantId="+comId+"&url="+escape(url)+lparam;
                op = 'scrollbars=yes,toolbar=no,location=no,directories=no,menubar=no,resizable=yes,status=no,width='+width+',height='+height;
                merchant=open(url,'',op);
}
 
function kk_viewMPopupXmlT(url,comId,catId,from,frameset,contentId,width,height) {
		var lparam="&catId="+catId+"&from="+from+"&frameset="+frameset;
		if(contentId!=""){lparam=lparam+'&contentId='+contentId;}
                url="/modules/go.jsp?merchantId="+comId+"&url="+escape(url)+lparam;
                op = 'scrollbars=yes,toolbar=yes,location=yes,directories=yes,menubar=yes,resizable=yes,status=yes,width='+width+',height='+height;
                merchant=open(url,'',op);
}


function kk_pubCol(newPubId){

  // Valeur par defaut
  var cid='7306';
  var url_c = 'http://www.cibleclick.com/cibles/clicks/symp.cfm?site_id=243280074&friend_id=765596634&banniere_id=7958';

  // Titre colonne
  if(newPubId=='2472') {
    cid = '7306';
    url_c = 'http://www.cibleclick.com/cibles/clicks/symp.cfm?site_id=243280074&friend_id=765596634&banniere_id=7958';
  }

  // Informatique
  if(newPubId=='2466') {
    cid = '7307';
    url_c = 'http://www.cibleclick.com/cibles/clicks/symp.cfm?site_id=243280074&friend_id=160921285&banniere_id=7958';
  }

  // Voyage
  if(newPubId=='2467') {
    cid='7308';
    url_c = 'http://www.cibleclick.com/cibles/clicks/symp.cfm?site_id=243280074&friend_id=693391310&banniere_id=7958';
  }

  // Hifi Photo Video
  if(newPubId=='2468') {
    cid='7310';
    url_c = 'http://www.cibleclick.com/cibles/clicks/symp.cfm?site_id=243280074&friend_id=152746674&banniere_id=7958';
  }


  // !!!!!!!!!!!!!!! rien pour l'instant en culturel !!!!!!!!!!!!!!!!!!!!!!!!!
  // Culturel
  if(newPubId=='2469') {
    cid='7329';
    url_c = 'http://www.cibleclick.com/cibles/clicks/symp.cfm?site_id=243280074&friend_id=765596634&banniere_id=7958'; //!!!!!!!!!!!!!!! rien pour l'instant en culturel !!!!!!!!!!!!!!!!!!!!!!!!! -> valeur par defaut au cas ou
  }

  // Electro
  if(newPubId=='2470') {
    cid='7311';
    url_c = 'http://www.cibleclick.com/cibles/clicks/symp.cfm?site_id=243280074&friend_id=945598350&banniere_id=7958';
  }

  // Maison et jardin
  if(newPubId=='2471') {
    cid='7330';
    url_c = 'http://www.cibleclick.com/cibles/clicks/symp.cfm?site_id=243280074&friend_id=910710268&banniere_id=7958';
  }

  // !!! new : univers Auto 
  if(newPubId=='2473') {
    cid='7309';
    url_c = 'http://www.cibleclick.com/cibles/clicks/symp.cfm?site_id=243280074&friend_id=647416776&banniere_id=7958';
  }

  
  kk_viewMPopupXmlT(url_c,'3635923','601','content','no',cid,'800','600');


  // document.write('<a href="#" onclick="viewMPopupXml(\'http://s0b.bluestreak.com/ix.e?hy&s='+tdid+'\',\'3711523\',\'601\',\'content\',\'no\',\''+newPubId+'\',\'800\',\'650\')"> <img src="'+cofimg+'" border="0" width="64" height="45"></a>');


  return true;

}


 function kk_showInfoLayer(layername,evt) {

    if (document.layers) {

        xpage=evt.pageX ;
        ypage=evt.pageY;

        xfenetre=xpage ;
        yfenetre=ypage ;

    } else if (document.all) {

        // IE
        xfenetre=evt.x ;
        yfenetre=evt.y ;

        xpage=xfenetre ;
        ypage=yfenetre ;

        if (!document.getElementById('globalnav')){
        
            if (document.documentElement && document.documentElement.scrollTop){
                // IE6 +4.01 and user has scrolled
                xpage=xfenetre + document.documentElement.scrollLeft;
                ypage=yfenetre + document.documentElement.scrollTop;
            }else if (document.body && document.body.scrollTop){
                // IE5 or DTD 3.2
                xpage=xfenetre + document.body.scrollLeft ;
                ypage=yfenetre + document.body.scrollTop;
            }
        }

    } else if (document.getElementById) {

        // Netscape et Mozilla

        xfenetre=evt.clientX ;
        yfenetre=evt.clientY ;

        xpage=xfenetre ;
        ypage=yfenetre ;

        if(evt.pageX) xpage=evt.pageX ;
        if(evt.pageY) ypage=evt.pageY ;
        }

    if (eval(document.getElementById(layername)) != null) {

        document.getElementById(layername).style.left=xpage;
        document.getElementById(layername).style.top=ypage+15;
        document.getElementById(layername).style.visibility='visible';
        }
    }

   function kk_hideInfoLayer(layername,evt) { 

       if (eval(document.getElementById(layername)) != null) {
           document.getElementById(layername).style.visibility='hidden';
       } 

   }





   function kk_viewInfoLayer2(tdid,newPubId,cofimg,layername,info){


       if (document.getElementById){

           kk_createInfo2(layername, info);

       }

       if (eval(document.getElementById(layername)) != null && info!= '') { 

         document.write('<a href="#" onclick="viewMPopupXml(\'http://s0b.bluestreak.com/ix.e?hy&s='+tdid+'\',\'3711523\',\'601\',\'content\',\'no\',\''+newPubId+'\',\'800\',\'650\')" onMouseOver="kk_showInfoLayer(\''+layername+'\',event)" onMouseOut="kk_hideInfoLayer(\''+layername+'\',event)"> <img src="'+cofimg+'" border="0" width="64" height="45"></a>');

       }else{

         document.write('<a href="#" onclick="viewMPopupXml(\'http://s0b.bluestreak.com/ix.e?hy&s='+tdid+'\',\'3711523\',\'601\',\'content\',\'no\',\''+newPubId+'\',\'800\',\'650\')"> <img src="'+cofimg+'" border="0" width="64" height="45"></a>');

       }

   }


   function kk_createInfo2(layername, info){

     document.write('<div id="'+layername+'" style="position: absolute; visibility: hidden;"><table width="130" border="0" cellspacing="0" cellpadding="2" style="border: solid 1px #cccccc"><tr class="ppr-bg"><td class="normal">'+info+'</td></tr></table></div>');

   }

function kk_viewEcotax(layername){

  if (document.getElementById){
    kk_createEcotax(layername);
  }

  if (eval(document.getElementById(layername)) != null) {
    document.write('<a href="#" onMouseOver="kk_showInfoLayer(\''+layername+'\',event)" onMouseOut="kk_hideInfoLayer(\''+layername+'\',event)">Ecopart</a>');
  }

}

/*function kk_createEcotax(layername){
    document.write('<div id="'+layername+'" style="position: absolute; visibility: hidden;"><table border="0" cellspacing="0" cellpadding="0" id="mod_more"><tr><td class="moretext"><div class="moretitle"><div style="color: #000;">Qu\'est-ce que l\'&eacute;co-participation ?</div><span class="cm">L\'&eacute;co-participation correspond au co&ucirc;t de collecte et de recyclage des d&eacute;chets des &eacute;quipements &eacute;lectriques et &eacute;lectroniques (DEEE)</span></div></td></tr></table></div>');
}*/

function kk_createEcotax(layername){
    document.write('<div id="'+layername+'" style="position: absolute;visibility: hidden;width : 210px;" class="moretext"><div id="mod_more" style="text-align : left;"><span class="moretitle" style="color : #000;display: block;">Qu\'est-ce que l\'&eacute;co-participation ?</span><span class="cm" style="display : block;padding : 5px;">L\'&eacute;co-participation correspond au co&ucirc;t de collecte et de recyclage des d&eacute;chets des &eacute;quipements &eacute;lectriques et &eacute;lectroniques (DEEE)</span></div></div>');
}


function kk_prepareParam(text){ 
      if(text!=""){
          regexp=/\S+/g;  
          myArray=text.match(regexp);
          var newText = myArray[0];
          for(ind=1; ind < myArray.length;ind++){
              newText=newText+"%20"+myArray[ind];
          }
          return newText;
      }else{
          return text;
      }
}

function kk_respop(u,n,w,h){
	pop = window.open(u,n,"width=" + h + ",height=" + w + ",location=no,menubar=no,resizable=yes");
	pop.focus; 
}

/**** Image zoom Feature V1  ****/
//css settings
document.write('<style type="text/css">@import url(http://r6.kelkoo.com/misc/kelkoo/kk_zoom/enlarge-pics.css);</style>');

function kk_hidzoom(){
var zzone = document.getElementsByTagName('div');
for(var i = 0,j = zzone.length; i < j; i++){
   if (zzone[i]){
	   if (zzone[i].className == "zimg"){
			var zlink=zzone[i].getElementsByTagName('a');
			if (zlink[0].className == "zoomlink"){ zlink[0].style.visibility = 'hidden'; }
		   }
	   }
   }
}
function kk_showzoom(){
var zzone = document.getElementsByTagName('div');
for(var i = 0,j = zzone.length; i < j; i++){
   if (zzone[i]){
	   if (zzone[i].className == "zimg"){
			var zlink=zzone[i].getElementsByTagName('a');
			zlink[0].style.visibility = 'visible';
		   }
	   }
   }
}
function kk_setzoom(){

var zzone = document.getElementsByTagName('div');
for(var i = 0,j = zzone.length; i < j; i++){
   if (zzone[i]){
	   if (zzone[i].className == "zimg"){
			var zlink=zzone[i].getElementsByTagName('a');
			zlink[0].onclick = function(){return kk_zoom(this); };
		   }
	   }
   }
}

function kk_zoom(link){

	var parent = link.parentNode;

	/* efface les zoom existants*/
	var zooms = document.getElementsByTagName('div');
	for(var i = 0,j = zooms.length; i < j; i++){
	   if (zooms[i]){
		   if (zooms[i].className == "zoom"){
				  zooms[i].parentNode.removeChild(zooms[i]);
			   }
		   }
	   }
	   
	var imsrc = parent.getElementsByTagName('a');
	var zimg = imsrc[0].href;

	var titretxt = parent.getElementsByTagName('span');
	var titleI = titretxt[0].innerHTML;	
	var title = titleI.replace(/&amp;/,"&");
		
	var div = document.createElement('div');
		parent.appendChild(div);
		div.className = "zoom";
		
	var zclose = document.createElement('div');
		zclose.style.textAlign = "right";
		div.appendChild(zclose); 
	var zcloselink = document.createElement('a');
		zcloselink.innerHTML = "Fermer la fen&ecirc;tre";
		zcloselink.style.textDecoration = "underline";
		zcloselink.style.cursor = "pointer";
		zcloselink.onclick = function(){ parent.removeChild(div); kk_showzoom();};
		zclose.appendChild(zcloselink); 

	var img = document.createElement('img');
		div.appendChild(img);
		img.className = "zoomimgpos";
		img.src = zimg;
		
		if (img.clientWidth){ img.className = "zoomimg"; img.style.cursor="pointer"; kk_resize(div,title); }
		else { img.onload = function(){ img.className = "zoomimg"; img.style.cursor="pointer"; kk_resize(div,title); }; }
		img.onclick = function(){ this.parentNode.removeChild(this); parent.removeChild(div); kk_showzoom(); };
		

	kk_hidzoom();		
	return false;
}

function kk_resize(div,title){
	
	var titleDiv = document.createElement('div');
		div.appendChild(titleDiv);
		titleDiv.style.marginTop = "2px";
		titleDiv.style.padding = "2px";
		titleDiv.style.textAlign = "center";
		titleDiv.className = "ztext";

	var textDiv = document.createTextNode(title);
		titleDiv.appendChild(textDiv);

	}

window.onload = function(){ kk_setzoom(); };
