﻿/*
<% @language="VBScript" %>
<% Response.ContentType = "text/javascript" %>
*/
var prevImg = 'mm_promo_img_1';
var prevRndNr = -1;
var mxp_img = '';
var od2url = 'http://promo.od2.co.uk/promo.dll?Vendor=478&quality=56&format=ASF&length=s&cat=';


function mobilemoneysale(ordernumber,pos) {
	mmrefname = 'msn_nl_mxp';
	mmlanguage = 'nl';
	mmpskin = 'music_xp';
    if (pos == undefined || pos == '') {
        pos = mxppos;
    }

	window.open('http://www.mobilemoney.com/salespopup.asp?country=31&pos='+pos+'&ordernumber='+escape(ordernumber)+'&refname='+escape(mmrefname)+'&language='+escape(mmlanguage)+'&popupskin='+escape(mmpskin),'popup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=468,height=550,left='+eval((screen.availWidth/2)-234)+',top=50');
}

function listenwindow(listenurl) {
	window.open(listenurl, 'Listen', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=150,height=150,left='+eval((screen.availWidth/2)-75)+',top=50');
}

function listen_mm(id) {

}

function listen_od2(id) {
	var x=window.open('http://promo.od2.co.uk/promo.dll?Vendor=478&cat=' + id + '&quality=56&format=ASF&length=s');
}

function buy_od2(id) {
}

function helpform() {
	mmrefname = 'msn_nl_mxp';
	mmlanguage = 'nl';
	mmpskin = 'music_xp';
	window.open('http://www.mobilemoney.com/salespopup.asp?refname='+mmrefname+'&language='+mmlanguage+'&action=help&popupskin='+mmpskin,'helppopup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=468,height=550,left='+eval((screen.availWidth/2)-234)+',top=50');
}

function mobilemoneyplay(url) {
	var el = document.getElementById('mmplayer');
	if(el) {
		if (el.controls)
			el.controls.stop();
		el.URL = url;
	}
}

function getElementValue(elementname, elementattribute){
    return document.getElementById(elementname).getAttribute(elementattribute);
}

function seriousrequest() {
	window.open('http://www.mobilemoney.com/partners/3fm/3fm.asp','seriousrequest_popup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=468,height=400,left='+eval((screen.availWidth/2)-234)+',top='+eval((screen.availHeight/2)-(400/1.5)));
}

function checkSearchEnter(e) {		//e is event object passed from function invocation
	var characterCode;				//literal character code will be stored in this variable

	if (e && e.which) {				//if which property of event object is supported (NN4)
		e = e;
		characterCode = e.which;	//character code is contained in NN4's which property
	} else {
		e = event;
		characterCode = e.keyCode;	//character code is contained in IE's keyCode property
	}

	if (characterCode == 13) {		//if generated character code is equal to ascii 13 (if enter key)
		frm = document.getElementById('mxpsearch');
		if (frm) {
			frm.submit();			//submit the form
			return false;
		}
	}
	return true;
}


function mxp_play(index, od2id) {
	mxp_stop(index);

	mxp_img = 'mxp_preview_image' + index;
	img = document.getElementById(mxp_img);
	link = document.getElementById('mxp_preview_link' + index);
	placeholder = document.getElementById('mxp_preview_placeholder');
	
	if (!img) return;
	if (!link) return;
	if (!placeholder) return;
	
	obj = '' +
		'<object id="mmplayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" height="0" width="0">' + 
		'  <param name="autoStart" value="true">' +
		'  <param name="uiMode" value="invisible">' +
		'  <param name="url" value="' + od2url + od2id + '">' + 
		'</object>';

	img.src = 'images/button_oranje_stop.gif';
	link.href = 'javascript:mxp_stop(' + index + ', \'' + od2id + '\');';
	placeholder.innerHTML = obj;
}

function mxp_stop(index, od2id) {
	img = document.getElementById(mxp_img);
	if (img) {
		img.src = 'images/button_oranje_play.gif';
	}

	link = document.getElementById('mxp_preview_link' + index);
	placeholder = document.getElementById('mxp_preview_placeholder');
	
	if (!link) return;
	if (!placeholder) return;

	link.href = 'javascript:mxp_play(' + index + ', \'' + od2id + '\');';
	placeholder.innerHTML = '';
}


function randomAd(iType, country) {
    var newURL = '';
    var oldURL = '';

    if (prevImg == 'mm_promo_img_type_1_1') { 
        prevImg = 'mm_promo_img_type_' + iType.toString() + '_2';
        newURL = 'mm_promo_link_type_' + iType.toString() + '_2';
        oldURL = 'mm_promo_link_type_' + iType.toString() + '_1';
    } else {
        prevImg = 'mm_promo_img_type_' + iType.toString() + '_1';
        newURL = 'mm_promo_link_type_' + iType.toString() + '_1';
        oldURL = 'mm_promo_link_type_' + iType.toString() + '_2';
    }

    var rnd_no = Math.round((aImgs1.length-1)*Math.random());

	// Check to make sure both images don't show the same promo.
    var url1 = document.getElementById('mm_promo_link_type_' + iType.toString() + '_1').href;
    var url2 = document.getElementById('mm_promo_link_type_' + iType.toString() + '_2').href;
	while (url1.indexOf(aImgs1[rnd_no][1]) > -1 || url2.indexOf(aImgs1[rnd_no][1]) > -1) {
 		rnd_no = Math.round((aImgs1.length-1)*Math.random());
	}

    if (document.getElementById(prevImg)) {
	    document.getElementById(prevImg).src = 'images/promo/' + country + '/' + aImgs1[rnd_no][0];
	    document.getElementById(newURL).href = aImgs1[rnd_no][1];
    }
}

function startRndAds (iType, country) {
    var id = setInterval('randomAd(' + iType.toString() + ',"' + country + '")', 5000);
}
