/* --- common utils --- */

var utilVars={projName:'rx-partners'}, psWWWrsid;

function openSupportWindow(){ showWindow('support_window','/out/?id=live_support_url',500,560); }

function showCertificate(u){
	u=u||'out.php?id=certificates_url';
	showWindow('cert_window',u,500,350);
}
function showSpecialOffer(u){
	u=u||'out.php?id=special_offer_url';
	showWindow('spo_window',u,620,620);
}
function showWindow(id,u,w,h){
	if(!utilVars[id] || utilVars[id].closed){
		utilVars[id]=popItUp(u,id,w,h);
	}
	utilVars[id].focus();
}
function popItUp(u,n,w,h){
	var l=(screen.availWidth  - w) / 2, t=(screen.availHeight - h) / 2
	,op='toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+w+',height='+h+',left='+l+',top='+t
	,n=n||'_blank';
	return window.open(u,n,op);
}
function reloadImageCode(){
	var img=document.getElementById('vcode_img');
	if(!utilVars.imgCodeUrl) utilVars.imgCodeUrl=img.src;
	img.src=utilVars.imgCodeUrl+'?'+Math.random();
}
function makeBookmark(linkElement) {
	var url='http://'+document.location.host+'/';
	var title= document.title;
    
	if (window.sidebar)
		window.sidebar.addPanel(title, url, "");
	else if (window.external)
		window.external.AddFavorite(url, title);
	else if (window.opera) {
		linkElement.href=url;
        linkElement.title=title;
        linkElement.rel='sidebar';
		return;
	}
    
	return false;
}
