//last updated 2004-12-03 by sunshine
//modified noBanner to allow flipbook without banner
var now = new Date ();
var seed = now.getTime() % 0xfffffff;
var Ord;
var key="";
var href = window.location.href;
var s = href.split("/");
var sitename = "mtvasia";
var sectname="home";
var iframe=false;
var isHome=false;
var isSponsored=false;
var onlyInhouseAds=false;
var noBanner=false;
var randID = rand(1000000);
randID = Math.floor(randID*87654);


function rand(n) {
	seed = (0x034ff15a4e35 * seed) % 0xfffffff;
	return (seed >> 16) % n;
}

function printf(arg)
{
  var i, pointer = 1
  var format = printf.arguments[0];
  var fromString="%s";
  while( format.indexOf(fromString) != -1){

  	var toTheLeft = format.substring(0, format.indexOf(fromString));
    var toTheRight = format.substring(format.indexOf(fromString)+fromString.length, format.length);
    format = toTheLeft + printf.arguments[pointer] + toTheRight;
    pointer++;
  }
  document.write(format);
}

var query = location.search;
var aValue = query.substring(query.indexOf("=") + 1, query.length);

switch(s[3]){
    case "unilever.html":
    	sectname="test";
    	break;
    case "index.html":
    	 isHome=true;
    	sectname="home";
    	break;
    case "index.htm":
    	isHome=true;
    	sectname="home";
    	break;
    case "":
    	isHome=true;
	sectname="home";
	break;
    case "Singapore.htm":
    	isHome=true;
    	sectname="homesg";
    	break;
    case "Malaysia.htm":
    	isHome=true;
    	sectname="homemy";
    	break;
    case "Philippines.htm":
    	isHome=true;
    	sectname="homeph";
    	break;
    case "Thailand.htm":
    	isHome=true;
    	sectname="hometh";
    	break;
    case "Indonesia.htm":
    	isHome=true;
    	sectname="homeid";
    	break;
    case "News":
		sectname="news";
		break;
    case "Onair":
		sectname="onair";
		break;
    case "Feature":
		sectname="features";
		break;
    case "Review":
		sectname="reviews";
		break;
    case "Video":
		sectname="videos";
		break;
    case "Funstuff":
		sectname="funstuff";
		break;
    case "Mobile":
		sectname="mobile";
		break;
    case "ubbthreads2":
		sectname="funstuff";
		break;
    case "includes":
		sectname=s[4];
		if ((s[4]=="community")&&(s[5]=="ssi_header_ubb_inhouse.html")){
			isSponsored=true;
			onlyInhouseAds=true;
		}
		break;
    case "kswiss":
		sectname="kswiss";
		break;
    case "mma":
		sectname="mma";
		break;
		case "Chat":
		sectname="musicremedy";
		break;
		 case "Movieawards":
		sectname="kidnerbueno";
		break;
		 case "movieawards":
		sectname="kidnerbueno";
		break;
    default:
	sectname="home";
}

	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="UrbanBeats")) {
		sectname="urban";
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="UrbanBeats05")) {
		sectname="urban";
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="MakeADifference")) {
		sectname="nkf";
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="MTVScreenReturnOfTheKing")) {
		sectname="screen";
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="ScoobyDoo2")) {
		sectname="screen";
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="TheArtofMixing")) {
		sectname="artofmixing";
	}
	if ((s[4]=="shows")&&(s[5]=="AsiaAwards2002")) {
		sectname="maa03";
	}
	if ((s[4]=="MTV")&&(s[6]=="0108")&&(s[7]=="0108011.html")) {
		sectname="maa03";
	}
	if ((s[4]=="MTV")&&(s[6]=="0111")&&(s[7]=="0111001.html")) {
		sectname="maa03";
	}
	if ((s[4]=="MTV")&&(s[6]=="0111")&&(s[7]=="0111005.html")) {
		sectname="maa03";
	}
	if ((s[4]=="MTV")&&(s[6]=="0201")) {
		sectname="maa03";
	}
	if ((s[4]=="MTV")&&(s[6]=="0202")&&(s[7]=="0111001.html")) {
		sectname="maa03";
	}
	if ((s[4]=="MTV")&&(s[6]=="0202")&&(s[7]=="0111002.html")) {
		sectname="maa03";
	}
	if ((s[4]=="MTV")&&(s[6]=="0202")&&(s[7]=="0111004.html")) {
		sectname="maa03";
	}
	if ((s[3]=="Partner")&&(s[4]=="SpeakYourMind")) {
		sectname="sym";
	}
	if ((s[4]=="MTV")&&(s[6]=="0201")&&(s[7]=="0201008.html")) {
		sectname="sym";
	}
	if ((s[4]=="MTV")&&(s[6]=="0202")&&(s[7]=="0202003.html")) {
		sectname="sym";
	}

	if ((s[3]=="videos")&&(s[4]=="index.html")) {
		sectname="sony";
	}
	if ((s[3]=="videos")&&(s[4]=="")) {
		sectname="sony";
	}
	if ((s[4]=="specials")&&(s[7]=="20020916001")) {
		isSponsored=true;
		onlyInhouseAds=true;
	}
	if ((s[3]=="onair")&&(s[4]=="shows") && (s[5]=="AsiaAwards2002") && ((s[6]=="RedCarpetGallery1") || (s[6]=="RedCarpetGallery2") || (s[6]=="RedCarpetGallery3") || (s[6]=="BackstageGallery1") || (s[6]=="OnStageGallery1") || (s[6]=="OnStageGallery2"))) {
		sectname="maa03_mc";
	}

	if ((s[3]=="Partner")&&(s[4]=="MTVStart")) {
		isSponsored=true;
		onlyInhouseAds=true;
		key="mtvstart";
		if (s[5]=="includes") {
			iframe=true;
		}
	}

	if ((s[3]=="Partner")&&(s[4]=="Starhub")&&(s[5]=="MTVCode")) {
		isSponsored=true;
		onlyInhouseAds=true;
	}

	if ((s[3]=="Partner")&&(s[4]=="ChivasRegal")) {
		sectname="chivas";
	}

	if ((s[3]=="Partner")&&(s[4]=="Philips")) {
		sectname="philips";
	}

	if ((s[3]=="Partner")&&(s[4]=="Canon")&&(s[5]=="ThePitch")) {
		sectname="thepitch";
	}

	if ((s[3]=="ubbthreads2") && (s[4].match(/MTVPitch/gi))) {
		sectname="thepitch";
	}
	if ((s[3]=="ubbthreads2") && (s[4].match(/MTVScreen/gi))) {
		sectname="screen";
	}
	if ((s[3]=="ubbthreads2") && (s[4].match(/MTVStart/gi))) {
		sectname="start";
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="SingaporeSpin")) {
		isSponsored=true;
		sectname="stb";
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="BrandNew")) {
		noBanner	=true;
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="BrandNew05")) {
		onlyInhouseAds=true;
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="StartPlay")) {
		sectname="start";
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="Diesel2003")) {
		isSponsored=true;
		sectname="diesel";
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="Hoopla")) {
		sectname="hoopla";
	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="NorahJones")) {
		sectname="chivas";
	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="MTVBuzzAsia2004")) {
		sectname="knto";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook229")) {
		sectname="knto";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook230")) {
		sectname="knto";
	}
	if ((s[3]=="getspotted") && ((s[4]=="index.html") || (s[4]=="page2.html"))) {
		isSponsored=false;
		onlyInhouseAds=true;
	}

	if ((s[3]=="Partner") && (s[4]=="JVC") && (s[5]=="SoundEducation")) {
		isSponsored=false;
		onlyInhouseAds=true;
	}
	if ((s[3]=="ubbthreads2") && (s[4].match(/WhateverThings/gi))) {
		onlyInhouseAds=true;
	}
	if (s[3]=="ipod") {
		noBanner	=true;
	}
	if (s[3]=="rouge") {
		sectname="rouge";
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="MTVSpiderMan2")) {
		sectname="spiderman";
		noBanner	=true;
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="MTVKingArthur")) {
		sectname="kingarthur";
		onlyInhouseAds=true;
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="MTVScreenKingArthur")) {
		sectname="screen";
	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="VMA2004")) {
		sectname="vma";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook225")) {
		sectname="vma";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook227")) {
		sectname="vma";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook228")) {
		sectname="vma";
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="MTVScreenWhiteChicks")) {
		sectname="screen";
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="TRL")) {
		onlyInhouseAds=true;
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="AMeiMTVLive")) {
		onlyInhouseAds=true;
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook254")) {
		sectname="what2";
		noBanner=true;
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook255")) {
		sectname="what2";
		noBanner=true;
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook256")) {
		sectname="what2";
		noBanner=true;
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook257")) {
		sectname="what2";
		noBanner=true;
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook258")) {
		sectname="what2";
		noBanner=true;
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook259")) {
		sectname="what2";
		noBanner=true;
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook260")) {
		sectname="what2";
		noBanner=true;
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="AdvanceWarning")) {
		onlyInhouseAds=true;
	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="MTVLiveAMei")) {
		onlyInhouseAds=true;
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook262")) {
		onlyInhouseAds=true;
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="PepsiFireIce")) {
		onlyInhouseAds=true;
	}
	if (s[3]=="kswiss") {
		sectname="kswiss";
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="McDonalds")) {
		onlyInhouseAds=true;
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="Trippin")) {
		sectname="trl";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook286")) {
		sectname="trl";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook287")) {
		sectname="trl";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook288")) {
		sectname="trl";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook289")) {
		sectname="trl";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook290")) {
		sectname="trl";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook291")) {
		sectname="trl";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook292")) {
		sectname="trl";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook293")) {
		sectname="trl";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook294")) {
		sectname="trl";
	}
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook295")) {
		sectname="trl";
	}
  	if (s[3]=="cgi-bin" && s[4]=="players" && s[5].match(/pwuri=tripping/gi)) {
		sectname="trl";
  	}
  	if (s[3]=="Feature" && s[4]=="Special" && s[5]=="TheIsland") {
		onlyInhouseAds=true;
  	}
  	if (s[3]=="Funstuff" && s[4]=="Contests" && s[5]=="Stealth") {
		sectname="stealth";
  	}
  	if (s[3]=="Onair" && s[4]=="Shows" && s[5]=="Picknplay") {
		sectname="picknplay";
  	}
  	if (s[3]=="Onair" && s[4]=="MOM" && s[5]=="200510") {
		sectname="zorro";
  	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="EMA2005")) {
		sectname="lg";
	}	
	
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="LGNewYork")) {
		sectname="lg";
	}  	  	
  	if (s[3]=="Funstuff" && s[4]=="Contests" && s[5]=="GobletOfFireContest") {
		sectname="hp4";
  	}  
  	if (s[3]=="Feature" && s[4]=="Special" && s[5]=="Zathura") {
		sectname="zathura";
  	}  
  	if (s[3]=="Funstuff" && s[4]=="Contests" && s[5]=="NarniaContest") {
		sectname="narnia";
  	}  
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook339")) {
		onlyInhouseAds=true;
	}  	
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook326")) {
		onlyInhouseAds=true;
	}
  	if (s[3]=="easports") {
		sectname="fifa06";
  	}  
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="Geisha")) {
		sectname="geisha";
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="PopInc")) {
		sectname="popinc";
	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="DickNJane")) {
		sectname="dicknjane";
	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="mfl")) {
		sectname="mfl";
	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="Underworld")) {
		sectname="underworld";
	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="Vendetta")) {
		sectname="vendetta";
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="BlackContest")) {
		sectname="eablack";
	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="GigGuide")) {
		onlyInhouseAds=true;
	}

	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="MI3Contest")) {
		sectname="mi3";
	}
  	if (s[3]=="Onair" && s[4]=="MOM" && s[5]=="200605") {
		sectname="mi3";
  	}
	
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="Poseidon")) {
		sectname='poseidon';
	}
  	if ((s[3]=="cgi-bin") && (s[4]=="players") && (s[5]=="playvid2.pl?pwuri=trailers") &&(s[6]=="mtv300_poseidon.asx")) {
		sectname="poseidon";
  	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="Centrestage")) {
		onlyInhouseAds=true;
	}  	
	if ((s[3]=="Onair")&&(s[4]=="Shows")&&(s[5]=="MTVFashionFiles")) {
		sectname="mtvff";
	}  
	if ((s[3]=="Funstuff")&&(s[4]=="Contests")&&(s[5]=="PopVillageContest")) {
		sectname="popvillage";
	} 
	if (s[3]=="Onair" && s[4]=="Shows" && s[5]=="Barrio19") {
	sectname="barrio19";
	}

	if ((s[3]=="Video")&&(s[4]=="MTVEssentialGorillaz")) {
		onlyInhouseAds=true;
	}

	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook381")) {
		onlyInhouseAds=true;
	}

	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook369")) {
		onlyInhouseAds=true;
	}

	if ((s[4]=="Shows")&&(s[5]=="Ampuh")) {
		sectname="benq";
	}
	
	if ((s[4]=="Shows")&&(s[5]=="Ampuh") && (s[6]=="e61contest")) {
		sectname="benqe61";
	}

	if ((s[4]=="Shows")&&(s[5]=="Ampuh") && (s[6]=="e61")) {
		sectname="benqe61";
	}

	if ((s[4]=="Shows")&&(s[5]=="Ampuh") && (s[6]=="ef51contest")) {
		sectname="benqef51";
	}

	if ((s[4]=="Shows")&&(s[5]=="Ampuh") && (s[6]=="ef51")) {
		sectname="benqef51";
	}

	if ((s[3]=="Funstuff")&&(s[4]=="Contests") && (s[5]=="DeadManChestContest")) {
		sectname="poc";
	}
	if ((s[3]=="Onair")&&(s[4]=="MOM") && (s[5]=="200606")) {
		sectname="superman";
	}
	if ((s[3]=="Onair")&&(s[4]=="Shows") && (s[5]=="MTVTwisted")) {
		sectname="mtvtwisted";
	}
	if ((s[3]=="Feature")&&(s[4]=="Special")&&(s[5]=="LadyintheWater")) {
		sectname="ladywater";
	} 
	if ((s[3]=="Review")&&(s[4]=="Event")&&(s[5]=="E20060714001438.html")) {
		onlyInhouseAds=true;
	} 
	if ((s[3]=="Flipbook")&&(s[4]=="data")&&(s[5]=="flipbook390")) {
		onlyInhouseAds=true;
	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests") && (s[5]=="JohnnieWalker")) {
		sectname="jw";
	}
	if ((s[3]=="Feature")&&(s[4]=="Special") && (s[5]=="Smirnoff")) {
		sectname="smirnoff";
	}	
	  if ((s[3]=="Onair")&&(s[4]=="Shows") && (s[5]=="HipHopCountdown")) {
	    sectname="vagary";
	  }
	  if ((s[3]=="Test")) {
	    sectname="test";
	  }
	if ((s[3]=="Funstuff")&&(s[4]=="Contests") && (s[5]=="FeelTheMusic")) {
		sectname="feelthemusic";
	}	
	if ((s[3]=="Funstuff")&&(s[4]=="Contests") && (s[5]=="CasinoRoyaleContest")) {
		sectname="casino";
	}  	
	if ((s[3]=="Funstuff")&&(s[4]=="Contests") && (s[5]=="MusicRemedy")) {
		sectname="musicremedy";
	}
	if ((s[3]=="Feature")&&(s[4]=="Special") && (s[5]=="DreamD8II")) {
		onlyInhouseAds=true;
	}	
  	if (s[3]=="cgi-bin" && s[4]=="players" && s[5].match(/pwuri=dreamd8ii/gi)) {
		onlyInhouseAds=true;
  	}
	if ((s[3]=="Funstuff")&&(s[4]=="Contests") && (s[5]=="MTVPresentsAkonLive")) {
		onlyInhouseAds=true;
	}  
	
	if ((s[3]=="Feature")&&(s[4]=="Special") && (s[5]=="GhostRider")) {
		sectname="ghostrider";
	}
	
		
if ((s[3]=="includes")||(sectname=="header.html")) {
	iframe=true;
}

//Let's find advertisers who are playing on same industry
var advertiserArr = Array("lg", "motorola", "nokia", "nokia/pixelmedia", "philips", "samsung", "samsung/pixel", "samsung/smgip", "sonnyericsson");
