﻿// Fichier JScript

//Encode une chaîne
function htmlentities(texte) {
	texte = texte.replace(/"/g,'&quot;'); // 34 22
	texte = texte.replace(/&/g,'&amp;'); // 38 26
	texte = texte.replace(/\'/g,'&#39;'); // 39 27
	texte = texte.replace(/</g,'&lt;'); // 60 3C
	texte = texte.replace(/>/g,'&gt;'); // 62 3E
	texte = texte.replace(/\^/g,'&circ;'); // 94 5E
	texte = texte.replace(/‘/g,'&lsquo;'); // 145 91
	texte = texte.replace(/’/g,'&rsquo;'); // 146 92
	texte = texte.replace(/“/g,'&ldquo;'); // 147 93
	texte = texte.replace(/”/g,'&rdquo;'); // 148 94
	texte = texte.replace(/•/g,'&bull;'); // 149 95
	texte = texte.replace(/–/g,'&ndash;'); // 150 96
	texte = texte.replace(/—/g,'&mdash;'); // 151 97
	texte = texte.replace(/˜/g,'&tilde;'); // 152 98
	texte = texte.replace(/™/g,'&trade;'); // 153 99
	texte = texte.replace(/š/g,'&scaron;'); // 154 9A
	texte = texte.replace(/›/g,'&rsaquo;'); // 155 9B
	texte = texte.replace(/œ/g,'&oelig;'); // 156 9C
	texte = texte.replace(//g,'&#357;'); // 157 9D
	texte = texte.replace(/ž/g,'&#382;'); // 158 9E
	texte = texte.replace(/Ÿ/g,'&Yuml;'); // 159 9F
	texte = texte.replace(/ /g,'&nbsp;'); // 160 A0
	texte = texte.replace(/¡/g,'&iexcl;'); // 161 A1
	texte = texte.replace(/¢/g,'&cent;'); // 162 A2
	texte = texte.replace(/£/g,'&pound;'); // 163 A3
	texte = texte.replace(/ /g,'&curren;'); // 164 A4
	texte = texte.replace(/¥/g,'&yen;'); // 165 A5
	texte = texte.replace(/¦/g,'&brvbar;'); // 166 A6
	texte = texte.replace(/§/g,'&sect;'); // 167 A7
	texte = texte.replace(/¨/g,'&uml;'); // 168 A8
	texte = texte.replace(/©/g,'&copy;'); // 169 A9
	texte = texte.replace(/ª/g,'&ordf;'); // 170 AA
	texte = texte.replace(/«/g,'&laquo;'); // 171 AB
	texte = texte.replace(/¬/g,'&not;'); // 172 AC
	texte = texte.replace(/­/g,'&shy;'); // 173 AD
	texte = texte.replace(/®/g,'&reg;'); // 174 AE
	texte = texte.replace(/¯/g,'&macr;'); // 175 AF
	texte = texte.replace(/°/g,'&deg;'); // 176 B0
	texte = texte.replace(/±/g,'&plusmn;'); // 177 B1
	texte = texte.replace(/²/g,'&sup2;'); // 178 B2
	texte = texte.replace(/³/g,'&sup3;'); // 179 B3
	texte = texte.replace(/´/g,'&acute;'); // 180 B4
	texte = texte.replace(/µ/g,'&micro;'); // 181 B5
	texte = texte.replace(/¶/g,'&para'); // 182 B6
	texte = texte.replace(/·/g,'&middot;'); // 183 B7
	texte = texte.replace(/¸/g,'&cedil;'); // 184 B8
	texte = texte.replace(/¹/g,'&sup1;'); // 185 B9
	texte = texte.replace(/º/g,'&ordm;'); // 186 BA
	texte = texte.replace(/»/g,'&raquo;'); // 187 BB
	texte = texte.replace(/¼/g,'&frac14;'); // 188 BC
	texte = texte.replace(/½/g,'&frac12;'); // 189 BD
	texte = texte.replace(/¾/g,'&frac34;'); // 190 BE
	texte = texte.replace(/¿/g,'&iquest;'); // 191 BF
	texte = texte.replace(/À/g,'&Agrave;'); // 192 C0
	texte = texte.replace(/Á/g,'&Aacute;'); // 193 C1
	texte = texte.replace(/Â/g,'&Acirc;'); // 194 C2
	texte = texte.replace(/Ã/g,'&Atilde;'); // 195 C3
	texte = texte.replace(/Ä/g,'&Auml;'); // 196 C4
	texte = texte.replace(/Å/g,'&Aring;'); // 197 C5
	texte = texte.replace(/Æ/g,'&AElig;'); // 198 C6
	texte = texte.replace(/Ç/g,'&Ccedil;'); // 199 C7
	texte = texte.replace(/È/g,'&Egrave;'); // 200 C8
	texte = texte.replace(/É/g,'&Eacute;'); // 201 C9
	texte = texte.replace(/Ê/g,'&Ecirc;'); // 202 CA
	texte = texte.replace(/Ë/g,'&Euml;'); // 203 CB
	texte = texte.replace(/Ì/g,'&Igrave;'); // 204 CC
	texte = texte.replace(/Í/g,'&Iacute;'); // 205 CD
	texte = texte.replace(/Î/g,'&Icirc;'); // 206 CE
	texte = texte.replace(/Ï/g,'&Iuml;'); // 207 CF
	texte = texte.replace(/Ð/g,'&ETH;'); // 208 D0
	texte = texte.replace(/Ñ/g,'&Ntilde;'); // 209 D1
	texte = texte.replace(/Ò/g,'&Ograve;'); // 210 D2
	texte = texte.replace(/Ó/g,'&Oacute;'); // 211 D3
	texte = texte.replace(/Ô/g,'&Ocirc;'); // 212 D4
	texte = texte.replace(/Õ/g,'&Otilde;'); // 213 D5
	texte = texte.replace(/Ö/g,'&Ouml;'); // 214 D6
	texte = texte.replace(/×/g,'&times;'); // 215 D7
	texte = texte.replace(/Ø/g,'&Oslash;'); // 216 D8
	texte = texte.replace(/Ù/g,'&Ugrave;'); // 217 D9
	texte = texte.replace(/Ú/g,'&Uacute;'); // 218 DA
	texte = texte.replace(/Û/g,'&Ucirc;'); // 219 DB
	texte = texte.replace(/Ü/g,'&Uuml;'); // 220 DC
	texte = texte.replace(/Ý/g,'&Yacute;'); // 221 DD
	texte = texte.replace(/Þ/g,'&THORN;'); // 222 DE
	texte = texte.replace(/ß/g,'&szlig;'); // 223 DF
	texte = texte.replace(/à/g,'&agrave;'); // 224 E0
	texte = texte.replace(/á/g,'&aacute;'); // 225 E1
	texte = texte.replace(/â/g,'&acirc;'); // 226 E2
	texte = texte.replace(/ã/g,'&atilde;'); // 227 E3
	texte = texte.replace(/ä/g,'&auml;'); // 228 E4
	texte = texte.replace(/å/g,'&aring;'); // 229 E5
	texte = texte.replace(/æ/g,'&aelig;'); // 230 E6
	texte = texte.replace(/ç/g,'&ccedil;'); // 231 E7
	texte = texte.replace(/è/g,'&egrave;'); // 232 E8
	texte = texte.replace(/é/g,'&eacute;'); // 233 E9
	texte = texte.replace(/ê/g,'&ecirc;'); // 234 EA
	texte = texte.replace(/ë/g,'&euml;'); // 235 EB
	texte = texte.replace(/ì/g,'&igrave;'); // 236 EC
	texte = texte.replace(/í/g,'&iacute;'); // 237 ED
	texte = texte.replace(/î/g,'&icirc;'); // 238 EE
	texte = texte.replace(/ï/g,'&iuml;'); // 239 EF
	texte = texte.replace(/ð/g,'&eth;'); // 240 F0
	texte = texte.replace(/ñ/g,'&ntilde;'); // 241 F1
	texte = texte.replace(/ò/g,'&ograve;'); // 242 F2
	texte = texte.replace(/ó/g,'&oacute;'); // 243 F3
	texte = texte.replace(/ô/g,'&ocirc;'); // 244 F4
	texte = texte.replace(/õ/g,'&otilde;'); // 245 F5
	texte = texte.replace(/ö/g,'&ouml;'); // 246 F6
	texte = texte.replace(/÷/g,'&divide;'); // 247 F7
	texte = texte.replace(/ø/g,'&oslash;'); // 248 F8
	texte = texte.replace(/ù/g,'&ugrave;'); // 249 F9
	texte = texte.replace(/ú/g,'&uacute;'); // 250 FA
	texte = texte.replace(/û/g,'&ucirc;'); // 251 FB
	texte = texte.replace(/ü/g,'&uuml;'); // 252 FC
	texte = texte.replace(/ý/g,'&yacute;'); // 253 FD
	texte = texte.replace(/þ/g,'&thorn;'); // 254 FE
	texte = texte.replace(/ÿ/g,'&yuml;'); // 255 FF
	return texte;
}
//Décode une chaîne
function html_entity_decode(texte) {


	texte = texte.replace(/&quot;/g,'"'); // 34 22
	texte = texte.replace(/&amp;/g,'&'); // 38 26	
	texte = texte.replace(/&#39;/g,"'"); // 39 27
	texte = texte.replace(/&lt;/g,'<'); // 60 3C
	texte = texte.replace(/&gt;/g,'>'); // 62 3E
	texte = texte.replace(/&circ;/g,'^'); // 94 5E
	texte = texte.replace(/&lsquo;/g,'‘'); // 145 91
	texte = texte.replace(/&rsquo;/g,'’'); // 146 92
	texte = texte.replace(/&ldquo;/g,'“'); // 147 93
	
	texte = texte.replace(/&rdquo;/g,'”'); // 148 94
	texte = texte.replace(/&bull;/g,'•'); // 149 95
	texte = texte.replace(/&ndash;/g,'–'); // 150 96
	texte = texte.replace(/&mdash;/g,'—'); // 151 97
	texte = texte.replace(/&tilde;/g,'˜'); // 152 98
	texte = texte.replace(/&trade;/g,'™'); // 153 99
	texte = texte.replace(/&scaron;/g,'š'); // 154 9A
	texte = texte.replace(/&rsaquo;/g,'›'); // 155 9B
	texte = texte.replace(/&oelig;/g,'œ'); // 156 9C
	texte = texte.replace(/&#357;/g,''); // 157 9D
	texte = texte.replace(/&#382;/g,'ž'); // 158 9E
	texte = texte.replace(/&Yuml;/g,'Ÿ'); // 159 9F
	texte = texte.replace(/&nbsp;/g,' '); // 160 A0
	texte = texte.replace(/&iexcl;/g,'¡'); // 161 A1
	texte = texte.replace(/&cent;/g,'¢'); // 162 A2
	texte = texte.replace(/&pound;/g,'£'); // 163 A3
	texte = texte.replace(/&curren;/g,' '); // 164 A4
	texte = texte.replace(/&yen;/g,'¥'); // 165 A5
	texte = texte.replace(/&brvbar;/g,'¦'); // 166 A6
	texte = texte.replace(/&sect;/g,'§'); // 167 A7
	texte = texte.replace(/&uml;/g,'¨'); // 168 A8
	texte = texte.replace(/&copy;/g,'©'); // 169 A9
	texte = texte.replace(/&ordf;/g,'ª'); // 170 AA
	texte = texte.replace(/&laquo;/g,'«'); // 171 AB
	texte = texte.replace(/&not;/g,'¬'); // 172 AC
	texte = texte.replace(/&shy;/g,'­'); // 173 AD
	texte = texte.replace(/&reg;/g,'®'); // 174 AE
	texte = texte.replace(/&macr;/g,'¯'); // 175 AF
	texte = texte.replace(/&deg;/g,'°'); // 176 B0
	texte = texte.replace(/&plusmn;/g,'±'); // 177 B1
	texte = texte.replace(/&sup2;/g,'²'); // 178 B2
	texte = texte.replace(/&sup3;/g,'³'); // 179 B3
	texte = texte.replace(/&acute;/g,'´'); // 180 B4
	texte = texte.replace(/&micro;/g,'µ'); // 181 B5
	texte = texte.replace(/&para/g,'¶'); // 182 B6
	texte = texte.replace(/&middot;/g,'·'); // 183 B7
	texte = texte.replace(/&cedil;/g,'¸'); // 184 B8
	texte = texte.replace(/&sup1;/g,'¹'); // 185 B9
	texte = texte.replace(/&ordm;/g,'º'); // 186 BA
	texte = texte.replace(/&raquo;/g,'»'); // 187 BB
	texte = texte.replace(/&frac14;/g,'¼'); // 188 BC
	texte = texte.replace(/&frac12;/g,'½'); // 189 BD
	texte = texte.replace(/&frac34;/g,'¾'); // 190 BE
	texte = texte.replace(/&iquest;/g,'¿'); // 191 BF
	texte = texte.replace(/&Agrave;/g,'À'); // 192 C0
	texte = texte.replace(/&Aacute;/g,'Á'); // 193 C1
	texte = texte.replace(/&Acirc;/g,'Â'); // 194 C2
	texte = texte.replace(/&Atilde;/g,'Ã'); // 195 C3
	texte = texte.replace(/&Auml;/g,'Ä'); // 196 C4
	texte = texte.replace(/&Aring;/g,'Å'); // 197 C5
	texte = texte.replace(/&AElig;/g,'Æ'); // 198 C6
	texte = texte.replace(/&Ccedil;/g,'Ç'); // 199 C7
	texte = texte.replace(/&Egrave;/g,'È'); // 200 C8
	texte = texte.replace(/&Eacute;/g,'É'); // 201 C9
	texte = texte.replace(/&Ecirc;/g,'Ê'); // 202 CA
	texte = texte.replace(/&Euml;/g,'Ë'); // 203 CB
	texte = texte.replace(/&Igrave;/g,'Ì'); // 204 CC
	texte = texte.replace(/&Iacute;/g,'Í'); // 205 CD
	texte = texte.replace(/&Icirc;/g,'Î'); // 206 CE
	texte = texte.replace(/&Iuml;/g,'Ï'); // 207 CF
	texte = texte.replace(/&ETH;/g,'Ð'); // 208 D0
	texte = texte.replace(/&Ntilde;/g,'Ñ'); // 209 D1
	texte = texte.replace(/&Ograve;/g,'Ò'); // 210 D2
	texte = texte.replace(/&Oacute;/g,'Ó'); // 211 D3
	texte = texte.replace(/&Ocirc;/g,'Ô'); // 212 D4
	texte = texte.replace(/&Otilde;/g,'Õ'); // 213 D5
	texte = texte.replace(/&Ouml;/g,'Ö'); // 214 D6
	texte = texte.replace(/&times;/g,'×'); // 215 D7
	texte = texte.replace(/&Oslash;/g,'Ø'); // 216 D8
	texte = texte.replace(/&Ugrave;/g,'Ù'); // 217 D9
	texte = texte.replace(/&Uacute;/g,'Ú'); // 218 DA
	texte = texte.replace(/&Ucirc;/g,'Û'); // 219 DB
	texte = texte.replace(/&Uuml;/g,'Ü'); // 220 DC
	texte = texte.replace(/&Yacute;/g,'Ý'); // 221 DD
	texte = texte.replace(/&THORN;/g,'Þ'); // 222 DE
	texte = texte.replace(/&szlig;/g,'ß'); // 223 DF
	texte = texte.replace(/&agrave;/g,'à'); // 224 E0
	texte = texte.replace(/&aacute;/g,'á'); // 225 E1
	texte = texte.replace(/&acirc;/g,'â'); // 226 E2
	texte = texte.replace(/&atilde;/g,'ã'); // 227 E3
	texte = texte.replace(/&auml;/g,'ä'); // 228 E4
	texte = texte.replace(/&aring;/g,'å'); // 229 E5
	texte = texte.replace(/&aelig;/g,'æ'); // 230 E6
	texte = texte.replace(/&ccedil;/g,'ç'); // 231 E7
	texte = texte.replace(/&egrave;/g,'è'); // 232 E8
	texte = texte.replace(/&eacute;/g,'é'); // 233 E9
	texte = texte.replace(/&ecirc;/g,'ê'); // 234 EA
	texte = texte.replace(/&euml;/g,'ë'); // 235 EB
	texte = texte.replace(/&igrave;/g,'ì'); // 236 EC
	texte = texte.replace(/&iacute;/g,'í'); // 237 ED
	texte = texte.replace(/&icirc;/g,'î'); // 238 EE
	texte = texte.replace(/&iuml;/g,'ï'); // 239 EF
	texte = texte.replace(/&eth;/g,'ð'); // 240 F0
	texte = texte.replace(/&ntilde;/g,'ñ'); // 241 F1
	texte = texte.replace(/&ograve;/g,'ò'); // 242 F2
	texte = texte.replace(/&oacute;/g,'ó'); // 243 F3
	texte = texte.replace(/&ocirc;/g,'ô'); // 244 F4
	texte = texte.replace(/&otilde;/g,'õ'); // 245 F5
	texte = texte.replace(/&ouml;/g,'ö'); // 246 F6
	texte = texte.replace(/&divide;/g,'÷'); // 247 F7
	texte = texte.replace(/&oslash;/g,'ø'); // 248 F8
	texte = texte.replace(/&ugrave;/g,'ù'); // 249 F9
	texte = texte.replace(/&uacute;/g,'ú'); // 250 FA
	texte = texte.replace(/&ucirc;/g,'û'); // 251 FB
	texte = texte.replace(/&uuml;/g,'ü'); // 252 FC
	texte = texte.replace(/&yacute;/g,'ý'); // 253 FD
	texte = texte.replace(/&thorn;/g,'þ'); // 254 FE
	texte = texte.replace(/&yuml;/g,'ÿ'); // 255 FF
	

	texte = texte.replace(/&#176;/g,'°'); // 255 FF
	texte = texte.replace(/&#249;/g,'ù'); // 255 FF
	texte = texte.replace(/&#168;/g,'¨'); // 255 FF
	texte = texte.replace(/&#232;/g,'è'); // 232 E8
		
	return texte;
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}


function MiseEnforme(wValeur)
{

if (wValeur.length)
{
  wValeur = Left (wValeur,1).toUpperCase() + Right(wValeur, wValeur.length - 1)
}
return wValeur
}

function onPressEnter(e) 
{ 
    var keynum = (e.which) ? e.which : e.keyCode;
   
    if (keynum ==13) 
    {  
        OuvreExecute('DataSearch.aspx?Code=' +  document.getElementById('TSearch2').value + "&" + window.parent.document.getElementById("ctl00_ContentPlaceHolder1_TTrad").value );    
        return false;
    }
    else
    {
        return true;
    }
    

}

function adjustIFrameSize (iframeWindow, wHaut, wLarg) 
{

    var wPlus= 5;
    if (wHaut=="1" && wLarg=="1")
    {
        var wPlus= 20;
    }
    else
   {
        var wPlus= 5;
   }

    var largeurScr=0;
    var hauteurScr=0;
    var decale = 0;
    
	    //sert quand trop petit iframe on la met a des mesures qui ne depasseront pas la fenêtre
    if (wLarg =="1"){largeurScr = Retourne_Taille_X()-40;}
	    //var largeurScr = document.body.offsetWidth*90/100;

    //   var largeurScr = Retourne_Taille_X() * 96/100; 

 //   if (wHaut =="1"){hauteurScr = (Retourne_Taille_Y()-120 )* 60 /100 ;}
//     alert (window.parent.document.getElementById("TR_Master").style.display);
//     alert (window.document.getElementById("TR_Master"));
     
    if (wHaut =="1"){
    if (window.document.getElementById("TR_Master") && window.document.getElementById("TR_Master").style.display == "none")
    {
        decale =74;
    }
    if (window.parent.document.getElementById("TR_Master") && window.parent.document.getElementById("TR_Master").style.display == "none")
    {   //alert ("jo");
        decale =74;
    }

    hauteurScr = (Retourne_Taille_Y()-130 + decale);

    }


 
    //	var hauteurScr = screen.availHeight*40/100;
	    //var hauteurScr = document.body.offsetHeight*40/100;
    //	alert(screen.availHeight*40/100);

    //	alert(document.body.offsetHeight*40/100);
    
      if (iframeWindow.document.height) {
        var iframeElement = document.getElementById
		    (iframeWindow.name);
        iframeElement.style.height = iframeWindow.document.height + 'px';
        iframeElement.style.width = iframeWindow.document.width  + 'px';
      }
      else if (document.all) {

        var iframeElement = document.all[iframeWindow.name];
        if (iframeWindow.document.compatMode &&
            iframeWindow.document.compatMode != 'BackCompat') 
        {
     
          iframeElement.style.height = 
			    iframeWindow.document.documentElement.scrollHeight + wPlus + 'px';
		
			    if (wLarg == 1)
			    {
          iframeElement.style.width = 
			    iframeWindow.document.documentElement.scrollWidth + 5 + 'px';
                }
    			
        }
        else {
          iframeElement.style.height = 
			    iframeWindow.document.body.scrollHeight + wPlus + 'px';
          iframeElement.style.width = 
			    iframeWindow.document.body.scrollWidth + 0 + 'px';
        }
     
      }

      var Tab_width=(iframeElement.style.width).replace ('px','');
      var Tab_height=(iframeElement.style.height).replace ('px','');

	    if (Tab_width < largeurScr) 
	    {
		    iframeElement.style.width=largeurScr +  'px';
	    }
	    if (Tab_height < hauteurScr)
	    {
		    iframeElement.style.height=hauteurScr +  'px';
	    }   

}

function CheckBoxAllChange(wCheck)
{
if (wCheck== true)
{
    window.document.getElementById("ctl00_ContentPlaceHolder1_DSegment").disabled  =true;
    window.document.getElementById("ctl00_ContentPlaceHolder1_DFamily").disabled  =true;
    window.document.getElementById("ctl00_ContentPlaceHolder1_DClass").disabled  =true;

}
else
{
    window.document.getElementById("ctl00_ContentPlaceHolder1_DSegment").disabled =false;
    window.document.getElementById("ctl00_ContentPlaceHolder1_DFamily").disabled =false;
    window.document.getElementById("ctl00_ContentPlaceHolder1_DClass").disabled =false;
    

}

}
function CheckBoxAllChangeListe(wCheck)
{
if (wCheck== true)
{
    window.document.getElementById("DSegment").disabled  =true;
    window.document.getElementById("DFamily").disabled  =true;
    window.document.getElementById("DClass").disabled  =true;

}
else
{
    window.document.getElementById("DSegment").disabled =false;
    window.document.getElementById("DFamily").disabled =false;
    window.document.getElementById("DClass").disabled =false;
    

}

}

function DoubleClic(rep) 
{
       alert(rep);
       alert ("kokoo");
       
}

function SimpleClic(Obj,Code) 
{

    document.getElementById("Code_Select").value= Code;
    var wNomGrid= "GridView1";
    if (document.getElementById("GridView1")==null)
    {
        wNomGrid= "GridView2";
    }
     var wNbCount = document.getElementById(wNomGrid).rows.length;

 	var rows=document.getElementById(wNomGrid).getElementsByTagName('TR');
 	 	  
 	for (var wi=1; wi<wNbCount; wi++)
	{
	    if (rows[wi].className == "SelectedRowStyle" || rows[wi].className == "SelectedRowSearch") 
	    {
	        if ((wi != 1 && rows[wi-1].className == "NormalRowStyle") || ( wi > 2 && rows[wi-1].className == "gridHover" && rows[wi-2].className == "AlternativeRowStyle") )
	        {
	            rows[wi].className = "AlternativeRowStyle";
	        }
	        else
	        {
	            rows[wi].className = "NormalRowStyle";
	        }
	    }
	}	
	Obj.className="SelectedRowStyle"; 
	
	if (document.getElementById("GridViewAll")!=null)
    {
        wNomGrid= "GridViewAll";
         var wNbCount = document.getElementById(wNomGrid).rows.length;

 	    var rows=document.getElementById(wNomGrid).getElementsByTagName('TR');
 	    for (var wi=1; wi<wNbCount; wi++)
	    {
	        if (rows[wi].className == "SelectedRowStyle" || rows[wi].className == "SelectedRowSearch") 
	        {
	            if ((wi != 1 && rows[wi-1].className == "NormalRowStyle") || ( wi > 2 && rows[wi-1].className == "gridHover" && rows[wi-2].className == "AlternativeRowStyle") )
	            {
	                rows[wi].className = "AlternativeRowStyle";
	            }
	            else
	            {
	                rows[wi].className = "NormalRowStyle";
	            }
	        }
	    }	
	    Obj.className="SelectedRowStyle";         
    }
	  
	/*
	if (window.document.getElementById("DivControl") != null)
	{
	    window.document.getElementById("DivControl").style.top = Retourne_Y() - 50 + "px";
	    window.document.getElementById("DivControl").style.left = ((Retourne_Taille_X()/4) - 111)/2;;

	    window.document.getElementById("DivControl").style.display ="block";
	}*/
	//alert("jo");
}

function SimpleClic2(Obj,Code) 
{
    document.getElementById("Code_Select2").value= Code;
    var wNomGrid= "GridView2";
    if (document.getElementById("GridView2")==null)
    {
        wNomGrid= "GridView3";
    }
     var wNbCount = document.getElementById(wNomGrid).rows.length;

 	var rows=document.getElementById(wNomGrid).getElementsByTagName('TR');
 	 	  
 	for (var wi=1; wi<wNbCount; wi++)
	{
	    if (rows[wi].className == "SelectedRowStyle" || rows[wi].className == "SelectedRowSearch") 
	    {
	        if ((wi != 1 && rows[wi-1].className == "NormalRowStyle") || ( wi > 2 && rows[wi-1].className == "gridHover" && rows[wi-2].className == "AlternativeRowStyle") )
	        {
	            rows[wi].className = "AlternativeRowStyle";
	        }
	        else
	        {
	            rows[wi].className = "NormalRowStyle";
	        }
	    }
	}	
	Obj.className="SelectedRowStyle"; 
	
}
	  
function SimpleClicAuto(wNom, wCode, wDepTrad) 
{


    var Dernier=2; //permet de savoir si c'est la dernière recherche
    if (wCode==1)
    {
        Dernier=0;
        if (wNom == "Segment" && (window.parent.document.getElementById("TFamily") ==null || window.parent.document.getElementById("TFamily").value =="")){Dernier=1;}
        if (wNom == "Family" && (window.parent.document.getElementById("TClass") ==null || window.parent.document.getElementById("TClass").value =="")){Dernier=1;}
        if (wNom == "Class" && (window.parent.document.getElementById("TBrick") ==null || window.parent.document.getElementById("TBrick").value =="")){Dernier=1;}
        if (wNom == "Brick"){Dernier=1;}
    }
    
    
    var wCode = document.getElementById("Code_Select").value;
    //alert (wCode);
    if (wCode !="")
    {
        var wNbCount = document.getElementById("GridView1").rows.length;
 	    var rows=document.getElementById('GridView1').getElementsByTagName('TR');

 	    for (var wi=1; wi<wNbCount; wi++)
	    {
	        if (rows[wi].getElementsByTagName('td')[1].innerHTML == wCode)
	        {
	            if (Dernier ==1)
	            {
	                rows[wi].className = "SelectedRowSearch";
	            }
	            else
	            {
	                rows[wi].className = "SelectedRowStyle";
	               // rows[wi].click();
	            }
	            if (window.parent.document.getElementById("T" + wNom + "TradClick") != null)
                {
	                if (wNom == "Brick")
	                {
   	                    window.parent.document.getElementById("T" + wNom + "TradClick").value = wDepTrad + ': ' +rows[wi].getElementsByTagName('td')[4].innerHTML;
	                    window.parent.document.getElementById("T" + wNom + "Trad").value  = wDepTrad + ': ' +rows[wi].getElementsByTagName('td')[4].innerHTML;            
	                }
	                else
	                {
   	                    window.parent.document.getElementById("T" + wNom + "TradClick").value = wDepTrad + ': ' + rows[wi].getElementsByTagName('td')[2].innerHTML;
	                    window.parent.document.getElementById("T" + wNom + "Trad").value  = wDepTrad + ': ' +rows[wi].getElementsByTagName('td')[2].innerHTML;
                    }
                    if (Dernier==0)
                    {agrandir (wNom ,2);}
                    else {agrandir (wNom ,1);}
                }
	        }
        } 
	}	
	
}

function AffichExplanation(wAffich)
{

if (wAffich==1)
{
    window.document.getElementById("DExplanation").style.width= Retourne_Taille_X() * 95/100 + "px";
    window.document.getElementById("DExplanation").style.height = (Retourne_Taille_Y())* 98 /100  + "px";;
    window.document.getElementById("DExplanation").style.display= "block";
     window.document.getElementById("TExplanation").focus();
}
else
{
     window.document.getElementById("DExplanation").style.display= "none";
}
}



function RecupTrace() 
{
    var wNbCount = document.getElementById("GridView1").rows.length;
    var rows=document.getElementById("GridView1").getElementsByTagName("TR");

    window.parent.document.getElementById("TActivatedBy").value = rows[1].getElementsByTagName("td")[3].innerHTML;
    window.parent.document.getElementById("TActivatedDate").value = rows[1].getElementsByTagName("td")[1].innerHTML;
    if ((wNbCount - 1) != 1)
    {
        window.parent.document.getElementById("TlastModificationBy").value = rows[wNbCount - 1].getElementsByTagName("td")[3].innerHTML;
        window.parent.document.getElementById("TlastModificationDate").value = rows[wNbCount - 1].getElementsByTagName("td")[1].innerHTML;
    }
    if (window.parent.document.getElementById("IInfoBrick") !=null)
    {  
        window.parent.document.getElementById("IInfoBrick").height = (Retourne_Taille_Y()-120) * 80 /100; 
    }
    if (window.parent.document.getElementById("IInfo") !=null)
    {  
        window.parent.document.getElementById("IInfo").height = (Retourne_Taille_Y()-120) * 80 /100; 
    }
}


function openPopup(strOpen)
{
    window.open(strOpen, "popup1", "status=0, scrollbars=yes, menubar=no, width=500 , top=100, left=300");
}

function Retourne_X()
{
    if(navigator.appName== "Microsoft Internet Explorer")
    {
	    e = window.event;
	    mouse_X = e.clientX + document.body.scrollLeft;
    }
    else
    {
	    mouse_X = e.pageX + document.documentElement.scrollLeft;
    }
   return mouse_X
}

function Retourne_Y()
{
    if(navigator.appName== "Microsoft Internet Explorer")
    {
	    e = window.event;
	    mouse_Y = e.clientY + document.body.scrollTop;
    }
    else
    {
	    mouse_Y = e.pageY + document.documentElement.scrollTop;
    }
       return mouse_Y

}


function Retourne_Taille_X()
{
    return (screen.availWidth);
}
function Retourne_Milieu_X(Nom)
{
    var larg = parseInt(document.getElementById(Nom).width);
    var result="";
    if (larg < 100 ) //pour les %
    {

        result = ((100-larg)/2) * parseInt (Retourne_Taille_X()) /100;
    }
    else
    {
         result = (Retourne_Taille_X() -larg)/2;
    }

    return result;
}
function Retourne_Taille_Y()
{
//alert (document.body.clientHeight);
if (document.documentElement.clientHeight<=300)
{

    return (document.body.clientHeight);
}
else
{

    return (document.documentElement.clientHeight);
}
//    return (document.documentElement.clientHeight);
//    return (screen.availHeight);
}


function Affich(nom, lien)
{
//alert (lien);
    document.getElementById(nom).src = lien;
    document.getElementById(nom).style.display= "block";
    document.getElementById(nom).style.position ="absolute";
    document.getElementById(nom).style.visibility="visible";
  document.getElementById(nom).style.top= Retourne_Y() + 20 + "px" ;       
    document.getElementById(nom).style.left= Retourne_Milieu_X("FGestion_Util");
}

function AffichCalendrier(nom)
{
//alert(nom);
    document.getElementById(nom).style.display= "block";
    document.getElementById(nom).style.position ="absolute";
    document.getElementById(nom).style.visibility="visible";
  document.getElementById(nom).style.top= Retourne_Y() + 20 + "px" ;       

}


function AfficheMasqueDiv(wNom,Affiche)
{
    if (Affiche ==1)
    {
        window.document.getElementById(wNom).style.display= "block";
        MajFrame2 ("I" + Right(wNom, wNom.length -1));

    }
    else
    {
        window.document.getElementById(wNom).style.display= "none";
    }
}

function AfficheInfo(wType,wCode, wTrad)
{ 
    window.document.getElementById("IInfo").src="Detail_Brick.aspx?Trad="+ wTrad + "&wPlus=1&wType=" + wType + "&wValue=" + wCode  ;
//    window.document.getElementById("IInfo").src="Detail_Brick.aspx?wCode=93040101&wType=Attribute&wValue='" + wCode + "'";
window.document.getElementById("DInfo").style.width = Retourne_Taille_X() * 95/100  +  "px";
 //   alert( window.document.getElementById("IInfo").src);
    window.document.getElementById("DInfo").style.display= "block";
   // AfficheMasqueDiv("DInfo",1)
   



}

function AfficheLiaison(wGPC,wCode, wLevel, wBase, wTgpc, wTunspsc)
{ 
 
    window.document.getElementById("DInfo").style.width = Retourne_Taille_X() * 97/100+ "px";
       window.document.getElementById("DInfo").style.height= (Retourne_Taille_Y())  + "px";  
    window.document.getElementById("IInfo").src="Liaison.aspx?GPC="+ wGPC + "&Code=" + wCode + "&Level=" + wLevel + "&Base=" + wBase + "&TGPC=" + wTgpc + "&TUNSPSC=" + wTunspsc;

    window.document.getElementById("DInfo").style.display= "block";

}

function AfficheInfo2(wType,wCode, wTrad)
{ 
    window.document.getElementById("IInfo").src="Detail_Brick.aspx?Trad=" + wTrad + "&wJustOne=1&wPlus=1&wType=" + wType + "&wValue=" + wCode;
//    window.document.getElementById("IInfo").src="Detail_Brick.aspx?wCode=93040101&wType=Attribute&wValue='" + wCode + "'";
    window.document.getElementById("DInfo").style.width = Retourne_Taille_X() * 95/100 + 7 +  "px";
 //   alert( window.document.getElementById("IInfo").src);
    window.document.getElementById("DInfo").style.display= "block";
   // AfficheMasqueDiv("DInfo",1)

}
function DepDetailBrick(wPlus)
{

if (wPlus==1)
{
    window.document.getElementById("IAttribute").height="320px";
    window.document.getElementById("IValue").height="320px";

}
//alert (window.document.getElementById("IAttribute").height);
}


function FermeUtilMaj()
{
 if( document.frames){ 
     var obj1 = window.parent.document.frames["I" + wNom];
 }
 else
 {
    var obj1 = window.parent.document.getElementById("I" + wNom);          
 }

 obj1.location.href = obj1.location.href;
 window.parent.document.getElementById("BrickDefinition").style.display = "none";     
 window.parent.document.getElementById("IModifObjet").style.display="none";
}

function taille_master(obj, TitleON, TitleOFF)
{
    if (window.document.getElementById("TR_Master").style.display == "none")
    {
        obj.title = TitleON;
        obj.src=obj.src.replace("plus", "moins");
        window.document.getElementById("TR_Master").style.display = "block"; 
        deplace_all_element (74);
        window.document.getElementById("ctl00_TAgrand").value = "0";                      
    }
    else
    {
        obj.title = TitleOFF;
        obj.src= obj.src.replace("moins", "plus");
        window.document.getElementById("TR_Master").style.display = "none";           
        deplace_all_element (-74);
        window.document.getElementById("ctl00_TAgrand").value = "1";      

    }

}

function AffecteValue (wNom)
{

    window.document.getElementById(wNom).value = window.document.getElementById(wNom + "Click").value;
}

function taille_masterAuto(TitleON, TitleOFF)
{
    if (window.document.getElementById("ctl00_TAgrand").value =="1")
    {
        taille_master (window.document.getElementById("ctl00_BtnTailMaster"), TitleON, TitleOFF);
    }
}

function deplace_all_element (decale)
{   


    if (window.document.getElementById("ISegment") != null)
    {

        window.document.getElementById("Div_Dep").style.top = parseInt(window.document.getElementById("Div_Dep").style.top) + decale + "px"; 
        window.document.getElementById("Div_Dep").style.height= parseInt(window.document.getElementById("Div_Dep").style.height) - decale + "px"; 
        window.document.getElementById("ISegment").height = parseInt(window.document.getElementById("ISegment").height) - decale + "px"; 
        window.document.getElementById("IFamily").height = parseInt(window.document.getElementById("IFamily").height) - decale + "px";  
        window.document.getElementById("IClass").height = parseInt(window.document.getElementById("IClass").height) - decale + "px"; 
        window.document.getElementById("IBrick").height = parseInt(window.document.getElementById("IBrick").height) - (decale/2) + "px";  
        window.document.getElementById("IValue").height = parseInt(window.document.getElementById("IValue").height) - decale + "px";  
        window.document.getElementById("IAttribute").height = parseInt(window.document.getElementById("IAttribute").height) - decale + "px";  
        window.document.getElementById("BrickDefinition").style.height = parseInt(window.document.getElementById("BrickDefinition").style.height) - (decale/2) + "px";
        window.document.getElementById("BrickDefinition").style.top = parseInt(window.document.getElementById("BrickDefinition").style.top) - (decale/2) + "px";

        window.document.getElementById("IModifObjet").style.top = parseInt(window.document.getElementById("IModifObjet").style.top) + decale + "px"; 
        window.document.getElementById("IModifObjet2").style.top = parseInt(window.document.getElementById("IModifObjet2").style.top) + decale + "px"; 
        window.document.getElementById("IModifObjet3").style.top = parseInt(window.document.getElementById("IModifObjet3").style.top) + decale + "px"; 
        window.document.getElementById("IModifObjet4").style.top = parseInt(window.document.getElementById("IModifObjet4").style.top) + decale + "px"; 
        window.document.getElementById("IModifObjet5").style.top = parseInt(window.document.getElementById("IModifObjet5").style.top) + decale + "px"; 

        window.document.getElementById("IModifObjet").height = parseInt(window.document.getElementById("IModifObjet").height) - decale + "px"; 
        window.document.getElementById("IModifObjet2").height = parseInt(window.document.getElementById("IModifObjet2").height) - decale + "px"; 
        window.document.getElementById("IModifObjet3").height = parseInt(window.document.getElementById("IModifObjet3").height) - decale + "px"; 
        window.document.getElementById("IModifObjet4").height = parseInt(window.document.getElementById("IModifObjet4").height) - decale + "px"; 
        window.document.getElementById("IModifObjet5").height = parseInt(window.document.getElementById("IModifObjet5").height) - decale + "px"; 
        
/*
        window.document.getElementById("ISegment").style.top = parseInt(window.document.getElementById("ISegment").style.top) + decale; 
        window.document.getElementById("IFamily").style.top = parseInt(window.document.getElementById("IFamily").style.top) + decale;  
        window.document.getElementById("IClass").style.top = parseInt(window.document.getElementById("IClass").style.top) + decale ; 
        window.document.getElementById("IBrick").style.top = parseInt(window.document.getElementById("IBrick").style.top) + decale ;  
        window.document.getElementById("IValue").style.top = parseInt(window.document.getElementById("IValue").style.top) + decale ;  
        window.document.getElementById("IAttribute").style.top = parseInt(window.document.getElementById("IAttribute").style.top) + decale ;  
        window.document.getElementById("IModifObjet").style.top = parseInt(window.document.getElementById("IModifObjet").style.top) + decale ;
        window.document.getElementById("BrickDefinition").style.top = parseInt(window.document.getElementById("BrickDefinition").style.top) + decale ;
*/
    }
    else
    {
        if (window.document.getElementById("IModifObjet") != null) 
        { 
            window.document.getElementById("IModifObjet").style.top = parseInt(window.document.getElementById("IModifObjet").style.top) + decale + "px"; 
            window.document.getElementById("IModifObjet").height = parseInt(window.document.getElementById("IModifObjet").height) - decale + "px"; 
        }
        if (window.document.getElementById("IModifObjet2") != null) 
        { 
            window.document.getElementById("IModifObjet2").style.top = parseInt(window.document.getElementById("IModifObjet2").style.top) + decale + "px"; 
            window.document.getElementById("IModifObjet2").height = parseInt(window.document.getElementById("IModifObjet2").height) - decale + "px"; 
        }
        if (window.document.getElementById("IModifObjet3") != null) 
        { 
            window.document.getElementById("IModifObjet3").style.top = parseInt(window.document.getElementById("IModifObjet3").style.top) + decale + "px"; 
            window.document.getElementById("IModifObjet3").height = parseInt(window.document.getElementById("IModifObjet3").height) - decale + "px"; 
        }            
        if (window.document.getElementById("IModifObjet4") != null) 
        { 
            window.document.getElementById("IModifObjet4").style.top = parseInt(window.document.getElementById("IModifObjet4").style.top) + decale + "px"; 
            window.document.getElementById("IModifObjet4").height = parseInt(window.document.getElementById("IModifObjet4").height) - decale + "px"; 
        }     
        if (window.document.getElementById("IModifObjet5") != null) 
        { 
            window.document.getElementById("IModifObjet5").style.top = parseInt(window.document.getElementById("IModifObjet5").style.top) + decale + "px"; 
            window.document.getElementById("IModifObjet5").height = parseInt(window.document.getElementById("IModifObjet5").height) - decale + "px"; 
        }                 
    }
}

function CacheFrame(wNom)
{

    window.parent.document.getElementById(wNom).style.display="none";
    window.parent.document.getElementById(wNom).style.visible="hidden";

}

// partie pour l'agrandissement des iframes
function agrandir (wNom,wOblige)
{
  
    if (document.getElementById("I" + wNom)!=null)
    {
        var obj = window.document.getElementById("I" + wNom);
        
    }
    else
    {
        var obj = window.parent.document.getElementById("I" + wNom);    
        var obj2=null;
         if( document.frames){ 
             var obj2 = window.parent.document.frames["I" + wNom].window.document.getElementById("ImgLoupe");
         }
         else
         {
            var obj2 = window.parent.document.getElementById("I" + wNom).contentWindow.document.getElementById("ImgLoupe");         
         }
  
    }
    //alert ("I" + wNom);
    if ((obj.width== parseInt(Retourne_Taille_X() /2.2)&& wOblige == 0 ) || wOblige==2)
    {
        if (obj2 !=null){ obj2.src='../IMAGE/loupe_zoom.gif';}          

        if (wNom == "Brick" || wNom =="Attribute")  
        {
        
            obj.width=Retourne_Taille_X() /3;
        } 
        else 
        {
            obj.width=Retourne_Taille_X() /4;
            CacheColonneTab("0");
        }                       
    }
    else
    {
        if (obj2 !=null){ obj2.src='../IMAGE/loupe_dezoom.gif';} 
        if (wNom != "Brick") 
        {        
                CacheColonneTab("1");
        }
       
        obj.width=Retourne_Taille_X() /2.2;
       

    }
    
    // on repasse les autre à 20%
    if (wOblige==1)
    {
        if (wNom != "Segment") {agrandir("Segment",2);}
        if (wNom != "Family") {agrandir("Family",2);}
        if (wNom != "Class") {agrandir("Class",2);}
        if (wNom != "Brick") {agrandir("Brick",2);}
        if (wNom != "Attribute") {agrandir("Attribute",2);}
//        if (wNom != "Attribute") {window.parent.document.getElementById("IAttribute").width = Retourne_Taille_X() /4}
            
    }

    if (wOblige!=0)
    {
        if (wNom == "Brick" || wNom == "Attribute")
        {
            window.parent.document.getElementById("Div_Dep").scrollLeft=window.parent.document.getElementById("Div_Dep").scrollWidth ; 
        }
    }
}

function CacheColonneTab(wAffich)
{
    if (document.getElementById("GridView1")!=null)
    {
        var wDisplay="block";
            document.getElementById("wAffichCode").value=1;
   //         alert(document.getElementById("ImgLoupe").src.lastIndexOf("loupe_dezoom.gif"));
        if (wAffich=="0")
        {
            document.getElementById("wAffichCode").value=0;
            wDisplay="none";
        }
        var wNbCount = document.getElementById("GridView1").rows.length;
        var rows=document.getElementById("GridView1").getElementsByTagName("TR");
        rows[0].getElementsByTagName("th")[1].style.display = wDisplay;
        for(var i=1; i< wNbCount; i++)
        {
          rows[i].getElementsByTagName("td")[1].style.display = wDisplay;
        }   
    }
}

function CacheColonneTabAuto()
{

    CacheColonneTab(document.getElementById("wAffichCode").value );
}

function DivScroll(Obj,wValue)
{
    window.document.getElementById(Obj).scrollLeft = wValue ; 
}

function ActualiseSchema(Valeur)
{


    window.document.getElementById("TSegmentTrad").style.width = Retourne_Taille_X() * 24/100  + "px";
    window.document.getElementById("TFamilyTrad").style.width = window.document.getElementById("TSegmentTrad").style.width; 
    window.document.getElementById("TClassTrad").style.width = window.document.getElementById("TSegmentTrad").style.width;
    window.document.getElementById("TBrickTrad").style.width = window.document.getElementById("TSegmentTrad").style.width;      
    window.document.getElementById("TAttributeTrad").style.width = window.document.getElementById("TSegmentTrad").style.width;      


    window.document.getElementById("TSegmentTrad").style.display = "none";
    window.document.getElementById("TFamilyTrad").style.display = "none";
    window.document.getElementById("TClassTrad").style.display = "none";
    window.document.getElementById("TBrickTrad").style.display = "none";    
    window.document.getElementById("TAttributeTrad").style.display = "none";    
    
     if (Valeur != "Segment")
     {    
     
        if (window.parent.document.getElementById("TSegmentTrad").innerHTML != "")
        {
            window.document.getElementById("TSegmentTrad").innerHTML = window.parent.document.getElementById("TSegmentTrad").innerHTML;
        }
        else
        {
            window.document.getElementById("TSegmentTrad").innerHTML = window.parent.document.getElementById("TSegmentTrad").value;
        }
        window.document.getElementById("TSegmentTrad").style.display = "block";            

        if (Valeur !="Family")
        {
            if (window.parent.document.getElementById("TFamilyTrad").innerHTML != "")
            {
                window.document.getElementById("TFamilyTrad").innerHTML = window.parent.document.getElementById("TFamilyTrad").innerHTML;           
            }
            else
            {
                window.document.getElementById("TFamilyTrad").innerHTML = window.parent.document.getElementById("TFamilyTrad").value;            
            }

            window.document.getElementById("TFamilyTrad").style.display = "block";    
            if (Valeur !="Class")
            {
                if (window.parent.document.getElementById("TClassTrad").innerHTML !="")
                {
                    window.document.getElementById("TClassTrad").innerHTML = window.parent.document.getElementById("TClassTrad").innerHTML;
                }
                else
                {
                    window.document.getElementById("TClassTrad").innerHTML = window.parent.document.getElementById("TClassTrad").value;                  
                }
                window.document.getElementById("TClassTrad").style.display = "block";            
                if (Valeur !="Brick")
                {
                    if (window.parent.document.getElementById("TBrickTrad").innerHTML !="")
                    {
                        window.document.getElementById("TBrickTrad").innerHTML = window.parent.document.getElementById("TBrickTrad").innerHTML;
                    }
                    else
                    {
                        window.document.getElementById("TBrickTrad").innerHTML = window.parent.document.getElementById("TBrickTrad").value;                    
                    }
                    window.document.getElementById("TBrickTrad").style.display = "block";

                    if (Valeur !="Attribute")
                    {
                        if (window.parent.document.getElementById("TAttributeTrad").innerHTML !="")
                        {
                            window.document.getElementById("TAttributeTrad").innerHTML = window.parent.document.getElementById("TAttributeTrad").innerHTML;                        
                        }
                        else
                        {
                            window.document.getElementById("TAttributeTrad").innerHTML = window.parent.document.getElementById("TAttributeTrad").value;                       
                        }
                        window.document.getElementById("TAttributeTrad").style.display = "block";
                    }                                                           
                }
            }
        } 
     }

}

function OuvreExecute(wURL)
{
     if(document.frames){ 
         var obj1 = window.parent.document.frames["IExecute"];
     }
     else
     {
        var obj1 = window.parent.document.getElementById("IExecute");  
     }

   if(document.frames)
   {     
        obj1.location.href = wURL ;
   }
   else 
   {    obj1.contentDocument.location.href = wURL ;
     }

}

function OuvreExecuteAttribute(wURL)
{
   if(document.frames){ 
         var obj1 = window.parent.parent.parent.document.frames["IExecute"];
     }
     else
     {
        var obj1 = window.parent.parent.parent.document.getElementById("IExecute");  
     }

   if(document.frames)
   {     
        obj1.location.href = wURL ;
   }
   else 
   {    obj1.contentDocument.location.href = wURL ;
     }

}
function DeplacementOutPut()
{
    window.document.getElementById("IModifObjet").width= Retourne_Taille_X() * 96/100 + "px"; 
    window.document.getElementById("IModifObjet").height= (Retourne_Taille_Y()-125)  + "px"; 
    window.document.getElementById("IModifObjet").style.top = "125px";  
    window.document.getElementById("IModifObjet").style.left = "10px";    
    window.document.getElementById("IModifObjet").style.display = "none";   
}

function DeplacementOutPut2()
{
    window.document.getElementById("IModifObjet").width= Retourne_Taille_X() * 96/100 + "px"; 
    window.document.getElementById("IModifObjet").height= (Retourne_Taille_Y()-25)  + "px"; 
    window.document.getElementById("IModifObjet").style.top = "125px";  
    window.document.getElementById("IModifObjet").style.left = "10px";    
    window.document.getElementById("IModifObjet").style.display = "none";   
   
}




function DeplacementAjouter()
{

    window.document.getElementById("IModifObjet").width= Retourne_Taille_X() * 96/100 + "px"; 
    window.document.getElementById("IModifObjet").height= (Retourne_Taille_Y()-125)  + "px"; 
    window.document.getElementById("IModifObjet").style.top = "125px";  
    window.document.getElementById("IModifObjet").style.left = "10px";    
    window.document.getElementById("IModifObjet").style.display = "none";   
    
}


function ClickMenu(menu) 
{
    for (var wi=1;wi<=6;wi++)
    {
        window.document.getElementById("Menu" + wi).className="";
    }
    window.document.getElementById("Menu" + menu).className="MenuChoisi";

}


function DeplacementDepart()
{
    var wHaut= 85;
  
    window.document.getElementById("Div_Dep").style.top ="125px"; 

    window.document.getElementById("Div_Dep").style.left = "10px"; ;   
    window.document.getElementById("Div_Dep").style.width= Retourne_Taille_X() * 96/100 + "px"; 

    window.document.getElementById("Div_Dep").style.height= (Retourne_Taille_Y()-125)* (wHaut+5)/100  + "px";   
    window.document.getElementById("Div_Dep").style.display = "block";
   
    window.document.getElementById("Div_Fin").style.top = parseInt(window.document.getElementById("Div_Dep").style.height) + 125  + "px"; 
    window.document.getElementById("Div_Fin").style.left = window.document.getElementById("Div_Dep").style.left;    
    window.document.getElementById("Div_Fin").style.width= Retourne_Taille_X() * 96/100 + "px"; 
    
    window.document.getElementById("Div_Fin").style.height= (Retourne_Taille_Y()-125 )* 10 /100  + "px";   
    
    window.document.getElementById("Div_Fin").style.display = "block";

    window.document.getElementById("TSegmentTrad").style.width = Retourne_Taille_X() / 4 - 20 + "px";
    window.document.getElementById("TFamilyTrad").style.width = Retourne_Taille_X() / 4 - 20  + "px";
    window.document.getElementById("TClassTrad").style.width = Retourne_Taille_X() / 4 - 20  + "px";
    window.document.getElementById("TBrickTrad").style.width = Retourne_Taille_X() / 4 - 20  + "px";


    window.document.getElementById("IModifObjet").width= Retourne_Taille_X() * 96/100 + "px"; 
    window.document.getElementById("IModifObjet").height= (Retourne_Taille_Y()-125)  + "px"; 
    window.document.getElementById("IModifObjet").style.top = "125px";  
    window.document.getElementById("IModifObjet").style.left = window.document.getElementById("Div_Dep").style.left;    
    window.document.getElementById("IModifObjet").style.display = "none";       
  
    window.document.getElementById("IModifObjet2").width= Retourne_Taille_X() * 96/100 + "px"; 
    window.document.getElementById("IModifObjet2").height= (Retourne_Taille_Y()-125)  + "px"; 
    window.document.getElementById("IModifObjet2").style.top = "125px";  
    window.document.getElementById("IModifObjet2").style.left = window.document.getElementById("Div_Dep").style.left;        
    window.document.getElementById("IModifObjet2").style.display = "none";         

    window.document.getElementById("IModifObjet3").width= Retourne_Taille_X() * 96/100 + "px"; 
    window.document.getElementById("IModifObjet3").height= (Retourne_Taille_Y()-125)  + "px"; 
    window.document.getElementById("IModifObjet3").style.top = "125px";  
    window.document.getElementById("IModifObjet3").style.left = window.document.getElementById("Div_Dep").style.left;        
    window.document.getElementById("IModifObjet3").style.display = "none";         

    window.document.getElementById("IModifObjet4").width= Retourne_Taille_X() * 96/100 + "px"; 
    window.document.getElementById("IModifObjet4").height= (Retourne_Taille_Y()-125)  + "px"; 
    window.document.getElementById("IModifObjet4").style.top = "125px";  
    window.document.getElementById("IModifObjet4").style.left = window.document.getElementById("Div_Dep").style.left;        
    window.document.getElementById("IModifObjet4").style.display = "none";     

    window.document.getElementById("IModifObjet5").width= Retourne_Taille_X() * 96/100 + "px"; 
    window.document.getElementById("IModifObjet5").height= (Retourne_Taille_Y()-125)  + "px"; 
    window.document.getElementById("IModifObjet5").style.top = "125px";  
    window.document.getElementById("IModifObjet5").style.left = window.document.getElementById("Div_Dep").style.left;        
    window.document.getElementById("IModifObjet5").style.display = "none";    
   
    window.document.getElementById("ISegment").src = "Segment.aspx?" + window.document.getElementById("ctl00_ContentPlaceHolder1_TTrad").value; 
 
    window.document.getElementById("ISegment").style.top ="0px"; 
    window.document.getElementById("ISegment").style.left = "0px";   
    window.document.getElementById("ISegment").width= Retourne_Taille_X() /4 + "px"; 
    window.document.getElementById("ISegment").height= (Retourne_Taille_Y()-125 )* wHaut /100 + "px";   
    window.document.getElementById("ISegment").style.display = "block";

    window.document.getElementById("IFamily").style.top ="0px"; 
    window.document.getElementById("IFamily").style.left = Retourne_Taille_X() * 25.3/100  + "px";   
    window.document.getElementById("IFamily").style.display = "none";     
    window.document.getElementById("IFamily").width= Retourne_Taille_X() /4; 
    window.document.getElementById("IFamily").height= (Retourne_Taille_Y()-125 ) * wHaut/100; 

    window.document.getElementById("IClass").style.top = "0px"; 
    window.document.getElementById("IClass").style.left = Retourne_Taille_X() * 50.6 /100 + "px";      
    window.document.getElementById("IClass").style.display = "none";       
    window.document.getElementById("IClass").width= Retourne_Taille_X() /4 + "px"; 
    window.document.getElementById("IClass").height= (Retourne_Taille_Y()-125) * wHaut / 100 + "px"; 

   
    window.document.getElementById("IBrick").style.top = "0px"; 
    window.document.getElementById("IBrick").style.left = Retourne_Taille_X() * 75.9 /100 + "px";      
    window.document.getElementById("IBrick").style.display = "none";       
    window.document.getElementById("IBrick").width= Retourne_Taille_X() /3 + "px"; 
    window.document.getElementById("IBrick").height= (Retourne_Taille_Y()-125) * wHaut / 200 + "px"; 

    window.document.getElementById("BrickDefinition").style.top = (Retourne_Taille_Y()-125) * wHaut /200 + "px"; 
    window.document.getElementById("BrickDefinition").style.left = Retourne_Taille_X() * 75.9 /100 + "px";      
    window.document.getElementById("BrickDefinition").style.display = "none";       
    window.document.getElementById("BrickDefinition").style.width= Retourne_Taille_X() /3 + "px"; 
    window.document.getElementById("BrickDefinition").style.height= (Retourne_Taille_Y()-125) * wHaut / 200 + "px"; 


    window.document.getElementById("IAttribute").style.top = "0px"; 
    window.document.getElementById("IAttribute").style.left = Retourne_Taille_X() * 109.5/100 + "px";       
    window.document.getElementById("IAttribute").style.display = "none";       
    window.document.getElementById("IAttribute").width= Retourne_Taille_X() /3  + "px"; 
    window.document.getElementById("IAttribute").height= (Retourne_Taille_Y()-125) * wHaut / 100 + "px"; 



    window.document.getElementById("IValue").style.top =  "0px";  
    window.document.getElementById("IValue").style.left = Retourne_Taille_X() * 143.1 /100 + "px";      
    window.document.getElementById("IValue").style.display = "none";       
    window.document.getElementById("IValue").width= Retourne_Taille_X() /4 + "px"; 
    window.document.getElementById("IValue").height= (Retourne_Taille_Y()-125) * wHaut / 100 + "px"; 


      
   var wSegment = ""
   var wFamily = ""
   var wClass = ""
   var wBrick =""
   if (window.document.getElementById("TSegment") != null && window.document.getElementById("TSegment").value !="" ){ wSegment = window.document.getElementById("TSegment").value;}
   if (window.document.getElementById("TFamily") != null  && window.document.getElementById("TFamily").value !="" ){ wFamily = window.document.getElementById("TFamily").value;}
   if (window.document.getElementById("TClass") != null  && window.document.getElementById("TClass").value !="" ){ wClass = window.document.getElementById("TClass").value;}  
   if (window.document.getElementById("TBrick") != null  && window.document.getElementById("TBrick").value !="" ){ wBrick = window.document.getElementById("TBrick").value;}
   
   if (wSegment != "")
   {
       TrouveSegment(wSegment);
   }
   if (wFamily != "")
   {
        TrouveFamily (wSegment, wFamily);
   }
   
   if (wClass != "")
   {
        TrouveClass (wFamily, wClass);
   }   
   if (wBrick != "")
   {
        TrouveBrick (wClass, wBrick);
   }    
   
   if (wSegment == "" && wFamily == "" && wClass== "" && wBrick =="")
   {
       agrandir ("Segment",0);
   }
}




function TrouveSegment(wSegment)
{

    window.document.getElementById("ISegment").src = "Segment.aspx?wSearch=O&SNumero=" + wSegment + "&" + window.parent.document.getElementById("ctl00_ContentPlaceHolder1_TTrad").value;
    window.document.getElementById("ISegment").style.display = "block";    
    window.document.getElementById("IFamily").style.display = "none";
    window.document.getElementById("IClass").style.display = "none";      
    window.document.getElementById("IBrick").style.display = "none";      
    window.document.getElementById("IAttribute").style.display = "none";   
    window.document.getElementById("BrickDefinition").style.display = "none";   
    window.document.getElementById("IValue").style.display = "none";  
    
    agrandir ("Segment",1);   
    
}

function TrouveFamily (wSegment, wFamily)
{
    window.document.getElementById("IFamily").src = "Family.aspx?wSearch=O&SNumero=" + wSegment + "&FNumero=" + wFamily + "&" + window.parent.document.getElementById("ctl00_ContentPlaceHolder1_TTrad").value;
    window.document.getElementById("IFamily").style.display = "block";
    window.document.getElementById("IClass").style.display = "none";      
    window.document.getElementById("IBrick").style.display = "none";      
    window.document.getElementById("IAttribute").style.display = "none";   
    window.document.getElementById("BrickDefinition").style.display = "none";   
    window.document.getElementById("IValue").style.display = "none";   
    agrandir ("Family",1);
}

function TrouveClass (wFamily, wClass)
{
     window.parent.document.getElementById("IClass").src = "Class.aspx?wSearch=O&FNumero=" + wFamily + "&CNumero=" + wClass + "&" + window.parent.document.getElementById("ctl00_ContentPlaceHolder1_TTrad").value;
     window.parent.document.getElementById("IClass").style.display = "block";     
     window.parent.document.getElementById("IBrick").style.display = "none";      
     window.parent.document.getElementById("IAttribute").style.display = "none";      
     window.parent.document.getElementById("BrickDefinition").style.display = "none";     
     window.parent.document.getElementById("IValue").style.display = "none";                
     agrandir ("Class",1);
}

function TrouveBrick (wClass, wBrick)
{
     window.parent.document.getElementById("IBrick").src = "Brick.aspx?wSearch=O&CNumero=" + wClass + "&BNumero=" + wBrick + "&" + window.parent.document.getElementById("ctl00_ContentPlaceHolder1_TTrad").value;
     window.parent.document.getElementById("IBrick").style.display = "block";     
     window.parent.document.getElementById("IAttribute").style.display = "none";      
     window.parent.document.getElementById("BrickDefinition").style.display = "none"; 
     window.parent.document.getElementById("IValue").style.display = "none";                        
     agrandir ("Brick",1);
}


function OuvreFamily (wCode)
{
   // alert(wCode);
   // alert (window.parent.document.getElementById("ISegment").width);
     window.parent.document.getElementById("IFamily").src = "Family.aspx?SNumero=" + wCode + "&" + window.parent.document.getElementById("ctl00_ContentPlaceHolder1_TTrad").value;
     window.parent.document.getElementById("IFamily").style.display = "block";
     window.parent.document.getElementById("IClass").style.display = "none";      
     window.parent.document.getElementById("IBrick").style.display = "none";      
     window.parent.document.getElementById("IAttribute").style.display = "none";   
     window.parent.document.getElementById("BrickDefinition").style.display = "none";   
     window.parent.document.getElementById("IValue").style.display = "none";   
     window.parent.document.getElementById("TFamilyTrad").value = "";
     window.parent.document.getElementById("TClassTrad").value = "";
     window.parent.document.getElementById("TBrickTrad").value = "";
     window.parent.document.getElementById("TAttributeTrad").value = "";     
                
     agrandir ("Family",1);
}

function OuvreClass (wCode)
{
     window.parent.document.getElementById("IClass").src = "Class.aspx?FNumero=" + wCode + "&" + window.parent.document.getElementById("ctl00_ContentPlaceHolder1_TTrad").value;
     window.parent.document.getElementById("IClass").style.display = "block";     
     window.parent.document.getElementById("IBrick").style.display = "none";      
     window.parent.document.getElementById("IAttribute").style.display = "none";      
     window.parent.document.getElementById("BrickDefinition").style.display = "none";     
     window.parent.document.getElementById("IValue").style.display = "none";           
     window.parent.document.getElementById("TClassTrad").value = "";
     window.parent.document.getElementById("TBrickTrad").value = "";
     window.parent.document.getElementById("TAttributeTrad").value = "";     
     
     agrandir ("Class",1);
}

function OuvreBrick (wCode)
{
     window.parent.document.getElementById("IBrick").src = "Brick.aspx?CNumero=" + wCode + "&" + window.parent.document.getElementById("ctl00_ContentPlaceHolder1_TTrad").value;
     window.parent.document.getElementById("IBrick").style.display = "block";     
     window.parent.document.getElementById("IAttribute").style.display = "none";      
     window.parent.document.getElementById("BrickDefinition").style.display = "none"; 
     window.parent.document.getElementById("IValue").style.display = "none";               
     window.parent.document.getElementById("TBrickTrad").value = "";
     window.parent.document.getElementById("TAttributeTrad").value = "";     
         
     agrandir ("Brick",1);
}
function OuvrirFrame(wCode, wURL)
{
     if(document.frames){ 
         var obj1 = window.parent.document.frames[wCode];
         var wURL_Final = obj1.location.href;
     }
     else
     {
        var obj1 = window.parent.document.getElementById(wCode);  
        var wURL_Final = obj1.contentDocument.location.href;        
     }
 
     
     if(document.frames){     
        obj1.location.href = wURL ;
     }
     else 
     {    obj1.contentDocument.location.href = wURL_Final + "?reload=O&" + wURL ;
     }
    window.parent.document.getElementById("IModifObjet").style.display="block";
    window.parent.document.getElementById("IModifObjet").style.visible="visible"; 
                window.document.getElementById("IModifObjet").height= (Retourne_Taille_Y()-0)  + "px"; 
                
/*
alert(window.document.getElementById("IModifObjet").height);                 
alert (document.body.clientHeight);

  alert (document.documentElement.clientHeight);
  */
}

function RetourneParamURL(wURL,wRech)
{

    urlvar = new Array();
    if (wURL != "") 
    {
        if (wURL.indexOf("?",0) != -1)
        {
            wURL = "&" + Right (wURL, wURL.length - wURL.indexOf("?",0)-1);
        }    
        longueur = wURL.length;
        data = wURL.substr(1,longueur);
        donnees = data.split("&");
        
        urlvarnum = new Array();
        for (var i=0; i < donnees.length; i++) 
        {
            position = donnees[i].indexOf("=");
            variable = donnees[i].substr(0,position);
            pos = position + 1;
            valeur = decodeURI(donnees[i].substr(pos,donnees[i].length));
            while (valeur.search(/\+/) != -1)
                valeur = valeur.replace(/\+/," ");
            urlvar[variable] = valeur;
            urlvarnum[i] = valeur;
        }
    }
return urlvar[wRech]
}

function FermeAjout(wCode, wURL)
{
     if(document.frames){ 
         var obj1 = window.parent.document.frames["I" + wCode];
         var wURL_Final = obj1.location.href;
     }
     else
     {
        var obj1 = window.parent.document.getElementById("I" + wCode);  
        var wURL_Final = obj1.contentDocument.location.href;        
     }
  
    if (wURL_Final.indexOf("?",0) != -1)
    {
        wURL_Final = wURL_Final.substring(0,wURL_Final.indexOf("?",0));
    }

     if(document.frames){     
        obj1.location.href = wURL_Final + "?Trad=" + RetourneParamURL(obj1.location.href,"Trad") + "&reload=O&" + wURL ;
     }
     else 
     {    obj1.contentDocument.location.href = wURL_Final + "?Trad=" + RetourneParamURL(obj1.location.href,"Trad") + "&reload=O&" + wURL ;
     }
           
    window.parent.document.getElementById("IModifObjet").style.display="none";
    window.parent.document.getElementById("IModifObjet").style.visible="hidden";
       
    if (window.parent.document.getElementById("IModifObjet2") != null)
    {
        window.parent.document.getElementById("IModifObjet2").style.display="none";
        window.parent.document.getElementById("IModifObjet2").style.visible="hidden";
    }  
    
     if (wCode == "Segment")
     {
        window.parent.document.getElementById("IFamily").style.display="none";
        window.parent.document.getElementById("IClass").style.display="none";        
        window.parent.document.getElementById("IBrick").style.display="none";
        window.parent.document.getElementById("BrickDefinition").style.display="none";
        window.parent.document.getElementById("IAttribute").style.display="none";
        window.parent.document.getElementById("IValue").style.display="none";           
     }
     if (wCode == "Family")
     {
        window.parent.document.getElementById("IClass").style.display="none";        
        window.parent.document.getElementById("IBrick").style.display="none";
        window.parent.document.getElementById("BrickDefinition").style.display="none";
        window.parent.document.getElementById("IAttribute").style.display="none";
        window.parent.document.getElementById("IValue").style.display="none";           
     }
     if (wCode == "Class")
     {     
        window.parent.document.getElementById("IBrick").style.display="none";
        window.parent.document.getElementById("BrickDefinition").style.display="none";
        window.parent.document.getElementById("IAttribute").style.display="none";
        window.parent.document.getElementById("IValue").style.display="none";           
     }
     if (wCode == "Brick")
     {     
        window.parent.document.getElementById("BrickDefinition").style.display="none";
        window.parent.document.getElementById("IAttribute").style.display="none";
        window.parent.document.getElementById("IValue").style.display="none";           
     }
     if (wCode == "Attribute")
     {     
        window.parent.document.getElementById("IValue").style.display="none";           
     }

 // setTimeout ("agrandir(wCode,0)",60);
//  setTimeout ("CacheColonneTab (1)",150);
  
}

function AjoutSegment()
{          
         window.parent.document.getElementById("IModifObjet").src = "Ajouter.aspx?Trad=N&wType=Segment&wValue=" + document.getElementById("Code_Select").value;
         window.parent.document.getElementById("IModifObjet").style.display = "block"; 
               
}
function AjoutFamily(wSegment)
{
         window.parent.document.getElementById("IModifObjet").src = "Ajouter.aspx?Trad=N&wType=Family&wCode=" + wSegment + "&wValue=" + document.getElementById("Code_Select").value;
         window.parent.document.getElementById("IModifObjet").style.display = "block";
}

function AjoutClass(wFamily)
{
         window.parent.document.getElementById("IModifObjet").src = "Ajouter.aspx?Trad=N&wType=Class&wCode=" + wFamily + "&wValue=" + document.getElementById("Code_Select").value;
         window.parent.document.getElementById("IModifObjet").style.display = "block";
}

function AjoutBrick(wClass)
{
         window.parent.document.getElementById("IModifObjet").src = "Ajouter.aspx?Trad=N&wType=Brick&wCode=" + wClass + "&wValue=" + document.getElementById("Code_Select").value;
         window.parent.document.getElementById("IModifObjet").style.display = "block";
}

function AjoutAttribute (wBrick)
{
         window.parent.document.getElementById("IModifObjet").src = "Ajouter.aspx?Trad=N&wType=Attribute&wCode=" + wBrick + "&wValue=" + document.getElementById("Code_Select").value;
         window.parent.document.getElementById("IModifObjet").style.display = "block";
}

function AjoutValue (wAttribute, wBrick )
{
         window.parent.document.getElementById("IModifObjet").src = "Ajouter.aspx?Trad=N&wType=Value&wCode=" + wAttribute + "&wCode2=" + wBrick + "&wValue=" + document.getElementById("Code_Select").value;
         window.parent.document.getElementById("IModifObjet").style.display = "block";
}

function RecupTqueryID(wPhrase)
{
//alert (wPhrase);
    window.document.getElementById("TQueryID").value = window.parent.document.getElementById("ctl00_ContentPlaceHolder2_TQueryID").value;
    if (window.document.getElementById("TQueryID").value =="")
    {
        if (confirm(wPhrase)== false)
        {
       // alert("jo");
            return false;
        }
        
    }
}

function Question(wPhrase)
{
//alert (wPhrase);
   if (confirm(wPhrase)== false)
   {
      return false;
   }        
}

function RecupAttribute()
{
//alert(window.document.getElementById("TRecherche").value);
//    alert (window.document.getElementById("TRecherche").value);
         if( document.frames){ 
             window.document.frames["IAttribute"].window.document.getElementById("TRecherche").value = window.document.getElementById("TRecherche").value;
         window.document.frames["IAttribute"].window.setTimeout('__doPostBack(\'TRecherche\',\'\')', 0);
         }
         else
         {
            window.document.getElementById("IAttribute").contentWindow.document.getElementById("TRecherche").value= window.document.getElementById("TRecherche").value;         
            window.document.getElementById("IAttribute").contentWindow.setTimeout('__doPostBack(\'TRecherche\',\'\')', 0);         
         }    
    
    // = window.parent.document.getElementById("TRecherche").value;
}


function Modif(wName, wCode)
{

    var wValue = document.getElementById("Code_Select").value;
    
    if (wValue !="" && wValue !=0)
    {    
         window.parent.document.getElementById("IModifObjet").style.zIndex = "2000";         
         window.parent.document.getElementById("IModifObjet").style.display = "block";
       //  window.parent.document.getElementById("IModifObjet").style.width=="100";
       //  window.parent.document.getElementById("IModifObjet").style.height="100";
 
         window.parent.document.getElementById("IModifObjet").src = "Modif_Brick.aspx?wCode=" + wCode + "&wType=" +  wName + "&wValue=" + wValue + "&" + window.parent.document.getElementById("ctl00_ContentPlaceHolder1_TTrad").value;
       // alert (window.parent.document.getElementById("IModifObjet").src);
        
        // window.parent.adjustIFrameSize(window);
    }   
}

function Modif2(wName, wValue, wTrad)
{
  
    if (wValue !="" && wValue !=0)
    {    
         window.parent.document.getElementById("IModifObjet").style.zIndex = "8000";         
         window.parent.document.getElementById("IModifObjet").style.display = "block";
       //  window.parent.document.getElementById("IModifObjet").style.width=="100";
       //  window.parent.document.getElementById("IModifObjet").style.height="100";
 
         window.parent.document.getElementById("IModifObjet").src = "Modif_Brick.aspx?Trad=" + wTrad + "& wCode=-1&wNOTMAJ=-1&wType=" +  wName + "&wValue=" + wValue;
       // alert (window.parent.document.getElementById("IModifObjet").src);
        
        // window.parent.adjustIFrameSize(window);
    }   
}

function Modif3(wName, wValue, wTrad)
{
  /*
  alert (wName);
  alert (wValue);
  alert (wTrad);
  */
    if (wValue !="" && wValue !=0)
    {    
        DeplacementAjouter();
         window.document.getElementById("IModifObjet").style.top = "0px";
         window.document.getElementById("IModifObjet").style.left = "0px";
         window.document.getElementById("IModifObjet").style.zIndex = "8000";         
         window.document.getElementById("IModifObjet").style.display = "block";
         window.document.getElementById("IModifObjet").src = "Modif_Brick.aspx?Trad=" + wTrad + "& wCode=-1&wNOTMAJ=-1&wType=" +  wName + "&wValue=" + wValue;
    }   
}

function Suppression_Mod(wObj,wCode)
{
         window.parent.document.getElementById("IModifObjet2").src = "Action.aspx?&Frame=IModifObjet2&wType=Delete&wTable=" + wObj + "&wValue=" + wCode ;
         window.parent.document.getElementById("IModifObjet2").style.display = "block";
}

function SuppressionAttribute_Mod(wObj,wCode,wBrick)
{
         window.parent.document.getElementById("IModifObjet2").src = "Action.aspx?&Frame=IModifObjet2&wType=Delete&wTable=" + wObj + "&wValue=" + wCode + "&wBrick=" + wBrick;
         window.parent.document.getElementById("IModifObjet2").style.display = "block";
}

function SuppressionValue_Mod(wObj,wCode, wBrick, wAttribute)
{
         window.parent.document.getElementById("IModifObjet2").src = "Action.aspx?&Frame=IModifObjet2&wType=Delete&wTable=" + wObj + "&wValue=" + wCode + "&wBrick=" + wBrick   + "&wAttribute=" + wAttribute;
         window.parent.document.getElementById("IModifObjet2").style.display = "block";
}

function Suppression(wObj, wCode)
{
    if (document.getElementById("Code_Select").value !="")
    {
         window.parent.document.getElementById("IModifObjet").src = "Action.aspx?&wCode=" + wCode + "&wType=Delete&wTable="+ wObj + "&wValue=" + document.getElementById("Code_Select").value;
         window.parent.document.getElementById("IModifObjet").style.display = "block";
    }
}

function SuppressionAttribute(wBrick)
{
    if (document.getElementById("Code_Select").value !="")
    {
         window.parent.document.getElementById("IModifObjet").src = "Action.aspx?&wCode=" + wBrick + "&wType=Delete&wTable=Attribute&wValue=" + document.getElementById("Code_Select").value  + "&wBrick=" + wBrick ;
         window.parent.document.getElementById("IModifObjet").style.display = "block";
    }
}
function SuppressionValue(wBrick, wAttribute)
{
    if (document.getElementById("Code_Select").value !="")
    {
         window.parent.document.getElementById("IModifObjet").src = "Action.aspx?&wCode=" + wAttribute + "&wCode2=" + wBrick + "&wType=Delete&wTable=Value&wValue=" + document.getElementById("Code_Select").value  + "&wBrick=" + wBrick   + "&wAttribute=" + wAttribute ;
         window.parent.document.getElementById("IModifObjet").style.display = "block";
    }
}

function bla(a,b)
{
alert("jio");
    var tx='<br>';
    var aa = new Array();
    for(i=0;i<a.options.length;i++)
    {
        aa[i] = a.options[i].text;
        tx = tx + aa[i]+'<br>';
    }
}

function MajFrame(wNom)
{
     if( document.frames){ 
         var obj1 = window.parent.document.frames["I" + wNom];
     }
     else
     {
        var obj1 = window.parent.document.getElementById("I" + wNom);          
     }
     obj1.location.href = obj1.location.href;
     
     if (wNom =="Segment") { MajFrame("Family");}
     if (wNom =="Family") { MajFrame("Class");}
     if (wNom =="Class") { MajFrame("Brick");}
    
}
function MajFrame2(wNom)
{

     if( document.frames){ 
         var obj1 = window.document.frames[wNom];
     }
     else
     {
        var obj1 = window.document.getElementById(wNom);          
     }
   //  alert ( obj1.location.href  );
     obj1.location.href = obj1.location.href;
 //  alert (window.document.getElementById(wNom).style.height);

         window.document.getElementById(wNom).style.height = Retourne_Taille_Y() * 95/100 + "px";
    //     window.document.getElementById(wNom).style.width = Retourne_Taille_X() * 102/100 + "px";
    
}

function AffichArbo(obj, TitleOn, TitleOff, wTrad)
{
    if (window.parent.document.getElementById("IModifObjet3").style.display == "none")
    {    
         obj.title = TitleOff;
         obj.src= obj.src.replace("treeview", "close");         
         if (window.parent.document.getElementById("IModifObjet3").src.substring(0,window.parent.document.getElementById("IModifObjet3").src.indexOf("?",0)) != "Arbo.aspx")
         {               
            window.parent.document.getElementById("IModifObjet3").src = "Arbo.aspx?Trad=" + wTrad;
         }
         window.parent.document.getElementById("IModifObjet3").style.zIndex=window.parent.document.getElementById("IModifObjet4").style.zIndex +10;
         if (window.parent.document.getElementById("IModifObjet3").style.zIndex <= window.parent.document.getElementById("IModifObjet5").style.zIndex )
         {
             window.parent.document.getElementById("IModifObjet3").style.zIndex=window.parent.document.getElementById("IModifObjet5").style.zIndex +10;        
         }
         window.parent.document.getElementById("IModifObjet3").style.display = "block";
    }
    else
    {
        obj.title = TitleOn;
        window.parent.document.getElementById("IModifObjet3").style.zIndex=5000;
        obj.src= obj.src.replace("close", "treeview");
        window.parent.document.getElementById("IModifObjet3").style.display = "none";
    }
}

function AffichTrace(obj, TitleOn, TitleOff, wTrad)
{
    if (window.parent.document.getElementById("IModifObjet4").style.display == "none")
    {    
         obj.title = TitleOff;
         obj.src= obj.src.replace("historique", "close");         
         if (window.parent.document.getElementById("IModifObjet4").src.substring(0,window.parent.document.getElementById("IModifObjet4").src.indexOf("?",0)) != "Info_Trace.aspx")
         {
             window.parent.document.getElementById("IModifObjet4").src = "Info_Trace.aspx?Trad=" + wTrad;         
         }
         window.parent.document.getElementById("IModifObjet4").style.zIndex=window.parent.document.getElementById("IModifObjet3").style.zIndex +10;       
         if (window.parent.document.getElementById("IModifObjet4").style.zIndex <= window.parent.document.getElementById("IModifObjet5").style.zIndex )
         {
             window.parent.document.getElementById("IModifObjet4").style.zIndex=window.parent.document.getElementById("IModifObjet5").style.zIndex +10;        
         }

         window.parent.document.getElementById("IModifObjet4").style.display = "block";
    }
    else
    {
        
        obj.title = TitleOn;
        obj.src= obj.src.replace("close", "historique");
         window.parent.document.getElementById("IModifObjet4").style.zIndex=5000;       
        window.parent.document.getElementById("IModifObjet4").style.display = "none"
    }
}

function AffichRech(obj, TitleOn, TitleOff, wTrad)
{
    if (window.parent.document.getElementById("IModifObjet5").style.display == "none")
    {    
         obj.title = TitleOff;
         obj.src= obj.src.replace("find", "close");         
         if (window.parent.document.getElementById("IModifObjet5").src.substring(0,window.parent.document.getElementById("IModifObjet5").src.indexOf("?",0)) != "Recherche.aspx")
         {
             window.parent.document.getElementById("IModifObjet5").src = "Recherche.aspx?Trad=" + wTrad;                     
         }
         window.parent.document.getElementById("IModifObjet5").style.zIndex=window.parent.document.getElementById("IModifObjet3").style.zIndex +10;
         if (window.parent.document.getElementById("IModifObjet5").style.zIndex <= window.parent.document.getElementById("IModifObjet4").style.zIndex )
         {
             window.parent.document.getElementById("IModifObjet5").style.zIndex=window.parent.document.getElementById("IModifObjet4").style.zIndex +10;        
         }

         window.parent.document.getElementById("IModifObjet5").style.display = "block";
    }
    else
    {
        
        obj.title = TitleOn;
        obj.src= obj.src.replace("close", "find");
         window.parent.document.getElementById("IModifObjet5").style.zIndex=5000;       
        window.parent.document.getElementById("IModifObjet5").style.display = "none"
    }
}
function AffichArboOLD(wBase,obj, TitleOn, TitleOff)
{


    if (window.parent.document.getElementById("IModifObjet").style.display == "none")
    {    
    
   var Lang= document.getElementById('ctl00$ContentPlaceHolder1$RadioButtonLangue').options[ document.getElementById('ctl00$ContentPlaceHolder1$RadioButtonLangue').selectedIndex].value; 

        window.parent.document.getElementById("ImgTreview").style.display = "block";
         window.parent.document.getElementById("IModifObjet").src = "Arbo.aspx?Trad=N&wBase=" + wBase + "&wLang=" + Lang;
         window.parent.document.getElementById("IModifObjet").style.display = "block";
    }
    else
    {
        window.parent.document.getElementById("IModifObjet").style.display = "none"
        window.parent.document.getElementById("ImgTreview").style.display = "none";        
    }
}

function AffichArboPublication(wBase,obj, TitleOn, TitleOff, Langue)
{

       var Lang= Langue; 

         window.document.getElementById("IModifObjet").src = "Arbo.aspx?Trad=N&wBase=" + wBase + "&wLang=" + Lang;
         window.document.getElementById("IModifObjet").style.display = "block";
    
}
function ModifFamily(wCode)
{
     window.parent.document.getElementById("IModifObjet").src = "Modif_Family.aspx?FNumero=" + wCode;

     window.parent.document.getElementById("IModifObjet").style.display = "block";

}

function OuvreAttribute (wCode)
{
     window.parent.document.getElementById("IAttribute").src = "Attribute.aspx?BNumero=" + wCode + "&" + window.parent.document.getElementById("ctl00_ContentPlaceHolder1_TTrad").value;
     window.parent.document.getElementById("IAttribute").style.display = "block"; 
     window.parent.document.getElementById("IValue").style.display = "none";          
 
     agrandir ("Attribute",1);
}

function AffichDivControl()
{
    if (window.document.getElementById('DivControl').style.display=="block")
    {
        window.document.getElementById('DivControl').style.display="none";    
    }
    else
    {
        window.document.getElementById('DivControl').style.display="block";    
    }
}

function FermeMaj(wNom)
{
 if (document.frames)
 { 
     var obj1 = window.parent.document.frames["I" + wNom];
 }
 else
 {
    var obj1 = window.parent.document.getElementById("I" + wNom);          
 }

    obj1.location.href = document.getElementById("Code_Select").value;    
    window.parent.document.getElementById("BrickDefinition").style.display = "none";     
    window.parent.document.getElementById("IModifObjet").style.display="none";
    
}
function OuvreDefinition (wCode)
{
    window.parent.document.getElementById('BrickDefinition').innerHTML = document.getElementById(wCode).value;
    window.parent.document.getElementById("BrickDefinition").style.display = "block"; 
    window.parent.document.getElementById("IValue").style.display = "none";    
     
}

function OuvreValue (wAttribute, wBrick, wTrad)
{

    window.parent.document.getElementById("IValue").src = "Value.aspx?Trad=" + wTrad + "&ANumero=" + wAttribute + "&BNumero=" + wBrick ;
    window.parent.document.getElementById("IValue").style.display = "block";     
 //   agrandir ("Attribute",1);
    agrandir ("Attribute",2);
    
}

function OuvreValue2 (wAttribute, wCode, wType, wTrad)
{

    window.parent.document.getElementById("IValue").src = "Value.aspx?Trad=" + wTrad + "&Mod=O&wChg=N&ANumero=" + wAttribute + "&" + wType + "Numero=" + wCode;
    window.parent.document.getElementById("IValue").style.display = "block";     

}

function TestZoneUpdate(Alert1)
{

    if (window.document.getElementById("TTitle").value =="")
    {
        alert(Alert1);
        return false;
        
    }
    return true;

}

function AffichWait(wi)
{
    if (wi == 1)
    {
        window.document.getElementById("ImageWait").style.display = "block";     
    }
    else
    {
        window.document.getElementById("ImageWait").style.display = "none";     
    }
}



/*

function Survol(Obj,Div_Text)
{

    var wLong=parseInt(document.getElementById("TD" + Div_Text).width) * screen.availWidth;

    //sinon soucie

     if (document.getElementById("T" + Div_Text).Text  == undefined) 
    {
        Obj.style.width= wLong /104;

    }

    if (document.getElementById("T" + Div_Text).Text !="OUI")
    {    
        document.getElementById("D" + Div_Text).style.position ="absolute";
         document.getElementById("D" + Div_Text).style.top ="40px";
         Obj.style.width= wLong /101 *2;
         document.getElementById("T" + Div_Text).Text ="OUI";
         //Obj.style.width="auto";
    }
        
}

function Survol_No(Obj,Div_Text)
{

    if (document.getElementById("T"+ Div_Text).Text =="OUI")
    {   
    //alert ("jo");
        var wLong=parseInt(document.getElementById("TD" + Div_Text).width) * screen.availWidth /104;
   Obj.style.width= wLong;
//        Obj.style.width= document.getElementById("T" + Div_Text).value;
      //  document.getElementById(Div_Text).style.position ="relative";
    

    document.getElementById("T" + Div_Text ).Text="NON";
    }
}
*/


function TestUnspsc (wMessage1)
{
var wRep=true;

if (document.getElementById("TCode").value != "" || document.getElementById("TTitle").value != "" || document.getElementById("TDefinition").value != "" || document.getElementById("DSegment").value != "")
{
    if (document.getElementById("CSegment").checked==false && document.getElementById("CFamily").checked==false && document.getElementById("CClass").checked==false && document.getElementById("CBrick").checked==false && document.getElementById("CAttribute").checked==false && document.getElementById("CValue").checked==false)
    {
            alert(wMessage1);
            return false;
    }
}

if (document.getElementById("TCode2").value != "" || document.getElementById("TTitle2").value != "" || document.getElementById("TDefinition2").value != "" || document.getElementById("DSegment2").value != "")
{
    if (document.getElementById("CSegment2").checked==false && document.getElementById("CFamily2").checked==false && document.getElementById("CClass2").checked==false && document.getElementById("CBrick2").checked==false)
    {
            alert(wMessage1);
            return false;
    }
}


return true;


}



    function func_KeyDown(event)
    {
        TouchKeyDown = (window.Event) ? event.which : event.keyCode;
    //    alert(TouchKeyDown);
        switch(TouchKeyDown)
        {
            case 13:           
                return false;                    
                    
                break;
        }
        return true;

    }
    