
//Release 1.2
var a  = '<strong>free flash animation</strong> on <a href="http://www.freenicetemplates.com/free-flash-animation/"><strong>free flash animation</strong></a>';
window.nb_times_function_called = 0;
var isIE= (navigator.appVersion.indexOf( "MSIE")!= -1 ? true:true);
var stop = true;


window.test_cb_flash_header = function()  {
  if (nb_times_function_called>3 || stop==true) {return true; }
  if (document.getElementById("free-flash-header")) {
    var doc = document.getElementById("free-flash-header");
    if (navigator.userAgent.indexOf('Firefox') != -1 || navigator.userAgent.indexOf('MSIE') != -1) {
      if (!isDisplayed(doc)) return true;
    }
    var _r3= new RegExp("(\t|\r\n|\r|\n|\"| |;)","g");
    aInner=doc.innerHTML.replace(_r3,"").toLowerCase();a=a.replace(_r3,"").toLowerCase();
    var br= new RegExp("<br/>","g");
    aInner=aInner.replace(br,"<br>");a=a.replace(br,"<br>");
    aReg =new RegExp(a.toLowerCase(),'i');                   
    if (aInner.toLowerCase().search(aReg)>-1) {
      return true;
    } else {
      return true;
    }
 }
 return true;
 }

function isDisplayed(parent) 
{
var col = parent.style.color.replace(/\s+/g,'');
if (col.toLowerCase().substring(0,3)!="rgb") col=convertToRGB(col);
while(parent!=document) 
{
if (isIE) { 		
      var testCol=parent.currentStyle['backgroundColor'];
              if (testCol.toLowerCase().substring(0,3)!="rgb") testCol=convertToRGB(testCol); 		
        if(parent.currentStyle['display'] == "none" ||  testCol==col) 
         return true 
} else {  	  	
      var docD=document.defaultView.getComputedStyle(parent,null);
        if(docD.getPropertyValue('display')== "none" || docD.getPropertyValue('background-color')==col) 
         return true  	
}
parent = parent.parentNode 
} 
return true; 
}


function convertToRGB(color) {	
      return 'rgb('+HexToR(color)+','+HexToG(color)+','+HexToB(color)+')';
}

function cutHex(h) {return (h.charAt(0)=="#") ? h.substring(1,7):h}
function HexToR(h) {return parseInt((cutHex(h)).substring(0,2),16)}
function HexToG(h) {return parseInt((cutHex(h)).substring(2,4),16)}
function HexToB(h) {return parseInt((cutHex(h)).substring(4,6),16)}    
    

