//var ubisrcURL="http:\/\/pub.ubi.com:4321";
var ubisrcURL="http:\/\/pub.ubi.com";

var categoriesMediaplazza=new Array(
Array("Brothers in Arms", "Brother"),
Array("Splinter Cell", "Splinter"),
Array("Rainbow Six", "Rainbow"),
Array("Darkwatch", "Darkwatch"),
Array("And 1", "And1"),
Array("Myst", "Myst"),
Array("Blazing Angels", "Angels"),
Array("Prince of Persia", "Prince"),
Array("Farcry", "Farcry"),
Array("187 Ride or Die", "Ride"),
Array("Might and Magic", "Might"),
Array("Ubisoft", "Ubi")
);

var contents=new Array(
Array("ID", "image_preview", "category"),
//Brothers in Arms
Array("33219", "Logo1", "Brothers in Arms"),
Array("33220", "Logo2", "Brothers in Arms"),
Array("55091", "bia_rth30_team", "Brothers in Arms"),
Array("55086", "bia_rth30_help", "Brothers in Arms"),
Array("55090", "bia_rth30_tank", "Brothers in Arms"),
Array("55087", "bia_rth30_plane", "Brothers in Arms"),
Array("55088", "bia_rth30_soldier", "Brothers in Arms"),
Array("55089", "bia_rth30_sunset", "Brothers in Arms"),
//Blazing Angels
Array("58213", "blazing_Paris_03", "Blazing Angels"),
Array("58209", "blazing_P51_05", "Blazing Angels"),
Array("58190", "blazing_B17_02", "Blazing Angels"),
Array("58202", "blazing_London_03", "Blazing Angels"),
Array("58194", "blazing_Corsair_01", "Blazing Angels"),
Array("58198", "blazing_logo_fond_blanc", "Blazing Angels"),
Array("58201", "blazing_London_02", "Blazing Angels"),
Array("58203", "blazing_London_04", "Blazing Angels"),
Array("58192", "blazing_BF109_01", "Blazing Angels"),
Array("58208", "blazing_P51_02", "Blazing Angels"),
Array("58188", "blazing_Announce", "Blazing Angels"),
Array("58200", "blazing_London_01", "Blazing Angels"),
Array("58216", "blazing_Spitfire_04", "Blazing Angels"),
Array("58207", "blazing_P47_03", "Blazing Angels"),
Array("58212", "blazing_Paris_02", "Blazing Angels"),
Array("58196", "blazing_Heroes", "Blazing Angels"),
Array("58215", "blazing_Spitfire_02", "Blazing Angels"),
Array("58189", "blazing_B17_01", "Blazing Angels"),
Array("58214", "blazing_Spitfire_01", "Blazing Angels"),
Array("58204", "blazing_London_06", "Blazing Angels"),
Array("58211", "blazing_Paris_01", "Blazing Angels"),
Array("58193", "blazing_BF109_04", "Blazing Angels"),
Array("58191", "blazing_B17_03", "Blazing Angels"),
Array("58205", "blazing_Mustang_02", "Blazing Angels"),
Array("58210", "blazing_P51_06", "Blazing Angels"),
Array("58197", "blazing_logo_attack", "Blazing Angels"),
Array("58199", "blazing_logo_fond_noir", "Blazing Angels"),
Array("58195", "blazing_Corsair_03", "Blazing Angels"),
Array("58206", "blazing_P47_01", "Blazing Angels"),
//187 Rid or Die
Array("55085", "187_perso3", "187 Ride or Die"),
Array("55082", "187_logo_fond_noir", "187 Ride or Die"),
Array("55084", "187_perso2", "187 Ride or Die"),
Array("55081", "187_logo_fond_blanc", "187 Ride or Die"),
Array("55083", "187_perso1", "187 Ride or Die"),
//FarCry
Array("55096", "farcry_multi1", "Farcry"),
Array("55104", "fci_eye_logo3", "Farcry"),
Array("55117", "fci_theme7", "Farcry"),
Array("55103", "fci_eye_logo2", "Farcry"),
Array("55102", "fci_eye_logo", "Farcry"),
Array("55093", "farcry_canyon", "Farcry"),
Array("55115", "fci_theme5", "Farcry"),
Array("55114", "fci_theme4", "Farcry"),
Array("55112", "fci_theme2", "Farcry"),
Array("55111", "fci_theme1", "Farcry"),
Array("55092", "farcry_2palmiers", "Farcry"),
Array("55100", "farcry_temple", "Farcry"),
Array("55097", "farcry_multi2", "Farcry"),
Array("55094", "farcry_island", "Farcry"),
Array("55105", "fci_fond_blanc", "Farcry"),
Array("55095", "farcry_island2", "Farcry"),
Array("55099", "farcry_soldier", "Farcry"),
Array("55098", "farcry_plage", "Farcry"),
Array("55101", "fci_eyegun_logo", "Farcry"),
Array("55116", "fci_theme6", "Farcry"),
Array("55113", "fci_theme3", "Farcry"),
Array("55110", "fci_predator", "Farcry"),
//Splinter Cell
Array("41016", "splintercell_artwork_mobile", "Splinter Cell"),
Array("41017", "splintercell_googles", "Splinter Cell"),
Array("33225", "SCCT_pack_artwork_BW_mobile", "Splinter Cell"),
Array("33223", "SCCT_logo_BW_mobile", "Splinter Cell"),
Array("41018", "splintercell_logo_mobile", "Splinter Cell"),
//Rainbow Six
Array("41015", "rainbowsix_sniper", "Rainbow Six"),
Array("41014", "rainbowsix_pack", "Rainbow Six"),
//Darkwatch
Array("41245", "darkwatch_logo_tete", "Darkwatch"),
Array("41246", "darkwatch_monster", "Darkwatch"),
Array("41241", "darkwatch_cowboy", "Darkwatch"),
Array("41243", "darkwatch_fullmoon2", "Darkwatch"),
Array("41242", "darkwatch_fullmoon", "Darkwatch"),
Array("41244", "darkwatch_logo_basic", "Darkwatch"),
Array("41247", "darkwatch_tombstone", "Darkwatch"),
// AND 1
Array("41010", "and1_professor", "And 1"),
Array("41009", "and1_make_your_move", "And 1"),
Array("41006", "and1_helicopter", "And 1"),
Array("41007", "and1_hot_sauce", "And 1"),
Array("41005", "and1_dj", "And 1"),
Array("41004", "and1_ao", "And 1"),
Array("41008", "and1_logo_streetball", "And 1"),
//Might and Magic
Array("55079", "h5_wraith", "Might and Magic"),
Array("55058", "h5_logo_parachemin", "Might and Magic"),
Array("55045", "h5_griffin2", "Might and Magic"),
Array("55030", "h5_agrael3", "Might and Magic"),
Array("55073", "h5_sketch3", "Might and Magic"),
Array("55076", "h5_succubus2", "Might and Magic"),
Array("55060", "h5_militia", "Might and Magic"),
Array("55034", "h5_archer_logo", "Might and Magic"),
Array("55080", "h5_wraith2", "Might and Magic"),
Array("55054", "h5_logo_fondblanc", "Might and Magic"),
Array("55046", "h5_horned_overseer", "Might and Magic"),
Array("55064", "h5_paladin", "Might and Magic"),
Array("55061", "h5_pack1", "Might and Magic"),
Array("55077", "h5_vampire_lord", "Might and Magic"),
Array("55051", "h5_knight3", "Might and Magic"),
Array("55049", "h5_knight", "Might and Magic"),
Array("55062", "h5_pack3", "Might and Magic"),
Array("55071", "h5_sketch1", "Might and Magic"),
Array("55059", "h5_logo_skulls", "Might and Magic"),
Array("55037", "h5_creature_devil", "Might and Magic"),
Array("55029", "h5_agrael2", "Might and Magic"),
Array("55056", "h5_logo_lion2", "Might and Magic"),
Array("55050", "h5_knight2", "Might and Magic"),
Array("55068", "h5_shadow_dragon", "Might and Magic"),
Array("55032", "h5_archangel_logo2", "Might and Magic"),
Array("55047", "h5_hpsite_logo", "Might and Magic"),
Array("55043", "h5_frightfulnightmare_logo2", "Might and Magic"),
Array("55078", "h5_vampire_lord2", "Might and Magic"),
Array("55042", "h5_frightfulnightmare_logo", "Might and Magic"),
Array("55069", "h5_shadow_dragon2", "Might and Magic"),
Array("55067", "h5_pit_lord2", "Might and Magic"),
Array("55070", "h5_shield", "Might and Magic"),
Array("55075", "h5_succubus", "Might and Magic"),
Array("55028", "h5_agrael", "Might and Magic"),
Array("55053", "h5_lich2", "Might and Magic"),
Array("55074", "h5_sketch4", "Might and Magic"),
Array("55036", "h5_cerberus", "Might and Magic"),
Array("55048", "h5_inquisitor", "Might and Magic"),
Array("55055", "h5_logo_lion", "Might and Magic"),
Array("55038", "h5_creature_imp", "Might and Magic"),
Array("55035", "h5_archer_logo2", "Might and Magic"),
Array("55072", "h5_sketch2", "Might and Magic"),
Array("55052", "h5_lich", "Might and Magic"),
Array("55041", "h5_dragon_logo2", "Might and Magic"),
Array("55057", "h5_logo_maille", "Might and Magic"),
Array("55039", "h5_demilich", "Might and Magic"),
Array("55063", "h5_pack4", "Might and Magic"),
Array("55040", "h5_dragon_logo", "Might and Magic"),
Array("55066", "h5_pit_lord", "Might and Magic"),
Array("55031", "h5_archangel_logo", "Might and Magic"),
Array("55044", "h5_griffin", "Might and Magic"),
Array("55033", "h5_archangel_rendered", "Might and Magic"),
Array("55065", "h5_paladin2", "Might and Magic"),
// Prince of Persia
Array("53823", "PoP_T2T_2faces", "Prince of Persia"),
Array("53824", "PoP_T2T_2faces2", "Prince of Persia"),
Array("53825", "PoP_T2T_2faces3", "Prince of Persia"),
Array("53826", "PoP_T2T_2princes", "Prince of Persia"),
Array("53827", "PoP_T2T_babylon", "Prince of Persia"),
Array("53828", "PoP_T2T_babylon_arrival", "Prince of Persia"),
Array("53829", "PoP_T2T_badface", "Prince of Persia"),
Array("53830", "PoP_T2T_blessures", "Prince of Persia"),
Array("53831", "PoP_T2T_darkprince_face", "Prince of Persia"),
Array("53832", "PoP_T2T_darkprince_face2", "Prince of Persia"),
Array("53833", "PoP_T2T_darkprince_rain", "Prince of Persia"),
Array("53834", "PoP_T2T_darkprince_rain2", "Prince of Persia"),
Array("53835", "PoP_T2T_darkprince_rain3", "Prince of Persia"),
Array("53836", "PoP_T2T_darkprince_throne", "Prince of Persia"),
Array("53837", "PoP_T2T_darkprince_weapon", "Prince of Persia"),
Array("53838", "PoP_T2T_demiprince", "Prince of Persia"),
Array("53839", "PoP_T2T_demiprince2", "Prince of Persia"),
Array("53840", "PoP_T2T_farah", "Prince of Persia"),
Array("53841", "PoP_T2T_farah_bed", "Prince of Persia"),
Array("53842", "PoP_T2T_gamefootage", "Prince of Persia"),
Array("53843", "PoP_T2T_gamefootage2", "Prince of Persia"),
Array("53844", "PoP_T2T_garden", "Prince of Persia"),
Array("53845", "PoP_T2T_goodface", "Prince of Persia"),
Array("53846", "PoP_T2T_kaileena", "Prince of Persia"),
Array("53847", "PoP_T2T_kaileena2", "Prince of Persia"),
Array("53848", "PoP_T2T_logo_blanc", "Prince of Persia"),
Array("53849", "PoP_T2T_logo_cape", "Prince of Persia"),
Array("53850", "PoP_T2T_logo_darkthrone", "Prince of Persia"),
Array("53851", "PoP_T2T_logo_noir", "Prince of Persia"),
Array("53852", "PoP_T2T_pack_logo", "Prince of Persia"),
Array("53853", "PoP_T2T_prince_flames", "Prince of Persia"),
Array("53854", "PoP_T2T_prince_throne", "Prince of Persia"),
Array("53855", "PoP_T2T_prince_throne2", "Prince of Persia"),
Array("53856", "PoP_T2T_prince_weapon", "Prince of Persia"),
Array("53857", "PoP_T2T_prince_weapon2", "Prince of Persia"),
Array("53858", "PoP_T2T_sacrificial", "Prince of Persia"),
Array("53859", "PoP_T2T_temple", "Prince of Persia"),
// Myst
Array("41013", "myst_logo_blanc_300x300", "Myst"),
// Ubisoft
Array("55122", "ubisoft_visuel5", "Ubisoft"),
Array("55118", "ubisoft_visuel1", "Ubisoft"),
Array("55123", "ubisoft_visuel6", "Ubisoft"),
Array("55120", "ubisoft_visuel3", "Ubisoft"),
Array("55119", "ubisoft_visuel2", "Ubisoft"),
Array("55121", "ubisoft_visuel4", "Ubisoft"),
Array("33222", "logonoir", "Ubisoft"),
Array("33221", "logoblanc", "Ubisoft")
);


