var YIH_CLSID = "30528230-99F7-4BB4-88D8-FA1D4F56A2AB";	 
var YIH_PROGID = "YInstHelper.YInstStarter";

function isMac()
{
	return (navigator.platform == "MacPPC");
}

function isIE()
{
	return (navigator.appName == "Microsoft Internet Explorer");
}

function isWinXP()
{
	return (navigator.userAgent.indexOf("Windows NT 5") > -1);
}

function isVista()
{
	return (navigator.userAgent.indexOf("Windows NT 6.0") > -1);
}

function isWin95()
{
	return (navigator.userAgent.indexOf("Windows 95") > -1);
}

function isNT()
{
	return (navigator.userAgent.indexOf("NT 4.0") > -1 || navigator.userAgent.indexOf("NT;") > -1 || navigator.userAgent.indexOf("NT)") > -1)
}

function isIE4()
{
	return (navigator.userAgent.indexOf("MSIE 4.0") > -1);
}

function isIE50()
{
	return (navigator.userAgent.indexOf("MSIE 5.0") > -1);
}

function isIE55()
{
	return (navigator.userAgent.indexOf("MSIE 5.5") > -1);
}

function isIE6()
{
	return (navigator.userAgent.indexOf("MSIE 6.0") > -1);
}

function isIE7()
{
	return (navigator.userAgent.indexOf("MSIE 7.0") > -1);
}

function insertControl()
{
	if(isMac() || !isIE() || isIE4() || isWin95() || isNT() || isIE50() || isIE55() )
		return;	
	
	if(!isVista() && !isWinXP())
		return;
	
	var tag = "<span id=\"TTL1\" name=\"TTL1\"><h1>"+ DOWNTTL + "</h1></span>" +
	"<object tabindex=\"1\" id=\"YInstStarter\" name=\"YInstStarter\" width=\"290\" height=\"75\" classid=\"CLSID:"+ YIH_CLSID +"\" codebase=\"http://download.yahoo.com/dl/yinst/yinst_current.cab#version=2006,4,14,2\" onError=\"controlError();\" style=\"visibility:hidden\">" +
	" <param name=\"StartOnLoad\" value=\"0\"> " +
	" <param name=\"ProgBarRGB\" value=\"21,124,219\"> " +
	" <param name=\"AppId\" value=\"" + APPID + "\"> " +
	" <param name=\"LocId\" value=\"" + LOCID + "\"> " +
	" <param name=\"Test\" value=\"888\"> " +			
	" <param name=\"Ind\" value=\""+ INDVAL +"\"> " +
	"</object>";
	
	downloadObj.innerHTML = tag;
	
	if(IsSV1())
		setTimeout("SP2Control();", 500);	
	else if(isIE7())
		setTimeout("SP2Control();", 500);	
	else
		setTimeout("initControl();", 500);	
	
}

function DisplayMainMsg()
{
	if(!isMac() && !isIE())
	{
		insertNoSupportDLLinkMsg();
	}
	else if(isMac())
	{
		insertMacMsg();
	}
	else if(!isWinXP() && !isVista())
	{
		insertWin95Msg();
	}
	else if(isIE4())
	{
		insertIE4Msg();
	}	
}

function insertNoSupportDLLinkMsg()
{
	document.write("<p>Automatic download is not supported by your browser.<br>");
	document.write("Please ensure that you meet the minimum system requirements.<br>");
	document.write("<ul><li>Internet Explorer 6.0</li>");
	document.write("<li>Windows 2000, XP, or Vista required</li>");	
	document.write("<li>64 MB RAM</li>");
	document.write("<li>256 Color adapter with 800 x 600 resolution</li>");
	document.write("<li>75 MB Available Hard drive space</li></ul></p>");	
	document.write("<p><ul style=\"list-style-type:decimal;list-style-image:none;padding-left:5px\">");

	document.write("<li><a href=\"" + MANURL + "\">Click here to download the software</a>.</li>");

	document.write("<li>Choose \"Open this file from its current location\".</li>");
	document.write("<li>When installation completes you may close this window.</li>");
	document.write("</ul></p>");	
}

function insertMacMsg()
{
	document.write("<p>We've detected that you're using a Mac. Sorry there's no download currently available.");
}

function insertWin95Msg()
{
	document.write("<p>Sorry AT&T Yahoo! requires Windows 2000, XP, or Vista.");
}

function insertWinNTMsg()
{
	document.write("<p>We've detected that you're using a computer with Windows NT. Sorry the software requires Windows 2000, XP, or Vista.");
}

function insertIE4Msg()
{
	document.write("<p>We've detected that you're using a computer with Internet Explorer 4.0. Sorry the software requires a minimum of Internet Explorer 6.0.");
}

function insertIE5Msg()
{
	document.write("<p>We've detected that you're using a computer with Internet Explorer 5.0. Sorry the software requires a minimum of Internet Explorer 6.0.");
}

function insertIE55Msg()
{
	document.write("<p>We've detected that you're using a computer with Internet Explorer 5.5. Sorry the software requires a minimum of Internet Explorer 6.0.");
}

