var ie=document.all;
var nn6=document.getElementById&&!document.all;
var isdrag=false;
var x,y;
var dobj;
var fobj;

var clientid="slforum";
var slboxbaner = 1;
var slboxframeborder=0;

if(open_at_start!=0)
var open_at_start=1;

var slboxsrc = "http://translation.paralink.com/box/default.asp";




function movemouse(e)
{

  if (isdrag)
  { 
    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x;
    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y;
    return false;
  }
}

function selectmouse(e)
{
  fobj       = nn6 ? e.target : event.srcElement;
  var topelement = nn6 ? "HTML" : "BODY";
  while (fobj.tagName != topelement && fobj.className != "dragme")
  {
    fobj = nn6 ? fobj.parentNode : fobj.parentElement;
  }
  if (fobj.className=="dragme")
  {
    showhidebottom(0);
    isdrag = true;
    dobj = fobj;
    tx = parseInt(dobj.style.left+0);
    ty = parseInt(dobj.style.top+0);
    x = nn6 ? e.clientX : event.clientX;
    y = nn6 ? e.clientY : event.clientY;
    document.onmousemove=movemouse;
    //updateShim(true);
    return false;
  }
}
document.onmousedown=selectmouse;
document.onmouseup= function() {if(isdrag==true && fobj.className!='blah')showhidebottom(1);isdrag=false;};

function showhidebottom(which){
if(!which)
	{
	document.getElementById('slbox').style.display='none';
	//updateShim(false);
	}
else if(which)
	document.getElementById('slbox').style.display='';
	//updateShim(true);
}

function hideslbox(){
document.getElementById('sldiv').style.display = 'none';
document.getElementById('slbox').style.display = 'none';
//updateShim(false);
}

function showslbox(){

var s = document.getElementById('sldiv');
var s2 = document.getElementById('slbox');
//if(s2.style.display == 'none')
//	{
        var d=document;
        var t=escape(d.selection?d.selection.createRange().text:(d.getSelection?d.getSelection().toString():''));
        if(t){          
           var m= slboxsrc+'?clientid='+clientid+'&slboxwidth='+slboxwidth+'&slboxheight='+slboxheight+'&slboxbaner='+slboxbaner+'&floater=true';
           m+="&text="+t;
           s2.src=m;

        }

	s.style.display='';
	s2.style.display='';
	//updateShim(true);
//	}
//else    
//	{
//	s.style.display='none';
//	s2.style.display='none';
//	//updateShim(false);
//	}
return false;
}


verifyslvars();
slboxstart();

function updateShim(state)
{                        
if(state)
   {

/*
    IfrRef.style.width = DivRef.offsetWidth;
    IfrRef.style.height = DivRef.offsetHeight;

    IfrRef.style.top = DivRef.style.top;
    IfrRef.style.left = DivRef.style.left;

    IfrRef.style.scrollTop = DivRef.style.scrollTop;
    IfrRef.style.scrollLeft = DivRef.style.scrollLeft;
*/
IfrRef.style.width=DivRef.style.width;
IfrRef.style.height=DivRef.style.height;
    IfrRef.style.zIndex = 1;
    IfrRef.style.display = "";
    DivRef.style.display = "";
   }
   else
   {
    DivRef.style.display = "none";
    IfrRef.style.display = "none";
   }
}

function getCookie (name) 
{
//debugAlert(document.cookie);
	var cookies = document.cookie.split(";");
	for(i = 0; i < cookies.length; i++) {
		if (cookies[i].indexOf(name + "=") !=-1 ) {
			return cookies[i];
		}
	}
	return "";
}

function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function cookieTrigger(zone){

var HIDE_BOX = getCookie("SHOW_SL_BOX").split("=");
if(HIDE_BOX[0] != "y" && HIDE_BOX[0] != "n") status = HIDE_BOX[1];
else status = HIDE_BOX[0];
if(zone == 0){ 
	if(status != "y" ) setCookie('SHOW_SL_BOX',"y");
	else                 setCookie('SHOW_SL_BOX',"n");
//	window.location.reload();
}else	{setCookie('SHOW_SL_BOX',"y");}



}

