// суммарный вес текстовых объявлений
var text_inc_weight = 0;
// тексты объявлений и их относительные веса
var text_inc = new Array (
 '<center><table border=0><tr><td valign="top"><g:plusone></g:plusone></td><td><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=172585616146956&amp;xfbml=1"></script><fb:like href="" send="true" width="370" show_faces="false" font=""></fb:like> </td></tr></table></center>', 3000,
 '<b>Hint:</b> Try <a href="/en/bb/">convert-me.com forum</a> where you can discuss your conversion issues and find answers to your questions.', 50,
 '<b>Hint:</b> Click <b>any</b> "convert" button to make conversions, they all act the same.', 20,
 'You can help us make the site better.  Support convert-me.com by <a href="/en/link2us_en.html">linking to our site from yours</a>.', 100,
 'Do you have a blog?  Spread the word about Convert-Me.Com by <a href="/en/link2us_en.html">mentioning our site in your blog</a>.', 100,
 '<b>Hint:</b> By clicking on the name of the unit you can get a list of all conversion factors from this unit to all others.', 30,
 '<b>Hint:</b> Drop-down menu on the top of the page is a quick navigation to other measurement conversion pages.', 30,
 'Your ideas on how to make Convert-Me.Com better are very appreciated! Please use <a href="/en/bb/">convert-me.com forum</a> for your thoughs and feedback.', 20,
 '<b>Hint:</b> Try adjusting "significant figures" option on the top of the page to get either cleaner or more precise figures.', 30,
 '<b>Hint:</b> It might be a good idea to bookmark Convert-Me.Com in your browser, don\'t you think so?', 20,
 '<b>Hint:</b> You can do as many conversions as you need without reloading the page.  Simply enter a new value in the appropriate box and click "Convert" again.', 30,
 '<b>Hint:</b> Do you know that as soon as the conversion page is loaded you don\'t need the Internet connection any more to make conversions? The calculations work offline just fine.', 30,
 '<b>Hint:</b> Tired or banner ads on our site?  <a href="/en/disable_banners_en.html">Switch them off</a>!', 50,
 'Want to know what happens on convert-me.com?  <a href="http://www.facebook.com/pages/Convert-mecom/87754164793?sk=wall">Visit our FaceBook page</a>!', 150,
 '<table border=0 cellpadding=0 cellspacing=0 align="left" style="margin-right:20px"><tr><td><a href="/en/en_gadget.html"><img src="/GG/convert-me-120x60.png" width=120 height=60 style="margin-right:20px; border: solid 1px #666666" alt="Units Conversion Gadget" title="Units Conversion Gadget"></a></td><td><b>Now you can add Units Conversion to your desktop, homepage or blog!</b> Convert-Me.Com gadget is free and easy to install. &nbsp;&nbsp;<a href="/en/en_gadget.html"><b>Read on</b></a>.</td></tr></table>',100,
// '*goadse*', 1000,
 '', 0
);


// вывести рекламное объявление перед n-ным заголовком
function formInc ( n ) {

//	( n == 2 && goSearchFeed() == 0 ) ||
        if( n== 2 || n == 3 || n == 4 || n == 6 || n == 9 || n == 11 ) {
		var r = Math.round(Math.random() * text_inc_weight);
		var r0 = r;
		var i = 0;
		while( i<text_inc.length ) {
			r -= text_inc[i+1];
                	if( r < 0 ) {
                		if( text_inc[i] == '*goadse*' ) {
                			goadse()
                                } else {
                			textInc( text_inc[i] );
                                }
               			text_inc_weight-=text_inc[i+1];
               			text_inc[i+1] = 0;
				break;
                	}
			i+=2;
                }
	}
}

// собственно вывод текстового объявления
function textInc ( txt ) {
	document.write('<tr><td colspan="2"><table width="90%" border="0" cellspacing="0" cellpadding="0" align="center" class="infotable">');
	document.write('<tr><td bgcolor="#666666"><table width="100%" border="0" cellspacing="1" cellpadding="6" class="infoblock">');
	document.write('<tr class="infoblock" align="center" valign="middle"><td class="infoblock">');
	document.write(txt);
	document.write('</td></tr></table></td></tr></table></td></tr>');
}

// вычислим суммарный вес
for( var i=1; i<text_inc.length; i+=2 )
	text_inc_weight += text_inc[i];

// для совместимости
function formAd ( n ) { formInc( n ) }


