function existsRectangle(ad_id) {
    var existsTest = new RegExp(ad_id, 'i');
	var exists = existsTest.test(window.soi_adtrace);
	
	//alert ("exists -"+ad_id+": "+exists);
	
	var fallback;
	
	if (exists == true) {
		var fallbackTest = new RegExp(ad_id + '.+Fallback', 'i');
		fallback = fallbackTest.test(window.soi_adtrace);
	}
	
	//alert ("fallback  - "+ad_id+": "+fallback);
	
	if (exists == true && fallback == true) return false;
	if (exists == true && fallback == false) return true;
	if (exists == false) return false;
}

function AdCloseParentContainer (id) {
	if (document.getElementById(id)) {
	el = document.getElementById(id).parentNode;
	//alert (el.attributes[1].nodeValue);
	el.style.display = "none";
	}
	
}

function showAdMarker (id) {
	document.getElementById(id).style.display = "";
}

function moveAd(id)
{
	var source_element = document.getElementById('source_' + id);
	var target_element = document.getElementById('target_' + id);

	if (!source_element || !target_element) return;
	
	var target_parent = target_element.parentNode;

	target_parent.replaceChild(source_element, target_element);
	source_element.style.display = source_element.tagName.toLowerCase() == 'div' ? 'block' : 'inline';
}



