function OpenWindow(file,width,height,scroll,wname)
{
window.open(file,wname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scroll+",resizable=no,width="+width+",height="+height);
}

function PopTos()
{
OpenWindow("tos.php",500,400,"yes","tos");
}


function my_getbyid(id)
{
	itm = null;
	
	if (document.getElementById)
	{
		itm = document.getElementById(id);
	}
	else if (document.all)
	{
		itm = document.all[id];
	}
	else if (document.layers)
	{
		itm = document.layers[id];
	}
	
	return itm;
}

function my_hide_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "none";
}

function my_show_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "";
}

var ns5 = (document.getElementById && navigator.userAgent.indexOf('Gecko') > -1) ? true: false;
var ie5 = (document.getElementById && navigator.userAgent.indexOf('MSIE') > -1) ? true : false;
var ie4 = (!document.getElementById && document.all) ? true : false;

if (!ie4 && !ie5 && !ns5)
{
	event = "nope"
}


var offset_x = 10;
var offset_y = 20; 
var pre_main;
var pretime_1, pretime_2;
var pre_show = false;
var cur_x, cur_y;

function initiate()
{
	if (!ie4 && !ie5 && !ns5)
	{
		return;
	}

	pre_main = my_getbyid('v0');
	if (pre_main)
	{
		document.onmousemove = set_preview;
	}
}

window.onload = initiate;

function showit(num, evnt)
{
if (!pre_main)
{
return;
}

if (pretime_1){clearTimeout(pretime_1);}
if (pretime_2){clearTimeout(pretime_2);}
pre_show = true;

if (ie4 || ie5 || ns5)
{
	var temp = my_getbyid('v'+num);
	var th = temp.innerHTML;
	var wd = (th.length > 100) ? 200 : th.length+25;
	var html = "<div><table width=200 align='left'><tr><td align='left'>";
	html += temp.innerHTML;
	html += "</td></tr></table></div>";
 	pre_main.innerHTML = html;
	my_show_div(pre_main);
}

	pretime_1 = setTimeout("my_show_div(pre_main)", 10);
}

function set_preview(e)
{
	cur_x = (ns5) ? e.pageX : event.x+tbody().scrollLeft;
	cur_y = (ns5) ? e.pageY : event.y+tbody().scrollTop;
	var redge = ((ie4 || ie5) && !window.opera) ? tbody().clientWidth-event.clientX-offset_x : window.innerWidth-e.clientX-offset_x-20;
	var bedge = 0;//((ie4 || ie5) && !window.opera) ? tbody().clientHeight-event.clientY-offset_y : window.innerHeight-e.clientY-offset_y-20;
	var ledge = (offset_x < 0) ? offset_x*(-1) : -1000;

	if (redge < pre_main.offsetWidth)
	{
		pre_main.style.left = (ie4 || ie5) ? tbody().scrollLeft+event.clientX-pre_main.offsetWidth+"px" : window.pageXOffset+e.clientX-pre_main.offsetWidth+"px";
	}
	else if (cur_x < ledge)
	{
		pre_main.style.left = "5px";
	}
	else
	{
		pre_main.style.left = cur_x+offset_x+"px";
	}

	if (bedge < pre_main.offsetHeight)
	{
		pre_main.style.top = (ie4 || ie5) ? tbody().scrollTop+event.clientY-pre_main.offsetHeight-offset_y+"px" : window.pageYOffset+e.clientY-pre_main.offsetHeight-offset_y+"px";
	}
	else
	{
		pre_main.style.top = cur_y+offset_y+"px";
	}
}

function hideit()
{
	if (!pre_main)
	{
		return;
	}

	pretime_2 = setTimeout("my_hide_div(pre_main)", 10);
	pre_show = false;
}

function tbody()
{
	return (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body;
}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function ShowHideLayers() { //v6.0
  var i,p,v,obj,args=ShowHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}