oldvalue = "";
function passText(passedvalue) {
  if (passedvalue != "") {
    var totalvalue = passedvalue+"\n"+oldvalue;
    document.HubspotForm.itemsbox.value = totalvalue;
    oldvalue = document.HubspotForm.itemsbox.value;
  }
}

function HubSpotFormSpamCheck() {
//alert('about to check for spam');
var id = document.HubspotForm.ContactFormId.value;
//alert(id);
var key = "document.HubspotForm.LeadGen_ContactForm_"+id+"_m0spam_check_key.value";
eval(key);
var sig = '';
for (var x = 0; x< key.length; x++ ) {
sig += key.charCodeAt(x)+13;
}
key2="document.HubspotForm.LeadGen_ContactForm_"+id+"_m0spam_check_sig.value = sig";
eval(key2);
//alert(key2);
var key3="document.HubspotForm.LeadGen_ContactForm_"+id+"_m0spam_check_sig.value";
eval(key3);
// Set the hidden field to contain the user token
var results = document.cookie.match ( '(^|;) ?hubspotutk=([^;]*)(;|$)' );
if (results && results[2]) {
var key4="document.HubspotForm.LeadGen_ContactForm_"+id+"_m0submitter_user_token.value = results[2]";
//alert('key4='+eval(key4));
eval(key4);
} else if (window['hsut']) {
var key5="document.HubspotForm.LeadGen_ContactForm_"+id+"_m0submitter_user_token.value = window['hsut']";
eval(key5);
} 

}

function category (content,sid) {
var getdivid=content;
var showsid=sid;
var getdiv = document.getElementById(getdivid).innerHTML;
document.getElementById(showsid).innerHTML=getdiv;
document.webfeedback.category.value=content;
var id = document.webfeedback.ContactFormId.value;
//alert(id);
var key = "document.webfeedback.LeadGen_ContactForm_"+id+"_m0spam_check_key.value";
eval(key);
var sig = '';
for (var x = 0; x< key.length; x++ ) {
sig += key.charCodeAt(x)+13;
}
key2="document.webfeedback.LeadGen_ContactForm_"+id+"_m0spam_check_sig.value = sig";
eval(key2);
//alert(key2);
var key3="document.webfeedback.LeadGen_ContactForm_"+id+"_m0spam_check_sig.value";
eval(key3);
// Set the hidden field to contain the user token
var results = document.cookie.match ( '(^|;) ?hubspotutk=([^;]*)(;|$)' );
if (results && results[2]) {
var key4="document.webfeedback.LeadGen_ContactForm_"+id+"_m0submitter_user_token.value = results[2]";
//alert('key4='+eval(key4));
eval(key4);
} else if (window['hsut']) {
var key5="document.webfeedback.LeadGen_ContactForm_"+id+"_m0submitter_user_token.value = window['hsut']";
eval(key5);
}

}

function setrating(rating) {
document.webfeedback.siterating.value=rating;
var thisrate=document.webfeedback.siterating.value;
var wording = 'You have rated this site with '+thisrate;
document.getElementById('showrate').innerHTML=wording;
}





function reprintReq(action) {
	var url='http://www.transonic.com/sales-marketing/new/rpc.php?action='+action;
	    http.open('get', url);
	    http.onreadystatechange = handleResponse;
	    http.send(null);
	}