function controlError()
{		
	if(IsSV1() || isVista())
		downloadSP2.style.display = "inline";	
	else
	{
		downloadObj.style.display = "none";
		downloadMnl.style.display = "inline";	
	}	
}


function initControl()
{
	var ok = true;
	try
	{	
		if (isControlHappy(YIH_CLSID))
		{			
			setTimeout("startDL();", 500);	
		}
		else
		{
			ok = false;
		}		
	}		
	catch(e) 
	{
		ok = false;
	}
	
	if(!ok)
	{
		setTimeout("initControl()", 500);
	}
}
function SP2Control()
{
	
	var ok = true;
	try
	{				
		var yinst = document.all("YInstStarter");
		yinst.style.visibility = "visible";
		
		document.all("YInstStarter").focus();

		yinst.attachEvent ("OnProgramBegin" , YInstStarter_OnProgramBegin );
  		yinst.attachEvent ("OnInstallFailure" , YInstStarter_OnInstallFailure );	
  		yinst.attachEvent ("OnInstallLaunched" , YInstStarter_OnInstallLaunched );
				
		if(getParam(".s") != "")  
		{			
			yinst.Start2("/WMH=$(YIH_WHD) /WMM=$(YIH_PROGMSG_E) /S /PCA=YES /U=" + getParam(".u"));  
		}
		else
			yinst.Start2("/WMH=$(YIH_WHD) /WMM=$(YIH_PROGMSG_E) /S /U=" + getParam(".u"));  
		
		
		downloadSP2.style.display = "none";	
		
	}		
	catch(e) 
	{
		ok = false;
	}
	
	if(!ok)
	{
		setTimeout("SP2Control()", 1000);
	}
}

function startDL()
{
	if (isControlPresent())			
	{
		var yinst = document.all("YInstStarter");
		yinst.style.visibility = "visible";
		 
		downloadMnl.style.display = "none";

		document.all("YInstStarter").focus();

		yinst.attachEvent ("OnProgramBegin" , YInstStarter_OnProgramBegin );
  		yinst.attachEvent ("OnInstallLaunched" , YInstStarter_OnInstallLaunched );
		yinst.attachEvent ("OnInstallFailure" , YInstStarter_OnInstallFailure );	
		
		if(getParam(".s") != "")  
		{			
			yinst.Start2("/WMH=$(YIH_WHD) /WMM=$(YIH_PROGMSG_E) /S /PCA=YES /U=" + getParam(".u"));  
		}
		else
			yinst.Start2("/WMH=$(YIH_WHD) /WMM=$(YIH_PROGMSG_E) /S /U=" + getParam(".u"));  
		
		
	}
	else
	{
	    controlError();
	}
}

var g_fIsSP2 = (window.navigator.userAgent.indexOf("SV1") != -1);

function IsSV1() { return g_fIsSP2; }

function IsControlInstalled(progID, classID)
{
	if (classID == null || IsSV1() || isVista())
	{
		if (progID == null)
			return false;
			
		try
		{	
			var obj = new ActiveXObject(progID);
			return true;
		}
		catch(e) {}
		
		return false;
	}
	else
	{
		if (window.document.all.ClientCaps == null ||
			typeof window.document.all.ClientCaps.isComponentInstalled == "undefined")
		{
			OnClientCapsError();
			return false;
		}

		return window.document.all.ClientCaps.isComponentInstalled("{" + classID + "}", "componentid");	
	}
}
function GetInstalledVersion(progID, classID)
{
	var vp = GetClientCapsVersion(classID);
	if (vp != null)
		return vp;
		
	if (progID == null)
		return null;
		
	try
	{	
		var obj = new ActiveXObject(progID);
		if (typeof obj.Version != "undefined")
		{
			var vp = obj.Version;
			if (vp.length > 0)
			{
				var i = vp.indexOf("File=");
				if (i > 0)
					vp = vp.substring(i+5);
				return vp.replace(/\./g, ",");
			}
		}
	}
	catch(e) {}

	return null;
}
function GetInstalledComponentVersion(progID, classID)
{
	var vp = GetClientCapsVersion(classID);
	if (vp != null)
		return vp;
		
	if (progID == null)
		return null;

	try
	{	
		var obj = new ActiveXObject(progID);
		if (typeof obj.ComponentVersion != "undefined")
		{
			var vp = obj.ComponentVersion;
			if (vp.length > 0)
				return vp;
		}
	}
	catch(e) {}

	return null;		
}

