if(window && window.addEventListener)
{
	window.addEventListener("load", init, false);
}
else if(window && window.attachEvent)
{
	window.attachEvent("onload", init);
}
	
function findJoost() 
{
 //searchOverwrite
	try
	{
		if((typeof(joostinstalled) != "undefined") && (joostinstalled != null))
 		{
 			return joostinstalled;
 		}
	} 
	catch(e){}
	//end of searchOverwrite

 var joostFound = false;
 //if browser = IE 
 try 
 {
   var plug = new ActiveXObject("JOOSTPLUGIN.JoostPluginCtrl.1");
   joostFound = true; 
 }catch(e){}
 	
 //if browser is any other 
 try
 {
   if(navigator.mimeTypes["application/x-joost-spoon"].enabledPlugin != null)  
   { 
     joostFound = true;
   }
 } catch(e) {}
 return joostFound;
}

function JoostPlay(publicid)
{
	if(findJoost())
	{
		var callFrame = document.createElement("iframe");
		document.body.appendChild(callFrame);
		callFrame.frameborder = "no";
		callFrame.scrolling = "no";
		callFrame.width = "0";
		callFrame.height = "0";
		callFrame.src = "joost://" + publicid + "/";
		//window.open("joost://"+publicid+"/");
	}
	else
	{
		window.open("/download/");
	}
	return true;
}