	// JavaScript Document
function XMLRequest(m_width,m_height) {
		var myPic = new Image;
		myPic.onerror = function(){ writeHfPlayer("http://s3.amazonaws.com/vtt-bp",m_width,m_height)};
		myPic.onload = function(){  writeHfPlayer_h("http://www.happyfish.ro",m_width,m_height)};
		myPic.src = "http://www.happyfish.ro/gri.gif";

}

function XMLRequestFix(m_width,m_height,m_cod) {
	var myPic = new Image;
	myPic.onerror = function(){ writeHfPlayerFix("http://s3.amazonaws.com/vtt-bp",m_width,m_height,m_cod)};
	myPic.onload = function(){  writeHfPlayer_hFix("http://www.happyfish.ro",m_width,m_height,m_cod)};
	myPic.src = "http://www.happyfish.ro/gri.gif";

}

function XMLRequestEmbed(m_width,m_height,ide) {
	var myPic = new Image;
	myPic.onerror = function(){ writeHfPlayerEmbed("http://s3.amazonaws.com/vtt-bp",m_width,m_height,ide)};
	myPic.onload = function(){  writeHfPlayer_hEmbed("http://embed.happyfish.ro",m_width,m_height,ide)};
	myPic.src = "http://embed.happyfish.ro/gri.gif";

}

function writeHfPlayer(where_to,m_width,m_height)
{
	writeItDown(where_to,m_width,m_height,'amz','http://s3.amazonaws.com/vtplayer');
}

function writeHfPlayerFix(where_to,m_width,m_height,m_cod)
{
	writeItDown(where_to,m_width,m_height,'amz','http://s3.amazonaws.com/vtplayer',m_cod);
}


function writeHfPlayer_h(where_to,m_width,m_height)
{
	writeItDown(where_to,m_width,m_height,'hf','http://www.happyfish.ro/');
}

function writeHfPlayer_hFix(where_to,m_width,m_height,m_cod)
{
	writeItDownFix(where_to,m_width,m_height,'hf','http://www.happyfish.ro/',m_cod);
}

//for embed

function writeHfPlayerEmbed(where_to,m_width,m_height,ide)
{
	writeItDownEmbed(where_to,m_width,m_height,'amz','http://s3.amazonaws.com/vtplayer',ide);
}

function writeHfPlayer_hEmbed(where_to,m_width,m_height,ide)
{
	writeItDownEmbed(where_to,m_width,m_height,'hf','http://embed.happyfish.ro/',ide);
}

function writeItDownEmbed(where_to,m_width,m_height,hfa,pls,ide)
{
	var whereAmI = location.href;
	//whereAmI = "www.contentlogic.ro/videotest";
	place = document.getElementById('hfPlayer_'+ide);
	if(place==null){
		place = document.getElementById('hfPlayer');
	}
	if(m_width==0 && m_height==0)
	{
		place.innerHTML = 'Hack. Nu muta scriptul de la happy';
	} else
		{
			//place.innerHTML = '<object id="player" width="'+m_width+'" height="'+m_height+'" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="'+pls+'player_embed_v2.swf" name="movie"/><param value="high" name="quality"/><param value="#869ca7" name="bgcolor"/><param value="always" name="allowScriptAccess"/><param value="true" name="allowFullScreen"/><param value="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&ide='+ide+'" name="FlashVars"/><embed width="'+m_width+'" height="'+m_height+'" align="middle" allowScriptAccess="always" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" quality="high" loop="false" play="true" flashvars="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&ide='+ide+'" name="player" bgcolor="#869ca7" src="'+pls+'player_embed_v2.swf"/></object><div style="width:'+m_width+'px; heigt:1px; border:none; background-color:#000000;"></div>';
		
			place.innerHTML = '<object id="embplayer" width="'+m_width+'" height="'+m_height+'" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="'+pls+'player_embed_v3.swf" name="movie"/><param value="high" name="quality"/><param value="#ffffff" name="bgcolor"/><param value="always" name="allowScriptAccess"/><param value="true" name="allowFullScreen"/><param value="config='+pls+'config.php?episid='+ide+'&width='+m_width+'&height='+m_height+'" name="FlashVars"/><embed src="'+pls+'player_embed_v3.swf" width="'+m_width+'" height="'+m_height+'" bgcolor="#ffffff" allowscriptaccess="always" allowfullscreen="true"  flashvars="config='+pls+'config.php?episid='+ide+'&width='+m_width+'&height='+m_height+'" /></object>';
		}
}


//end of for embed