function slboxstart()
{                
var HIDE_BOX = getCookie("SHOW_SL_BOX").split("=");


	var delta;
	delta=20;
	document.write('<style> #slnavbar { BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-WEIGHT: bold; BORDER-LEFT-WIDTH: 0px; FONT-SIZE: 11px; Z-INDEX: 5; BACKGROUND: none transparent scroll repeat 0% 0%; LEFT:1px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; WIDTH: 150px; PADDING-TOP: 0px; POSITION: absolute; TOP: 1px; BORDER-RIGHT-WIDTH: 0px }</style>');
	document.write('<DIV id="slnavbar">');
	document.write('<img src="http://translation.paralink.com/box/images/imtranslator.gif" border="0" height="35" width="150" onclick="cookieTrigger(0);showslbox();" style="cursor:hand;"/>');

	document.write('<DIV id=mid><UL id="nav">');

HIDE_BOX[1] = "n"; // HARDCODE by VK 12.17.2007

if(HIDE_BOX[1] != "y"){
	document.write('<div id="sldiv" class="dragme" style="position:absolute; width:' +(slboxwidth+3)+ '; height: 1; z-index: 8; top:180px; left: '+((document.body.clientWidth-slboxwidth-delta))+'px;display:none;">');
	document.write('<table border="0" width="100%" cellspacing="0" cellpadding="0" ><tr><td><img border="0" src="http://translation.paralink.com/box/images/drag.gif" width="7" height="20"></td><td title="Drag the tool" style="cursor:move;" background="http://translation.paralink.com/box/images/drag-bg.gif" width="100%"></td><td title="Close" style="width:80px"><img class="blah" border="0" src="http://translation.paralink.com/box/images/close.gif" width="26" height="20" style="cursor:hand;" title="close" onclick="cookieTrigger(1);hideslbox();"/></td></tr></table>');
	document.write('<iframe id="slbox" name="slbox" style="border:1px solid #7F9DB9;" width='+slboxwidth+" height="+slboxheight+" frameborder="+slboxframeborder+" src="+slboxsrc+'?clientid='+clientid+'&slboxwidth='+slboxwidth+'&slboxheight='+slboxheight+'&slboxbaner='+slboxbaner+'&floater=true'+' marginwidth="0"'+' marginheight="0"'+' vspace="0"'+' hspace="0"'+' allowtransparency="true"'+' scrolling="no"></iframe>');
}else{

slboxwidth =0;
slboxheight = 0;
	document.write('<iframe id="slbox" name="slbox" style="border:1px solid #7F9DB9; visibility:hidden;" width='+slboxwidth+" height="+slboxheight+" frameborder="+slboxframeborder+" src="+slboxsrc+'?clientid='+clientid+'&slboxwidth='+slboxwidth+'&slboxheight='+slboxheight+'&slboxbaner='+slboxbaner+'&floater=true'+' marginwidth="0"'+' marginheight="0"'+' vspace="0"'+' hspace="0"'+' allowtransparency="true"'+' scrolling="no"></iframe>');
	document.write('<div id="sldiv" class="dragme" style="visibility:hidden;position: absolute; width:' +slboxwidth+ '; height: 1; z-index: 8; top:180px; left: '+((document.body.clientWidth-slboxwidth-delta))+'px;display:none;">');
}
	document.write('</div> </UL></DIV></DIV>');
	//document.write('<iframe id="DivShim" src="" scrolling="no" frameborder="0" style="position:absolute; width:' +slboxwidth+ ';top:180px; left:'+((document.body.clientWidth-slboxwidth-delta))+'px; display:none;"></iframe>');
}
var DivRef = document.getElementById('sldiv');
var IfrRef = document.getElementById('DivShim');


function verifyslvars()
{

if(!slboxwidth)var slboxwidth=468;
if(!slboxheight)var slboxheight=331;
if(!slboxcolor)var slboxcolor='white';
if(!slboxclientid)var slboxclientid='default';
if(!dir)var dir="en/es";

if(slboxwidth=="")slboxwidth=468;
if(slboxheight=="")slboxheight=331;
if(slboxcolor=="")slboxcolor='white';
if(slboxclientid=="")slboxclientid='default';
if(dir=="") dir="en/es";
}



/////////////////////////////////////////////////////////////////////////////////
//cerberus.js for new website
// 
// ver 3.0

//Browser capablilities
navigator.di=typeof(document.images)!='undefined';
navigator.dl=typeof(document.layers)!='undefined';
navigator.da=typeof(document.all)!='undefined';
navigator.w3c=((typeof(document.getElementById)!='undefined')&&(typeof(document.createElement)!='undefined'));
navigator.webtv=navigator.userAgent.indexOf('WebTV')>-1;

navigator.bt=bt();
//Browser Type used by the slnavbar 
function bt(){
	if ((typeof(document.documentElement)!="undefined") && (typeof(document.documentElement.scrollTop)!="undefined")) return 3;
	if(typeof(window.pageYOffset)!="undefined") return 1;
	return 0;
}

var getEl=null;		//vars for functions
var getElStyle=null;
var hb=new HB; 		//create object for Hover Buttons

function walkLayers(d, id){					//hack function for NN4x
	var o=null;
	for( var e in d) { 						//first check for id'd elements with document layer
		if(e==id) {
			d[e].id=id;						//NN4 uses NAME for images so create Property here
			return d[e];  					//return object if id matches
		}
	}
	for( var l in d.layers ){				//check if matches dhtml layers
		if(l==id) return d.layers[l];		//return matching layer
		if(d.layers[l].document) {			//check if element in dhtml layer 
			o=walkLayers(d.layers[l].document, id);
			if(o) return o;
		}			
	}
	return o;								//if previously found, pass on object	
}

