var _comtubeLoaderFx = {};
_comtubeLoaderFx.open_window = function (url, twidth, theight, win_name, opts) 
{
    var twidth = twidth || '300';
    var theight = theight || '280';
    var win_name = win_name || ( 'window_name_' + parseInt(Math.random()*1000) );
    
    var scrollbar = (opts && opts.scrollbar) || 0;
    var resizable = (opts && opts.resizable) || 0;
    
    var screenLeft = Math.floor(Math.abs((screen.availWidth - twidth) / 2));
    var screenTop = Math.floor(Math.abs((screen.availHeight - theight) / 2));
    var ua = navigator.userAgent.toLowerCase();
    var is_opera = /opera/.test(ua);
    
    if (is_opera) screenTop -= (screen.height - screen.availHeight);
    
    var opts_str = 'fullscreen=0, toolbar=0, scrollbars=' + scrollbar + ', directories=0, status=0, menubar=0, resizable=' + resizable + ', width=' + twidth + ', height=' + theight
	             + ', left=' + screenLeft + ', top=' + screenTop;
	   
    var win = window.open(url, win_name, opts_str);
   
	if (typeof(win) == 'object')
	{
    	win.focus();
    	return win;
	}
}

if (typeof(open_window) == 'undefined')
{
    open_window = _comtubeLoaderFx.open_window;
};

function callme_click(in_param, lang, edit_mode)
{
    var win_width = 340;
    var win_height = 250;
    
    var url = "http://www.rent1c.ru";
    
    url += '/webcall/tel.php';

    if (typeof(lang) != 'undefined' && lang && lang.length)
        url += '&lang=' + lang;
        
    if (typeof(edit_mode) != 'undefined')
    {
        url += '&edit_mode=1';
        win_height += 35;
    }
    else
    {
        url = url.replace(/^https/, "http");
    }
    
    //url += '&r=' + escape(document.referrer) + '&u=' + escape(document.URL);
    
    _comtubeLoaderFx.open_window(url, win_width, win_height, 'callme');
}
;

