// JavaScript Document

// add link to favorites
function AddFavorite(){ 
  var addUrl = 'http://www.process-info.org/';
  var addTitle = 'Process-info.org computer processes library';
  
  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 www.process-info.org to your bookmarks.'); 
  return false; 
} 

function rst(elm) { // reset search box
	if (elm.value == 'Search processes') elm.value='';
}


function cv(id){ // count visit of displaying extension on page load
	ci = new Image()
	ci.src = "/counter/process/id/" + id
}

function initContent(){
	var el;
		
	if (arguments.callee.done) return;
	arguments.callee.done = true;

	if (el = document.getElementById("uniSpy1a")){
		el.innerHTML = '<strong>We strongly recommend you to <a href="http://www.liutilities.com/affcb/?id=RBfileextensions&amp;aff=2020&amp;xat=processinfo_uniSpy1a">run a free spyware scan of your system</a>, provided by Microsoft Gold certified partner.</strong>';
	}

	if (el = document.getElementById("uniSpy1b")){
		el.innerHTML = '<strong>We strongly recommend you to <a href="http://www.liutilities.com/affcb/?id=RBfileextensions&amp;aff=2020&amp;xat=processinfo_uniSpy1b">run a free spyware scan of your system</a>, provided by Microsoft Gold certified partner.</strong>';
	}

	if (el = document.getElementById("uniSpy2a")){
		el.innerHTML = '<strong>If you are not sure about ' + stripHTML(el.innerHTML) + ' process, <a href="http://www.liutilities.com/affcb/?id=RBfileextensions&amp;aff=2020&amp;xat=processinfo_uniSpy2a">run a free spyware scan of your system</a>, provided by Microsoft Gold certified partner.</strong>';
	}

	if (el = document.getElementById("uniSpy2b")){
		el.innerHTML = '<strong>If you are not sure about ' + stripHTML(el.innerHTML) + ' process, <a href="http://www.liutilities.com/affcb/?id=RBfileextensions&amp;aff=2020&amp;xat=processinfo_uniSpy2b">run a free spyware scan of your system</a>, provided by Microsoft Gold certified partner.</strong>';
	}

	if (el = document.getElementById("uniTop")){
		el.innerHTML = '<div class="advicon"><a href="http://www.liutilities.com/affcb/?id=RBfileextensions&amp;aff=2020&amp;xat=processinfo_uniTop" rel="nofollow">Click here to Run Free Scan for Spyware and dangerous applications</a></div>';
	}

	if (el = document.getElementById("uniDetail")){
		el.innerHTML = '<div class="advicon1"><a href="http://www.liutilities.com/affcb/?id=RBfileextensions&amp;aff=2020&amp;xat=processinfo_uniDetail" rel="nofollow">Click here to Run Free Scan for Spyware and dangerous applications</a></div>';
	}
}

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, "");
}