Hmm, I just noticed something that might be a cause of this. See that in version 5 code you have:
Code:
backgroundColor="#ffffff" foregroundColor="#808080" highliteColor="#fea804"
and in version 4:
Code:
backgroundColor="ffffff" foregroundColor="808080" highliteColor="fea804"
"#" is added in version 5. I think that might be the issue here.
As if you check the page output with version 5 code you can see that there is an empty definition for :
Code:
.AG_classic_centered_nocaption .ag_imageThumb:hover {
}
but in version 4 you have:
Code:
.AG_classic_centered_nocaption .ag_imageThumb:hover {
background-color: #FEA804;
}
If this is the case it also makes sense why everything is OK when both codes are on one page, because version 4 code adds the correct definition that is picked up by both galleries.
All in all, can you try to remove "#" from version 5 code and check? And I should check why does version 5 creating the code with #
