I'm having trouble passing query_enc var value from first <script> tag to second <script> tag src
here is my code - 
<script>
var query_enc = "";
var query = "%inputParams.query%";
if !( stringStartsWith(query, "%" && stringEndsWith(query, "%")
{  
query_enc = encodeURIComponent(query);
}
buildUrl(query_enc);
</script>
<script src="http://keyword.monfuel.com/sponsored.js?q='+query_enc+'&url=%inputParams.clientSiteUrl%&height=250&sp1=sitefuel&sp2=Latestmotorcyceles&sp3=BB&padding=7"></script>
this is the result
<script src="http://keyword.monfuel.com/sponsored.js?q=**'+query_enc+'**&url=http://latestmotorcycles.com/&height=250&sp1=sitefuel&sp2=Latestmotorcyceles&sp3=BB&padding=7"></script>
 
    