var href = document.location.href;
var site = "DBExplorer";
var imag = "dbe";
var cb = "dbexplorer";

if ( href.match( /eclipse/i ) ) {
  site = "DBEclipse";
  imag = "dbeclipse";
  cb = "dbeclipse";
}
else if ( href.match( /tuner/i ) ) {
  site = "QueryTuner";
  imag = "qt";
  cb = "querytuner";
}
else if ( href.match( /planner/i ) ) {
  site = "QueryPlanner";
  imag = "qp";
}

document.write( "<img src='"+imag+".jpg' height=99>" );

var isMain = document.location.href.match( /main.html/ );

function placeAdds(isVertical,which) {
  if ( !isVertical ) return;
  if ( !isMain || 1 ) {
    var href = "<a href='http://commons.wikimedia.org/wiki/Image%3AWaitangi_Maori_Carving_n.jpg'>";
    var tattle = " border=1 bordercolor=336699 cellspacing=0'><tr>"+
      "<td title='*Maori wood carving, ceremonial war canoe, Waitangi\n(16 January 2005); The North Island, New Zealand.\n*Photograph by James Shook, who retains copyright and releases the image under the Creative commons license.\n*from en.wikipedia - click to open source' style='border: 0;' background='border"+(which)+".jpg' onclick='window.open(\"http://commons.wikimedia.org/wiki/Image%3AWaitangi_Maori_Carving_n.jpg\"); return false;'>&nbsp;</td></tr></table>";//"</a>"
    href="";
    document.write( isVertical ?
      href+"<table style='width:120; height:524;'"+tattle : // 600
      href+"<table style='width:728; height:90;'"+tattle );
    return;
  }

  google_ad_client = "pub-2274732975242236";

  if ( isVertical ) {
    google_ad_width = 120; google_ad_height = 600;
    google_ad_format = "120x600_as";
  }
  else {
    google_ad_width = 728; google_ad_height = 90;
    google_ad_format = "728x90_as";
  }

  google_ad_type = "text_image";
  google_ad_channel ="";
  google_color_border = "336699";
  google_color_bg = "000000";
  google_color_link = "0000FF";
  google_color_url = "008000";
  google_color_text = "ffffff";

  document.write( '<script type="text/javascript"\
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\
  <\/script>' );
}

function checks(id,title,jar) {
  var chkd = id == "sybok" || (document.cookie||"").indexOf( jar )>=0;
  document.write( "<td><input type=checkbox id="+id+
	(chkd==true?" checked=true":"")+">"+title+"<br>\n" );
}

var opened;

function loadApplet() {

  var dt = new Date();
  dt.setTime(dt.getTime()+90.*24*60*60*1000);

  if ( !document.cookie.match( /acceptedtermz/ ) )
    if ( !confirm(
	"This page will now attempt to download a WebApplet.     \n"+
	"This may take a few moments. You will be promted by\n"+
	"Java to confirm the activation of the signed archive.\n"+
	"\n"+
	"This software is licensed only for use from this site at no\n"+
	"charge. "+site+".com is however not liable for any\n"+
	"loss or damges arising out of the use of this software.\n"+
	"\n"+
	"If you accept these terms, Please Click OK to continue.." ) )
      return false;
    else
      document.cookie = "acceptedtermz=true; expires="+dt.toGMTString();

  var none = !sybok.checked&&!db2ok.checked&&!oraok.checked&&!mysok.checked;
  var jars = "jhttpd.jar,"+(none?"n":"j")+"sql.jar,gnu.jar"

  if ( sybok.checked || 1 ) jars += ",jtds-1.2s.jar";
  if ( db2ok.checked ) jars += ",db2jcc.jar,db2jcc_license_cu.jar";
  if ( oraok.checked ) jars += ",classes12.jar";
  if ( mysok.checked ) jars += ",mysql.jar";

  document.cookie = "jars="+jars+"; expires="+dt.toGMTString();

  document.getElementById( "appletDiv" ).innerHTML = 
	"<applet name='WebServer' code='org/jhttpd/WebServer.class' "+
	"width=0 height=0 codebase='jars' archive='"+jars+"' mayscript>\n"+
	"<param name=onload value='appletLoaded( \"{0}\", {1} );'>\n"+
	"<param name=onerror value='appletFailed( \"{0}\" );'>\n"+
	"<param name='port' value='21962'>"+
	"</applet>";

  return false;
}

function setOpened( o ) {
  opened = o;
}

function appletLoaded( ipaddr, port, host ) {
  if ( host && 0 )
    alert( "You will be directed to a remote site running jSQL.\n"+
	"The login for server SYBDEMO is pcguest/pcguest." );

  var url = "http://"+(host||"localhost")+":"+port+
	"/jsqldocs/jsql.html?/jsql/Sybase/SYBDEMO/pubs2";

  if ( ( navigator.userAgent.match( /MSIE [67]/ ) || 1 ) )
    parent.fader( window.opened, url );
  else
    opened = window.open( url );

  if ( !host )
  top.fs.onbeforeunload = function() {
    top.event.returnValue = '            Do you realy want to leave '+site+'?';
    return false;
  };

  return false;
}

var url;

function appletFailed( message ) {
    url = "onerror.html?"+message;
    setTimeout( "top.fader( window.opened, url )", 100 );
}

function gnu() {
  top.open( "gnu.html", "_new", "width=500,height=500" );
  return false;
}

function contact() {
  window.open( "mailto:support@"+site+".com?subject=Enquiry from "+site+".com" );
  return false;
}

