function start(){

//extract query string
var q = document.location.search; 
var q = q.split("?");
var q = q[1];
if(q){
var q2 = q.split("=");
var remote_id = parseInt(q2[1]); //convert string to int
var t ="artist_"+remote_id; 
} // end check if query

new Ajax.Request('scripts/aj_artistmenu.php', {
  method: 'post', 
  onSuccess: function(transport) {
  var zzz = transport.responseText;
  var zz = zzz.split("|||");
  
  $('menu2').update(zz[1]);
  if (remote_id) { 
  selectartist(remote_id);
  } else {
    selectartist(zz[0]);
  }
  
  }
  });
  

}





function selectartist(artistID){
if($('subcontent'))$('subcontent').update("");
$$('div.selected_artist').invoke('removeClassName','selected_artist');

var cc = "artist_"+artistID;
var selectedDIV=$(cc);

selectedDIV.addClassName('selected_artist');

new Ajax.Request('scripts/aj_artistsubmenu.php', {
  method: 'post', parameters : { artistID: artistID },
  onSuccess: function(transport) {
  var zzz = transport.responseText;
  $('headcontent').update(zzz);
  if (remote_id) { 
  selectartist(remote_id);
  }
  
  }
  });

}



function getcontent(what,artistID) { 

$$('span.selected_menu').invoke('removeClassName','selected_menu');
var vv = "menu_"+what;
var rel = $(vv);
rel.addClassName('selected_menu');

new Ajax.Request('scripts/aj_artistcontent.php', {
  method: 'post', parameters : { sel_content: what, artist_id: artistID },
  onSuccess: function(transport) {
  var zzz = transport.responseText;
 
 $('subcontent').update(zzz);
  if (remote_id) {  selectartist(remote_id); }
  
  }
  });
}






function nextImage(){
if(zzz[bilder+4]) bilder = bilder + 4;
else bilder = 0;

$("phototitle").update(zzz[bilder]+"<br />"+zzz[bilder+1]);
$("photocredit").update(zzz[bilder+2]);
$("photo").update(zzz[bilder+3]);
}



function prevImage(){
if(zzz[bilder-4]) bilder = bilder - 4;
else bilder =zzz.length-4;

$("phototitle").update(zzz[bilder]+"<br />"+zzz[bilder+1]);
$("photocredit").update(zzz[bilder+2]);
$("photo").update(zzz[bilder+3]);
}


bilder = 0;




function getcontentimages(what,artistID) { 
$('subcontent').innerHTML="<br /><table border='0' width='100%' cellspacing='0' cellpadding='0'><tr><td id='phototitle'>&nbsp;</td><td style='text-align:right'><a href='javascript:void(0);' onclick='prevImage();' class='artistpicpfeil'>&lt;</a> &nbsp; <a href='javascript:void(0);' onclick='nextImage();' class='artistpicpfeil'>&gt;</a></td></tr><tr><td colspan='2' id='photo'>&nbsp;</td></tr><tr><td height='60'>&nbsp;</td><td id='photocredit' style='text-align:right;'>&nbsp;</td></tr></table>";


$$('span.selected_menu').invoke('removeClassName','selected_menu');
var vvv = "menu_"+what;
var rel = $(vvv);
rel.addClassName('selected_menu');

new Ajax.Request('scripts/aj_artistcontent.php', {
  method: 'post', parameters : { sel_content: what, artist_id: artistID },
  onSuccess: function(transport) {
 
zzz = transport.responseText.evalJSON();



$("phototitle").update(zzz[0]+"<br />"+zzz[1]);
$("photocredit").update(zzz[2]);
$("photo").update(zzz[3]);


if (remote_id) {  selectartist(remote_id); }

 
  }
  });

}