function getMediaplazzaLanguage(lng) {
switch (lng.toLowerCase()) {
case "fr":
	mpzlng="fr";
	break;
case "de":
	mpzlng="de";
	break;
case "gb":
case "en":
case "uk":
case "sp":
case "nl":
case "it":
case "us":
case "es":
	mpzlng="gb";
	break;
}
return mpzlng
}

function jsOpenWnd(id,name,img,ps,mpf) {
    p="height=660,width=380,toolbar=no,directories=no,status=no,scrollbars=auto,resizable=no,menubar=no";    hWnd=window.open('http:\/\/diomede.homere.jmsp.net/label_v4/external/DrtTop/dl.php?f=c_15&type=15&a=ubisoft&id='+id+'&son_nom='+name+'&ps='+ps+'&logo_image='+img+'&lang=FR&mpf='+mpf+'&c=FR',"Hwnd",p);
    hWnd.focus();
}


function getMobileContent(id,img,lng) {
    p="height=660,width=380,toolbar=no,directories=no,status=no,scrollbars=auto,resizable=no,menubar=no";    hWnd=window.open('http:\/\/diomede.homere.jmsp.net/label_v4/external/DrtTop/dl.php?f=c_15&type=15&a=ubisoft&id='+id+'&son_nom=&ps=&logo_image='+img+'&lang='+lng.toLowerCase()+'&mpf=&c='+lng.toLowerCase(),"Hwnd",p);
    hWnd.focus();
}


