var content_sections=new Array();
var site_name='sri.umusic';
// var dcopt=ist;
var tile_id=1;
var ord=Math.random(100000000000);
var zone=get_zone(location.pathname);
sri_init();

function sri_init(){
  //add the section/zone pairs...
  add_section(content_sections,"",site_name+'/'+'homepage');
  // formed as:			/site/web/<....>				<dart zone>
  add_section(content_sections,"artists",site_name+'/'+'artists');
  add_section(content_sections,"news",site_name+'/'+'news');
  add_section(content_sections,"contests",site_name+'/'+'blogs');
  add_section(content_sections,"blogs",site_name+'/'+'blogs');
  // etc . etc . etc .. (see spreadsheet for full list of dart zones...
}

function add_section(a,p,z){
  if(a==null||a==undefined){return;}
  var o=new Object();
  o.path=p;
  o.zone=z;
  a[a.length]=o;
}

/* begin new function */
function write_advert(w,h){
  if(tile_id==1){
    dcopt_val='dcopt=ist;'
  }
  else{
    dcopt_val='';
  }
  document.write("<sc"+"ript type=\"text/jav"+"ascript\" src=\"http://ad.double"+"click.net/adj/"+zone+";tile="+tile_id+";sz="+w+"x"+h+";"+dcopt_val+"ord="+ord+"?\"><\/scr"+"ipt>");
  tile_id++;
}
/* end new function */

function get_zone(path){
// look at the path and try and find a matching zone
	var z="";
// check for homepage
	if(path=="/"||path=="/index.php"){
		z=find_zone("");
	}
// dissect path
// current umusic uses: /site/web/<path name>
	path=path.replace("/site/web/","");
// find last "/"
	var last=path.indexOf("/");
	if(last>0){
		path=path.substring(0,last);
	}
	z=find_zone(path);

	if(z==""){
		z=find_zone("sitemisc");
	}
	return z;
}

function find_zone(p){
  for(var i=0;i<content_sections.length;i++){
	if(content_sections[i].path==p){
		return content_sections[i].zone;
	}
  }
  return site_name+'/'+'sitemisc';
}
