function popup(p_url,p_width,p_height,p_props){
	var myURL = p_url, popupName = 'mySite', popupWidth = p_width, popupHeight = p_height, mypopup;
	var popupX = (screen.availWidth)? ((screen.availWidth - popupWidth) / 2): 20;
	var popupY = (screen.availHeight)? ((screen.availHeight - popupHeight) / 3):20;
	var details = p_props+',width='+popupWidth+',height='+popupHeight+',top='+popupY+',left='+popupX;
	mypopup = window.open(myURL,popupName,details);
	mypopup.focus();
}

function displayCertificate(cert_data) { //v2.0
  popup('certificates/certificates.html?'+cert_data,590,420,'status=no,resizable=0')
}

function popupInstructions(url){
	popup('HTML_how_to_play/'+url,336,500,'status=no,resizable=0,scrollbars=yes')
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; 
  document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function quitGame(gameLocation){ // gameLocation = 'cash_cloud' || 'money_island' || 'dollar_reef'
	if(!gameLocation)gameLocation='money_island';
	MM_goToURL('parent','kidsandmoney_main.html?'+gameLocation);
}

function popupHTMLGame(url){
	// NOTE: I used an absolute url for the directory containing the html games, change this to relative if you want:
	popup('http://www.sorted.co.nz/kidsMoney/games/'+url,600,531,'scrollbars=yes');
}

function startGame(theURL){
	MM_goToURL('this',theURL);
}

// the flash movies all call this function:
function logUserStat(gameName){// gameName is the code for the event eg: "Shoe_Rush_start"
	//which in turn calls this function, by First Rate
	MTTrackAction_0001('Games',gameName,'0');
}

function MTTrackAction_0001(acg,acn,acv) {
    var W="http://tracker.mediatracker.co.nz/mt/getstats.asp?mt_cid=200041";
    W+="&mt_ver=2004";
    W+="&mt_typ=2007";
    W+="&mt_acn="+acn;
    W+="&mt_acg="+acg;
    W+="&mt_acv="+acv;
    W+="&mt_ran="+(randomnumber=Math.floor(Math.random()*100001));
    //document.MTI_0001.src = W;
} // -->

// Added 12 Sep 04, for treasure hunt promotion:
function popupTermsAndConditions(){
	popup('terms_conditions/terms_conditions.html', 600, 531, 'scrollbars=yes');
}
