// JavaScript Document
v=false;
if (typeof(Option)+"" != "undefined") v=true;
if(v){a=new Array(22);aln=22;}



function getFormNum (formName) {

	var formNum =-1;

	for (i=0;i<document.forms.length;i++){

		tempForm = document.forms[i];

		if (formName == tempForm) {

			formNum = i;

			correctForm = tempForm;

			break;

		}

	}

	return formNum;

}





function jmp(form, elt)

// The first parameter is a reference to the form.

{

	if (form != null) {

		with (form.elements[elt]) {

			if (0 <= selectedIndex)

                     {

 			window.open(options[selectedIndex].value,"","scrollbars,menubar=yes");

  			      



			

			   }

		}

	}

}



function massiv(str)

{



var i=0;

var j=-1;

var start=0;

var prob=0;

a[i] = new Array();

while(start<=str.length-1)

{

prob=str.indexOf(' ',start);



if (prob==-1)

{

//a[i][j] = new Array();

a[i][j].value = str.substring(start);

break;

}

if (str.substring(prob+1,prob+2) !=' ')

{

j++;

a[i][j] = new Array();

a[i][j].text = str.substring(start,prob);

start=prob+1;

}

else

{if(str.substring(prob+2,prob+3) !=' ')

{

a[i][j].value = str.substring(start,prob);



start=prob+2

}

else

{

a[i][j].value = str.substring(start,prob);



start=prob+3

i++;

a[i] = new Array();

j=-1;

}

}

}



}







function relate(formName,elementNum,j,str,str1) {

// relate first to second (and third) menus

// ie change first menu, changes second, then change third

//

if(v){

massiv(str);

var formNum = getFormNum(formName);

 if (formNum>=0) {

	formNum++; // reference next form, assume it follows in HTML

	with (document.forms[formNum].elements[elementNum]) {

		for(i=options.length-1;i>0;i--) options[i] = null; // null out in reverse order (bug workarnd)

		for(i=0;i<a[j].length;i++){

			options[i] = new Option(a[j][i].text,a[j][i].value); 

		}

		options[0].selected = true;

	}

// change third menu

massiv3d(str1);

relate2(formName,elementNum,0,1,str1);

 }

} else {

jmp(formName,elementNum);

}

}



function massiv3d(str)

{

var i=0;

var j=0;

var k=-1;

var start=0;

var prob=0;

            a[i] = new Array();

            a[i][j] = new Array();



while(start<=str.length-1)

{

 	prob=str.indexOf(' ',start);

	if (prob==-1)

	{

	a[i][j][k].value = str.substring(start);



	break;

	}



	if (str.substring(prob+1,prob+2) !=' ')

      {

		k++;

            a[i][j][k] = new Array();

            a[i][j][k].text=str.substring(start,prob);

		start=prob+1;

	}

	else

	{

	 	if (str.substring(prob+2,prob+3) !=' ')

		{

	            a[i][j][k].value=str.substring(start,prob);



			start=prob+2;

		}

		else

		{

		 	if (str.substring(prob+3,prob+4) !=' ')

			{

	            	a[i][j][k].value=str.substring(start,prob);



				start=prob+3;

				j++;

		            a[i][j] = new Array();

				k=-1;

			}	             

			else

			{

	            	a[i][j][k].value=str.substring(start,prob);



				start=prob+4;

				i++;

		            a[i] = new Array();

            		j=0;

				a[i][j] = new Array();

				k=-1;

			}

		}

	}  

} 

 



   

}



function relate2(formName,elementNum,j,fromRelate,str1) {

if(v){

massiv3d(str1);



var formNum = getFormNum(formName);

 if (formNum>=0) {

	// find first menu's selection

	// fromRelate means "coming from relate function?" 

	//   then increment formNum so k refers to first form, 

	//   not the nonexistent one before it (-1)

	if (fromRelate) formNum++; // assumes forms follow each other 

	k = document.forms[formNum-1].elements[elementNum].selectedIndex;

	if(k<0)k=0; // precaution against missing selected in first menu list - abk

	formNum++; // reference next form, assume it follows in HTML

	with (document.forms[formNum].elements[elementNum]) {

		for(i=options.length-1;i>0;i--) options[i] = null; // null out in reverse order (bug workarnd)

		for(i=0;i<a[k][j].length;i++){

			options[i] = new Option(a[k][j][i].text,a[k][j][i].value); 

		}

		options[0].selected = true;

	}

 }

} else {

jmp(formName,elementNum);

}

}





function IEsetup(){

	if(!document.all) return;

	IE5 = navigator.appVersion.indexOf("5.")!=-1;

	if(!IE5) {

		for (i=0;i<document.forms.length;i++) {

			document.forms[i].reset();

		}

	}

}



window.onload = IEsetup;




var resId=0;
var imgWndw;

function imgOpen(imgLink,Title) {
    if (typeof(window.resizeBy)=='undefined') return true;
    imgWndw=window.open('',imgLink.target,'width=100,height=100'+
        ',toolbar=no,menubar=no,location=no,status=no,'+
        'resizable=yes,scrollbars=no,left='+(screen.width>>>1)+
        ',top='+(screen.height>>>4));
    self.focus();
    var imgTitle=(Title)?Title:imgLink.href;
    with (imgWndw.document){
        open();
        write('<ht'+'ml><he'+'ad><ti'+'tle>'+imgTitle+'</ti'+'tle>'+
        '</he'+'ad><bo'+'dy leftmargin="0" topmargin="0" '+
        'rightmargin="0" bottommargin="0" marginwidth="0" '+
        'style="margin:0;padding:0;position:fixed;overflow:none;" '+
        'marginheight="0"><img src="'+imgLink.href+'" border="0" '+
        ' alt="'+imgTitle+'" title="'+imgTitle+'" class="r" /></bo'+
        'dy></ht'+'ml>');
        close();
    }
    resId=setInterval('imgResize()',100);
    return false
}

function imgResize() {
    var w=imgWndw.document.images[0].width;
    if (w>screen.availWidth) w=screen.availWidth;
    var h=imgWndw.document.images[0].height;
    if (h>screen.availHeight) h=screen.availHeight;
    if (w>50 && h>50) {
        var ww=(imgWndw.innerWidth)?imgWndw.innerWidth:((document.body)?
            imgWndw.document.body.clientWidth:null);
        var wh=(imgWndw.innerHeight)?imgWndw.innerHeight:((document.body)?
            imgWndw.document.body.clientHeight:null);
        if (ww && wh) {
            imgWndw.resizeBy(w-ww,h-wh);
        }
        imgWndw.focus();
        clearInterval(resId)
    }
}