function displayRandomLogoFromGame(category, lng) {
	num=0;
	myContent=new Array();
	for (i=1; i<contents.length; i++) {
		if (contents[i][2].toLowerCase()==category.toLowerCase()) {
			myContent[num]=contents[i];
			num++;
		}
	}
	
	randomLogo=Math.floor(myContent.length*Math.random(),0);
	//alert(myContent[randomLogo][1])
	myImage=myContent[randomLogo][1];
	myID=myContent[randomLogo][0];
	document.write ("<table cellpadding=0 cellspacing=0 width=101 height=80><tr><td background=http:\/\/media.mediaplazza.com/t_15/101x80/"+myImage+".gif><a onclick=javascript:getMobileContent("+myID+",'"+myImage+"','"+getMediaplazzaLanguage(lng)+"') href=javascript:;><IMG SRC="+ubisrcURL+"\/download_"+getMediaplazzaLanguage(lng)+".gif HEIGHT=80 WIDTH=101 border=0></a></td></tr></table>");
}


function displayBannerFromGame(category, lng) {
//alert(category)
for (i=0; i<categoriesMediaplazza.length; i++) {
		if (categoriesMediaplazza[i][0].toLowerCase()==category.toLowerCase()) {
			mediaplazzaCat=categoriesMediaplazza[i][1];
		}
	}
switch (lng.toLowerCase()) {
case "fr":
	linkpage="logos_couleurs";
	break;
case "de":
	linkpage="farbige_logos";
	break;
case "gb":
case "en":
case "uk":
case "sp":
case "nl":
case "it":
case "us":
case "es":
	linkpage="wallpapers";
	break;
}

document.write("<table width=\"468\" height=\"60\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=5,0,0,0\" width=\"381\" height=\"60\"><param name=movie value=\""+ubisrcURL+"\/768-60-"+lng.toLowerCase()+".swf?goto=http:\/\/mobile.ubi.com\/"+getMediaplazzaLanguage(lng)+"\/"+linkpage+".php?c="+mediaplazzaCat+"\"><param name=quality value=high><embed src=\""+ubisrcURL+"\/768-60-"+lng.toLowerCase()+".swf?goto=http:\/\/mobile.ubi.com\/"+getMediaplazzaLanguage(lng)+"\/"+linkpage+".php?c="+mediaplazzaCat+"\" quality=high pluginspage=\"http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application\/x-shockwave-flash\" width=\"381\" height=\"60\"><\/embed><\/object><\/td><td bgcolor=\"#A9A8D2\" width=\"100%\" height=\"60\"><\/td><td background=\""+ubisrcURL+"\/index_03.jpg\" valign=top><img src=\""+ubisrcURL+"\/sp.gif\" width=\"282\" height=\"5\" border=\"0\"><table border=0 cellspacing=0 cellpadding=0><tr valign=top><td><img src=\""+ubisrcURL+"\/sp.gif\" width=\"184\" height=\"55\" border=\"0\"><\/td><td>"+displayBannerRandomLogoFromGame(category, lng)+"<br><img src=\""+ubisrcURL+"\/sp.gif\" width=\"59\" height=\"8\" border=\"0\"><\/td><td><img src=\""+ubisrcURL+"\/sp.gif\" width=\"39\" height=\"55\" border=\"0\"><\/td><\/tr><\/table><\/td><\/tr><\/table>");
}

