
function getLastDoc(){if(curr_doc=="search_results"){return"search_results";}else if(curr_doc=="journal_results"){return"journal_results";}else{if(pub_loaded=="Bulletins"){return curr_doc.split("_")[3]+"_contents";}else if(pub_loaded=="Campaign"){return curr_doc.split("_")[2]+"_contents";}else{if(curr_doc.match(/Bulletins/)){return curr_doc.split("_")[3]+"_contents";}else if(curr_doc.match(/Campaign/)){return curr_doc.split("_")[2]+"_contents";}else{if(curr_doc.match(/sch/)){return curr_doc.split("_")[3]+"_contents";}else{return curr_doc.split("_")[1]+"_contents";}}}}}
function showLoader(){if($("loading").style.top==""){var view_port=document.viewport.getDimensions();var load_height=parseInt(view_port.height/3);$("loading").style.top=load_height+"px";var load_width=parseInt(view_port.width/3);$("loading").style.left=load_width+"px";$("disable").show();$("loading").style.visibility="";}else{$("disable").show();$("loading").style.visibility="";}}
function hideLoader(){$("loading").style.visibility="hidden";$("disable").hide();}
function searchMake(url,year){$('DivMake').innerHTML='Loading .... Please wait';var LanguageOption=$('lang_code').value;var data='&Language='+LanguageOption+'&SelectYear='+year;new Ajax.Request(url,{method:'post',parameters:data,onSuccess:updateMake,onFailure:function(transport){alert("There was a problem with the request.");}});}
function updateMake(request){$('DivMake').innerHTML=request.responseText;}
function searchModel(url,maker){$('DivModel').innerHTML='Loading .... Please wait';var LanguageOption=$('lang_code').value;var SelectYear=$('SelectYear').value;var data='&Language='+LanguageOption+'&SelectYear='+SelectYear+'&SelectMake='+maker;new Ajax.Request(url,{method:'post',parameters:data,onSuccess:updateModel,onFailure:function(transport){alert("There was a problem with the request.");}});}
function updateModel(request){$('DivModel').innerHTML=request.responseText;}
function searchPubs(url,vehicle){$('DivPubs').innerHTML='Loading .... Please wait';var LanguageOption=$('lang_code').value;var SelectYear=$('SelectYear').value;var data='&Language='+LanguageOption+'&SelectYear='+SelectYear+'&SelectVehicle='+vehicle;new Ajax.Request(url,{method:'post',parameters:data,onSuccess:updatePubs,onFailure:function(transport){alert("There was a problem with the request.");}});}
function updatePubs(request){$('DivPubs').innerHTML=request.responseText;try{pub_dialog.updateWidth(null);pub_dialog.updateHeight();pub_dialog.showCenter();var curr_size=pub_dialog.getSize();var viewport=screen.height;if(curr_size.height>=(viewport*.70)){document.body.focus();pub_dialog.setSize(curr_size.width,(viewport*.70));pub_dialog.showCenter();}}catch(e){if(!request.responseText.match(/store\/category\=1/)){$("survey_box").hide();var newHeight=parseInt($("DivPubs").getDimensions().height+40);if(newHeight<250){$("front_header").setStyle({height:"250px"});}else{$("front_header").setStyle({height:newHeight+"px"});}
if(!browser.match(/MSIE 6\.0/)){$$(".front_tab").each(function(s,index){var offsetHeight=newHeight-250;if(offsetHeight>0){s.setStyle({marginTop:offsetHeight+"px"});}else{s.setStyle({marginTop:"0px"});}});$$(".front_tab_active").each(function(s,index){var offsetHeight=newHeight-250;if(offsetHeight>0){s.setStyle({marginTop:offsetHeight+"px"});}else{s.setStyle({marginTop:"0px"});}});}}}}
function getReturnData(transport){var returnData=new Object();var responseArray=transport.responseXML.getElementsByTagName("RETURN_DATA");var dataFound=0;for(i=0;i<responseArray.length;i++){var thisChild=responseArray[i].firstChild;while(thisChild!=null){try{if(thisChild.nodeValue.match(/^\s+$/)){thisChild=thisChild.nextSibling;if(thisChild==null){break;}else{var thisVal=thisChild.textContent;}}else{var thisVal=thisChild.textContent;}}catch(e){var thisVal=thisChild.firstChild.nodeValue;}
returnData[thisChild.nodeName.toLowerCase()]=thisVal;dataFound++;thisChild=thisChild.nextSibling;}}
returnData["arr_length"]=dataFound;return returnData;}
var prev_width;function collapseTOC(){if($("tree").visible()){$("tree").hide();$("collapse_graphic").src="./graphics/arrow_back.gif";prev_width=$("tree").getDimensions().width;$("tree").style.width="0px";$("collapse").style.left="0px";$("content").style.left="6px";$("result_box").style.left="6px";$("dynamic_results").style.left="6px";var newWidth=parseInt(document.viewport.getDimensions().width)-17;$("content").style.width=newWidth+"px";$("result_box").style.width=newWidth+"px";$("dynamic_results").style.width=newWidth+"px";}else{$("tree").show();$("collapse_graphic").src="./graphics/arrow.gif";$("tree").style.width=prev_width+"px";$("collapse").style.left=prev_width+"px";$("content").style.left=(prev_width+6)+"px";$("result_box").style.left=(prev_width+6)+"px";$("dynamic_results").style.left=(prev_width+6)+"px";var newWidth=parseInt(document.viewport.getDimensions().width)-(prev_width+17);$("content").style.width=newWidth+"px";$("result_box").style.width=newWidth+"px";$("dynamic_results").style.width=newWidth+"px";}}
function validatePub(){if($("year").value==""){alert("Please select a year.");return false;}
if($("make").value==""){alert("Please select a make.");return false;}
if($("model").value==""){alert("Please select a model.");return false;}
if($("pubSelected").value==""){alert("Please select a publication.");return false;}
return true;}
function resetPub(){$("DivPubs").innerHTML="";try{$("survey_box").show();$("front_header").setStyle({height:"250px"});$$(".front_tab").each(function(s,index){s.setStyle({marginTop:"0px"});});$$(".front_tab_active").each(function(s,index){s.setStyle({marginTop:"0px"});});}catch(e){}
$("SelectModel").value="NA";$("SelectModel").disabled=true;$("SelectMake").value="NA";$("SelectMake").disabled=true;$("SelectYear").value="NA";}
function loadDebug(){$("debug").style.top=(document.viewport.getDimensions().width/4)+"px";$("debug").style.left=(document.viewport.getDimensions().width/3)+"px";$("debug").show();new Draggable("debug");}
function showDebug(format){var formats=new Array("sgml","html","variable");for(i=0;i<formats.length;i++){if(format==formats[i]){$("debug_"+formats[i]).className="tab_active";$("debug_"+formats[i]).onmouseover=function(){return false;}
$("debug_"+formats[i]).onmouseout=function(){return false;}
$("debug_"+formats[i]+"_text").show();}else{$("debug_"+formats[i]).onmouseover=function(){this.className="tab_hover";};$("debug_"+formats[i]).onmouseout=function(){this.className="tab";};$("debug_"+formats[i]).className="tab";$("debug_"+formats[i]+"_text").hide();}}}