function GetInstalledSbVersion(progID, classID)
{
	var vp = GetClientCapsVersion(classID);
	if (vp != null)
		return vp;
		
	if (progID == null)
		return null;

	try
	{	
		var obj = new ActiveXObject(progID);
		if (typeof obj.sbVersion != "undefined")
		{
			var vp = obj.sbVersion;
			if (vp.length > 0)
			{
				var i = vp.indexOf("File=");
				if (i > 0)
					vp = vp.substring(i+5);
				return vp.replace(/\./g, ",");
			}
		}
	}
	catch(e) {}

	return null;		
}
function GetClientCapsVersion(clsid)
{
	if (clsid == null || IsSV1() || isVista())
		return null;
		
	if (window.document.all.ClientCaps == null ||
		typeof window.document.all.ClientCaps.getComponentVersion == "undefined")
	{
		OnClientCapsError();
		return null;
	}
		
	return window.document.all.ClientCaps.getComponentVersion("{" + clsid + "}","componentid");
}
function OnClientCapsError()
{
	alert("<MSIE:CLIENTCAPS ID=\"ClientCaps\" STYLE=\"behavior:url('#default#clientCaps')\" /> must be on the page for ClientCaps to work.");
}
function IsVersionOK(installedVersion, expectedVersion)
{
	if (installedVersion == null || expectedVersion == null)
		return false;
		
	return _versionAtLeast(installedVersion, expectedVersion, ",");
}
function _versionAtLeast(vs,rs,d)
{
	if(!d)
		d=".";
	var v=vs.split(d);
	var r=rs.split(d);
	if(v.length!=4||r.length!=4)
		return false;
	var x,y;
	for(var i=0;i<4;++i)
	{
		x=parseInt(v[i]);
		y=parseInt(r[i]);
		if(x<y)
			return false;
		if(x>y)
			return true;
	}
	return true;
}

 

function isControlHappy(classID)
{
	var vString = GetInstalledComponentVersion(YIH_PROGID,YIH_CLSID);

	if (vString == null)
		return false;
	
	if (isVista())		
		var cString = "2007,2,6,1";
	else if (IsSV1())
		var cString = "2006,4,14,2";
	else
	{
		var cString = "2006,4,14,2";	
	
		if (vString == "2006,4,14,2")
			return true;
	}
	
	if(_versionAtLeast(vString,cString,","))
		return true;
	
	return false;	
}

function isControlPresent()
{
	return("undefined" != typeof(document.all("YInstStarter")) && null != document.all("YInstStarter").object);
}

 
 
 
function YInstStarter_OnProgramBegin()
{	
	document.all("YInstStarter").style.height = "1";
	document.all("YInstStarter").style.width = "1";	
	document.all("TTL1").style.display = "none";
	downloadMnl.style.display = "none";
	finishTXT.style.display = "none";
	installTXT.style.display = "inline";	
}

function YInstStarter_OnInstallLaunched()
{
	
	document.all("YInstStarter").style.height = "1";
	document.all("YInstStarter").style.width = "1";
	downloadMnl.style.display = "none";
	 
	installTXT.style.display = "none";
	finishTXT.style.display = "none";
	moveToFinish();
	 
}

function YInstStarter_OnInstallFailure()
{
	controlError();
}

function moveToFinish()
{
	
	document.location.href = "finish.html";
	
}

function getParam(sParam) {
	var q=document.location.search;
	
	if(q.charAt(0)=='?')
	{
		q=q.substr(1,q.length-1);
	}
	
	var p=q.split("&");
	for(var i=0;i < p.length;++i)
	{
		if(!p[i].indexOf(sParam))
			return p[i].substr(sParam.length+("=".length),p[i].length-(sParam.length+("=".length)));
	}
	return "";
}

function FillAuto()
{
	//runSlideShow();
	insertControl();	
}

function FillSoft()
{
	mainDwn.style.display = "none";
	softDwn.style.display = "inline";
}

function CloseSoft()
{
	if(isIE50())
	{		
		softDwn.style.display = "none";
		mainDwn.style.display = "inline";
		mainDwn.style.visibility = "visible";
		downloadMnl.style.display = "inline";
		//runSlideShow();
		insertControl();		
	}
	else
	{
		softDwn.style.display = "none";
		mainDwn.style.visibility = "visible";
		mainDwn.style.display = "inline";
		//runSlideShow();
		insertControl();		
	}
	
	
}





 
 
 

 
 
 

 
var SlideShowSpeed = 3333;
	
 
var CrossFadeDuration = .08;
	
var Picture = new Array();  
	
//Picture[1]  = 'http://us.i1.yimg.com/us.yimg.com/i/us/plus/pr/dlk_bt_mail_2.jpg';
//Picture[2]  = 'http://us.i1.yimg.com/us.yimg.com/i/us/plus/pr/dlk_bt_virus_1.jpg';
//Picture[3]  = 'http://us.i1.yimg.com/us.yimg.com/i/us/plus/pr/dlk_bt_browser_1.jpg';
//Picture[4]  = 'http://us.i1.yimg.com/us.yimg.com/i/us/plus/pr/dlk_bt_popup_1.jpg';
//Picture[5]  = 'http://us.i1.yimg.com/us.yimg.com/i/us/plus/pr/dlk_bt_ypc_1.jpg';
 
	
var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;
	
var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}
	
function runSlideShow(){
if (document.all){
	document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
	document.images.PictureBox.filters.blendTrans.Apply();}
	document.images.PictureBox.src = preLoad[jss].src;
	if (document.all) document.images.PictureBox.filters.blendTrans.Play();
	jss++;
	if (jss > (pss)) jss=1;
	tss = setTimeout('runSlideShow()', SlideShowSpeed);
}
	
	
