D.Biz = {
	pname: null,
	pval: null,
	root:null,
	timeout: null,
	allowsayintegration: false,
	rate:function(v, node, container){
		$.get(D.Biz.root + 'rating/submit/', { rating: v, pn:D.Biz.pname, pv:D.Biz.pval });

	},
	checkExternalUrl:function( el ){
		var node = document.getElementById( 'bizAddExternalPath' );
		var url = el.value.replace( /[^A-Za-z0-9\._-]/g, '' ).toLowerCase();
		node.innerHTML = 'http://' + document.domain + '/' + encodeURIComponent( url );
		node.style.color = '';
		if( D.Biz.timeout ) clearTimeout( D.Biz.timeout );		
		if( empty( url ) ) return false;
		D.Biz.timeout = setTimeout( function(){
			rpc = new RPC( '/say/rq/app.php' );
			rpc.send(
				'checkExternalUrl',
				{
					url:url
				},
				function( re ){
					node.style.color = ( re.exists ? '#C00' : '#0A0' );
					if (D.Biz.allowsayintegration && typeof(existingExtNames[re.url])!== "undefined"){
						node.innerHTML += '<a href="/lapas/?controller=register&action=sayintegration" onclick="InfoBox.open(this.href, {width:600}); return false;" class="infoIcon" style="display: block;float: left;width:16px;height:16px;margin-right:5px;"></a>';
						node.style.color = '#f60';
						document.getElementById('say_uid').value=existingExtNames[re.url];
						return;
					}else{
						try{
							document.getElementById('say_uid').value = 0;
						}catch(e){}
					}
				}
			)
		}, 1000 );
	}
		
		
};