/*function setVariables(){
if(navigator.appName == "Netscape") {
    if(parseInt(navigator.appVersion) >= 5) {
      v=".top=";
      h=".left=";
      dS="document.getElementById(\"";
      sD="\").style";
      y="window.pageYOffset";
      x="window.pageXOffset";
    }
    else {
      v=".top=";
      h=".left=";
      dS="document.";
      sD="";
      y="window.pageYOffset";
      x="window.pageXOffset";
    }
  }
  else {
    h=".pixelLeft=";
    v=".pixelTop=";
    dS="";
    sD=".style";
    y="document.body.scrollTop";
    x="document.body.scrollLeft";
  }
  checkLocationA()
}
movex=0,movey=0,xdiff=0,ydiff=0,ystart=0,xstart=0
function checkLocation() {
  object="divMenu";
  yy=eval(y);
  ydiff=ystart-yy-200;
  if((ydiff<(-1))||(ydiff>(1))) movey=Math.round(ydiff/10),ystart-=movey
  if(ystart >= 100) {
    eval(dS+object+sD+v+(ystart - 100));
  } 
  setTimeout("checkLocation()",10);
}
function checkLocationA(){ystart=eval(y);xstart=eval(x);}
*/
var sour=null,inter=null,topic=null,docu=null;

function jsfunction(url,title,options) {
	var i=0;
	if(url=="sources.php") {
		i=1;
		if(topic!=null)
			if(topic.closed!=true)
				topic.focus();
			else
				topic=null;
		if(inter!=null)
			if(inter.closed!=true)
				inter.focus();
			else
				inter=null;
		sour = window.open(url,'sources',options);
		sour.focus();
	}
	if(url=="calendar.html") {
		i=1;
		if(topic!=null)
			if(topic.closed!=true)
				topic.focus();
			else
				topic=null;
		if(sour!=null)
			if(sour.closed!=true)
				sour.focus();
			else
				sour=null;
		inter = window.open(url,'calendar',options);
		inter.focus();		
	}
	if(url=="topics.php") {
		i=1;
		if(inter!=null) {
			if(inter.closed!=true)
				inter.focus();
			else
				inter=null;
		}
		if(sour!=null)
			if(sour.closed!=true)
				sour.focus();
			else
				sour=null;
		topic = window.open(url,'topic',options);
		topic.focus();
	}
	if(url=="harsh.php") {
		i=1;
		if(document.forms[0].sources.options[0].value=="<empty>") {
			alert("You need to choose the sources first!!!");
			return;
		}
		if(document.forms[0].date.options[0].value=="<empty>") {
			alert("You need to choose the interval time first!!!");
			return;
		}
		if(document.forms[0].topics.options[0].value=="<empty>") {
			alert("You need to choose the topics first!!!");
			return;
		}
		document.graphic.top_hid.value="1";		
		if(sour!=null)
			sour.close();
		if(topic!=null)
			topic.close();
		if(inter!=null)
			inter.close();
		query = "SELECT harshness.month, harshness.day, harshness.year, harshness.tf, harshness.dwtf, harshness.template, harshness.tf_notop, harshness.template_notop, harshness.hybrid,min(harshness.id_doc) as id_doc FROM harshness,sources WHERE harshness.id_source=sources.id_source and ";
		andsrc = "( ";
		var shid = '';
		for(i=0;i<document.forms[0].sources.options.length;i++) {
			str = document.forms[0].sources.options[i].value;
			len = str.length;
			if(i==document.forms[0].sources.options.length-1)
				andsrc = andsrc + " sources.url='"+str.substring(4,len)+"') ";
			else
				andsrc = andsrc + " sources.url='"+str.substring(4,len)+"' or";
			if(i==document.forms[0].sources.options.length-1)
				shid += str;
			else
				shid += str+"^";
		}
		document.forms[1].sources_h.value = shid;
		var thid=document.forms[0].date.options[1].value+"^";
		thid += document.forms[0].date.options[3].value;
		document.forms[1].time_h.value = thid;
		query = query + andsrc;
		timstart = document.forms[0].date.options[1].value;
		ms = timstart.substring(0,2);
		ds = timstart.substring(3,5);
		ys = timstart.substring(6,10);
		ms = 1*ms;
		ds = 1*ds;
		ys = 1*ys;
		d1 = 1*(ys*10000)+1*(ms*100)+ds;
		timstop = document.forms[0].date.options[3].value;
		me = timstop.substring(0,2);
		de = timstop.substring(3,5);
		ye = timstop.substring(6,10);
		me = 1*me;
		de = 1*de;
		ye = 1*ye;
		d2 = 0;
		d2 = 1*(ye*10000)+1*(me*100)+de;
		
		tim = "and (year*10000+month*100+day>="+d1+") and (year*10000+month*100+day<="+d2+") ";
		query = query + tim;
		andtop = " and (";
		var tohid ='';
		for(i=0;i<document.forms[0].topics.options.length;i++) {
			str = document.forms[0].topics.options[i].value;
			str = str.replace("`","''");
			len = str.length;
			if(i==document.forms[0].topics.options.length-1)
				tohid += str;
			else
				tohid += str+"^";
			if(i==document.forms[0].topics.options.length-1)
				andtop = andtop + " lower(harshness.topic)='"+str+"') ";
			else
				andtop = andtop + " lower(harshness.topic)='"+str+"' or";
		}
		document.forms[1].topics_h.value = tohid;
		query = query + andtop;
		document.graphic.query.value = query;
		document.graphic.submit();
	}
	if(i==0) { // then document.php?id=...
		if(docu!=null)
			docu.close();
		docu = window.open(url,'document',options);
		docu.focus();
	}
}

function swap(src,dest) {
	document[src].src='images/'+dest;
}
ie=document.all?1:0;
n=document.layers?1:0;

lshow=167;

var move=10;

menuSpeed=40;

var moveOnScroll=true;

var tim;
var ltop;

function makeMenu(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.';
        this.css=(n) ? eval(nest+'document.'+obj):eval(obj+'.style');
        this.state=1;
        this.go=0;
        this.width=n?this.css.document.width:eval(obj+'.offsetWidth');
        this.left=b_getleft;
    this.obj = obj + "Object";  eval(this.obj + "=this");
}

function b_getleft(){
        var gleft=(n) ? eval(this.css.left):eval(this.css.pixelLeft);
        return gleft;
}
function checkScrolled(){
        if(!oMenu.go) oMenu.css.top=eval(scrolled)+ltop;
        if(n) setTimeout('checkScrolled()',30);
}
/*function menuInit(){
        oMenu=new makeMenu('divMenu');
        scrolled=n?"window.pageYOffset":"document.body.scrollTop";

        oMenu.css.left=-oMenu.width+lshow;

        ltop=(n)?oMenu.css.top:oMenu.css.pixelTop;

        oMenu.css.visibility='visible';

        if(moveOnScroll) ie?window.onscroll=checkScrolled:checkScrolled();

}

onload=menuInit;*/