function displayMiniSkyFromGame(category, lng) {
//alert(category)
for (i=0; i<categoriesMediaplazza.length; i++) {
		if (categoriesMediaplazza[i][0].toLowerCase()==category.toLowerCase()) {
			mediaplazzaCat=categoriesMediaplazza[i][1];
		}
	}

switch (lng.toLowerCase()) {
case "fr":
	linkpage="logos_couleurs";
	break;
case "de":
	linkpage="farbige_logos";
	break;
case "gb":
case "en":
case "uk":
case "sp":
case "nl":
case "it":
case "us":
case "es":
	linkpage="wallpapers";
	break;
}
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=5,0,0,0\" width=\"120\" height=\"200\"><param name=movie value=\""+ubisrcURL+"\/120-200-"+lng.toLowerCase()+".swf?goto=http:\/\/mobile.ubi.com\/"+getMediaplazzaLanguage(lng)+"\/"+linkpage+".php?c="+mediaplazzaCat+"\"><param name=quality value=high><embed src=\""+ubisrcURL+"\/120-200-"+lng.toLowerCase()+".swf?goto=http:\/\/mobile.ubi.com\/"+getMediaplazzaLanguage(lng)+"\/"+linkpage+".php?c="+mediaplazzaCat+"\" quality=high pluginspage=\"http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application\/x-shockwave-flash\" width=\"120\" height=\"200\"><\/embed><\/object>");
}


