
function printClient (id,name,type) {

	var noCheck = 'no';
	var reURL = document.location.href;

	if (reURL.indexOf("noCheck") > 0)
		noCheck = "yes";
	
	if (reURL.indexOf("?") > 0) {
		reURL = document.location.href + '&noCheck=yes';
	}
	else {
		reURL = document.location.href + '?noCheck=yes';
	}

	document.write('<div id="ALclient" align="center"><table border="0" cellpadding="0" cellspacing="1"  bgcolor="#000000"><tr><td><table cellspacing="0" cellpadding="5"><tr><td bgcolor="#FFFFFF"><font face="Arial"><b>Loading Anti-Leech Download client...</b></font></td></tr><tr><td bgcolor="#FFFFFF"><p align="center"><b><font face="Arial" size="2" color="#000000"><a href="javascript:document.location.href = \''+reURL+'\'"><font color="#000000">Click here to start download</font></a></font></b><br><font face="Arial" size="2" color="#000000"><i>(please <a href="http://forums.anti-leech.com"><font color="#000000">report here</font></a> if nothing happens)</i></font></td></tr></table></td></tr></table></div>');

	var domain = escape(document.location.href);
	var referrer = escape(document.referrer);
	//document.write('Domain: ' + domain + '<br>');
	//document.write('Id: ' + id + '<br>');
	//document.write('Name: ' + name + '<br>');
	//document.write('Type: ' + type + '<br>');
	
	if (noCheck == "no") {

		// Detect browser
		var browser = whatBrowser();
		//document.write('Browser: ' + browser + '<br>');
	
		// Detect plugin	
		switch (whatBrowser()) {
			// IE - try for Plugin
			case 3:
				var plugin;
				plugin = tryPlugin('ie');
				//document.writeln('Plugin status: ' + plugin + '<br>');
				break;
			// Firefox, Opera, Netscape - try for Plugin
			case 4:
			case 5:
			case 6:
				var plugin;
				plugin = tryPlugin('nn');
				//document.writeln('Plugin status: ' + plugin + '<br>');
				break;
		}
		
		// Detect NetPumper
		var np;
		if (checkplugin() == 'i')
			np = 'yes';
		else
			np = 'no';
		//document.write('NetPumper status: ' + np + '<br>');
	
		// Detect java applet
		var java;
		var javaStatus;
		javaStatus = checkDefaultJVM();
		if (javaStatus == 'sun')
			java = 'yes';
		else
			java = 'no';
	
		//document.write('Java status: ' + java);
		//if (java == 'yes')
			//document.write(' (' + javaStatus + ')' + '<br><br>');
	}
	// Load Anti-Leech.com through iFrame (now with pop option)
	document.getElementById("ALclient").innerHTML='<iframe name=\"antileech\" src=\"http://download.anti-leech.com/showdl.php?d='+ domain +'&id='+ id +'&n='+ name +'&t='+ type +'&b='+ browser +'&p='+ plugin +'&np='+ np +'&r='+ referrer +'&j='+ java +'&jt='+ javaStatus +'&dyn=431527674'+'\" border=\"0\" frameborder=\"0\" scrolling=\"no\" width=\"554\" height=\"397\">Your browser does not support inline frames or is currently configured not to display inline frames, therefor you must load the download page in a pop up. <a href=javascript:ny_sida_auto(\"http://download.anti-leech.com/showdl.php?d='+ domain +'&id='+ id +'&n='+ name +'&t='+ type +'&b='+ browser +'&p='+ plugin +'&np='+ np +'&r='+ referrer +'&j='+ java +'&jt='+ javaStatus +'&dyn=431527674'+'\",\"554\",\"397\")>Click here to do so</a>.</iframe>';

}

BROWSER_NOWIN32=0;
BROWSER_UNSUP=1;
BROWSER_LOWER_VERSION=2;
BROWSER_IE=3;
BROWSER_NN=4;
BROWSER_OGCK=5;
BROWSER_OPERA=6;

function whatBrowser() {
	if (navigator.platform.toLowerCase() != 'win32') return BROWSER_NOWIN32;
	var appVersion = navigator.appVersion;
	var xmsie = appVersion.indexOf('MSIE');
	if (xmsie >= 0) {
	   if (appVersion.substring(xmsie+5,xmsie+8) < 5.0) return BROWSER_LOWER_VERSION;
	   else return BROWSER_IE;
	}
	if (navigator.appName == 'Netscape') {
	   if (appVersion.substring(0,3) < 4.0) return BROWSER_LOWER_VERSION;
	   else return BROWSER_NN;
	}
	if (navigator.appName == 'Opera') {
	   return BROWSER_OPERA;
	}
	if (appVersion.indexOf('Gecko') >= 0) {
	   return BROWSER_OGCK;
	}
	return BROWSER_UNSUP;
}

