fixed it
if (<?php echo $relation_type?> == 1)
{
window.onload = function()
{
var x = document.getElementsByClassName("company");
for (var i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
}
}
else if (<?php echo $relation_type?> == 0)
{
window.onload = function()
{
var x = document.getElementsByClassName("company");
for (var i = 0; i < x.length; i++) {
x[i].style.display = "";
}
}
}
CLICK HERE to find out more related problems solutions.