function RoadBlocks(p_roadBlocks) {
	this.roadBlocks = p_roadBlocks;
	this.commandRe = /\/pfadx\//;
	this.szRe = /;sz=\d+x\d+;/;
}

RoadBlocks.prototype.setup = function (p_adTag) {
	for (var i=0; i<this.roadBlocks.length; i++) {
		var adTag = p_adTag;
		// replace command
		adTag = adTag.replace(this.commandRe, '/' + this.roadBlocks[i].command + '/');
		// replace size
		adTag = adTag.replace(this.szRe, ';sz=' + this.roadBlocks[i].width + "x" + this.roadBlocks[i].height + ';');
		// store it for sync
		this.roadBlocks[i].adTag = adTag;
	}
}

RoadBlocks.prototype.sync = function (d_dcSeed) {
	for (var i=0; i<this.roadBlocks.length; i++) {
		var adTag = this.roadBlocks[i].adTag;
		// append dc_seed
		if (d_dcSeed) adTag += ";dc_seed=" + d_dcSeed;
		// append ord
		adTag += ";ord=" + Math.floor(Math.random()*Math.pow(10,4)) + "?";
		// update iframe
		$('#'+this.roadBlocks[i].id).attr('src', adTag);
	}
}

var roadBlocks = new RoadBlocks([{id:'minibanner',width:320, height:55, command:'adi'},{id:'skyscraper',width:160, height:600, command:'adi'}]);

