// JavaScript Document


function winstat(w) {window.status = 'go to' + w; return true;}

function clearstat(){window.status='';}

function google_ad_request_done(google_ads) {  
	// Number companies was set in calling script !!!!!!!!!!!!! as max
	// google_info.feedback_url                    - google URL
	// google_ads[i].line1                         - company name
	// google_ads[i].line2 and google_ads[i].line3 - company description
	// google_ads[i].visible_url                   - company URL
	var first_ad_unit = '', second_ad_unit='', third_ad_unit='', goog_ad='', goog_url='', ad_order='';
	if (google_ads.length > 0) {
		var end_g_a = (google_ads.length > 6 )?6:google_ads.length;
		for(var i = 0; i < end_g_a; ++i) {
			if (google_ads[i].type == 'text') {
				ad_order = '<div class="div_google_part">';	
				if (i == 0 || i == 3)
					goog_url = '<a class="google_title" href=\"' + google_info.feedback_url + '\">Ads by Google</a><br><br>';
				else
					goog_url = '';
					
				goog_ad = ad_order + goog_url +
				'<a href="' + google_ads[i].url + '" onMouseOver="javascript:window.status=\'go to ' + google_ads[i].visible_url +'\';return true;" onMouseOut="window.status=\'\';return true;">' +
				google_ads[i].line1 + '</a><br>'+
				'<div class="google_info_link">' +
				google_ads[i].line2 + 
				google_ads[i].line3 + 
				'</div>'+
				'<a href="' + google_ads[i].url + '" onMouseOver="javascript:window.status=\'go to ' + google_ads[i].visible_url +'\';return true;" onMouseOut="window.status=\'\';return true;">' +				
				 google_ads[i].visible_url + '</a>'+
				'</div>';
			} // end if text 
			if (i<3) { first_ad_unit +=  goog_ad;}
			else {second_ad_unit += goog_ad; }
		}     // end for
		
		var third_ad_unit = '<a class=\"google_title_abs\" href=\"' + google_info.feedback_url + '\">Ads by Google</a><br>';
		var startPos = google_ads.length - 4;
		if(startPos > 0){
			for(var i = startPos; i < google_ads.length; ++i) {
				if (google_ads[i].type == 'text') {
					var vis_url = (google_ads[i].visible_url.length > 20)? google_ads[i].visible_url.substr(0,20)+"...":google_ads[i].visible_url;
					third_ad_unit = third_ad_unit +
					'<a href="' + google_ads[i].url + '" onMouseOver="javascript:window.status=\'go to ' + google_ads[i].visible_url +'\';return true;" onMouseOut="window.status=\'\';return true;">' +
					google_ads[i].line1 + '</a><br>'+
					'<div class="google_info_link">' +
					google_ads[i].line2 + 
					google_ads[i].line3 + 
					'</div>'+
					'<a class=\"google_link_smoll\" href="' + google_ads[i].url + '" onMouseOver="javascript:window.status=\'go to ' + google_ads[i].visible_url +'\';return true;" onMouseOut="window.status=\'\';return true;">' +				
					 vis_url + '</a>'				
					 if(i < google_ads.length-1)
						third_ad_unit = third_ad_unit + "<hr>"
				}
			}
		}
	}

	if (document.getElementById('ads_unit_mid')){
		document.getElementById('ads_unit_mid').innerHTML += first_ad_unit;
	}
	document.getElementById('ads_unit_bottom').innerHTML += second_ad_unit;
	document.getElementById('ads_unit_side').innerHTML += third_ad_unit;
}
