var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

// Global JS
function MM_preloadImages() { //v3.0
  var d=document;
  
  if(d.images) { 
  
  	if(!d.MM_p) d.MM_p=new Array();
	
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
	
		for(i=0; i<a.length; i++) {
			
			if (a[i].indexOf("#")!=0){ 
			
				d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
			}
		}	
  	}
}

	function PopUp(url, name, width,height,center,resize,scroll,posleft,postop) {
	
		if (posleft != 0) { X = posleft }
		if (postop  != 0) { Y = postop  }
	
		if (!scroll) { scroll = 1 }
		if (!resize) { resize = 'no' }
	
		if ((parseInt (navigator.appVersion) >= 4 ) && (center)) {
		  X = (screen.width  - width ) / 2;
		  Y = (screen.height - height) / 2;
		}
		if (scroll != 0) { scroll = 1 }
	
		var Win = window.open( url, name, 'width='+width+',height='+height+',top='+Y+',left='+X+',resizable='+resize+',scrollbars='+scroll+',location=0,directories=0,status=none,menuBar=0,toolbar=0,copyhistory=0');
		
		if( Win ) {
			Win.focus();
		}
		else {
			alert("Desactivate your anti-popup system !");
			return;
		}
	}
		
function decode_img(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = keyStr.indexOf(input.charAt(i++));
      enc2 = keyStr.indexOf(input.charAt(i++));
      enc3 = keyStr.indexOf(input.charAt(i++));
      enc4 = keyStr.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);

      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }
   } while (i < input.length);

   return output;
}
