function showDiv(divId) {
   var div = document.getElementById(divId);
   if (div) {
      div.style.display = '';
      div.style.visibility = 'visible';
   }
}
function hideDiv(divId) {
   var div = document.getElementById(divId);
   if (div) {
      div.style.display = 'none';
      div.style.visibility = 'hidden';
   }
}
function trimStr(str) {
   if(str == undefined || str == null) return '';
   return str.replace(/^\s+|\s+$/g,"");
}

function loadBanner(url, bid, exactMatch, pg){
   var ifr = document.getElementById('advertpro');
   if(ifr == undefined || ifr == null) return;
    url = escape(url);
    url = url.replace(/&amp;/g, '&');
    url = url.replace(/%3F/g, '?');
    url = url.replace(/%3D/g, '=');
	ifr.src = url;

    setTimeout(checkBanner, 500);
	var count = 10;
	function checkBanner() {
		var badi = ifr.contentWindow.document.body;
		if (badi != null && badi.childNodes != null && badi.childNodes.length > 0) {
            if(!pg) {
			    ifr.style.display = 'block';
            }
			if (bid == 0) {
                ifr.style.paddingTop = "20px";
				ifr.height = "250px";
                ifr.width = "250px";
            } else if(bid == 1) {
// arama sonuc sayfalari
                ifr.style.marginLeft = "20px";
                if(exactMatch) {
                    ifr.style.marginTop = "40px";
                }
                if(pg){
                    ifr.style.visibility = "hidden";
                    ifr.style.display = "none";
                }
                ifr.height = "600px";
                ifr.width = "160px";
            } else if (bid == 2) {
// mesaj kutusu
                ifr.style.marginLeft = "10px";
                ifr.height = "600px";
                ifr.width = "160px";
            } else if(bid == 3) {
// mesaj okuma sayfasi
                ifr.height = "600px";
                ifr.width = "160px";
            } else if(bid == 4) {
                ifr.height = "250px";
                ifr.width = "300px";
            } else if(bid == 5) {
                ifr.height = "250px";
                ifr.width = "300px";
            } else if(bid == 6) {
// goz kirpmalar
                if(exactMatch) {
                    ifr.style.marginTop = "40px";
                }
                if(pg){
                    ifr.style.visibility = "hidden";
                    ifr.style.display = "none";
                }
                ifr.height = "600px";
                ifr.width = "160px";
            }
			ifr.style.overflow = "hidden";
			badi.style.backgroundColor = "#F0F0F0";
		}
		else {
			count--;
			if (count > 0)
				setTimeout(checkBanner, 500);
		}
	}

}

function displayProfileInPopup(userId) {
   window.open('/popup/' + userId, 'profile' + userId, 'height=600, width=900, left=0, top=0, scrollbars=1, resizable=yes');
   return false;
}

function pictureFolder(userid) {
   var n = Math.floor(userid / 1000)+1;
   return n + '/' + userid;
}
