var NumRnd, mynum;
NumRnd = Math.round(Math.random() * 100);
ad = new Array(10);
url = new Array(10);
// Define each image and url

i = 0;

ad[1-1] = "/story_picture/m/01277_001.gif";
url[1-1] = "http://mobilemagic.sanook.com/ringtone/search.php?contentDescription=2NE1&adsID=0188";
i++;

ad[2-1] = "/story_picture/m/01276_001.gif";
url[2-1] = "http://mobilemagic.sanook.com/sms/politic/";
i++;

ad[3-1] = "/story_picture/m/01275_001.gif";
url[3-1] = "http://mobilemagic.sanook.com/sms/gossip/";
i++;

ad[4-1] = "/story_picture/m/01274_001.gif";
url[4-1] = "http://mobilemagic.sanook.com/sms/stocks/";
i++;

ad[5-1] = "/story_picture/m/01273_001.gif";
url[5-1] = "http://shop.mobilemagic.sanook.com/d/index/848585/0188/";
i++;

ad[6-1] = "/story_picture/m/01272_001.gif";
url[6-1] = "http://mobilemagic.sanook.com/ringtone/search.php?adsID=0188&contentName=&contentDescription=%E0%BE%C5%A7%BB%C3%D0%A1%CD%BA%C5%D0%A4%C3%CA%D9%B5%C3%E0%CA%B9%E8%CB%D2&defaultCatalogID=&groupID=&x=20&y=10";
i++;

ad[7-1] = "/story_picture/m/01271_001.gif";
url[7-1] = "http://mobilemagic.sanook.com/mobilegame/index.php?adsID=0188";
i++;

ad[8-1] = "/story_picture/m/01267_001.gif";
url[8-1] = "http://mobilemagic.sanook.com/activity/bigcampaign";
i++;

ad[9-1] = "/story_picture/m/01249_001.gif";
url[9-1] = "http://mobilemagic.sanook.com/ringtone/search.php?contentDescription=OST.%C3%B6%E4%BF%BF%E9%D2%C1%D2%CB%D2%B9%D0%E0%B8%CD&adsID=0188";
i++;

ad[10-1] = "/story_picture/m/01220_001.gif";
url[10-1] = "http://mobilemagic.sanook.com/ringtone/search.php?adsID=1004&contentName=&contentDescription=OST.Boys+Over+Flower&defaultCatalogID=&groupID=&x=11&y=12&adsID=0188";
i++;


mynum = NumRnd % i;
if (ad[mynum].indexOf('.swf') != -1) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="728" height="90">');
document.write('<param name="movie" value="' +ad[mynum]+ '">');
document.write('<param name="quality" value="high">');
document.write('<embed src="' +ad[mynum]+ '" width="728" height="90" vspace="5" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></object>');
}
else {
document.write('<a href="' +url[mynum]+ '" target="_blank"><img src="' +ad[mynum]+ '" border="0" width="728" height="90"></a>');
}
