// JavaScript Document

function GetYearValue(){
	
var selectoption=document.form1.elements['select1'].selectedIndex;
var selectoption_value=document.form1.elements['select1'].options[selectoption].text;

var pr_form_year=document.getElementById("prformyear");
var proxypollvalue=pr_form_year.contentWindow.document.form1.year;
proxypollvalue.value=selectoption_value;

SubmitForm();
GetLate();

}// close GetYearValue()


function SubmitForm(){

var pr_form_year=document.getElementById("prformyear");
var prform=pr_form_year.contentWindow.document.form1;
prform.submit();

}// close SubmitForm()

function SubmitFormTwo(){

var pr_form_year=document.getElementById("prformanot");
var prform=pr_form_year.contentWindow.document.form2;
prform.submit();

}// close SubmitForm()

function GetLate(){
	
var late=window.setTimeout("GetRequest()",2000);
	
}//close GetLate()

function GetLateTwo(){
	
var late=window.setTimeout("GetAnotRequest()",2000);
	
}//close GetLate()

function GetRequest(){

var edition=document.form1.elements['select3'];
var anotation=document.form1.elements['select2'];
var btn=document.form1.Submit;

edition.disabled=false;
anotation.disabled=true;
btn.disabled=true;
	
var pr_form_year=document.getElementById("prformyear");
var prformyear_content=pr_form_year.contentWindow.document.getElementsByTagName("p")[0].childNodes[0].nodeValue;

var year_field=document.form1.elements['select1'];
var edition_field=document.form1.elements['select3'];

for(i=0; i<=prformyear_content; i++){
var newoptions=document.createElement('option');
if(i==0){
newoptions.value=0;
newoptions.text='---';
}
else{
newoptions.value=i;
newoptions.text=i;
}
try{
	edition_field.add(newoptions,null);
}

catch(ex){
	edition_field.add(newoptions);	
}

}//close for

pr_form_year.setAttribute("src","pr_form_year.html");

}// close GetRequest()

function ChangeYearValue(){

var edition=document.form1.elements['select3'];
var anotation=document.form1.elements['select2'];
var btn=document.form1.Submit;

edition.disabled=true;
anotation.disabled=true;
btn.disabled=true;

var selectoption=document.form1.elements['select1'];
selectoption.onchange=GetYearValue;
selectoption.onclick=ClearOptions;
//alert(selectoption);

}//close ChangeYearValue()

function ChangeEditionValue(){

var selectoptions=document.form1.elements['select3'];
selectoptions.onchange=GetAnotValue;
selectoptions.onclick=ClearOptionsTwo;
//alert(selectoption);

}//close ChangeEditionValue()

function ChangeAnotValue(){

var selectoptions=document.form1.elements['select2'];
selectoptions.onchange=OnChangeAnotValue;
//alert(selectoption);

}//close ChangeEditionValue()

function ClearOptions(){
	
var edition=document.form1.elements['select3'];
var anotation=document.form1.elements['select2'];
var btn=document.form1.Submit;

edition.disabled=true;
anotation.disabled=true;
btn.disabled=true;
	
var editionoptions=document.form1.elements['select3'];
var editionlength=editionoptions.length;

for(i=1;i<=editionlength;i++){
editionoptions.remove(editionoptions.selectedIndex);
}

var anotoptions=document.form1.elements['select2'];
var anotlength=anotoptions.length;

for(c=1;c<=anotlength;c++){
anotoptions.remove(anotoptions.selectedIndex);
}
//alert(editionlength);

}//close ClearOptions()

function ClearOptionsTwo(){
	
var anotoptions=document.form1.elements['select2'];
var anotlength=anotoptions.length;

for(c=1;c<=anotlength;c++){
anotoptions.remove(anotoptions.selectedIndex);
}

var btn=document.form1.Submit;
btn.disabled=true;

}//close ClearOptions()


function GetAnotValue(){

var selectoption=document.form1.elements['select1'].selectedIndex;
var selectoption_value=document.form1.elements['select1'].options[selectoption].text;

var select_ed_option=document.form1.elements['select3'].selectedIndex;
var select_ed_option_value=document.form1.elements['select3'].options[select_ed_option].text;

var pr_form_anot=document.getElementById("prformanot");
var proxyformvalue=pr_form_anot.contentWindow.document.form2.year;
proxyformvalue.value=selectoption_value;

var proxyform_ed_value=pr_form_anot.contentWindow.document.form2.edition;
proxyform_ed_value.value=select_ed_option_value;

SubmitFormTwo();
GetLateTwo();
	
}//close GetAnotValue()

function GetAnotRequest(){

var edition=document.form1.elements['select3'];
var anotation=document.form1.elements['select2'];
var btn=document.form1.Submit;

edition.disabled=false;
anotation.disabled=false;
btn.disabled=true;
	
var pr_form_anot=document.getElementById("prformanot");
var prformanot_content=pr_form_anot.contentWindow.document.getElementsByTagName("p")[0].childNodes[0].nodeValue;


var anot_field=document.form1.elements['select2'];

for(i=0; i<=prformanot_content; i++){
var newoptions=document.createElement('option');
if(i==0){
newoptions.value=0;
newoptions.text='---';
}
else{
newoptions.value=i;
newoptions.text=i;
}
try{
	anot_field.add(newoptions,null);
}

catch(ex){
	anot_field.add(newoptions);	
}

}//close for

pr_form_anot.setAttribute("src","pr_form_edition.html");

}// close GetRequest()

function OnChangeAnotValue(){
var btn=document.form1.Submit;
btn.disabled=false;
}