function writeItDownFix(where_to,m_width,m_height,hfa,pls,m_cod)
{
	var whereAmI = location.href;
	//whereAmI = "www.contentlogic.ro/videotest";
	place = document.getElementById('hfPlayer_'+m_cod);
	if(m_width==0 && m_height==0)
	{
		place.innerHTML = 'Hack. Nu muta scriptul de la happy';
	} else
		{
			if((whereAmI.match('happyfish.ro')!=null) || (whereAmI.match('gsp.ro')!=null) || (whereAmI.match('sistersmagazine.ro')!=null) || (whereAmI.match('cotidianul.ro')!=null) || (whereAmI.match('flacarais.ro')!=null) || (whereAmI.match('paginademedia.ro')!=null))
			{
				place.innerHTML = '<object id="player" width="'+m_width+'" height="'+m_height+'" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="'+pls+'player_v2.swf" name="movie"/><param value="high" name="quality"/><param value="#869ca7" name="bgcolor"/><param value="always" name="allowScriptAccess"/><param value="true" name="allowFullScreen"/><param value="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+m_cod+'" name="FlashVars"/><embed width="'+m_width+'" height="'+m_height+'" align="middle" allowScriptAccess="always" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" quality="high" loop="false" play="true" flashvars="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+m_cod+'" name="player" bgcolor="#869ca7" src="'+pls+'player_v2.swf"/></object><div style="width:'+m_width+'px; heigt:1px; border:none; background-color:#000000;"></div>';
			} else
			{
				if(whereAmI.match('romlit.ro')!=null){
					place.innerHTML = '<object id="player" width="'+m_width+'" height="'+m_height+'" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="'+pls+'player_v3.swf" name="movie"/><param value="high" name="quality"/><param value="#869ca7" name="bgcolor"/><param value="always" name="allowScriptAccess"/><param value="true" name="allowFullScreen"/><param value="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+m_cod+'" name="FlashVars"/><embed width="'+m_width+'" height="'+m_height+'" align="middle" allowScriptAccess="always" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" quality="high" loop="false" play="true" flashvars="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+m_cod+'" name="player" bgcolor="#869ca7" src="'+pls+'player_v3.swf"/></object><div style="width:'+m_width+'px; heigt:1px; border:none; background-color:#000000;"></div>';
				} else {
					place.innerHTML = '<object id="player" width="'+m_width+'" height="'+m_height+'" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="'+pls+'player.swf" name="movie"/><param value="high" name="quality"/><param value="#869ca7" name="bgcolor"/><param value="always" name="allowScriptAccess"/><param value="true" name="allowFullScreen"/><param value="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+m_cod+'" name="FlashVars"/><embed width="'+m_width+'" height="'+m_height+'" align="middle" allowScriptAccess="always" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" quality="high" loop="false" play="true" flashvars="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+m_cod+'" name="player" bgcolor="#869ca7" src="'+pls+'player.swf"/></object><div style="width:'+m_width+'px; heigt:1px; border:none; background-color:#000000;"></div>';
				}
			}
		
		}
}

function writeItDown(where_to,m_width,m_height,hfa,pls)
{
	var whereAmI = location.href;
	//whereAmI = "www.contentlogic.ro/videotest";
	place = document.getElementById('hfPlayer');
	if(m_width==0 && m_height==0)
	{
		place.innerHTML = 'Hack. Nu muta scriptul de la happy';
	} else
		{
		if((whereAmI.match('happyfish.ro')!=null) || (whereAmI.match('gsp.ro')!=null) || (whereAmI.match('sistersmagazine.ro')!=null) || (whereAmI.match('cotidianul.ro')!=null) || (whereAmI.match('flacarais.ro')!=null) || (whereAmI.match('paginademedia.ro')!=null))
			{
				place.innerHTML = '<object id="player" width="'+m_width+'" height="'+m_height+'" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="'+pls+'player_v2.swf" name="movie"/><param value="high" name="quality"/><param value="#869ca7" name="bgcolor"/><param value="always" name="allowScriptAccess"/><param value="true" name="allowFullScreen"/><param value="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+whereAmI+'" name="FlashVars"/><embed width="'+m_width+'" height="'+m_height+'" align="middle" allowScriptAccess="always" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" quality="high" loop="false" play="true" flashvars="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+whereAmI+'" name="player" bgcolor="#869ca7" src="'+pls+'player_v2.swf"/></object><div style="width:'+m_width+'px; heigt:1px; border:none; background-color:#000000;"><a href="http://www.happyfish.ro" target="_blank"><img src="http://www.happyfish.ro/hack.jpg" height="1" border="0" alt="happyfish tv" title="happyfish tv" /></a></div>';
			} else
			{
				if(whereAmI.match('romlit.ro')!=null){
					place.innerHTML = '<object id="player" width="'+m_width+'" height="'+m_height+'" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="'+pls+'player_v3.swf" name="movie"/><param value="high" name="quality"/><param value="#869ca7" name="bgcolor"/><param value="always" name="allowScriptAccess"/><param value="true" name="allowFullScreen"/><param value="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+whereAmI+'" name="FlashVars"/><embed width="'+m_width+'" height="'+m_height+'" align="middle" allowScriptAccess="always" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" quality="high" loop="false" play="true" flashvars="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+whereAmI+'" name="player" bgcolor="#869ca7" src="'+pls+'player_v3.swf"/></object><div style="width:'+m_width+'px; heigt:1px; border:none; background-color:#000000;"><a href="http://www.happyfish.ro" target="_blank"><img src="http://www.happyfish.ro/hack.jpg" height="1" border="0" alt="happyfish tv" title="happyfish tv" /></a></div>';
				} else{
					place.innerHTML = '<object id="player" width="'+m_width+'" height="'+m_height+'" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param value="'+pls+'player.swf" name="movie"/><param value="high" name="quality"/><param value="#869ca7" name="bgcolor"/><param value="always" name="allowScriptAccess"/><param value="true" name="allowFullScreen"/><param value="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+whereAmI+'" name="FlashVars"/><embed width="'+m_width+'" height="'+m_height+'" align="middle" allowScriptAccess="always" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" quality="high" loop="false" play="true" flashvars="autoplay=false&hfa='+hfa+'&whereTo='+where_to+'&cuid='+whereAmI+'" name="player" bgcolor="#869ca7" src="'+pls+'player.swf"/></object><div style="width:'+m_width+'px; heigt:1px; border:none; background-color:#000000;"><a href="http://www.happyfish.ro" target="_blank"><img src="http://www.happyfish.ro/hack.jpg" height="1" border="0" alt="happyfish tv" title="happyfish tv" /></a></div>';
				}
			}
		
		}
}