// JavaScript Document
// add link to favorites
function AddFavorite(){ 
  var addUrl = 'http://www.file-extensions.org/';
  var addTitle = 'File-extensions.org';
  
  if (document.all && !window.opera) 
  { 
    window.external.AddFavorite(addUrl,addTitle); 
    return false; 
  } 
  else if (window.opera && window.print) 
  { 
    return true; 
  } 
  else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')) 
  { 
    if (window.confirm('Add to favorites?')) 
    { 
      window.sidebar.addPanel(addTitle,addUrl,''); 
      return false; 
    } 
  } 
  window.alert('Press CTRL+D (CTRL+T - Opera) to add file-extensions.org to your bookmarks.'); 
  return false; 
} 

function rst(elm) { // reset search box
	if (elm.value == 'Type file extension') elm.value='';
}

function cv(id){ // count visit of displaying extension on page load

	ci = new Image();
	ci.src = "/counter/extension/id/" + id;
	
}

function initContent(){
	var el;
		
	if (arguments.callee.done) return;
	arguments.callee.done = true;
				
	if (el = document.getElementById("uniBan")){
		document.regbooster = new Image();
		document.regbooster.src = 'http://www.file-extensions.org/imgs/t01/uniblue/registry-booster-2009.gif';
		el.innerHTML = '<p><a href="http://www.liutilities.com/affcb/?id=RBfileextensions&amp;aff=2020&amp;xat=fileext_BAN_RBB1"><img src="imgs/t01/uniblue/registry-booster-2009.gif" width="335" height="150" alt="Fix File Extension Errors with the number one industry leading and award winning RegistryBooster 2" style="border:none;" /></a></p>';
	}

	if (el = document.getElementById("addthis")){
		addthis_pub  = 'digidy';
		el.innerHTML = '<a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, \'\', \'[URL]\', \'[TITLE]\')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="http://s9.addthis.com/button1-bm.gif" width="125" height="16" border="0" alt="" /></a>';
	}
	
	if (el = document.getElementById("globalbookmark")){
		addthis_pub  = 'digidy';
		changeOpac(0, 'globalbookmark');
		el.innerHTML = '<a href="http://www.addthis.com/bookmark.php" onclick="addthis_url=location.href; addthis_title=document.title; return addthis_click(this);" target="_blank"><img src="http://s9.addthis.com/button1-bm.gif" width="125" height="16" border="0" alt="Bookmark and Share" /></a>';
		opacity('globalbookmark', 0, 100, 1500);
	}
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
} 

function flash(id){
	var i
	for (i = 1; i < 20; i = i + 2){
		setTimeout("changeOpac(5,'" + id + "')", i * 150);
		setTimeout("changeOpac(100,'" + id + "')", (i + 1) * 150);
	}
}

function stripHTML(s){
        var matchTag = /<(?:.|\s)*?>/g;
        return s.replace(matchTag, "");
}