// JavaScript Document


var codeCopied=[];
	
function createEmbed(E,link,site,inElement)
{
  getElement = E;
  var H=Position.cumulativeOffset(E);
  var K=H[0];
  var I=H[1];
  var flashcopier='flashcopier';
//  if(!document.getElementById(flashcopier))
//  {
      var divholder=document.createElement('div');
      divholder.id=flashcopier;
      document.body.appendChild(divholder)
//  }
  document.getElementById(flashcopier).innerHTML='';
  divholder.style.position="absolute";
  divholder.style.width="183px";
  divholder.style.height="58px";
  divholder.style.left=K+"px";
  divholder.style.top=I+"px";
  var divinfo='<embed src="http://www.coupons24.com/typo3conf/ext/am_affililinks/res/CopyButton.swf" onmouseout="delEmbed()" FlashVars="txtToCopy='+encodeURIComponent(inElement)+'&link='+link+'&site='+site+'&element='+E+'" width="183" height="58" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false"></embed>';
  document.getElementById(flashcopier).innerHTML=divinfo;
}

function delEmbed()
{
	var test = document.getElementById("flashcopier");
	$(test).remove();
}

function openIt(link,site)
{
	var E = document.getElementById(link);
	var url="http://www.coupons24.com/index.php?id=49&tx_amaffililinks_pi1[aktion_id]="+link;
  var F="textCopied";
  var C=null;
  if((C=$(F))==null)
  {
      C=document.createElement("div");
      C.setAttribute("id",F);
      C.style.display="none";
      C.innerHTML="Copied!";
      document.body.appendChild(C)
  }
  E.onblur=function(M)
  {
      Element.hide(C);
      return true
  };
    var H=Position.cumulativeOffset(E);
    var K=H[0];
    var I=H[1];
    C.style.left=(K+12)+"px";
    C.style.top=I+"px";
    Element.show(C);
    var B=Effect.Fade(C,{fps:75,from:1.9,to:0,duration:1,queue:"front"});
      
	if(!codeCopied[site])
	{
		if(navigator.appName=="Microsoft Internet Explorer")
		{
			merchantWindow=window.open(url,'partner')
		}
		else
	  {
			setTimeout(function()
			{
				 merchantWindow=window.open(url,'partner')
			},
			1000)
		}
	}
	codeCopied[site]=1;
}