function oememailreqfields(){
var blank="";
var FullName = document.HubspotForm.FullName.value;
if (FullName==blank) {
confirm ("All RED fields are required" )
return false;

}var email=document.HubspotForm.Email.value;
if (email==blank) {
confirm ("All RED fields are required" )
return false;
}
var institution = document.HubspotForm.institution.value;
if (institution==blank) {
confirm ("Please fill in your Institution" )
return false;
}
var dept = document.HubspotForm.dept.value;
if (dept==blank) {
confirm ("Please fill in your Department" )
return false;
}

var emailconfirm=document.HubspotForm.emailconfirm.value;
if (emailconfirm!=email ) {
confirm ("Your Confirm Email does not match your email. Please correct." )
return false;
}
var Country = document.HubspotForm.country.value;
if (Country==blank) {
confirm ("All RED fields are required." )
return false;
}
var Phone = document.HubspotForm.phone.value;
if (Phone==blank) {
confirm ("All RED fields are required" )
return false;
} 
var message = document.HubspotForm.message.value;
if (message==blank) {
confirm ("All RED fields are required. Comments/Message is empty" )
return false;
}
var Country = document.HubspotForm.Country.value;
if (Country==blank) {
confirm ("All RED fields are required." )
return false;
}
HubSpotFormSpamCheck();
}

function ratemailreqfields(){
var blank="";
var FullName = document.HubspotForm.FullName.value;
if (FullName==blank) {
confirm ("Please fill in your Full Name" )
return false;

}var email=document.HubspotForm.Email.value;
if (email==blank) {
confirm ("Please fill in your Work Email" )
return false;
}
var institution = document.HubspotForm.institution.value;
if (institution==blank) {
confirm ("Please fill in your Institution" )
return false;
}
var dept = document.HubspotForm.dept.value;
if (dept==blank) {
confirm ("Please fill in your Department" )
return false;
}

var address = document.HubspotForm.address.value;
if (address==blank) {
confirm ("Please fill in your Work Address" )
return false;
}
var city = document.HubspotForm.city.value;
if (city==blank) {
confirm ("Please fill in your City" )
return false;
}
var state = document.HubspotForm.state.value;
if (state==blank) {
confirm ("Please fill in your State" )
return false;
}
var zip_code = document.HubspotForm.zip_code.value;
if (zip_code==blank) {
confirm ("Please fill in your Zip Code" )
return false;
}
HubSpotFormSpamCheck();
}


function emailreqfields(){
var blank="";
var email=document.HubspotForm.Email.value;
if (email==blank) {
confirm ("All RED fields are required" )
return false;
}
var emailconfirm=document.HubspotForm.emailconfirm.value;
if (emailconfirm!=email ) {
confirm ("Your Confirm Email does not match your email. Please correct." )
return false;
}

var FullName = document.HubspotForm.FullName.value;
if (FullName==blank) {
confirm ("All RED fields are required" )
return false;
}
/* var Phone = document.HubspotForm.phone.value;
if (Phone==blank) {
confirm ("All RED fields are required" )
return false;
} */
var message = document.HubspotForm.message.value;
if (message==blank) {
confirm ("All RED fields are required. Comments/Message is empty" )
return false;
}
var Country = document.HubspotForm.Country.value;
if (Country==blank) {
confirm ("All RED fields are required. Country is empty" )
return false;
}
HubSpotFormSpamCheck();
}


function emailreqfields2(){
var blank="";
var FullName = document.HubspotForm.FullName.value;
if (FullName==blank) {
confirm ("All RED fields are required. Name is empty" )
return false;
}
var email=document.HubspotForm.Email.value;
if (email==blank) {
confirm ("All RED fields are required. Email is empty" )
return false;
}
var emailconfirm=document.HubspotForm.emailconfirm.value;
if (emailconfirm!=email ) {
confirm ("Your Confirm Email does not match your email. Please correct." )
return false;
}

var address = document.HubspotForm.address.value;
if (address==blank) {
confirm ("All RED fields are required. Address is empty" )
return false;
}
 var city = document.HubspotForm.city.value;
if (city==blank) {
confirm ("All RED fields are required. City is empty" )
return false;
} 
 var state = document.HubspotForm.state.value;
if (state==blank) {
confirm ("All RED fields are required. State is empty" )
return false;
} 
 var zip_code = document.HubspotForm.zip_code.value;
if (zip_code==blank) {
confirm ("All RED fields are required. Zip Code is empty" )
return false;
} 
var Country = document.HubspotForm.Country.value;
if (Country==blank) {
confirm ("All RED fields are required. Country is empty" )
return false;
}
HubSpotFormSpamCheck();
}

