var adPositions = new Array();

// Write out the placeholder <div> and add an entry to the adPositions array to indicate that this ad position is present on the current page
var writeAdDiv = function(name, style) {
    // Write the placeholder <div>
    document.write('<div id="'+name+'" style="width:0;height:0;display:inline;"></div>');
    // Add an item to the adPositions array
    adPositions[name] = [name, style];
}

var OpenX_positionDivs = function() {
	$(function(){
		for (var zoneName in adPositions) {
			var offScreenZoneName = adPositions[zoneName][0] + '-Hidden';
			targetZoneDivID = $('#' + zoneName);
			sourceZoneDivID = $('#' + offScreenZoneName);
			if ((targetZoneDivID != null) && (sourceZoneDivID != null)) {
				var target_cords = targetZoneDivID.offset();
				var top = target_cords.top;
				if (target_cords.top < 0) {
					top = 0;
				}
				var left = target_cords.left;
				if (target_cords.left < 0) {
					left = 0;
				}
				sourceZoneDivID.attr('style', 'top:' + top + 'px;left:' + left + 'px;' + adPositions[zoneName][1]);
				targetZoneDivID.remove();
			}
		}
	});
}