function tryPlugin(type) {
	if (type == "ie") {
		  var o = null;
		  eval('try { o = new ActiveXObject("AntiLeech.ALIE") } catch (Exception) {};');
		  if (o)
			return 'yes';
		  else
		  	return 'no';
	}
	else if (type == "nn") {
		p = navigator.plugins["Anti-Leech Plug-in"];

		if (p)
			return 'yes';
		else
			return 'no';
	}
	
}

function checkplugin() {
  if (netie(6,-1)) return "n";

  if (netie(-1,5)) 
      return IE5_checkplugin('NetPumperNNProxy.NetscapeInterface')? 'i' : 'n';
  /* Unsafe:
  if (netie(-1,4)) 
      return IE4_checkplugin('NetPumperNNProxy.NetscapeInterface')? 'i' : 'n';
  */
  if (netie(4,-1)) 
     return NN_checkplugin('application/x-netpumper-detector')? 'i' : 'n';
  return '';
}

function netie(net, ie) {
var appVersion = navigator.appVersion;
var xmsie = appVersion.indexOf('MSIE');
//document.writeln('AV:'+appVersion+' x:'+xmsie);
if (xmsie >= 0) appVersion = appVersion.substring(xmsie+5,xmsie+8);
else appVersion = appVersion.substring(0,3);
//document.writeln('AV2:'+appVersion);
if ((appVersion >= net && navigator.appName == 'Netscape' && net != -1) || 
    (appVersion >= ie && navigator.appName.substring(0,9) == 'Microsoft' && ie != -1)) 
    return true; 
else return false; 
}

function NN_checkplugin(mimet) {
  //document.writeln('NN_checkplugin('+mimet+')<BR>');
  var m = navigator.mimeTypes[mimet];
  //document.writeln(m.type);
  if (!m) return false;
  return true;
}

function IE4_checkplugin(servername) {
  //document.writeln('IE4_checkplugin('+servername+')<BR>');
  var o = null;
  eval ('o = new ActiveXObject(servername);');
  if (!o) return false;
  //document.writeln('Found:'+servername+'<BR>');
  return true;
}

function IE5_checkplugin(servername) {
  //document.writeln('IE5_checkplugin('+servername+')<BR>');
  var o = null;
  eval('try { o = new ActiveXObject(servername) } catch (Exception) {};');
  if (!o) return false;
  //document.writeln('Found:'+servername+'<BR>');
  return true;
}

function checkDefaultJVM(){  
	//if((!navigator.javaEnabled()) || (!isJavaPluginInstalled() && !isMSVMInstalled())){
	if((!navigator.javaEnabled()) || (!isJavaPluginInstalled())){
		return 'no';
	}
	//else if(!isIE && isJavaPluginInstalled()){
		//return 'sun';
	//}
	else{
		//if(document.appletDetector.getJavaVendor().indexOf("Microsoft")!=-1){
		//	return 'ms';
		//}
		//else{    
			return 'sun';
		//}
	}
}

//if(navigator.javaEnabled()){
	//document.write('<applet code="AppletDetector.class"  codebase="http://www.anti-leech.com/" name="appletDetector"  width="1"  height="1"></applet>');
//}
var agt=navigator.userAgent.toLowerCase();
var isIE = (agt.indexOf("msie") != -1);

// check if the sun jvm is installed.
function isJavaPluginInstalled(){
	if(isIE){
		try {
    		// Create Sun Java plugin ActiveX object
    		var pluginObject = new ActiveXObject("JavaPlugin");
  		} // they cannot be created
  		catch(e)  {
  			return false;
  		}
		if(pluginObject)
  			return true;
	}
	else{
		for (var i = 0; i < navigator.plugins.length; i++) {
  			if (navigator.plugins[i].name.indexOf("Java") > -1) 
  				return true;
 		} 
		return false;	
	}
}// function end.


// check if the Microsoft VM is installed
function isMSVMInstalled(){
if(!isIE)
	return false;
if ( (sMSvmVersion = oClientCaps.getComponentVersion("{08B0E5C0-4FCB-11CF-AAA5-00401C608500}", "ComponentID") ) )
	//Microsoft VM is present.
	return true;
else	//Microsoft VM is not present.
	return false;
}// function end

function ny_sida_auto(url,width,height)
{
egenskaper="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes";
egenskaper+=",width="+width;
egenskaper+=",height="+height;
egenskaper+=",top=150,left=200";
unik='antileech';
window.open(url,unik,egenskaper);
}