function emailreqfields3(){
var blank="";
var itemsbox = document.HubspotForm.itemsbox.value;
if (itemsbox==blank) {
confirm ("Please select at least one type of Manual and click Add to list" )
return false;
}
var FullName = document.HubspotForm.FullName.value;
if (FullName==blank) {
confirm ("All RED fields are required. Name is empty" )
return false;
}
var email=document.HubspotForm.Email.value;
if (email==blank) {
confirm ("All RED fields are required. Email is empty" )
return false;
}
var emailconfirm=document.HubspotForm.emailconfirm.value;
if (emailconfirm!=email ) {
confirm ("Your Confirm Email does not match your email. Please correct." )
return false;
}

var address = document.HubspotForm.address.value;
if (address==blank) {
confirm ("All RED fields are required. Address is empty" )
return false;
}
 var city = document.HubspotForm.city.value;
if (city==blank) {
confirm ("All RED fields are required. City is empty" )
return false;
} 
 var state = document.HubspotForm.state.value;
if (state==blank) {
confirm ("All RED fields are required. State is empty" )
return false;
} 
 var zip_code = document.HubspotForm.zip_code.value;
if (zip_code==blank) {
confirm ("All RED fields are required. Zip Code is empty" )
return false;
} 
var Country = document.HubspotForm.Country.value;
if (Country==blank) {
confirm ("All RED fields are required. Country is empty" )
return false;
}
HubSpotFormSpamCheck();
}


function checkphone() {
 var Phone = document.HubspotForm.phone.value;
if (Phone==blank) {
confirm ("All RED fields are required" )
return false;
} 
emailreqfields();
}


