var sUrl = 'http://static.px24.com/promotion/cornerads/';
var pUrl = 'http://webmaster.px24.com/promotion/';
var cUrl = pUrl + 'webm_corneradsclick.php?wmid='+wmid+'&pp='+pp+'&lang='+lang;
var cornerIMG = [{img:'01.gif',height:153,width:86},{img:'02.gif',height:120,width:110},{img:'03.gif',height:115,width:106},{img:'04.gif',height:120,width:81},{img:'05.gif',height:121,width:134},{img:'06.gif',height:129,width:96},{img:'07.gif',height:98,width:85},{img:'08.gif',height:84,width:72},{img:'09.gif',height:105,width:103},{img:'10.gif',height:118,width:89},{img:'11.gif',height:120,width:111},{img:'12.gif',height:112,width:101},{img:'13.gif',height:127,width:105},{img:'14.gif',height:150,width:108},{img:'15.gif',height:121,width:93},{img:'16.gif',height:122,width:88},{img:'17.gif',height:114,width:110},{img:'18.gif',height:121,width:134},{img:'19.gif',height:121,width:134},{img:'20.gif',height:121,width:134},{img:'21.gif',height:133,width:99},{img:'22.gif',height:111,width:78},{img:'23.gif',height:120,width:111},{img:'24.gif',height:120,width:81},{img:'25.gif',height:129,width:96},{img:'26.gif',height:129,width:96},{img:'27.gif',height:129,width:96}];
var corner = corners.split('|');

var index = rand(corner.length);

switch(position){
  case 'TL': position = 'top:0px;left:0px;';  break;
  case 'TR': position = 'top:0px;right:0px;';  break;
  case 'BL': position = 'bottom:0px;left:0px;';  break;
  case 'BR': position = 'bottom:0px;right:0px;';  break;
  default: position = 'top:0px;left:0px;';  break;
}
switch (target){
  case 'b':
  case 'B': target = '_blank';  break;
  case 's':
  case 'S': target = '_self';  break;
  default: target = '_blank';  break;
}

var htmlCode = '<div style="'+position+'position:absolute;width:' + cornerIMG[corner[index]].width + 'px;height:'+cornerIMG[corner[index]].height + 'px;border: 0px solid #000000;"><a href="' + cUrl + '" target ="'+ target +'" title=""><img src="' + sUrl + cornerIMG[corner[index]].img + '" alt="" border="0"></a></div>';

document.write(htmlCode);

function rand(num){
   return (Math.floor(Math.random() * num));
}