function displayBannerRandomLogoFromGame(category, lng) {
	num=0;
	myContent=new Array();
	for (i=1; i<contents.length; i++) {
		if (contents[i][2].toLowerCase()==category.toLowerCase()) {
			myContent[num]=contents[i];
			num++;
		}
	}
	
	randomLogo=Math.floor(myContent.length*Math.random(),0);
	//alert(category+" : "+randomLogo)
	//alert(myContent[randomLogo][1])
	myImage=myContent[randomLogo][1];
	myID=myContent[randomLogo][0];
	return "<a onclick=javascript:getMobileContent("+myID+",'"+myImage+"','"+lng.toLowerCase()+"') href=javascript:;><img src=http:\/\/media.mediaplazza.com/t_15/101x80/"+myImage+".gif width=59 height=47 border=0></a>";
}


function displayMobileContent(id,lng) {
thisimage="";
for (i=1; i<contents.length; i++) {
	if (contents[i][0]==id) {
		thisimage=contents[i][1];
	}
}
document.write ("<table cellpadding=0 cellspacing=0 width=101 height=80><tr><td background=http:\/\/media.mediaplazza.com/t_15/101x80/"+thisimage+".gif><a onclick=javascript:getMobileContent("+id+",'"+thisimage+"','"+lng.toLowerCase()+"') href=javascript:;><IMG SRC="+ubisrcURL+"\/download_"+getMediaplazzaLanguage(lng)+".gif HEIGHT=80 WIDTH=101 border=0></a></td></tr></table>");
}