
function addBookmark(title,url) {
		if (window.sidebar) {
		    window.sidebar.addPanel(title, url,"");
		} else if( document.all ) {
		    window.external.AddFavorite( url, title);
		} else if( window.opera && window.print ) {
		    return true;
		}
	}

	


// PRINT
function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}
//CENTERED WINDOW
function openCenteredWindow(url, w, h) {
	var screenWidth  = screen.availWidth;
   	var screenHeight = screen.availHeight;

	var left = (screenWidth - w)/2;
	var top = (screenHeight - h)/2;

	var winName = Math.round(Math.random() * 10000000);

	window.open(url,winName,"toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width="+w+",height="+h+",left="+left+",top="+top)
}

//COPY TO CLIP
function intext(name, id) {return document.getElementById(name + id).innerText;}
function add_to_clip(id) {var a = intext('text_', id);cliptext(a);}
function cliptext(text) {text_buf.innerText = text;comclip = text_buf.createTextRange();comclip.execCommand("RemoveFormat");comclip.execCommand("Copy");}

//ENGLISH USEAGE NOTICE
var EnglishCharCount=0;

function checkKeyPressed(evt,element,title,msg)
{
  evt = (evt) ? evt : (window.event) ? event : null;
  if (evt)
  {
    var charCode = (evt.charCode) ? evt.charCode :
                   ((evt.keyCode) ? evt.keyCode :
                   ((evt.which) ? evt.which : 0));
    if((charCode>=65 && charCode<=90)||(charCode>=97 && charCode<=122))
    {
    EnglishCharCount++;

  if(EnglishCharCount==2)
          show(notice,title,msg);

         }
  }
  }
    
  function checkBackspace(evt)
  {
  var charCode = (evt.charCode) ? evt.charCode :
                   ((evt.keyCode) ? evt.keyCode :
                   ((evt.which) ? evt.which : 0));
   if (charCode == 8 && EnglishCharCount>0) { 
      
      hide(notice);
    EnglishCharCount=1000;
   }
  }
  

//SHOW/HIDE
//function show(itemID) {
//  document.getElementById(itemID).style.visibility = 'visible';
//  document.getElementById(itemID).style.display = 'block';
//} 
function notice(itemID, msg) { 

  document.getElementById(itemID).style.visibility = 'visible';
  document.getElementById(itemID).style.display = 'block';
  document.getElementById(itemID).innerHTML = msg;
}

function hide(itemID) { 
  document.getElementById(itemID).style.visibility = 'hidden';
  document.getElementById(itemID).style.display = 'none';
}


function show(itemID) {
  
	if (document.getElementById(itemID).style.visibility == 'hidden') {
		//opacity('fader', 0, 90, 40);
		opacity(itemID, 0, 100, 50);
	}
	else {

		//hide('fader');
		hide(itemID);
	}
}
//OPACITY DISPLAY
function opacity(id, opacStart, opacEnd, millisec) {
	changeOpac(0,id);
	document.getElementById(id).style.visibility = 'visible';
	document.getElementById(id).style.display = 'block';

    //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++; 
        } 
    } 
} 

//change the opacity for different browsers 
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 + ")"; 
}