function initLayout(){
	var el = document.getElementsByTagName('a');
	if(el.length){
		for(var i=0; i<el.length; i++){
			if (!document.addEventListener && document.attachEvent){
				el[i].attachEvent("focus", function(){ blur(); }, false)
			}else{
				el[i].addEventListener("focus", function(){ blur(); }, false)
			}
		}
	}
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function download(pdf, title) {
var url='/pdfdownload.php?pdf='+pdf+'&title='+title;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function probeReq(action, SearchSpecies, SearchVessel) {
var url='/faqrpc.php?action='+action+'&vessel='+SearchVessel+'&species='+SearchSpecies;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function getcontent (content, divname) {
var getdiv = document.getElementById(content).innerHTML;
document.getElementById(divname).innerHTML=getdiv;
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function closediv (divname) {
var getdivid=divname;
var block ="";
document.getElementById(getdivid).innerHTML=block;
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function giveurl() {
var getdiv = document.getElementById('downloadurl').innerHTML;
document.getElementById('upload').innerHTML=getdiv;
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function createRequestObject() {
 var ro;
 var browser = navigator.appName;
 if(browser == "Microsoft Internet Explorer"){
 ro = new ActiveXObject("Microsoft.XMLHTTP");
 }else{
 ro = new XMLHttpRequest();
 }
 return ro;
}
var http = createRequestObject();

//---------------------------------------------------------------------------------------------------------------------------------------------
function newsReq() {
var blank="";
var email=document.HubspotForm.email.value;
if (email==blank) {
confirm ("Please fill in your email address" )
return false;
}
/* var emailconfirm=document.HubspotForm.emailconfirm.value;
if (emailconfirm!=email ) {
confirm ("Your Confirm Email does not match your email. Please correct." )
return false;
} */
var fname = document.HubspotForm.fname.value;
if (fname==blank) {
confirm ("Please fill in your Name" )
return false;
}
var lname = document.HubspotForm.lname.value;
if (lname==blank) {
confirm ("Please fill in your Name" )
return false;
}
var country = document.HubspotForm.country.value;
if (country==blank) {
confirm ("Please fill in your Country" )
return false;
}
var techarea = document.HubspotForm.techarea.value;
if (techarea==blank) {
confirm ("Please select your Field of Interest" )
return false;
}
HubSpotFormSpamCheck();
}

//------------------------------------------------------------------------------------------------------------------------------------


function workbookReq() {
Alert('working');
var blank="";
var email=document.HubspotForm.email.value;
if (email==blank) {
confirm ("Please fill in your email address" )
return false;
}
var fullname = document.HubspotForm.fullname.value;
if (fullname==blank) {
confirm ("Please fill in your Name" )
return false;
}
var institution = document.HubspotForm.institution.value;
if (institution==blank) {
confirm ("Please fill in your Institution" )
return false;
}
var dept = document.HubspotForm.dept.value;
if (dept==blank) {
confirm ("Please fill in your Department" )
return false;
}
var address = document.HubspotForm.address.value;
if (address==blank) {
confirm ("Please fill in your Work Address" )
return false;
}
var city = document.HubspotForm.city.value;
if (city==blank) {
confirm ("Please fill in your City" )
return false;
}
var state = document.HubspotForm.state.value;
if (state==blank) {
confirm ("Please fill in your State" )
return false;
}
var zip_code = document.HubspotForm.zip_code.value;
if (zip_code==blank) {
confirm ("Please fill in your Zip Code" )
return false;
}
HubSpotFormSpamCheck();
}

//---------------------------------------------------------------Javascript evalReq(action)
function evalReq(action) {
var name=document.askRequest.FullName.value;
var email=document.askRequest.email.value;
var emailconfirm=document.askRequest.emailconfirm.value;
var company=document.askRequest.company.value;
var phone=document.askRequest.phone.value;
var address=document.askRequest.address.value;
var city=document.askRequest.city.value;
var state=document.askRequest.state.value;
var zip=document.askRequest.zip.value;
var comments=document.askRequest.message.value;
if (emailconfirm!=email ) {
confirm ("Your Confirm Email does not match your email. Please correct." )
return false;
}
var url='/faqrpc.php?action='+action+'&name='+name+'&email='+email+'&company='+company+'&phone='+phone+'&address='+address+'&city='+city+'&state='+state+'&zip='+zip+'&comments='+comments;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function snddReq(action) {
var name=document.askquestion.name.value;
var email=document.askquestion.email.value;
var question = document.askquestion.question.value;
var url='/faqrpc.php?action='+action+'&name='+name+'&email='+email+'&question='+question;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function sndReqSales(action) {
var url='/salesrpc.php?action='+action;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function getregs(action, id) {
var url='/docsrpc.php?action='+action+'&id='+id;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}


//---------------------------------------------------------------------------------------------------------------------------------------------

function snd4Req(action) {
var Specialty=document.repsearch.ddlSpecialty.value;
var Country=document.repsearch.ddlCountry.value;
alert(Country);
alert(Specialty);
var url='/faqrpc.php?action='+action+'&ddlSpecialty='+Specialty+'&ddlCountry='+Country;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------

function snd2Req(action) {
var SearchVessel=document.probesearch.SearchVessel.value;
var SearchSpecies=document.probesearch.SearchSpecies.value;
var url='/faqrpc.php?action='+action+'&vessel='+SearchVessel+'&species='+SearchSpecies;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function snd3Req(action) {
var ep =document.pubsearch.ep.value;
var perpage =document.pubsearch.perpage.value;
var documenttitle =document.pubsearch.documenttitle.value;
var species =document.pubsearch.species.value;
var vessel =document.pubsearch.vessel.value;
var author =document.pubsearch.author.value;
var publication =document.pubsearch.publication.value;
var duration =document.pubsearch.duration.value;
var procedure =document.pubsearch.procedure.value;
var probesize =document.pubsearch.probesize.value;
var tranrefprefix =document.pubsearch.tranrefprefix.value;
var tranref =document.pubsearch.tranref.value;
var tranrefsuffix =document.pubsearch.tranrefsuffix.value;
var url='/pubs.php?action='+action+'&ep='+ep+'&perpage='+perpage+'&documenttitle='+documenttitle+'&species='+species+'&vessel='+vessel+'&author='+author+'&publication='+publication+'&duration='+duration+'&procedure='+procedure+'&probesize='+probesize+'&tranrefprefix='+tranrefprefix+'&tranref='+tranref+'&tranrefsuffix='+tranrefsuffix;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function sndPubReq(action, id) {
var url='/pubs.php?action='+action+'&id='+id;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}


//---------------------------------------------------------------------------------------------------------------------------------------------
function sndemailReq(action, email, dist, contactname) {
var url='/faqrpc.php?action='+action+'&email='+email+'&dist='+dist+'&contactname='+contactname;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function webinarReq(action) {
var url='/2010rpc.php?action='+action;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}
//---------------------------------------------------------------------------------------------------------------------------------------------
function playmovie(action) {
var url='/movierpc.php?action='+action;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}


//---------------------------------------------------------------------------------------------------------------------------------------------
function doSearch(action) {
var name=document.search.keyword.value;
var url='/faqrpc2.php?action='+action+'&keyword='+name;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------

function sndeReq(action) {

var Specialty=document.repsearch.ddlSpecialty.value;
var Country=document.repsearch.ddlCountry.value;
var url='http://www.transonic.com/faqrpc.php?action='+action+'&ddlSpecialty='+Specialty+'&ddlCountry='+Country;

 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function sndReq(action) {
var url='/faqrpc.php?action='+action;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
 }
 
 
 //---------------------------------------------------------------------------------------------------------------------------------------------
 function demoReq(action, product) {
 var url='/faqrpc.php?action='+action+'&product='+product;
  http.open('get', url);
  http.onreadystatechange = handleResponse;
  http.send(null);
 }
 
  //---------------------------------------------------------------------------------------------------------------------------------------------
  function manReq(action, product) {
  var url='/faqrpc.php?action='+action+'&product='+product;
   http.open('get', url);
   http.onreadystatechange = handleResponse;
   http.send(null);
 }
 
 //---------------------------------------------------------------------------------------------------------------------------------------------
function sndccReq(action) {
var url='/ccfaqrpc.php?action='+action;
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function handleResponse() {
 if(http.readyState == 4){
 var response = http.responseText;
 var update = new Array();
 if(response.indexOf('|' != -1)) {
 update = response.split('|');
 document.getElementById(update[0]).innerHTML = update[1];
 }
 }
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function F_loadRollover(){} function F_roll(){}
function showans ( divid ) {
var ansid = divid;
var divida = divid+"a";
var ans = document.getElementById(divida).innerHTML;
document.getElementById(ansid).innerHTML=ans;
}

//---------------------------------------------------------------------------------------------------------------------------------------------
function closeans (divid) {
var ans =" ";
document.getElementById(divid).innerHTML=ans;
}


//---------------------------------------------------------------------------------------------------------------------------------------------
function contactReq(action,forme) {
var blank="";
var results = document.cookie.match ( '(^|;) ?hubspotutk=([^;]*)(;|$)' );
alert(results[2]);
var Lead_Src = document.supportform.Lead_Src.value;
alert(Lead_Src);
var fullname = document.supportform.fullname.value;
var email=document.supportform.email.value;
var city = document.supportform.city.value;
var state = document.supportform.state.value;
var zip = document.supportform.zip_code.value;
var phone = document.supportform.phone.value;
var comments = document.supportform.message.value;
var url='/faqrpc.php?action='+action+'&email='+email;
var url = url+'&fullname='+Lead_Src+'&Lead_Src='+fullname+'&city='+city+'&state='+state+'&zip='+zip+'&phone='+phone+'&comments='+comments+'&forme='+forme;
alert(fullname);
alert(url);
 http.open('get', url);
 http.onreadystatechange = handleResponse;
 http.send(null);
}





