window.onerror=err;
var brName = navigator.appName;
var brVer = parseInt(navigator.appVersion);
var brVendor = brName.substring(0,9);

function err() {return false;}

function wopen(item,pwidth,pheight,usetoolbar,uselocationbar,usemenubar,rndURL) {
if(brVendor=='Microsoft' && brVer < 4) {return true;}

   if(typeof(usetoolbar) == 'undefined') {
      usetoolbar = "1";
   }
   if(typeof(uselocationbar) == 'undefined') {
      uselocationbar = "1";
   }
   if(typeof(usemenubar) == 'undefined') {
      usemenubar = "1";
   }
   if(typeof(pwidth) == 'undefined') {
      pwidth = "720";
   }
   if(typeof(pheight) == 'undefined') {
      pheight = "480";
   }

   var URL = item.href;

   if(rndURL) {
      if(URL.indexOf('?') > 0) {
			URL += '&RandKey=';
      } else {
			URL += '?RandKey=';
      }
      URL += Math.floor(Math.random() * 1000000);
   }

	window.open(URL,'_blank','toolbar=' + usetoolbar + ',location=' + uselocationbar + ',directories=0,status=1,menubar=' + usemenubar + ',scrollbars=1,resizable=1,width='+pwidth+',height='+pheight);return false;
}

function ao(obj) {
	return wopen(obj,720,480,1,0,0,1);
}

function fao(obj) {
	return wopen(obj,640,500,0,0,0,0);
}

function oao(obj) {
	return wopen(obj,640,570,1,1,1,0);
}

function fo(obj) {
	return wopen(obj,640,550,0,0,0,0);
}


var boxtext;

function box_focus(item) {
	if(typeof(boxtext) == 'undefined') {
		boxtext = item.value;
		item.value = '';
		return;
	}
	if(item.value == boxtext) {
		item.value = '';
	}
}

function box_blur(item) {
	if(item.value == '') {
		item.value = boxtext;
	}
}

function dd_check(item,text, check) {
   if(check) {
	   if(item.value == text) {
		   alert('"' + text + '" is not a newswire. Please select a newswire from the list.');
			return false;
		}
	}
	
	return true;
}


if (!document.layers&&!document.all&&!document.getElementById)
event="test"

function showTip(current,e,text){

if (document.all||document.getElementById){
thetitle=text.split('<br>')
if (thetitle.length>1){
thetitles=''
for (i=0;i<thetitle.length;i++)
thetitles+=thetitle[i]
current.title=thetitles
}
else
current.title=text
}

else if (document.layers){
document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-size:12px;color:black">'+text+'</layer>')
document.tooltip.document.close()
document.tooltip.left=e.pageX+5
document.tooltip.top=e.pageY+5
document.tooltip.visibility="show"
}
}
function hideTip(){
if (document.layers)
document.tooltip.visibility="hidden"
}

function showRegTip(current,e) {
   showTip(current, e, 'To read this, first register with this publication');
}

function showSubTip(current,e) {
   showTip(current, e, 'To read this, first pay and subscribe to this publication');
}

function change_location (address) {
   location.href=address;
}

function set_window_status (text) {
   window.status=text;
   return true;
}
               
var ADS_tag = new Array(6);
var ADSc = 0;
var ADSenabled = 0;

var delayedAdLoad = 1;
var delayedAdUntilOnLoad = 0;

function insertAdDest(pos, tag, width, height, attr) {
   if(delayedAdLoad) {
      ADS_tag[pos] = tag; ADSc++;
      document.write('<span id="d' + tag + '"><img src="/ico/1.gif" border="0" width="' +
		     width + '" height="' + height + '"/></span>');
   }
   else {
      insertAdSrc(-1, tag, width, height, attr);
   }
}

function insertAdSrc(pos, tag, width, height, attr) {
   if(delayedAdLoad || (pos == -1)) {
      var myDate = new Date();
      AT_MISC = myDate.getTime();

      document.write('<scr' + 'ipt src="http://adserver.adtech.de/?addyn|2.0|' +
		     tag + '|target=_blank;loc=100;misc=' + AT_MISC + ';">');
      if (navigator.userAgent.indexOf("Mozilla/2.") >= 0 || navigator.userAgent.indexOf("MSIE") >= 0) {
	 document.write('<a href="http://adserver.adtech.de/?adlink|2.0|' + tag +
			'|ADTECH;loc=200;" target="_blank"><img ' + attr +
			' src="http://adserver.adtech.de/?adserv|2.0|' + tag +
			'|ADTECH;loc=200;" border="0" width="' + width +
			'" height="' + height + '"></a>');
      }
      document.write('</scr' + 'ipt>');
   }
}

function enableAd(i) {
   if( !delayedAdLoad || delayedAdUntilOnLoad ) return;
   onAd(i);
}

function onAd(i) {
   if(!ADS_tag[i]) return true;

   var s = document.getElementById('s' + ADS_tag[i]);
   var d = document.getElementById('d' + ADS_tag[i]);

   d.parentNode.replaceChild(s,d);
   s.className = 'on';
   
   ADS_tag[i] = '';
   ADSenabled++;
}

function enableAds() {
   if( (ADSc == 0) || (ADSenabled == ADSc) ) return true;
   var i;
   for(i = 0; i < ADSc; i++) {
      // onAd(i);
      setTimeout("onAd(" + i + ")",i*2000);
   }
   return true;
}