if(navigator.dl){							//set functions
	getEl=new Function("id", "return walkLayers(document, id)");
	getElStyle=getEl;
}
else if(navigator.da){
	getEl=new Function("id", "return document.all[id]");
	getElStyle=new Function("id", "return document.all[id].style");
}
else if(navigator.w3c){
	getEl=new Function("id", "return document.getElementById(id)");
	getElStyle=new Function("id", "return document.getElementById(id).style");
}

//############## new version special buttons use with PHP ###
function addBtn(id, pfx, sfx){
	var me=this;
	var a=new Array;
	for(var i=0; i<2; i++ ){
		a[i]=new Image;
		a[i].src=pfx + i + '.' + sfx;
		a[i].handle=null;
	}	
	me.btns[id]=a;
}

function hoverBtn(id, state, idx){		
	var b=this.btns[id];				//Use typeof, IE <6.0 doesn't have constant 'undefined'
	if(typeof(idx) == 'undefined'){							//idx for 'up' buttons 
		if(!b.handle) { b.handle=getEl(id);	} //set once
		b.handle.src=b[state].src;	}
	else{		//idx for 'up' buttons
		if(!b.handle) { b.handle=new Array; } 				//create array if missing
		if(!b.handle[idx]){ b.handle[idx]=getEl(id+idx); }	//set once
		b.handle[idx].src=b[state].src;
	}
}

function HB(){
	this.btns=new Object;
	this.add=addBtn;
	this.hover=hoverBtn;
}
//###########################################################



//###########################################################
//MSIE hack for lack of CSS LI roll overs
<!--//--><![CDATA[//><!--

var sfHover = function() {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	if (window.attachEvent) window.attachEvent("onload", sfHover);

//--><!]]> 


//###########################################################
//New Sticky routines

function getScrollHack(){
	//seems damn new browsers set one or the other, opposite stays 0 
	//if this behavior changes will have to add more code forks
	//many set document.documentElement.scrollTop
	//NN sets window.document.body.scrollTop
	//and damn Opera sets both!!!!
	
	if(window.document.documentElement.scrollTop) return window.document.documentElement.scrollTop;
	if(window.document.body.scrollTop) return window.document.body.scrollTop;
	return 0;
}
	
function browserType(){
	if(typeof(document.documentElement)!="undefined") {
		if(typeof(document.documentElement.scrollTop)!="undefined") return 3;
	}
	if(typeof(window.pageYOffset)!="undefined") return 1;
	//Don't test for document.body.scrollTop, WebTV has a static 0 but uses 'window.pageYOffset'!
	//But IE4 as document.body.scrollTop but no window.pageYOffset so MUST test AFTER wpYO
	if(typeof(document.body.scrollTop)!="undefined") return 2;
	return 0;
}

function jump(){
	var me=this;
	me.dyW=me.getD();
	me.hStyle.top=me.dyW+me.yOfs+me.units; //relocate
	setTimeout(me.id + "_x.sticky()",5);
}

function bounce(){
	var me=this;
	me.dyW=me.getD();
	var t=me.dy;
	if(me.dyW!=me.dy){
		var pos=(me.dyW-me.dy) * .2;
		pos>0 ? pos=Math.ceil(pos) : pos=Math.floor(pos);
		me.dy+=pos;
		t=me.dy + me.yOfs;
		me.hStyle.top= t + me.units;
	}	
	setTimeout(me.id + "_x.sticky()",5);
}

function makeSticky(id,useBounce){		
	var me=getEl(id);
	var bt=browserType();
	switch(bt){
		//DOM
		case 3: me.getD=getScrollHack; break;
		//IE4
		case 2: me.getD= function(){return document.body.scrollTop;}; break;
		//NN4
		case 1: me.getD= function(){return window.pageYOffset;}; break;
		//Text or Ancient
		default:  me.getD= function(){return 0;};
	}
	me.units = bt>1 ? "px" : "";	
	me.hStyle=getElStyle(id);					//handle to style
	me.yOfs=(typeof(me.pageY)=='number' ? me.pageY : 0); 		//el's init yOfs
	me.yOfs+= (typeof(me.offsetTop)=='number' ? me.offsetTop: 0);	//WebTV fix
	me.dy=0;							
	me.sticky=(useBounce ? bounce : jump );					
	window[me.id+"_x"]=me;			//universal document handle		
	me.sticky();
	//return me.hStyle; 			//use to make visible
}

function fireup(){
	if(!(navigator.dl || navigator.webtv)) {makeSticky('slnavbar',1);/*makeSticky('DivShim',1);*/}
}
  
function statusPrompt(text){
	window.status=text;
	return true;
}

function demo(m){ 
	alert(m);
	return void(0);		
}

function dummy(){
	alert('This is just a sample link');
	return false;
}
fireup();

if(open_at_start)showslbox();