var randomm = 714025;
var randoma = 4096;
var randomc = 150889;
var acnt	= 1;

function random()
{
	randomseed = (randomseed * randoma + randomc) % randomm;
	return randomseed / randomm;
}
randomseed = Date.parse(new Date()); 
randomNumberAdsNumberXXX = random() + "";
function stripTicks(str)
{
	var s = str;
	while(s.indexOf("'") != -1) {
	s = s.replace("'",""); }
	return s;
}
function get_url() { //el=str, case_sensitive=bool
	var rs="i";
	var urls = document.URL;
	urls = stripTicks(urls);

	var el = "friendID";
	var re = new RegExp( "\\?[\\w\\W]*"+ el +"=([^\\&\\?#]*)", rs);
	var arr = re.exec(urls);
if (!arr) {
	elg = "groupID";
	var red = new RegExp( "\\?[\\w\\W]*"+ elg +"=([^\\&\\?#]*)", rs);
	arr = red.exec(urls);
	}
	if(arr && arr.length>1){	
	return arr[1];
	}else{ 
	var expr = /\/([\w]*)$/i;
	arr = expr.exec(urls);
		if(arr && arr.length>1) {
			return arr[1].toLowerCase(); }
		else {
			return ''; }
	}
}
function oas_ad()
{
	var argv = oas_ad.arguments;
	var friendID = 0;
	var AdTopicID = 0;
	var page = argv[0];
	var pos = argv[1];
	var pxsize = '';

	if(argv.length ==3){
		AdTopicID = argv[2];
	}
	
	subd = 'deSB';

	re_ex = /,/;
	
	temp_flag = 0;
	if(re_ex.test(page)){
		site_arr = page.split(",");
		page = site_arr[1];
	}
	
	switch (pos)
	{
		case 'Frame1':
			friendID = get_url();
			pxsize = 'width=728 height=90';
			pos = 'leaderboard';
			subd = 'deLB';
			break;
		case 'Top':
			pxsize = 'width=468 height=60';
			pos = 'banner';
			subd = 'deBR';
			break;
		case 'x08':
			pxsize = 'width=430 height=600';
			pos = 'halfpage';
			subd = 'deHP';
			break;
		case 'x14':
			pxsize = 'width=300 height=300';
			pos = 'mrec';
			subd = 'deMR';
			break;
		case 'x15':
			pxsize = 'width=160 height=600';
			pos = 'skyscraper';
			subd = 'deSK';
			break;
		case 'x54': //feature profile
			pxsize = 'width=225 height=170';
			pos = 'profile';
			subd = 'deFP';
			break;
		case 'x54-1': //feature profile small
			pxsize = 'width=200 height=170';
			pos = 'profile';
			subd = 'uhpfp';
			break;
		case 'x55': //feature group
			pxsize = 'width=640 height=280';
			pos = 'group';
			subd = 'deFG';
			break;
		case 'x56':
			pxsize = 'width=460 height=140';
			break;
		case 'x69': // This was added for the anchor man inbox add.
			pxsize = 'width=628 height=288';
			break;
		case 'x77':
			pxsize = 'width=1 height=1';
			pos = '1x1';
			subd = 'deSB';
			break;
		case 'x78': // login page
			pxsize = 'width=750 height=600';
			pos = 'interstitial';
			subd = 'deSB';
			break;
		case 'x85':
			pxsize = 'width=300 height=300';
			break;
		case 'x86':
			pxsize = 'width=465 height=360';
			break;
		case 'x87':
			pxsize = 'width=463 height=400';
			break;
		case 'x88':
			pxsize = 'width=440 height=140';
			pos = 'featuredband';
			subd = 'deFB';
			break;
		case 'fspecial':
			pxsize = 'width=440 height=140';
			pos = 'fspecial';
			subd = 'deSB';
			break;
		case 'featblg':
			pxsize = 'width=500 height=100';
			pos = 'featblg';
			subd = 'deSB';
			break;
		case 'uhpfp': //uhp feature profile
			pxsize = 'width=200 height=170';
			pos = 'uhpfp';
			subd = 'deFP';
			break;
		case 'west':
			pxsize = 'width=440 height=160';
			pos = 'west';
			subd = 'deWB';
			break;
		case 'east':
			pxsize = 'width=300 height=100';
			pos = 'east';
			subd = 'deEB';
			break;
		case 'featvid':
			pxsize = 'width=300 height=170';
			pos = 'featvid';
			subd = 'deFV';
			break;
		case 'movpro':
			pxsize = 'width=300 height=250';
			pos = 'movpro';
			subd = 'deMP';
			break;
		case 'fmovl':
			pxsize = 'width=229 height=216';
			pos = 'fmovl';
			subd = 'deFML';
			break;
		case 'fmovr':
			pxsize = 'width=229 height=216';
			pos = 'fmovr';
			subd = 'deFMR';
			break;
		case 'vrec':
			pxsize = 'width=240 height=400';
			pos = 'vrec';
			subd = 'deVR';
			break;
		default:
			pxsize = 'width=468 height=60';
			pos = 'test';
			break;
	}

	var rand = randomNumberAdsNumberXXX.substring(2,11);
	
	if(friendID){
		friendID = "&friendid="+friendID;
	}
	
	if(AdTopicID){
		AdTopicID = "&category="+AdTopicID;
	}
	
	document.getElementById("teazer").innerHTML = ("<IFRAME " + pxsize + " style=\"position:relative;z-index:10000\" MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no src='http://"+subd+".myspace.com/html.ng/site=myspace&position="+pos+"&page="+page+"&rand="+rand+friendID+AdTopicID+"&acnt="+acnt+"'></iframe>");
	acnt = acnt + 1;

}
